aboutsummaryrefslogtreecommitdiff
path: root/src/client/apis/google_docs/GooglePhotosClientUtils.ts
blob: 67a282f48f7d2bb0c2b90aa6664eaf714efe677f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Album } from "../../../server/apis/google/typings/albums";
import { PostToServer } from "../../../Utils";
import { RouteStore } from "../../../server/RouteStore";

export namespace GooglePhotosClientUtils {

    export const Create = async (title: string) => {
        let parameters = {
            action: Album.Action.Create,
            body: { album: { title } }
        } as Album.Create;
        return PostToServer(RouteStore.googlePhotos, parameters);
    };

    export const List = async (options?: Partial<Album.ListOptions>) => {
        let parameters = {
            action: Album.Action.List,
            parameters: {
                pageSize: (options ? options.pageSize : 20) || 20,
                pageToken: (options ? options.pageToken : undefined) || undefined,
                excludeNonAppCreatedData: (options ? options.excludeNonAppCreatedData : false) || false,
            } as Album.ListOptions
        } as Album.List;
        return PostToServer(RouteStore.googlePhotos, parameters);
    };

    export const Get = async (albumId: string) => {
        let parameters = {
            action: Album.Action.Get,
            albumId
        } as Album.Get;
        return PostToServer(RouteStore.googlePhotos, parameters);
    };

}