Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #462 from 3846masa/fix/create-album
Browse files Browse the repository at this point in the history
Optimize to create album
  • Loading branch information
3846masa authored Jan 19, 2020
2 parents a8cc597 + a5de80d commit bfcb797
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/GPhotos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,13 @@ class GPhotos {
}

async createAlbum({ title }: { title: string }): Promise<GPhotosAlbum> {
const {
results: [latestPhoto],
} = await this.fetchPhotoList({ cursor: null });

const {
OXvT9d: [[albumId]],
} = await this.requestor.sendBatchExecute<{
OXvT9d: [[string]];
}>({
queries: {
OXvT9d: [title, null, 1, [[[latestPhoto.id]]]],
OXvT9d: [title, null, 2, []],
},
});

Expand All @@ -106,18 +102,13 @@ class GPhotos {
title,
id: albumId,
type: 'album',
period: { from: new Date(), to: new Date() },
period: { from: new Date(0), to: new Date(0) },
itemsCount: 0,
isShared: false,
},
{ requestor: this.requestor },
);

const {
results: [insertedPhoto],
} = await album.fetchPhotoList({ cursor: null });
await album.remove(insertedPhoto);

return album;
}

Expand Down

0 comments on commit bfcb797

Please sign in to comment.