diff --git a/types/gapi.client.photoslibrary/gapi.client.photoslibrary-tests.ts b/types/gapi.client.photoslibrary/gapi.client.photoslibrary-tests.ts new file mode 100644 index 0000000000..0cdeb3953e --- /dev/null +++ b/types/gapi.client.photoslibrary/gapi.client.photoslibrary-tests.ts @@ -0,0 +1,319 @@ +/* This is stub file for gapi.client.photoslibrary definition tests */ +/* IMPORTANT. +* This file was automatically generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually. +* In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator +**/ +gapi.load('client', () => { + /** now we can use gapi.client */ + gapi.client.load('photoslibrary', 'v1', () => { + /** now we can use gapi.client.photoslibrary */ + + /** don't forget to authenticate your client before sending any request to resources: */ + /** declare client_id registered in Google Developers Console */ + const client_id = '<>'; + const scope = [ + /** View and manage your Google Photos library */ + 'https://www.googleapis.com/auth/photoslibrary', + /** Add to your Google Photos library */ + 'https://www.googleapis.com/auth/photoslibrary.appendonly', + /** View your Google Photos library */ + 'https://www.googleapis.com/auth/photoslibrary.readonly', + /** Manage photos added by this app */ + 'https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata', + /** Manage and add to shared albums on your behalf */ + 'https://www.googleapis.com/auth/photoslibrary.sharing', + ]; + const immediate = false; + gapi.auth.authorize({ client_id, scope, immediate }, authResult => { + if (authResult && !authResult.error) { + /** handle successful authorization */ + run(); + } else { + /** handle authorization error */ + } + }); + }); + + async function run() { + /** Adds an enrichment at a specified position in a defined album. */ + await gapi.client.photoslibrary.albums.addEnrichment({ + albumId: "Test string", + }, { + albumPosition: { + position: "Test string", + relativeEnrichmentItemId: "Test string", + relativeMediaItemId: "Test string", + }, + newEnrichmentItem: { + locationEnrichment: { + location: { + latlng: { + latitude: 42, + longitude: 42, + }, + locationName: "Test string", + }, + }, + mapEnrichment: { + destination: { + latlng: { + latitude: 42, + longitude: 42, + }, + locationName: "Test string", + }, + origin: { + latlng: { + latitude: 42, + longitude: 42, + }, + locationName: "Test string", + }, + }, + textEnrichment: { + text: "Test string", + }, + }, + }); + /** + * Adds one or more media items in a user's Google Photos library to + * an album. The media items and albums must have been created by the + * developer via the API. + * + * Media items are added to the end of the album. If multiple media items are + * given, they are added in the order specified in this call. + * + * Each album can contain up to 20,000 media items. + * + * Only media items that are in the user's library can be added to an + * album. For albums that are shared, the album must either be owned by the + * user or the user must have joined the album as a collaborator. + * + * Partial success is not supported. The entire request will fail if an + * invalid media item or album is specified. + */ + await gapi.client.photoslibrary.albums.batchAddMediaItems({ + albumId: "Test string", + }, { + mediaItemIds: [ + "Test string" ], + }); + /** + * Removes one or more media items from a specified album. The media items and + * the album must have been created by the developer via the API. + * + * For albums that are shared, this action is only supported for media items + * that were added to the album by this user, or for all media items if the + * album was created by this user. + * + * Partial success is not supported. The entire request will fail and no + * action will be performed on the album if an invalid media item or album is + * specified. + */ + await gapi.client.photoslibrary.albums.batchRemoveMediaItems({ + albumId: "Test string", + }, { + mediaItemIds: [ + "Test string" ], + }); + /** Creates an album in a user's Google Photos library. */ + await gapi.client.photoslibrary.albums.create({ + }, { + album: { + coverPhotoBaseUrl: "Test string", + coverPhotoMediaItemId: "Test string", + id: "Test string", + isWriteable: true, + mediaItemsCount: "Test string", + productUrl: "Test string", + shareInfo: { + isJoined: true, + isOwned: true, + shareToken: "Test string", + shareableUrl: "Test string", + sharedAlbumOptions: { + isCollaborative: true, + isCommentable: true, + }, + }, + title: "Test string", + }, + }); + /** + * Returns the album based on the specified `albumId`. + * The `albumId` must be the ID of an album owned by the user or a shared + * album that the user has joined. + */ + await gapi.client.photoslibrary.albums.get({ + albumId: "Test string", + }); + /** + * Lists all albums shown to a user in the Albums tab of the Google + * Photos app. + */ + await gapi.client.photoslibrary.albums.list({ + excludeNonAppCreatedData: true, + pageSize: 42, + pageToken: "Test string", + }); + /** + * Marks an album as shared and accessible to other users. This action can + * only be performed on albums which were created by the developer via the + * API. + */ + await gapi.client.photoslibrary.albums.share({ + albumId: "Test string", + }, { + sharedAlbumOptions: { + isCollaborative: true, + isCommentable: true, + }, + }); + /** + * Marks a previously shared album as private. This means that the album is + * no longer shared and all the non-owners will lose access to the album. All + * non-owner content will be removed from the album. If a non-owner has + * previously added the album to their library, they will retain all photos in + * their library. This action can only be performed on albums which were + * created by the developer via the API. + */ + await gapi.client.photoslibrary.albums.unshare({ + albumId: "Test string", + }, { + }); + /** + * Creates one or more media items in a user's Google Photos library. + * + * This is the second step for creating a media item. For details regarding + * Step 1, uploading the raw bytes to a Google Server, see + * Uploading media. + * + * This call adds the media item to the library. If an album `id` is + * specified, the call adds the media item to the album too. Each album can + * contain up to 20,000 media items. By default, the media item will be added + * to the end of the library or album. + * + * If an album `id` and position are both defined, the media item is + * added to the album at the specified position. + * + * If the call contains multiple media items, they're added at the specified + * position. + * If you are creating a media item in a shared album where you are not the + * owner, you are not allowed to position the media item. Doing so will result + * in a `BAD REQUEST` error. + */ + await gapi.client.photoslibrary.mediaItems.batchCreate({ + }, { + albumId: "Test string", + albumPosition: { + position: "Test string", + relativeEnrichmentItemId: "Test string", + relativeMediaItemId: "Test string", + }, + newMediaItems: [ + { + description: "Test string", + simpleMediaItem: { + fileName: "Test string", + uploadToken: "Test string", + }, + } ], + }); + /** + * Returns the list of media items for the specified media item identifiers. + * Items are returned in the same order as the supplied identifiers. + */ + await gapi.client.photoslibrary.mediaItems.batchGet({ + mediaItemIds: "Test string", + }); + /** Returns the media item for the specified media item identifier. */ + await gapi.client.photoslibrary.mediaItems.get({ + mediaItemId: "Test string", + }); + /** List all media items from a user's Google Photos library. */ + await gapi.client.photoslibrary.mediaItems.list({ + pageSize: 42, + pageToken: "Test string", + }); + /** + * Searches for media items in a user's Google Photos library. + * If no filters are set, then all media items in the user's library are + * returned. + * If an album is set, all media items in the specified album are returned. + * If filters are specified, media items that match the filters from the + * user's library are listed. If you set both the album and the filters, the + * request results in an error. + */ + await gapi.client.photoslibrary.mediaItems.search({ + }, { + albumId: "Test string", + filters: { + contentFilter: { + excludedContentCategories: [ + "Test string" ], + includedContentCategories: [ + "Test string" ], + }, + dateFilter: { + dates: [ + { + day: 42, + month: 42, + year: 42, + } ], + ranges: [ + { + endDate: { + day: 42, + month: 42, + year: 42, + }, + startDate: { + day: 42, + month: 42, + year: 42, + }, + } ], + }, + excludeNonAppCreatedData: true, + featureFilter: { + includedFeatures: [ + "Test string" ], + }, + includeArchivedMedia: true, + mediaTypeFilter: { + mediaTypes: [ + "Test string" ], + }, + }, + pageSize: 42, + pageToken: "Test string", + }); + /** Returns the album based on the specified `shareToken`. */ + await gapi.client.photoslibrary.sharedAlbums.get({ + shareToken: "Test string", + }); + /** Joins a shared album on behalf of the Google Photos user. */ + await gapi.client.photoslibrary.sharedAlbums.join({ + }, { + shareToken: "Test string", + }); + /** + * Leaves a previously-joined shared album on behalf of the Google Photos + * user. The user must not own this album. + */ + await gapi.client.photoslibrary.sharedAlbums.leave({ + }, { + shareToken: "Test string", + }); + /** + * Lists all shared albums available in the Sharing tab of the + * user's Google Photos app. + */ + await gapi.client.photoslibrary.sharedAlbums.list({ + excludeNonAppCreatedData: true, + pageSize: 42, + pageToken: "Test string", + }); + } +}); diff --git a/types/gapi.client.photoslibrary/index.d.ts b/types/gapi.client.photoslibrary/index.d.ts new file mode 100644 index 0000000000..56491340b7 --- /dev/null +++ b/types/gapi.client.photoslibrary/index.d.ts @@ -0,0 +1,1454 @@ +// Type definitions for non-npm package Photos Library API v1 1.0 +// Project: https://developers.google.com/photos/ +// Definitions by: Maxim Mazurok +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.7 + +// IMPORTANT +// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually. +// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator +// Generated from: https://photoslibrary.googleapis.com/\$discovery/rest?version=v1 + +/// + +declare namespace gapi.client { + /** Load Photos Library API v1 */ + function load(name: "photoslibrary", version: "v1"): PromiseLike; + function load(name: "photoslibrary", version: "v1", callback: () => any): void; + + namespace photoslibrary { + interface AddEnrichmentToAlbumRequest { + /** The position in the album where the enrichment is to be inserted. */ + albumPosition?: AlbumPosition; + /** The enrichment to be added. */ + newEnrichmentItem?: NewEnrichmentItem; + } + interface AddEnrichmentToAlbumResponse { + /** Output only. Enrichment which was added. */ + enrichmentItem?: EnrichmentItem; + } + interface Album { + /** + * [Output only] A URL to the cover photo's bytes. This shouldn't be used as + * is. Parameters should be appended to this URL before use. See the + * [developer + * documentation](https://developers.google.com/photos/library/guides/access-media-items#base-urls) + * for a complete list of supported parameters. For example, + * `'=w2048-h1024'` sets the dimensions of the cover photo to have a width of + * 2048 px and height of 1024 px. + */ + coverPhotoBaseUrl?: string; + /** + * [Output only] Identifier for the media item associated with the cover + * photo. + */ + coverPhotoMediaItemId?: string; + /** + * [Ouput only] Identifier for the album. This is a persistent identifier that + * can be used between sessions to identify this album. + */ + id?: string; + /** + * [Output only] True if you can create media items in this album. + * This field is based on the scopes granted and permissions of the album. If + * the scopes are changed or permissions of the album are changed, this field + * is updated. + */ + isWriteable?: boolean; + /** [Output only] The number of media items in the album. */ + mediaItemsCount?: string; + /** + * [Output only] Google Photos URL for the album. The user needs to be signed + * in to their Google Photos account to access this link. + */ + productUrl?: string; + /** + * [Output only] Information related to shared albums. + * This field is only populated if the album is a shared album, the + * developer created the album and the user has granted the + * `photoslibrary.sharing` scope. + */ + shareInfo?: ShareInfo; + /** + * Name of the album displayed to the user in their Google Photos account. + * This string shouldn't be more than 500 characters. + */ + title?: string; + } + interface AlbumPosition { + /** Type of position, for a media or enrichment item. */ + position?: string; + /** + * The enrichment item to which the position is relative to. + * Only used when position type is AFTER_ENRICHMENT_ITEM. + */ + relativeEnrichmentItemId?: string; + /** + * The media item to which the position is relative to. + * Only used when position type is AFTER_MEDIA_ITEM. + */ + relativeMediaItemId?: string; + } + interface BatchAddMediaItemsToAlbumRequest { + /** + * Identifiers of the MediaItems to be + * added. + * The maximum number of media items that can be added in one call is 50. + */ + mediaItemIds?: string[]; + } + // tslint:disable-next-line:no-empty-interface + interface BatchAddMediaItemsToAlbumResponse { + } + interface BatchCreateMediaItemsRequest { + /** + * Identifier of the album where the media items are added. The media items + * are also added to the user's library. This is an optional field. + */ + albumId?: string; + /** + * Position in the album where the media items are added. If not + * specified, the media items are added to the end of the album (as per + * the default value, that is, `LAST_IN_ALBUM`). The request fails if this + * field is set and the `albumId` is not specified. The request will also fail + * if you set the field and are not the owner of the shared album. + */ + albumPosition?: AlbumPosition; + /** List of media items to be created. */ + newMediaItems?: NewMediaItem[]; + } + interface BatchCreateMediaItemsResponse { + /** Output only. List of media items created. */ + newMediaItemResults?: NewMediaItemResult[]; + } + interface BatchGetMediaItemsResponse { + /** + * Output only. List of media items retrieved. + * Note that even if the call to BatchGetMediaItems succeeds, there may have + * been failures for some media items in the batch. These failures are + * indicated in each + * MediaItemResult.status. + */ + mediaItemResults?: MediaItemResult[]; + } + interface BatchRemoveMediaItemsFromAlbumRequest { + /** + * Identifiers of the MediaItems to be + * removed. + * + * Must not contain repeated identifiers and cannot be empty. The maximum + * number of media items that can be removed in one call is 50. + */ + mediaItemIds?: string[]; + } + // tslint:disable-next-line:no-empty-interface + interface BatchRemoveMediaItemsFromAlbumResponse { + } + interface ContentFilter { + /** + * The set of categories which are not to be included in the media item search + * results. The items in the set are ORed. There's a maximum of 10 + * `excludedContentCategories` per request. + */ + excludedContentCategories?: string[]; + /** + * The set of categories to be included in the media item search results. + * The items in the set are ORed. There's a maximum of 10 + * `includedContentCategories` per request. + */ + includedContentCategories?: string[]; + } + interface ContributorInfo { + /** Display name of the contributor. */ + displayName?: string; + /** URL to the profile picture of the contributor. */ + profilePictureBaseUrl?: string; + } + interface CreateAlbumRequest { + /** The album to be created. */ + album?: Album; + } + interface Date { + /** Day of month. Must be from 1 to 31 and valid for the year and month, or 0 if specifying a year/month where the day isn't significant. */ + day?: number; + /** + * Month of year. Must be from 1 to 12, or 0 if specifying a year without a + * month and day. + */ + month?: number; + /** + * Year of date. Must be from 1 to 9999, or 0 if specifying a date without + * a year. + */ + year?: number; + } + interface DateFilter { + /** + * List of dates that match the media items' creation date. A maximum of + * 5 dates can be included per request. + */ + dates?: Date[]; + /** + * List of dates ranges that match the media items' creation date. A + * maximum of 5 dates ranges can be included per request. + */ + ranges?: DateRange[]; + } + interface DateRange { + /** + * The end date (included as part of the range). It must be specified in the + * same format as the start date. + */ + endDate?: Date; + /** + * The start date (included as part of the range) in one of the formats + * described. + */ + startDate?: Date; + } + interface EnrichmentItem { + /** Identifier of the enrichment item. */ + id?: string; + } + interface FeatureFilter { + /** + * The set of features to be included in the media item search results. + * The items in the set are ORed and may match any of the specified features. + */ + includedFeatures?: string[]; + } + interface Filters { + /** Filters the media items based on their content. */ + contentFilter?: ContentFilter; + /** Filters the media items based on their creation date. */ + dateFilter?: DateFilter; + /** + * If set, the results exclude media items that were not created by this app. + * Defaults to false (all media items are returned). This field is ignored if + * the photoslibrary.readonly.appcreateddata scope is used. + */ + excludeNonAppCreatedData?: boolean; + /** Filters the media items based on their features. */ + featureFilter?: FeatureFilter; + /** + * If set, the results include media items that the user has archived. + * Defaults to false (archived media items aren't included). + */ + includeArchivedMedia?: boolean; + /** Filters the media items based on the type of media. */ + mediaTypeFilter?: MediaTypeFilter; + } + interface JoinSharedAlbumRequest { + /** Token to join the shared album on behalf of the user. */ + shareToken?: string; + } + interface JoinSharedAlbumResponse { + /** Shared album that the user has joined. */ + album?: Album; + } + interface LatLng { + /** The latitude in degrees. It must be in the range [-90.0, +90.0]. */ + latitude?: number; + /** The longitude in degrees. It must be in the range [-180.0, +180.0]. */ + longitude?: number; + } + interface LeaveSharedAlbumRequest { + /** Token to leave the shared album on behalf of the user. */ + shareToken?: string; + } + // tslint:disable-next-line:no-empty-interface + interface LeaveSharedAlbumResponse { + } + interface ListAlbumsResponse { + /** + * Output only. List of albums shown in the Albums tab of the user's Google + * Photos app. + */ + albums?: Album[]; + /** + * Output only. Token to use to get the next set of albums. Populated if + * there are more albums to retrieve for this request. + */ + nextPageToken?: string; + } + interface ListMediaItemsResponse { + /** Output only. List of media items in the user's library. */ + mediaItems?: MediaItem[]; + /** + * Output only. Token to use to get the next set of media items. Its presence + * is the only reliable indicator of more media items being available in the + * next request. + */ + nextPageToken?: string; + } + interface ListSharedAlbumsResponse { + /** + * Output only. Token to use to get the next set of shared albums. Populated + * if there are more shared albums to retrieve for this request. + */ + nextPageToken?: string; + /** Output only. List of shared albums. */ + sharedAlbums?: Album[]; + } + interface Location { + /** Position of the location on the map. */ + latlng?: LatLng; + /** Name of the location to be displayed. */ + locationName?: string; + } + interface LocationEnrichment { + /** Location for this enrichment item. */ + location?: Location; + } + interface MapEnrichment { + /** Destination location for this enrichemt item. */ + destination?: Location; + /** Origin location for this enrichment item. */ + origin?: Location; + } + interface MediaItem { + /** + * A URL to the media item's bytes. This shouldn't be used as is. Parameters + * should be appended to this URL before use. See the [developer + * documentation](https://developers.google.com/photos/library/guides/access-media-items#base-urls) + * for a complete list of supported parameters. For example, `'=w2048-h1024'` + * will set the dimensions of a media item of type photo to have a width of + * 2048 px and height of 1024 px. + */ + baseUrl?: string; + /** Information about the user who created this media item. */ + contributorInfo?: ContributorInfo; + /** + * Description of the media item. This is shown to the user in the item's + * info section in the Google Photos app. + */ + description?: string; + /** + * Filename of the media item. This is shown to the user in the item's info + * section in the Google Photos app. + */ + filename?: string; + /** + * Identifier for the media item. This is a persistent identifier that can be + * used between sessions to identify this media item. + */ + id?: string; + /** + * Metadata related to the media item, such as, height, width, or + * creation time. + */ + mediaMetadata?: MediaMetadata; + /** MIME type of the media item. For example, `image/jpeg`. */ + mimeType?: string; + /** + * Google Photos URL for the media item. This link is available to + * the user only if they're signed in. + */ + productUrl?: string; + } + interface MediaItemResult { + /** + * Media item retrieved from the user's library. It's populated if no errors + * occurred and the media item was fetched successfully. + */ + mediaItem?: MediaItem; + /** + * If an error occurred while accessing this media item, this field + * is populated with information related to the error. For details regarding + * this field, see Status. + */ + status?: Status; + } + interface MediaMetadata { + /** + * Time when the media item was first created (not when it was uploaded to + * Google Photos). + */ + creationTime?: string; + /** Original height (in pixels) of the media item. */ + height?: string; + /** Metadata for a photo media type. */ + photo?: Photo; + /** Metadata for a video media type. */ + video?: Video; + /** Original width (in pixels) of the media item. */ + width?: string; + } + interface MediaTypeFilter { + /** + * The types of media items to be included. This field should be populated + * with only one media type. If you specify multiple media types, it results + * in an error. + */ + mediaTypes?: string[]; + } + interface NewEnrichmentItem { + /** Location to be added to the album. */ + locationEnrichment?: LocationEnrichment; + /** Map to be added to the album. */ + mapEnrichment?: MapEnrichment; + /** Text to be added to the album. */ + textEnrichment?: TextEnrichment; + } + interface NewMediaItem { + /** + * Description of the media item. This will be shown to the user in the item's + * info section in the Google Photos app. + * This string shouldn't be more than 1000 characters. + */ + description?: string; + /** A new media item that has been uploaded via the included `uploadToken`. */ + simpleMediaItem?: SimpleMediaItem; + } + interface NewMediaItemResult { + /** + * Media item created with the upload token. It's populated if no errors + * occurred and the media item was created successfully. + */ + mediaItem?: MediaItem; + /** + * If an error occurred during the creation of this media item, this field + * is populated with information related to the error. For details regarding + * this field, see Status. + */ + status?: Status; + /** The upload token used to create this new media item. */ + uploadToken?: string; + } + interface Photo { + /** Aperture f number of the camera lens with which the photo was taken. */ + apertureFNumber?: number; + /** Brand of the camera with which the photo was taken. */ + cameraMake?: string; + /** Model of the camera with which the photo was taken. */ + cameraModel?: string; + /** Exposure time of the camera aperture when the photo was taken. */ + exposureTime?: string; + /** Focal length of the camera lens with which the photo was taken. */ + focalLength?: number; + /** ISO of the camera with which the photo was taken. */ + isoEquivalent?: number; + } + interface SearchMediaItemsRequest { + /** + * Identifier of an album. If populated, lists all media items in + * specified album. Can't set in conjunction with any filters. + */ + albumId?: string; + /** + * Filters to apply to the request. Can't be set in conjunction with an + * `albumId`. + */ + filters?: Filters; + /** + * Maximum number of media items to return in the response. Fewer media items + * might be returned than the specified number. The default `pageSize` is 25, + * the maximum is 100. + */ + pageSize?: number; + /** + * A continuation token to get the next page of the results. Adding this to + * the request returns the rows after the `pageToken`. The `pageToken` should + * be the value returned in the `nextPageToken` parameter in the response to + * the `searchMediaItems` request. + */ + pageToken?: string; + } + interface SearchMediaItemsResponse { + /** Output only. List of media items that match the search parameters. */ + mediaItems?: MediaItem[]; + /** + * Output only. Use this token to get the next set of media items. Its + * presence is the only reliable indicator of more media items being available + * in the next request. + */ + nextPageToken?: string; + } + interface ShareAlbumRequest { + /** Options to be set when converting the album to a shared album. */ + sharedAlbumOptions?: SharedAlbumOptions; + } + interface ShareAlbumResponse { + /** Output only. Information about the shared album. */ + shareInfo?: ShareInfo; + } + interface ShareInfo { + /** + * True if the user has joined the album. This is always true for the owner + * of the shared album. + */ + isJoined?: boolean; + /** True if the user owns the album. */ + isOwned?: boolean; + /** + * A token that can be used by other users to join this shared album via the + * API. + */ + shareToken?: string; + /** + * A link to the album that's now shared on the Google Photos website and app. + * Anyone with the link can access this shared album and see all of the items + * present in the album. + */ + shareableUrl?: string; + /** Options that control the sharing of an album. */ + sharedAlbumOptions?: SharedAlbumOptions; + } + interface SharedAlbumOptions { + /** + * True if the shared album allows collaborators (users who have joined + * the album) to add media items to it. Defaults to false. + */ + isCollaborative?: boolean; + /** + * True if the shared album allows the owner and the collaborators (users + * who have joined the album) to add comments to the album. Defaults to false. + */ + isCommentable?: boolean; + } + interface SimpleMediaItem { + /** + * File name with extension of the media item. This is shown to the user in + * Google Photos. The file name specified during the byte + * upload process is ignored if this field is set. The file name, + * including the file extension, shouldn't be more than 255 characters. This + * is an optional field. + */ + fileName?: string; + /** Token identifying the media bytes that have been uploaded to Google. */ + uploadToken?: string; + } + interface Status { + /** The status code, which should be an enum value of google.rpc.Code. */ + code?: number; + /** + * A list of messages that carry the error details. There is a common set of + * message types for APIs to use. + */ + details?: Array>; + /** + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * google.rpc.Status.details field, or localized by the client. + */ + message?: string; + } + interface TextEnrichment { + /** Text for this enrichment item. */ + text?: string; + } + // tslint:disable-next-line:no-empty-interface + interface UnshareAlbumRequest { + } + // tslint:disable-next-line:no-empty-interface + interface UnshareAlbumResponse { + } + interface Video { + /** Brand of the camera with which the video was taken. */ + cameraMake?: string; + /** Model of the camera with which the video was taken. */ + cameraModel?: string; + /** Frame rate of the video. */ + fps?: number; + /** Processing status of the video. */ + status?: string; + } + interface AlbumsResource { + /** Adds an enrichment at a specified position in a defined album. */ + addEnrichment(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Identifier of the album where the enrichment is to be added. */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: AddEnrichmentToAlbumRequest; + }): Request; + addEnrichment(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Identifier of the album where the enrichment is to be added. */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: AddEnrichmentToAlbumRequest): Request; + /** + * Adds one or more media items in a user's Google Photos library to + * an album. The media items and albums must have been created by the + * developer via the API. + * + * Media items are added to the end of the album. If multiple media items are + * given, they are added in the order specified in this call. + * + * Each album can contain up to 20,000 media items. + * + * Only media items that are in the user's library can be added to an + * album. For albums that are shared, the album must either be owned by the + * user or the user must have joined the album as a collaborator. + * + * Partial success is not supported. The entire request will fail if an + * invalid media item or album is specified. + */ + batchAddMediaItems(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** + * Identifier of the Album that the + * media items are added to. + */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: BatchAddMediaItemsToAlbumRequest; + }): Request<{}>; + batchAddMediaItems(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** + * Identifier of the Album that the + * media items are added to. + */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: BatchAddMediaItemsToAlbumRequest): Request<{}>; + /** + * Removes one or more media items from a specified album. The media items and + * the album must have been created by the developer via the API. + * + * For albums that are shared, this action is only supported for media items + * that were added to the album by this user, or for all media items if the + * album was created by this user. + * + * Partial success is not supported. The entire request will fail and no + * action will be performed on the album if an invalid media item or album is + * specified. + */ + batchRemoveMediaItems(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** + * Identifier of the Album that the media + * items are to be removed from. + */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: BatchRemoveMediaItemsFromAlbumRequest; + }): Request<{}>; + batchRemoveMediaItems(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** + * Identifier of the Album that the media + * items are to be removed from. + */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: BatchRemoveMediaItemsFromAlbumRequest): Request<{}>; + /** Creates an album in a user's Google Photos library. */ + create(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: CreateAlbumRequest; + }): Request; + create(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: CreateAlbumRequest): Request; + /** + * Returns the album based on the specified `albumId`. + * The `albumId` must be the ID of an album owned by the user or a shared + * album that the user has joined. + */ + get(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Identifier of the album to be requested. */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }): Request; + /** + * Lists all albums shown to a user in the Albums tab of the Google + * Photos app. + */ + list(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** + * If set, the results exclude media items that were not created by this app. + * Defaults to false (all albums are returned). This field is ignored if the + * photoslibrary.readonly.appcreateddata scope is used. + */ + excludeNonAppCreatedData?: boolean; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** + * Maximum number of albums to return in the response. Fewer albums might be + * returned than the specified number. The default `pageSize` is 20, the + * maximum is 50. + */ + pageSize?: number; + /** + * A continuation token to get the next page of the results. Adding this to + * the request returns the rows after the `pageToken`. The `pageToken` should + * be the value returned in the `nextPageToken` parameter in the response to + * the `listAlbums` request. + */ + pageToken?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }): Request; + /** + * Marks an album as shared and accessible to other users. This action can + * only be performed on albums which were created by the developer via the + * API. + */ + share(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** + * Identifier of the album to be shared. This `albumId` must belong to an + * album created by the developer. + */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: ShareAlbumRequest; + }): Request; + share(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** + * Identifier of the album to be shared. This `albumId` must belong to an + * album created by the developer. + */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: ShareAlbumRequest): Request; + /** + * Marks a previously shared album as private. This means that the album is + * no longer shared and all the non-owners will lose access to the album. All + * non-owner content will be removed from the album. If a non-owner has + * previously added the album to their library, they will retain all photos in + * their library. This action can only be performed on albums which were + * created by the developer via the API. + */ + unshare(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** + * Identifier of the album to be unshared. This album id must belong to an + * album created by the developer. + */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: UnshareAlbumRequest; + }): Request<{}>; + unshare(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** + * Identifier of the album to be unshared. This album id must belong to an + * album created by the developer. + */ + albumId: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: UnshareAlbumRequest): Request<{}>; + } + interface MediaItemsResource { + /** + * Creates one or more media items in a user's Google Photos library. + * + * This is the second step for creating a media item. For details regarding + * Step 1, uploading the raw bytes to a Google Server, see + * Uploading media. + * + * This call adds the media item to the library. If an album `id` is + * specified, the call adds the media item to the album too. Each album can + * contain up to 20,000 media items. By default, the media item will be added + * to the end of the library or album. + * + * If an album `id` and position are both defined, the media item is + * added to the album at the specified position. + * + * If the call contains multiple media items, they're added at the specified + * position. + * If you are creating a media item in a shared album where you are not the + * owner, you are not allowed to position the media item. Doing so will result + * in a `BAD REQUEST` error. + */ + batchCreate(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: BatchCreateMediaItemsRequest; + }): Request; + batchCreate(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: BatchCreateMediaItemsRequest): Request; + /** + * Returns the list of media items for the specified media item identifiers. + * Items are returned in the same order as the supplied identifiers. + */ + batchGet(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** + * Identifiers of the media items to be requested. + * Must not contain repeated identifiers and cannot be empty. The maximum + * number of media items that can be retrieved in one call is 50. + */ + mediaItemIds?: string | string[]; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }): Request; + /** Returns the media item for the specified media item identifier. */ + get(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** Identifier of the media item to be requested. */ + mediaItemId: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }): Request; + /** List all media items from a user's Google Photos library. */ + list(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** + * Maximum number of media items to return in the response. Fewer media items + * might be returned than the specified number. The default `pageSize` is 25, + * the maximum is 100. + */ + pageSize?: number; + /** + * A continuation token to get the next page of the results. Adding this to + * the request returns the rows after the `pageToken`. The `pageToken` should + * be the value returned in the `nextPageToken` parameter in the response to + * the `listMediaItems` request. + */ + pageToken?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }): Request; + /** + * Searches for media items in a user's Google Photos library. + * If no filters are set, then all media items in the user's library are + * returned. + * If an album is set, all media items in the specified album are returned. + * If filters are specified, media items that match the filters from the + * user's library are listed. If you set both the album and the filters, the + * request results in an error. + */ + search(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: SearchMediaItemsRequest; + }): Request; + search(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: SearchMediaItemsRequest): Request; + } + interface SharedAlbumsResource { + /** Returns the album based on the specified `shareToken`. */ + get(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Share token of the album to be requested. */ + shareToken: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }): Request; + /** Joins a shared album on behalf of the Google Photos user. */ + join(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: JoinSharedAlbumRequest; + }): Request; + join(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: JoinSharedAlbumRequest): Request; + /** + * Leaves a previously-joined shared album on behalf of the Google Photos + * user. The user must not own this album. + */ + leave(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + /** Request body */ + resource: LeaveSharedAlbumRequest; + }): Request<{}>; + leave(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }, + body: LeaveSharedAlbumRequest): Request<{}>; + /** + * Lists all shared albums available in the Sharing tab of the + * user's Google Photos app. + */ + list(request: { + /** V1 error format. */ + "$.xgafv"?: string; + /** OAuth access token. */ + access_token?: string; + /** Data format for response. */ + alt?: string; + /** JSONP */ + callback?: string; + /** + * If set, the results exclude media items that were not created by this app. + * Defaults to false (all albums are returned). This field is ignored if the + * photoslibrary.readonly.appcreateddata scope is used. + */ + excludeNonAppCreatedData?: boolean; + /** Selector specifying which fields to include in a partial response. */ + fields?: string; + /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */ + key?: string; + /** OAuth 2.0 token for the current user. */ + oauth_token?: string; + /** + * Maximum number of albums to return in the response. Fewer albums might be + * returned than the specified number. The default `pageSize` is 20, the + * maximum is 50. + */ + pageSize?: number; + /** + * A continuation token to get the next page of the results. Adding this to + * the request returns the rows after the `pageToken`. The `pageToken` should + * be the value returned in the `nextPageToken` parameter in the response to + * the `listSharedAlbums` request. + */ + pageToken?: string; + /** Returns response with indentations and line breaks. */ + prettyPrint?: boolean; + /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */ + quotaUser?: string; + /** Legacy upload protocol for media (e.g. "media", "multipart"). */ + uploadType?: string; + /** Upload protocol for media (e.g. "raw", "multipart"). */ + upload_protocol?: string; + }): Request; + } + + const albums: AlbumsResource; + + const mediaItems: MediaItemsResource; + + const sharedAlbums: SharedAlbumsResource; + } +} diff --git a/types/gapi.client.photoslibrary/readme.md b/types/gapi.client.photoslibrary/readme.md new file mode 100644 index 0000000000..2cccfd83c0 --- /dev/null +++ b/types/gapi.client.photoslibrary/readme.md @@ -0,0 +1,212 @@ +# TypeScript typings for Photos Library API v1 +Manage photos, videos, and albums in Google Photos + +For detailed description please check [documentation](https://developers.google.com/photos/). + +## Installing + +Install typings for Photos Library API: +``` +npm install @types/gapi.client.photoslibrary@v1 --save-dev +``` + +## Usage + +You need to initialize Google API client in your code: +```typescript +gapi.load("client", () => { + // now we can use gapi.client + // ... +}); +``` + +Then load api client wrapper: +```typescript +gapi.client.load('photoslibrary', 'v1', () => { + // now we can use gapi.client.photoslibrary + // ... +}); +``` + +Don't forget to authenticate your client before sending any request to resources: +```typescript + +// declare client_id registered in Google Developers Console +var client_id = '', + scope = [ + // View and manage your Google Photos library + 'https://www.googleapis.com/auth/photoslibrary', + + // Add to your Google Photos library + 'https://www.googleapis.com/auth/photoslibrary.appendonly', + + // View your Google Photos library + 'https://www.googleapis.com/auth/photoslibrary.readonly', + + // Manage photos added by this app + 'https://www.googleapis.com/auth/photoslibrary.readonly.appcreateddata', + + // Manage and add to shared albums on your behalf + 'https://www.googleapis.com/auth/photoslibrary.sharing', + ], + immediate = true; +// ... + +gapi.auth.authorize({ client_id: client_id, scope: scope, immediate: immediate }, authResult => { + if (authResult && !authResult.error) { + /* handle successful authorization */ + } else { + /* handle authorization error */ + } +}); +``` + +After that you can use Photos Library API resources: + +```typescript + +/* +Adds an enrichment at a specified position in a defined album. +*/ +await gapi.client.albums.addEnrichment({ albumId: "albumId", }); + +/* +Adds one or more media items in a user's Google Photos library to +an album. The media items and albums must have been created by the +developer via the API. + +Media items are added to the end of the album. If multiple media items are +given, they are added in the order specified in this call. + +Each album can contain up to 20,000 media items. + +Only media items that are in the user's library can be added to an +album. For albums that are shared, the album must either be owned by the +user or the user must have joined the album as a collaborator. + +Partial success is not supported. The entire request will fail if an +invalid media item or album is specified. +*/ +await gapi.client.albums.batchAddMediaItems({ albumId: "albumId", }); + +/* +Removes one or more media items from a specified album. The media items and +the album must have been created by the developer via the API. + +For albums that are shared, this action is only supported for media items +that were added to the album by this user, or for all media items if the +album was created by this user. + +Partial success is not supported. The entire request will fail and no +action will be performed on the album if an invalid media item or album is +specified. +*/ +await gapi.client.albums.batchRemoveMediaItems({ albumId: "albumId", }); + +/* +Creates an album in a user's Google Photos library. +*/ +await gapi.client.albums.create({ }); + +/* +Returns the album based on the specified `albumId`. +The `albumId` must be the ID of an album owned by the user or a shared +album that the user has joined. +*/ +await gapi.client.albums.get({ albumId: "albumId", }); + +/* +Lists all albums shown to a user in the Albums tab of the Google +Photos app. +*/ +await gapi.client.albums.list({ }); + +/* +Marks an album as shared and accessible to other users. This action can +only be performed on albums which were created by the developer via the +API. +*/ +await gapi.client.albums.share({ albumId: "albumId", }); + +/* +Marks a previously shared album as private. This means that the album is +no longer shared and all the non-owners will lose access to the album. All +non-owner content will be removed from the album. If a non-owner has +previously added the album to their library, they will retain all photos in +their library. This action can only be performed on albums which were +created by the developer via the API. +*/ +await gapi.client.albums.unshare({ albumId: "albumId", }); + +/* +Creates one or more media items in a user's Google Photos library. + +This is the second step for creating a media item. For details regarding +Step 1, uploading the raw bytes to a Google Server, see +Uploading media. + +This call adds the media item to the library. If an album `id` is +specified, the call adds the media item to the album too. Each album can +contain up to 20,000 media items. By default, the media item will be added +to the end of the library or album. + +If an album `id` and position are both defined, the media item is +added to the album at the specified position. + +If the call contains multiple media items, they're added at the specified +position. +If you are creating a media item in a shared album where you are not the +owner, you are not allowed to position the media item. Doing so will result +in a `BAD REQUEST` error. +*/ +await gapi.client.mediaItems.batchCreate({ }); + +/* +Returns the list of media items for the specified media item identifiers. +Items are returned in the same order as the supplied identifiers. +*/ +await gapi.client.mediaItems.batchGet({ }); + +/* +Returns the media item for the specified media item identifier. +*/ +await gapi.client.mediaItems.get({ mediaItemId: "mediaItemId", }); + +/* +List all media items from a user's Google Photos library. +*/ +await gapi.client.mediaItems.list({ }); + +/* +Searches for media items in a user's Google Photos library. +If no filters are set, then all media items in the user's library are +returned. +If an album is set, all media items in the specified album are returned. +If filters are specified, media items that match the filters from the +user's library are listed. If you set both the album and the filters, the +request results in an error. +*/ +await gapi.client.mediaItems.search({ }); + +/* +Returns the album based on the specified `shareToken`. +*/ +await gapi.client.sharedAlbums.get({ shareToken: "shareToken", }); + +/* +Joins a shared album on behalf of the Google Photos user. +*/ +await gapi.client.sharedAlbums.join({ }); + +/* +Leaves a previously-joined shared album on behalf of the Google Photos +user. The user must not own this album. +*/ +await gapi.client.sharedAlbums.leave({ }); + +/* +Lists all shared albums available in the Sharing tab of the +user's Google Photos app. +*/ +await gapi.client.sharedAlbums.list({ }); +``` diff --git a/types/gapi.client.photoslibrary/tsconfig.json b/types/gapi.client.photoslibrary/tsconfig.json new file mode 100644 index 0000000000..76a7c8f112 --- /dev/null +++ b/types/gapi.client.photoslibrary/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "gapi.client.photoslibrary-tests.ts" + ] +} diff --git a/types/gapi.client.photoslibrary/tslint.json b/types/gapi.client.photoslibrary/tslint.json new file mode 100644 index 0000000000..1c5c1ce060 --- /dev/null +++ b/types/gapi.client.photoslibrary/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-name": [false], + "ban-types": [false], + "await-promise": [true, "Request"] + } +}