Skip to content

Commit

Permalink
Merge pull request #15 from internxt/feature/get-photos-since-date
Browse files Browse the repository at this point in the history
(photos) Added getPhotosSince method to photos.photos module
  • Loading branch information
carlossalasamper authored Dec 31, 2021
2 parents 0f7103a + c91ef3f commit af70593
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internxt/sdk",
"version": "0.2.1",
"version": "0.2.2",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions src/photos/photos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ export default class PhotosSubmodule {
});
}

public async getPhotosSince(date: Date, limit: number, skip: number): Promise<Photo[]> {
return axios
.get<PhotoJSON[]>(`${this.model.baseUrl}/photos?from=${date}&limit=${limit}&skip=${skip}`, {
headers: {
Authorization: `Bearer ${this.model.accessToken}`,
},
})
.then((res) => res.data.map((photoJson) => this.parse(photoJson)))
.catch((err) => {
throw new Error(extractAxiosErrorMessage(err));
});
}

public getPhotosCountByMonth(month: number, year: number): Promise<number> {
return axios
.get<number>(`${this.model.baseUrl}/photos/?month=${month}&year=${year}`, {
Expand Down

0 comments on commit af70593

Please sign in to comment.