From 0921a036205fbc5fbb915546400e6f41bbf5fbb2 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Mon, 3 Feb 2020 18:00:37 -0800 Subject: [PATCH] Initial generation of photoslibrary API --- .gitignore | 9 + Cargo.toml | 18 + src/lib.rs | 6453 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 6480 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e4c808 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/target + + +#Added by cargo +# +#already existing elements were commented out + +#/target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..5ff3367 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "google-photoslibrary1" +version = "0.1.0-20200203" +authors = ["Glenn Griffin , + #[doc = "The enrichment to be added."] + #[serde( + rename = "newEnrichmentItem", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub new_enrichment_item: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for AddEnrichmentToAlbumRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for AddEnrichmentToAlbumRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct AddEnrichmentToAlbumResponse { + #[doc = "Output only. Enrichment which was added."] + #[serde( + rename = "enrichmentItem", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub enrichment_item: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for AddEnrichmentToAlbumResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for AddEnrichmentToAlbumResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct Album { + #[doc = "[Output only] A URL to the cover photo's bytes. This shouldn't be used as\nis. Parameters should be appended to this URL before use. See the\n[developer\ndocumentation](https://developers.google.com/photos/library/guides/access-media-items#base-urls)\nfor a complete list of supported parameters. For example,\n`'=w2048-h1024'` sets the dimensions of the cover photo to have a width of\n2048 px and height of 1024 px."] + #[serde( + rename = "coverPhotoBaseUrl", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub cover_photo_base_url: ::std::option::Option, + #[doc = "Identifier for the media item associated with the cover photo."] + #[serde( + rename = "coverPhotoMediaItemId", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub cover_photo_media_item_id: ::std::option::Option, + #[doc = "[Ouput only] Identifier for the album. This is a persistent identifier that\ncan be used between sessions to identify this album."] + #[serde( + rename = "id", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub id: ::std::option::Option, + #[doc = "[Output only] True if you can create media items in this album.\nThis field is based on the scopes granted and permissions of the album. If\nthe scopes are changed or permissions of the album are changed, this field\nis updated."] + #[serde( + rename = "isWriteable", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub is_writeable: ::std::option::Option, + #[doc = "[Output only] The number of media items in the album."] + #[serde( + rename = "mediaItemsCount", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + #[serde(with = "crate::parsed_string")] + pub media_items_count: ::std::option::Option, + #[doc = "[Output only] Google Photos URL for the album. The user needs to be signed\nin to their Google Photos account to access this link."] + #[serde( + rename = "productUrl", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub product_url: ::std::option::Option, + #[doc = "[Output only] Information related to shared albums.\nThis field is only populated if the album is a shared album, the\ndeveloper created the album and the user has granted the\n`photoslibrary.sharing` scope."] + #[serde( + rename = "shareInfo", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub share_info: ::std::option::Option, + #[doc = "Name of the album displayed to the user in their Google Photos account.\nThis string shouldn't be more than 500 characters."] + #[serde( + rename = "title", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub title: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for Album { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Album { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct AlbumPosition { + #[doc = "Type of position, for a media or enrichment item."] + #[serde( + rename = "position", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub position: ::std::option::Option, + #[doc = "The enrichment item to which the position is relative to.\nOnly used when position type is AFTER_ENRICHMENT_ITEM."] + #[serde( + rename = "relativeEnrichmentItemId", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub relative_enrichment_item_id: ::std::option::Option, + #[doc = "The media item to which the position is relative to.\nOnly used when position type is AFTER_MEDIA_ITEM."] + #[serde( + rename = "relativeMediaItemId", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub relative_media_item_id: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for AlbumPosition { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for AlbumPosition { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Hash, PartialOrd, Ord, Eq, Copy)] + pub enum AlbumPositionPosition { + #[doc = "After an enrichment item."] + AfterEnrichmentItem, + #[doc = "After a media item."] + AfterMediaItem, + #[doc = "At the beginning of the album."] + FirstInAlbum, + #[doc = "At the end of the album."] + LastInAlbum, + #[doc = "Default value if this enum isn't set."] + PositionTypeUnspecified, + } + impl AlbumPositionPosition { + pub fn as_str(self) -> &'static str { + match self { + AlbumPositionPosition::AfterEnrichmentItem => "AFTER_ENRICHMENT_ITEM", + AlbumPositionPosition::AfterMediaItem => "AFTER_MEDIA_ITEM", + AlbumPositionPosition::FirstInAlbum => "FIRST_IN_ALBUM", + AlbumPositionPosition::LastInAlbum => "LAST_IN_ALBUM", + AlbumPositionPosition::PositionTypeUnspecified => "POSITION_TYPE_UNSPECIFIED", + } + } + } + impl ::std::convert::AsRef for AlbumPositionPosition { + fn as_ref(&self) -> &str { + self.as_str() + } + } + impl ::std::str::FromStr for AlbumPositionPosition { + type Err = (); + fn from_str(s: &str) -> ::std::result::Result { + Ok(match s { + "AFTER_ENRICHMENT_ITEM" => AlbumPositionPosition::AfterEnrichmentItem, + "AFTER_MEDIA_ITEM" => AlbumPositionPosition::AfterMediaItem, + "FIRST_IN_ALBUM" => AlbumPositionPosition::FirstInAlbum, + "LAST_IN_ALBUM" => AlbumPositionPosition::LastInAlbum, + "POSITION_TYPE_UNSPECIFIED" => AlbumPositionPosition::PositionTypeUnspecified, + _ => return Err(()), + }) + } + } + impl ::std::fmt::Display for AlbumPositionPosition { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { + f.write_str(self.as_str()) + } + } + impl ::serde::Serialize for AlbumPositionPosition { + fn serialize(&self, serializer: S) -> ::std::result::Result + where + S: ::serde::ser::Serializer, + { + serializer.serialize_str(self.as_str()) + } + } + impl<'de> ::serde::Deserialize<'de> for AlbumPositionPosition { + fn deserialize(deserializer: D) -> ::std::result::Result + where + D: ::serde::de::Deserializer<'de>, + { + let value: &'de str = <&str>::deserialize(deserializer)?; + Ok(match value { + "AFTER_ENRICHMENT_ITEM" => AlbumPositionPosition::AfterEnrichmentItem, + "AFTER_MEDIA_ITEM" => AlbumPositionPosition::AfterMediaItem, + "FIRST_IN_ALBUM" => AlbumPositionPosition::FirstInAlbum, + "LAST_IN_ALBUM" => AlbumPositionPosition::LastInAlbum, + "POSITION_TYPE_UNSPECIFIED" => AlbumPositionPosition::PositionTypeUnspecified, + _ => { + return Err(::serde::de::Error::custom(format!( + "invalid enum for #name: {}", + value + ))) + } + }) + } + } + impl ::google_field_selector::FieldSelector for AlbumPositionPosition { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for AlbumPositionPosition { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct BatchAddMediaItemsToAlbumRequest { + #[doc = "Identifiers of the MediaItems to be\nadded.\nThe maximum number of media items that can be added in one call is 50."] + #[serde( + rename = "mediaItemIds", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_item_ids: ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for BatchAddMediaItemsToAlbumRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for BatchAddMediaItemsToAlbumRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Copy, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct BatchAddMediaItemsToAlbumResponse {} + impl ::google_field_selector::FieldSelector for BatchAddMediaItemsToAlbumResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for BatchAddMediaItemsToAlbumResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct BatchCreateMediaItemsRequest { + #[doc = "Identifier of the album where the media items are added. The media items\nare also added to the user's library. This is an optional field."] + #[serde( + rename = "albumId", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub album_id: ::std::option::Option, + #[doc = "Position in the album where the media items are added. If not\nspecified, the media items are added to the end of the album (as per\nthe default value, that is, `LAST_IN_ALBUM`). The request fails if this\nfield is set and the `albumId` is not specified. The request will also fail\nif you set the field and are not the owner of the shared album."] + #[serde( + rename = "albumPosition", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub album_position: ::std::option::Option, + #[doc = "List of media items to be created."] + #[serde( + rename = "newMediaItems", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub new_media_items: ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for BatchCreateMediaItemsRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for BatchCreateMediaItemsRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Default, :: serde :: Deserialize, :: serde :: Serialize)] + pub struct BatchCreateMediaItemsResponse { + #[doc = "Output only. List of media items created."] + #[serde( + rename = "newMediaItemResults", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub new_media_item_results: ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for BatchCreateMediaItemsResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for BatchCreateMediaItemsResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Default, :: serde :: Deserialize, :: serde :: Serialize)] + pub struct BatchGetMediaItemsResponse { + #[doc = "Output only. List of media items retrieved.\nNote that even if the call to BatchGetMediaItems succeeds, there may have\nbeen failures for some media items in the batch. These failures are\nindicated in each\nMediaItemResult.status."] + #[serde( + rename = "mediaItemResults", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_item_results: ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for BatchGetMediaItemsResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for BatchGetMediaItemsResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct BatchRemoveMediaItemsFromAlbumRequest { + #[doc = "Identifiers of the MediaItems to be\nremoved.\n\nMust not contain repeated identifiers and cannot be empty. The maximum\nnumber of media items that can be removed in one call is 50."] + #[serde( + rename = "mediaItemIds", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_item_ids: ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for BatchRemoveMediaItemsFromAlbumRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for BatchRemoveMediaItemsFromAlbumRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Copy, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct BatchRemoveMediaItemsFromAlbumResponse {} + impl ::google_field_selector::FieldSelector for BatchRemoveMediaItemsFromAlbumResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for BatchRemoveMediaItemsFromAlbumResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct ContentFilter { + #[doc = "The set of categories which are not to be included in the media item search\nresults. The items in the set are ORed. There's a maximum of 10\n`excludedContentCategories` per request."] + #[serde( + rename = "excludedContentCategories", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub excluded_content_categories: + ::std::option::Option>, + #[doc = "The set of categories to be included in the media item search results.\nThe items in the set are ORed. There's a maximum of 10\n`includedContentCategories` per request."] + #[serde( + rename = "includedContentCategories", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub included_content_categories: + ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for ContentFilter { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ContentFilter { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Hash, PartialOrd, Ord, Eq, Copy)] + pub enum ContentFilterExcludedContentCategoriesItems { + Animals, + Arts, + Birthdays, + Cityscapes, + Crafts, + Documents, + Fashion, + Flowers, + Food, + Gardens, + Holidays, + Houses, + Landmarks, + Landscapes, + Night, + None, + People, + Performances, + Pets, + Receipts, + Screenshots, + Selfies, + Sport, + Travel, + Utility, + Weddings, + Whiteboards, + } + impl ContentFilterExcludedContentCategoriesItems { + pub fn as_str(self) -> &'static str { + match self { + ContentFilterExcludedContentCategoriesItems::Animals => "ANIMALS", + ContentFilterExcludedContentCategoriesItems::Arts => "ARTS", + ContentFilterExcludedContentCategoriesItems::Birthdays => "BIRTHDAYS", + ContentFilterExcludedContentCategoriesItems::Cityscapes => "CITYSCAPES", + ContentFilterExcludedContentCategoriesItems::Crafts => "CRAFTS", + ContentFilterExcludedContentCategoriesItems::Documents => "DOCUMENTS", + ContentFilterExcludedContentCategoriesItems::Fashion => "FASHION", + ContentFilterExcludedContentCategoriesItems::Flowers => "FLOWERS", + ContentFilterExcludedContentCategoriesItems::Food => "FOOD", + ContentFilterExcludedContentCategoriesItems::Gardens => "GARDENS", + ContentFilterExcludedContentCategoriesItems::Holidays => "HOLIDAYS", + ContentFilterExcludedContentCategoriesItems::Houses => "HOUSES", + ContentFilterExcludedContentCategoriesItems::Landmarks => "LANDMARKS", + ContentFilterExcludedContentCategoriesItems::Landscapes => "LANDSCAPES", + ContentFilterExcludedContentCategoriesItems::Night => "NIGHT", + ContentFilterExcludedContentCategoriesItems::None => "NONE", + ContentFilterExcludedContentCategoriesItems::People => "PEOPLE", + ContentFilterExcludedContentCategoriesItems::Performances => "PERFORMANCES", + ContentFilterExcludedContentCategoriesItems::Pets => "PETS", + ContentFilterExcludedContentCategoriesItems::Receipts => "RECEIPTS", + ContentFilterExcludedContentCategoriesItems::Screenshots => "SCREENSHOTS", + ContentFilterExcludedContentCategoriesItems::Selfies => "SELFIES", + ContentFilterExcludedContentCategoriesItems::Sport => "SPORT", + ContentFilterExcludedContentCategoriesItems::Travel => "TRAVEL", + ContentFilterExcludedContentCategoriesItems::Utility => "UTILITY", + ContentFilterExcludedContentCategoriesItems::Weddings => "WEDDINGS", + ContentFilterExcludedContentCategoriesItems::Whiteboards => "WHITEBOARDS", + } + } + } + impl ::std::convert::AsRef for ContentFilterExcludedContentCategoriesItems { + fn as_ref(&self) -> &str { + self.as_str() + } + } + impl ::std::str::FromStr for ContentFilterExcludedContentCategoriesItems { + type Err = (); + fn from_str( + s: &str, + ) -> ::std::result::Result { + Ok(match s { + "ANIMALS" => ContentFilterExcludedContentCategoriesItems::Animals, + "ARTS" => ContentFilterExcludedContentCategoriesItems::Arts, + "BIRTHDAYS" => ContentFilterExcludedContentCategoriesItems::Birthdays, + "CITYSCAPES" => ContentFilterExcludedContentCategoriesItems::Cityscapes, + "CRAFTS" => ContentFilterExcludedContentCategoriesItems::Crafts, + "DOCUMENTS" => ContentFilterExcludedContentCategoriesItems::Documents, + "FASHION" => ContentFilterExcludedContentCategoriesItems::Fashion, + "FLOWERS" => ContentFilterExcludedContentCategoriesItems::Flowers, + "FOOD" => ContentFilterExcludedContentCategoriesItems::Food, + "GARDENS" => ContentFilterExcludedContentCategoriesItems::Gardens, + "HOLIDAYS" => ContentFilterExcludedContentCategoriesItems::Holidays, + "HOUSES" => ContentFilterExcludedContentCategoriesItems::Houses, + "LANDMARKS" => ContentFilterExcludedContentCategoriesItems::Landmarks, + "LANDSCAPES" => ContentFilterExcludedContentCategoriesItems::Landscapes, + "NIGHT" => ContentFilterExcludedContentCategoriesItems::Night, + "NONE" => ContentFilterExcludedContentCategoriesItems::None, + "PEOPLE" => ContentFilterExcludedContentCategoriesItems::People, + "PERFORMANCES" => ContentFilterExcludedContentCategoriesItems::Performances, + "PETS" => ContentFilterExcludedContentCategoriesItems::Pets, + "RECEIPTS" => ContentFilterExcludedContentCategoriesItems::Receipts, + "SCREENSHOTS" => ContentFilterExcludedContentCategoriesItems::Screenshots, + "SELFIES" => ContentFilterExcludedContentCategoriesItems::Selfies, + "SPORT" => ContentFilterExcludedContentCategoriesItems::Sport, + "TRAVEL" => ContentFilterExcludedContentCategoriesItems::Travel, + "UTILITY" => ContentFilterExcludedContentCategoriesItems::Utility, + "WEDDINGS" => ContentFilterExcludedContentCategoriesItems::Weddings, + "WHITEBOARDS" => ContentFilterExcludedContentCategoriesItems::Whiteboards, + _ => return Err(()), + }) + } + } + impl ::std::fmt::Display for ContentFilterExcludedContentCategoriesItems { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { + f.write_str(self.as_str()) + } + } + impl ::serde::Serialize for ContentFilterExcludedContentCategoriesItems { + fn serialize(&self, serializer: S) -> ::std::result::Result + where + S: ::serde::ser::Serializer, + { + serializer.serialize_str(self.as_str()) + } + } + impl<'de> ::serde::Deserialize<'de> for ContentFilterExcludedContentCategoriesItems { + fn deserialize(deserializer: D) -> ::std::result::Result + where + D: ::serde::de::Deserializer<'de>, + { + let value: &'de str = <&str>::deserialize(deserializer)?; + Ok(match value { + "ANIMALS" => ContentFilterExcludedContentCategoriesItems::Animals, + "ARTS" => ContentFilterExcludedContentCategoriesItems::Arts, + "BIRTHDAYS" => ContentFilterExcludedContentCategoriesItems::Birthdays, + "CITYSCAPES" => ContentFilterExcludedContentCategoriesItems::Cityscapes, + "CRAFTS" => ContentFilterExcludedContentCategoriesItems::Crafts, + "DOCUMENTS" => ContentFilterExcludedContentCategoriesItems::Documents, + "FASHION" => ContentFilterExcludedContentCategoriesItems::Fashion, + "FLOWERS" => ContentFilterExcludedContentCategoriesItems::Flowers, + "FOOD" => ContentFilterExcludedContentCategoriesItems::Food, + "GARDENS" => ContentFilterExcludedContentCategoriesItems::Gardens, + "HOLIDAYS" => ContentFilterExcludedContentCategoriesItems::Holidays, + "HOUSES" => ContentFilterExcludedContentCategoriesItems::Houses, + "LANDMARKS" => ContentFilterExcludedContentCategoriesItems::Landmarks, + "LANDSCAPES" => ContentFilterExcludedContentCategoriesItems::Landscapes, + "NIGHT" => ContentFilterExcludedContentCategoriesItems::Night, + "NONE" => ContentFilterExcludedContentCategoriesItems::None, + "PEOPLE" => ContentFilterExcludedContentCategoriesItems::People, + "PERFORMANCES" => ContentFilterExcludedContentCategoriesItems::Performances, + "PETS" => ContentFilterExcludedContentCategoriesItems::Pets, + "RECEIPTS" => ContentFilterExcludedContentCategoriesItems::Receipts, + "SCREENSHOTS" => ContentFilterExcludedContentCategoriesItems::Screenshots, + "SELFIES" => ContentFilterExcludedContentCategoriesItems::Selfies, + "SPORT" => ContentFilterExcludedContentCategoriesItems::Sport, + "TRAVEL" => ContentFilterExcludedContentCategoriesItems::Travel, + "UTILITY" => ContentFilterExcludedContentCategoriesItems::Utility, + "WEDDINGS" => ContentFilterExcludedContentCategoriesItems::Weddings, + "WHITEBOARDS" => ContentFilterExcludedContentCategoriesItems::Whiteboards, + _ => { + return Err(::serde::de::Error::custom(format!( + "invalid enum for #name: {}", + value + ))) + } + }) + } + } + impl ::google_field_selector::FieldSelector for ContentFilterExcludedContentCategoriesItems { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ContentFilterExcludedContentCategoriesItems { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Hash, PartialOrd, Ord, Eq, Copy)] + pub enum ContentFilterIncludedContentCategoriesItems { + Animals, + Arts, + Birthdays, + Cityscapes, + Crafts, + Documents, + Fashion, + Flowers, + Food, + Gardens, + Holidays, + Houses, + Landmarks, + Landscapes, + Night, + None, + People, + Performances, + Pets, + Receipts, + Screenshots, + Selfies, + Sport, + Travel, + Utility, + Weddings, + Whiteboards, + } + impl ContentFilterIncludedContentCategoriesItems { + pub fn as_str(self) -> &'static str { + match self { + ContentFilterIncludedContentCategoriesItems::Animals => "ANIMALS", + ContentFilterIncludedContentCategoriesItems::Arts => "ARTS", + ContentFilterIncludedContentCategoriesItems::Birthdays => "BIRTHDAYS", + ContentFilterIncludedContentCategoriesItems::Cityscapes => "CITYSCAPES", + ContentFilterIncludedContentCategoriesItems::Crafts => "CRAFTS", + ContentFilterIncludedContentCategoriesItems::Documents => "DOCUMENTS", + ContentFilterIncludedContentCategoriesItems::Fashion => "FASHION", + ContentFilterIncludedContentCategoriesItems::Flowers => "FLOWERS", + ContentFilterIncludedContentCategoriesItems::Food => "FOOD", + ContentFilterIncludedContentCategoriesItems::Gardens => "GARDENS", + ContentFilterIncludedContentCategoriesItems::Holidays => "HOLIDAYS", + ContentFilterIncludedContentCategoriesItems::Houses => "HOUSES", + ContentFilterIncludedContentCategoriesItems::Landmarks => "LANDMARKS", + ContentFilterIncludedContentCategoriesItems::Landscapes => "LANDSCAPES", + ContentFilterIncludedContentCategoriesItems::Night => "NIGHT", + ContentFilterIncludedContentCategoriesItems::None => "NONE", + ContentFilterIncludedContentCategoriesItems::People => "PEOPLE", + ContentFilterIncludedContentCategoriesItems::Performances => "PERFORMANCES", + ContentFilterIncludedContentCategoriesItems::Pets => "PETS", + ContentFilterIncludedContentCategoriesItems::Receipts => "RECEIPTS", + ContentFilterIncludedContentCategoriesItems::Screenshots => "SCREENSHOTS", + ContentFilterIncludedContentCategoriesItems::Selfies => "SELFIES", + ContentFilterIncludedContentCategoriesItems::Sport => "SPORT", + ContentFilterIncludedContentCategoriesItems::Travel => "TRAVEL", + ContentFilterIncludedContentCategoriesItems::Utility => "UTILITY", + ContentFilterIncludedContentCategoriesItems::Weddings => "WEDDINGS", + ContentFilterIncludedContentCategoriesItems::Whiteboards => "WHITEBOARDS", + } + } + } + impl ::std::convert::AsRef for ContentFilterIncludedContentCategoriesItems { + fn as_ref(&self) -> &str { + self.as_str() + } + } + impl ::std::str::FromStr for ContentFilterIncludedContentCategoriesItems { + type Err = (); + fn from_str( + s: &str, + ) -> ::std::result::Result { + Ok(match s { + "ANIMALS" => ContentFilterIncludedContentCategoriesItems::Animals, + "ARTS" => ContentFilterIncludedContentCategoriesItems::Arts, + "BIRTHDAYS" => ContentFilterIncludedContentCategoriesItems::Birthdays, + "CITYSCAPES" => ContentFilterIncludedContentCategoriesItems::Cityscapes, + "CRAFTS" => ContentFilterIncludedContentCategoriesItems::Crafts, + "DOCUMENTS" => ContentFilterIncludedContentCategoriesItems::Documents, + "FASHION" => ContentFilterIncludedContentCategoriesItems::Fashion, + "FLOWERS" => ContentFilterIncludedContentCategoriesItems::Flowers, + "FOOD" => ContentFilterIncludedContentCategoriesItems::Food, + "GARDENS" => ContentFilterIncludedContentCategoriesItems::Gardens, + "HOLIDAYS" => ContentFilterIncludedContentCategoriesItems::Holidays, + "HOUSES" => ContentFilterIncludedContentCategoriesItems::Houses, + "LANDMARKS" => ContentFilterIncludedContentCategoriesItems::Landmarks, + "LANDSCAPES" => ContentFilterIncludedContentCategoriesItems::Landscapes, + "NIGHT" => ContentFilterIncludedContentCategoriesItems::Night, + "NONE" => ContentFilterIncludedContentCategoriesItems::None, + "PEOPLE" => ContentFilterIncludedContentCategoriesItems::People, + "PERFORMANCES" => ContentFilterIncludedContentCategoriesItems::Performances, + "PETS" => ContentFilterIncludedContentCategoriesItems::Pets, + "RECEIPTS" => ContentFilterIncludedContentCategoriesItems::Receipts, + "SCREENSHOTS" => ContentFilterIncludedContentCategoriesItems::Screenshots, + "SELFIES" => ContentFilterIncludedContentCategoriesItems::Selfies, + "SPORT" => ContentFilterIncludedContentCategoriesItems::Sport, + "TRAVEL" => ContentFilterIncludedContentCategoriesItems::Travel, + "UTILITY" => ContentFilterIncludedContentCategoriesItems::Utility, + "WEDDINGS" => ContentFilterIncludedContentCategoriesItems::Weddings, + "WHITEBOARDS" => ContentFilterIncludedContentCategoriesItems::Whiteboards, + _ => return Err(()), + }) + } + } + impl ::std::fmt::Display for ContentFilterIncludedContentCategoriesItems { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { + f.write_str(self.as_str()) + } + } + impl ::serde::Serialize for ContentFilterIncludedContentCategoriesItems { + fn serialize(&self, serializer: S) -> ::std::result::Result + where + S: ::serde::ser::Serializer, + { + serializer.serialize_str(self.as_str()) + } + } + impl<'de> ::serde::Deserialize<'de> for ContentFilterIncludedContentCategoriesItems { + fn deserialize(deserializer: D) -> ::std::result::Result + where + D: ::serde::de::Deserializer<'de>, + { + let value: &'de str = <&str>::deserialize(deserializer)?; + Ok(match value { + "ANIMALS" => ContentFilterIncludedContentCategoriesItems::Animals, + "ARTS" => ContentFilterIncludedContentCategoriesItems::Arts, + "BIRTHDAYS" => ContentFilterIncludedContentCategoriesItems::Birthdays, + "CITYSCAPES" => ContentFilterIncludedContentCategoriesItems::Cityscapes, + "CRAFTS" => ContentFilterIncludedContentCategoriesItems::Crafts, + "DOCUMENTS" => ContentFilterIncludedContentCategoriesItems::Documents, + "FASHION" => ContentFilterIncludedContentCategoriesItems::Fashion, + "FLOWERS" => ContentFilterIncludedContentCategoriesItems::Flowers, + "FOOD" => ContentFilterIncludedContentCategoriesItems::Food, + "GARDENS" => ContentFilterIncludedContentCategoriesItems::Gardens, + "HOLIDAYS" => ContentFilterIncludedContentCategoriesItems::Holidays, + "HOUSES" => ContentFilterIncludedContentCategoriesItems::Houses, + "LANDMARKS" => ContentFilterIncludedContentCategoriesItems::Landmarks, + "LANDSCAPES" => ContentFilterIncludedContentCategoriesItems::Landscapes, + "NIGHT" => ContentFilterIncludedContentCategoriesItems::Night, + "NONE" => ContentFilterIncludedContentCategoriesItems::None, + "PEOPLE" => ContentFilterIncludedContentCategoriesItems::People, + "PERFORMANCES" => ContentFilterIncludedContentCategoriesItems::Performances, + "PETS" => ContentFilterIncludedContentCategoriesItems::Pets, + "RECEIPTS" => ContentFilterIncludedContentCategoriesItems::Receipts, + "SCREENSHOTS" => ContentFilterIncludedContentCategoriesItems::Screenshots, + "SELFIES" => ContentFilterIncludedContentCategoriesItems::Selfies, + "SPORT" => ContentFilterIncludedContentCategoriesItems::Sport, + "TRAVEL" => ContentFilterIncludedContentCategoriesItems::Travel, + "UTILITY" => ContentFilterIncludedContentCategoriesItems::Utility, + "WEDDINGS" => ContentFilterIncludedContentCategoriesItems::Weddings, + "WHITEBOARDS" => ContentFilterIncludedContentCategoriesItems::Whiteboards, + _ => { + return Err(::serde::de::Error::custom(format!( + "invalid enum for #name: {}", + value + ))) + } + }) + } + } + impl ::google_field_selector::FieldSelector for ContentFilterIncludedContentCategoriesItems { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ContentFilterIncludedContentCategoriesItems { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct ContributorInfo { + #[doc = "Display name of the contributor."] + #[serde( + rename = "displayName", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub display_name: ::std::option::Option, + #[doc = "URL to the profile picture of the contributor."] + #[serde( + rename = "profilePictureBaseUrl", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub profile_picture_base_url: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for ContributorInfo { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ContributorInfo { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct CreateAlbumRequest { + #[doc = "The album to be created."] + #[serde( + rename = "album", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub album: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for CreateAlbumRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for CreateAlbumRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct Date { + #[doc = "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."] + #[serde( + rename = "day", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub day: ::std::option::Option, + #[doc = "Month of year. Must be from 1 to 12, or 0 if specifying a year without a\nmonth and day."] + #[serde( + rename = "month", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub month: ::std::option::Option, + #[doc = "Year of date. Must be from 1 to 9999, or 0 if specifying a date without\na year."] + #[serde( + rename = "year", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub year: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for Date { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Date { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct DateFilter { + #[doc = "List of dates that match the media items' creation date. A maximum of\n5 dates can be included per request."] + #[serde( + rename = "dates", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub dates: ::std::option::Option>, + #[doc = "List of dates ranges that match the media items' creation date. A\nmaximum of 5 dates ranges can be included per request."] + #[serde( + rename = "ranges", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub ranges: ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for DateFilter { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for DateFilter { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct DateRange { + #[doc = "The end date (included as part of the range). It must be specified in the\nsame format as the start date."] + #[serde( + rename = "endDate", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub end_date: ::std::option::Option, + #[doc = "The start date (included as part of the range) in one of the formats\ndescribed."] + #[serde( + rename = "startDate", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub start_date: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for DateRange { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for DateRange { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct EnrichmentItem { + #[doc = "Identifier of the enrichment item."] + #[serde( + rename = "id", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub id: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for EnrichmentItem { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for EnrichmentItem { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct FeatureFilter { + #[doc = "The set of features to be included in the media item search results.\nThe items in the set are ORed and may match any of the specified features."] + #[serde( + rename = "includedFeatures", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub included_features: + ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for FeatureFilter { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for FeatureFilter { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Hash, PartialOrd, Ord, Eq, Copy)] + pub enum FeatureFilterIncludedFeaturesItems { + Favorites, + None, + } + impl FeatureFilterIncludedFeaturesItems { + pub fn as_str(self) -> &'static str { + match self { + FeatureFilterIncludedFeaturesItems::Favorites => "FAVORITES", + FeatureFilterIncludedFeaturesItems::None => "NONE", + } + } + } + impl ::std::convert::AsRef for FeatureFilterIncludedFeaturesItems { + fn as_ref(&self) -> &str { + self.as_str() + } + } + impl ::std::str::FromStr for FeatureFilterIncludedFeaturesItems { + type Err = (); + fn from_str(s: &str) -> ::std::result::Result { + Ok(match s { + "FAVORITES" => FeatureFilterIncludedFeaturesItems::Favorites, + "NONE" => FeatureFilterIncludedFeaturesItems::None, + _ => return Err(()), + }) + } + } + impl ::std::fmt::Display for FeatureFilterIncludedFeaturesItems { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { + f.write_str(self.as_str()) + } + } + impl ::serde::Serialize for FeatureFilterIncludedFeaturesItems { + fn serialize(&self, serializer: S) -> ::std::result::Result + where + S: ::serde::ser::Serializer, + { + serializer.serialize_str(self.as_str()) + } + } + impl<'de> ::serde::Deserialize<'de> for FeatureFilterIncludedFeaturesItems { + fn deserialize(deserializer: D) -> ::std::result::Result + where + D: ::serde::de::Deserializer<'de>, + { + let value: &'de str = <&str>::deserialize(deserializer)?; + Ok(match value { + "FAVORITES" => FeatureFilterIncludedFeaturesItems::Favorites, + "NONE" => FeatureFilterIncludedFeaturesItems::None, + _ => { + return Err(::serde::de::Error::custom(format!( + "invalid enum for #name: {}", + value + ))) + } + }) + } + } + impl ::google_field_selector::FieldSelector for FeatureFilterIncludedFeaturesItems { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for FeatureFilterIncludedFeaturesItems { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct Filters { + #[doc = "Filters the media items based on their content."] + #[serde( + rename = "contentFilter", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub content_filter: ::std::option::Option, + #[doc = "Filters the media items based on their creation date."] + #[serde( + rename = "dateFilter", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub date_filter: ::std::option::Option, + #[doc = "If set, the results exclude media items that were not created by this app.\nDefaults to false (all media items are returned). This field is ignored if\nthe photoslibrary.readonly.appcreateddata scope is used."] + #[serde( + rename = "excludeNonAppCreatedData", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub exclude_non_app_created_data: ::std::option::Option, + #[doc = "Filters the media items based on their features."] + #[serde( + rename = "featureFilter", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub feature_filter: ::std::option::Option, + #[doc = "If set, the results include media items that the user has archived.\nDefaults to false (archived media items aren't included)."] + #[serde( + rename = "includeArchivedMedia", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub include_archived_media: ::std::option::Option, + #[doc = "Filters the media items based on the type of media."] + #[serde( + rename = "mediaTypeFilter", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_type_filter: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for Filters { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Filters { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct JoinSharedAlbumRequest { + #[doc = "Token to join the shared album on behalf of the user."] + #[serde( + rename = "shareToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub share_token: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for JoinSharedAlbumRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for JoinSharedAlbumRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct JoinSharedAlbumResponse { + #[doc = "Shared album that the user has joined."] + #[serde( + rename = "album", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub album: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for JoinSharedAlbumResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for JoinSharedAlbumResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct LatLng { + #[doc = "The latitude in degrees. It must be in the range [-90.0, +90.0]."] + #[serde( + rename = "latitude", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub latitude: ::std::option::Option, + #[doc = "The longitude in degrees. It must be in the range [-180.0, +180.0]."] + #[serde( + rename = "longitude", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub longitude: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for LatLng { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for LatLng { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct LeaveSharedAlbumRequest { + #[doc = "Token to leave the shared album on behalf of the user."] + #[serde( + rename = "shareToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub share_token: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for LeaveSharedAlbumRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for LeaveSharedAlbumRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Copy, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct LeaveSharedAlbumResponse {} + impl ::google_field_selector::FieldSelector for LeaveSharedAlbumResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for LeaveSharedAlbumResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct ListAlbumsResponse { + #[doc = "Output only. List of albums shown in the Albums tab of the user's Google\nPhotos app."] + #[serde( + rename = "albums", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub albums: ::std::option::Option>, + #[doc = "Output only. Token to use to get the next set of albums. Populated if\nthere are more albums to retrieve for this request."] + #[serde( + rename = "nextPageToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub next_page_token: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for ListAlbumsResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ListAlbumsResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct ListMediaItemsResponse { + #[doc = "Output only. List of media items in the user's library."] + #[serde( + rename = "mediaItems", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_items: ::std::option::Option>, + #[doc = "Output only. Token to use to get the next set of media items. Its presence\nis the only reliable indicator of more media items being available in the\nnext request."] + #[serde( + rename = "nextPageToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub next_page_token: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for ListMediaItemsResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ListMediaItemsResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct ListSharedAlbumsResponse { + #[doc = "Output only. Token to use to get the next set of shared albums. Populated\nif there are more shared albums to retrieve for this request."] + #[serde( + rename = "nextPageToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub next_page_token: ::std::option::Option, + #[doc = "Output only. List of shared albums."] + #[serde( + rename = "sharedAlbums", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub shared_albums: ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for ListSharedAlbumsResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ListSharedAlbumsResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct Location { + #[doc = "Position of the location on the map."] + #[serde( + rename = "latlng", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub latlng: ::std::option::Option, + #[doc = "Name of the location to be displayed."] + #[serde( + rename = "locationName", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub location_name: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for Location { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Location { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct LocationEnrichment { + #[doc = "Location for this enrichment item."] + #[serde( + rename = "location", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub location: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for LocationEnrichment { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for LocationEnrichment { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct MapEnrichment { + #[doc = "Destination location for this enrichemt item."] + #[serde( + rename = "destination", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub destination: ::std::option::Option, + #[doc = "Origin location for this enrichment item."] + #[serde( + rename = "origin", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub origin: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for MapEnrichment { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for MapEnrichment { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct MediaItem { + #[doc = "A URL to the media item's bytes. This shouldn't be used as is. Parameters\nshould be appended to this URL before use. See the [developer\ndocumentation](https://developers.google.com/photos/library/guides/access-media-items#base-urls)\nfor a complete list of supported parameters. For example, `'=w2048-h1024'`\nwill set the dimensions of a media item of type photo to have a width of\n2048 px and height of 1024 px."] + #[serde( + rename = "baseUrl", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub base_url: ::std::option::Option, + #[doc = "Information about the user who created this media item."] + #[serde( + rename = "contributorInfo", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub contributor_info: ::std::option::Option, + #[doc = "Description of the media item. This is shown to the user in the item's\ninfo section in the Google Photos app."] + #[serde( + rename = "description", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub description: ::std::option::Option, + #[doc = "Filename of the media item. This is shown to the user in the item's info\nsection in the Google Photos app."] + #[serde( + rename = "filename", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub filename: ::std::option::Option, + #[doc = "Identifier for the media item. This is a persistent identifier that can be\nused between sessions to identify this media item."] + #[serde( + rename = "id", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub id: ::std::option::Option, + #[doc = "Metadata related to the media item, such as, height, width, or\ncreation time."] + #[serde( + rename = "mediaMetadata", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_metadata: ::std::option::Option, + #[doc = "MIME type of the media item. For example, `image/jpeg`."] + #[serde( + rename = "mimeType", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub mime_type: ::std::option::Option, + #[doc = "Google Photos URL for the media item. This link is available to\nthe user only if they're signed in."] + #[serde( + rename = "productUrl", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub product_url: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for MediaItem { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for MediaItem { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Default, :: serde :: Deserialize, :: serde :: Serialize)] + pub struct MediaItemResult { + #[doc = "Media item retrieved from the user's library. It's populated if no errors\noccurred and the media item was fetched successfully."] + #[serde( + rename = "mediaItem", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_item: ::std::option::Option, + #[doc = "If an error occurred while accessing this media item, this field\nis populated with information related to the error. For details regarding\nthis field, see Status."] + #[serde( + rename = "status", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub status: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for MediaItemResult { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for MediaItemResult { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct MediaMetadata { + #[doc = "Time when the media item was first created (not when it was uploaded to\nGoogle Photos)."] + #[serde( + rename = "creationTime", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub creation_time: ::std::option::Option, + #[doc = "Original height (in pixels) of the media item."] + #[serde( + rename = "height", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + #[serde(with = "crate::parsed_string")] + pub height: ::std::option::Option, + #[doc = "Metadata for a photo media type."] + #[serde( + rename = "photo", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub photo: ::std::option::Option, + #[doc = "Metadata for a video media type."] + #[serde( + rename = "video", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub video: ::std::option::Option, + #[doc = "Original width (in pixels) of the media item."] + #[serde( + rename = "width", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + #[serde(with = "crate::parsed_string")] + pub width: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for MediaMetadata { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for MediaMetadata { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct MediaTypeFilter { + #[doc = "The types of media items to be included. This field should be populated\nwith only one media type. If you specify multiple media types, it results\nin an error."] + #[serde( + rename = "mediaTypes", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_types: ::std::option::Option>, + } + impl ::google_field_selector::FieldSelector for MediaTypeFilter { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for MediaTypeFilter { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Hash, PartialOrd, Ord, Eq, Copy)] + pub enum MediaTypeFilterMediaTypesItems { + AllMedia, + Photo, + Video, + } + impl MediaTypeFilterMediaTypesItems { + pub fn as_str(self) -> &'static str { + match self { + MediaTypeFilterMediaTypesItems::AllMedia => "ALL_MEDIA", + MediaTypeFilterMediaTypesItems::Photo => "PHOTO", + MediaTypeFilterMediaTypesItems::Video => "VIDEO", + } + } + } + impl ::std::convert::AsRef for MediaTypeFilterMediaTypesItems { + fn as_ref(&self) -> &str { + self.as_str() + } + } + impl ::std::str::FromStr for MediaTypeFilterMediaTypesItems { + type Err = (); + fn from_str(s: &str) -> ::std::result::Result { + Ok(match s { + "ALL_MEDIA" => MediaTypeFilterMediaTypesItems::AllMedia, + "PHOTO" => MediaTypeFilterMediaTypesItems::Photo, + "VIDEO" => MediaTypeFilterMediaTypesItems::Video, + _ => return Err(()), + }) + } + } + impl ::std::fmt::Display for MediaTypeFilterMediaTypesItems { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { + f.write_str(self.as_str()) + } + } + impl ::serde::Serialize for MediaTypeFilterMediaTypesItems { + fn serialize(&self, serializer: S) -> ::std::result::Result + where + S: ::serde::ser::Serializer, + { + serializer.serialize_str(self.as_str()) + } + } + impl<'de> ::serde::Deserialize<'de> for MediaTypeFilterMediaTypesItems { + fn deserialize(deserializer: D) -> ::std::result::Result + where + D: ::serde::de::Deserializer<'de>, + { + let value: &'de str = <&str>::deserialize(deserializer)?; + Ok(match value { + "ALL_MEDIA" => MediaTypeFilterMediaTypesItems::AllMedia, + "PHOTO" => MediaTypeFilterMediaTypesItems::Photo, + "VIDEO" => MediaTypeFilterMediaTypesItems::Video, + _ => { + return Err(::serde::de::Error::custom(format!( + "invalid enum for #name: {}", + value + ))) + } + }) + } + } + impl ::google_field_selector::FieldSelector for MediaTypeFilterMediaTypesItems { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for MediaTypeFilterMediaTypesItems { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct NewEnrichmentItem { + #[doc = "Location to be added to the album."] + #[serde( + rename = "locationEnrichment", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub location_enrichment: ::std::option::Option, + #[doc = "Map to be added to the album."] + #[serde( + rename = "mapEnrichment", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub map_enrichment: ::std::option::Option, + #[doc = "Text to be added to the album."] + #[serde( + rename = "textEnrichment", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub text_enrichment: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for NewEnrichmentItem { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for NewEnrichmentItem { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct NewMediaItem { + #[doc = "Description of the media item. This will be shown to the user in the item's\ninfo section in the Google Photos app.\nThis string shouldn't be more than 1000 characters."] + #[serde( + rename = "description", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub description: ::std::option::Option, + #[doc = "A new media item that has been uploaded via the included `uploadToken`."] + #[serde( + rename = "simpleMediaItem", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub simple_media_item: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for NewMediaItem { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for NewMediaItem { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Default, :: serde :: Deserialize, :: serde :: Serialize)] + pub struct NewMediaItemResult { + #[doc = "Media item created with the upload token. It's populated if no errors\noccurred and the media item was created successfully."] + #[serde( + rename = "mediaItem", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_item: ::std::option::Option, + #[doc = "If an error occurred during the creation of this media item, this field\nis populated with information related to the error. For details regarding\nthis field, see Status."] + #[serde( + rename = "status", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub status: ::std::option::Option, + #[doc = "The upload token used to create this new media item."] + #[serde( + rename = "uploadToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub upload_token: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for NewMediaItemResult { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for NewMediaItemResult { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct Photo { + #[doc = "Aperture f number of the camera lens with which the photo was taken."] + #[serde( + rename = "apertureFNumber", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub aperture_f_number: ::std::option::Option, + #[doc = "Brand of the camera with which the photo was taken."] + #[serde( + rename = "cameraMake", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub camera_make: ::std::option::Option, + #[doc = "Model of the camera with which the photo was taken."] + #[serde( + rename = "cameraModel", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub camera_model: ::std::option::Option, + #[doc = "Exposure time of the camera aperture when the photo was taken."] + #[serde( + rename = "exposureTime", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub exposure_time: ::std::option::Option, + #[doc = "Focal length of the camera lens with which the photo was taken."] + #[serde( + rename = "focalLength", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub focal_length: ::std::option::Option, + #[doc = "ISO of the camera with which the photo was taken."] + #[serde( + rename = "isoEquivalent", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub iso_equivalent: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for Photo { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Photo { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct SearchMediaItemsRequest { + #[doc = "Identifier of an album. If populated, lists all media items in\nspecified album. Can't set in conjunction with any filters."] + #[serde( + rename = "albumId", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub album_id: ::std::option::Option, + #[doc = "Filters to apply to the request. Can't be set in conjunction with an\n`albumId`."] + #[serde( + rename = "filters", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub filters: ::std::option::Option, + #[doc = "Maximum number of media items to return in the response. Fewer media items\nmight be returned than the specified number. The default `pageSize` is 25,\nthe maximum is 100."] + #[serde( + rename = "pageSize", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub page_size: ::std::option::Option, + #[doc = "A continuation token to get the next page of the results. Adding this to\nthe request returns the rows after the `pageToken`. The `pageToken` should\nbe the value returned in the `nextPageToken` parameter in the response to\nthe `searchMediaItems` request."] + #[serde( + rename = "pageToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub page_token: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for SearchMediaItemsRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for SearchMediaItemsRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct SearchMediaItemsResponse { + #[doc = "Output only. List of media items that match the search parameters."] + #[serde( + rename = "mediaItems", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub media_items: ::std::option::Option>, + #[doc = "Output only. Use this token to get the next set of media items. Its\npresence is the only reliable indicator of more media items being available\nin the next request."] + #[serde( + rename = "nextPageToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub next_page_token: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for SearchMediaItemsResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for SearchMediaItemsResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct ShareAlbumRequest { + #[doc = "Options to be set when converting the album to a shared album."] + #[serde( + rename = "sharedAlbumOptions", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub shared_album_options: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for ShareAlbumRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ShareAlbumRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct ShareAlbumResponse { + #[doc = "Output only. Information about the shared album."] + #[serde( + rename = "shareInfo", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub share_info: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for ShareAlbumResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ShareAlbumResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct ShareInfo { + #[doc = "True if the user has joined the album. This is always true for the owner\nof the shared album."] + #[serde( + rename = "isJoined", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub is_joined: ::std::option::Option, + #[doc = "True if the user owns the album."] + #[serde( + rename = "isOwned", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub is_owned: ::std::option::Option, + #[doc = "A token that can be used by other users to join this shared album via the\nAPI."] + #[serde( + rename = "shareToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub share_token: ::std::option::Option, + #[doc = "A link to the album that's now shared on the Google Photos website and app.\nAnyone with the link can access this shared album and see all of the items\npresent in the album."] + #[serde( + rename = "shareableUrl", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub shareable_url: ::std::option::Option, + #[doc = "Options that control the sharing of an album."] + #[serde( + rename = "sharedAlbumOptions", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub shared_album_options: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for ShareInfo { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for ShareInfo { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct SharedAlbumOptions { + #[doc = "True if the shared album allows collaborators (users who have joined\nthe album) to add media items to it. Defaults to false."] + #[serde( + rename = "isCollaborative", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub is_collaborative: ::std::option::Option, + #[doc = "True if the shared album allows the owner and the collaborators (users\nwho have joined the album) to add comments to the album. Defaults to false."] + #[serde( + rename = "isCommentable", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub is_commentable: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for SharedAlbumOptions { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for SharedAlbumOptions { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct SimpleMediaItem { + #[doc = "File name with extension of the media item. This is shown to the user in\nGoogle Photos. The file name specified during the byte\nupload process is ignored if this field is set. The file name,\nincluding the file extension, shouldn't be more than 255 characters. This\nis an optional field."] + #[serde( + rename = "fileName", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub file_name: ::std::option::Option, + #[doc = "Token identifying the media bytes that have been uploaded to Google."] + #[serde( + rename = "uploadToken", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub upload_token: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for SimpleMediaItem { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for SimpleMediaItem { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Default, :: serde :: Deserialize, :: serde :: Serialize)] + pub struct Status { + #[doc = "The status code, which should be an enum value of google.rpc.Code."] + #[serde( + rename = "code", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub code: ::std::option::Option, + #[doc = "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use."] + #[serde( + rename = "details", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub details: + ::std::option::Option>>, + #[doc = "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client."] + #[serde( + rename = "message", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub message: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for Status { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Status { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct TextEnrichment { + #[doc = "Text for this enrichment item."] + #[serde( + rename = "text", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub text: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for TextEnrichment { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for TextEnrichment { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Copy, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct UnshareAlbumRequest {} + impl ::google_field_selector::FieldSelector for UnshareAlbumRequest { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for UnshareAlbumRequest { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, + Clone, + PartialEq, + Hash, + PartialOrd, + Ord, + Eq, + Copy, + Default, + :: serde :: Deserialize, + :: serde :: Serialize, + )] + pub struct UnshareAlbumResponse {} + impl ::google_field_selector::FieldSelector for UnshareAlbumResponse { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for UnshareAlbumResponse { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive( + Debug, Clone, PartialEq, PartialOrd, Default, :: serde :: Deserialize, :: serde :: Serialize, + )] + pub struct Video { + #[doc = "Brand of the camera with which the video was taken."] + #[serde( + rename = "cameraMake", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub camera_make: ::std::option::Option, + #[doc = "Model of the camera with which the video was taken."] + #[serde( + rename = "cameraModel", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub camera_model: ::std::option::Option, + #[doc = "Frame rate of the video."] + #[serde( + rename = "fps", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub fps: ::std::option::Option, + #[doc = "Processing status of the video."] + #[serde( + rename = "status", + default, + skip_serializing_if = "std::option::Option::is_none" + )] + pub status: ::std::option::Option, + } + impl ::google_field_selector::FieldSelector for Video { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Video { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Hash, PartialOrd, Ord, Eq, Copy)] + pub enum VideoStatus { + #[doc = "Something has gone wrong and the video has failed to process."] + Failed, + #[doc = "Video is being processed. The user sees an icon for this\nvideo in the Google Photos app; however, it isn't playable yet."] + Processing, + #[doc = "Video processing is complete and it is now ready for viewing."] + Ready, + #[doc = "Video processing status is unknown."] + Unspecified, + } + impl VideoStatus { + pub fn as_str(self) -> &'static str { + match self { + VideoStatus::Failed => "FAILED", + VideoStatus::Processing => "PROCESSING", + VideoStatus::Ready => "READY", + VideoStatus::Unspecified => "UNSPECIFIED", + } + } + } + impl ::std::convert::AsRef for VideoStatus { + fn as_ref(&self) -> &str { + self.as_str() + } + } + impl ::std::str::FromStr for VideoStatus { + type Err = (); + fn from_str(s: &str) -> ::std::result::Result { + Ok(match s { + "FAILED" => VideoStatus::Failed, + "PROCESSING" => VideoStatus::Processing, + "READY" => VideoStatus::Ready, + "UNSPECIFIED" => VideoStatus::Unspecified, + _ => return Err(()), + }) + } + } + impl ::std::fmt::Display for VideoStatus { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { + f.write_str(self.as_str()) + } + } + impl ::serde::Serialize for VideoStatus { + fn serialize(&self, serializer: S) -> ::std::result::Result + where + S: ::serde::ser::Serializer, + { + serializer.serialize_str(self.as_str()) + } + } + impl<'de> ::serde::Deserialize<'de> for VideoStatus { + fn deserialize(deserializer: D) -> ::std::result::Result + where + D: ::serde::de::Deserializer<'de>, + { + let value: &'de str = <&str>::deserialize(deserializer)?; + Ok(match value { + "FAILED" => VideoStatus::Failed, + "PROCESSING" => VideoStatus::Processing, + "READY" => VideoStatus::Ready, + "UNSPECIFIED" => VideoStatus::Unspecified, + _ => { + return Err(::serde::de::Error::custom(format!( + "invalid enum for #name: {}", + value + ))) + } + }) + } + } + impl ::google_field_selector::FieldSelector for VideoStatus { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for VideoStatus { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } +} +pub mod params { + #[derive(Debug, Clone, PartialEq, Hash, PartialOrd, Ord, Eq, Copy)] + pub enum Alt { + #[doc = "Responses with Content-Type of application/json"] + Json, + #[doc = "Media download with context-dependent Content-Type"] + Media, + #[doc = "Responses with Content-Type of application/x-protobuf"] + Proto, + } + impl Alt { + pub fn as_str(self) -> &'static str { + match self { + Alt::Json => "json", + Alt::Media => "media", + Alt::Proto => "proto", + } + } + } + impl ::std::convert::AsRef for Alt { + fn as_ref(&self) -> &str { + self.as_str() + } + } + impl ::std::str::FromStr for Alt { + type Err = (); + fn from_str(s: &str) -> ::std::result::Result { + Ok(match s { + "json" => Alt::Json, + "media" => Alt::Media, + "proto" => Alt::Proto, + _ => return Err(()), + }) + } + } + impl ::std::fmt::Display for Alt { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { + f.write_str(self.as_str()) + } + } + impl ::serde::Serialize for Alt { + fn serialize(&self, serializer: S) -> ::std::result::Result + where + S: ::serde::ser::Serializer, + { + serializer.serialize_str(self.as_str()) + } + } + impl<'de> ::serde::Deserialize<'de> for Alt { + fn deserialize(deserializer: D) -> ::std::result::Result + where + D: ::serde::de::Deserializer<'de>, + { + let value: &'de str = <&str>::deserialize(deserializer)?; + Ok(match value { + "json" => Alt::Json, + "media" => Alt::Media, + "proto" => Alt::Proto, + _ => { + return Err(::serde::de::Error::custom(format!( + "invalid enum for #name: {}", + value + ))) + } + }) + } + } + impl ::google_field_selector::FieldSelector for Alt { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Alt { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } + #[derive(Debug, Clone, PartialEq, Hash, PartialOrd, Ord, Eq, Copy)] + pub enum Xgafv { + #[doc = "v1 error format"] + _1, + #[doc = "v2 error format"] + _2, + } + impl Xgafv { + pub fn as_str(self) -> &'static str { + match self { + Xgafv::_1 => "1", + Xgafv::_2 => "2", + } + } + } + impl ::std::convert::AsRef for Xgafv { + fn as_ref(&self) -> &str { + self.as_str() + } + } + impl ::std::str::FromStr for Xgafv { + type Err = (); + fn from_str(s: &str) -> ::std::result::Result { + Ok(match s { + "1" => Xgafv::_1, + "2" => Xgafv::_2, + _ => return Err(()), + }) + } + } + impl ::std::fmt::Display for Xgafv { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result { + f.write_str(self.as_str()) + } + } + impl ::serde::Serialize for Xgafv { + fn serialize(&self, serializer: S) -> ::std::result::Result + where + S: ::serde::ser::Serializer, + { + serializer.serialize_str(self.as_str()) + } + } + impl<'de> ::serde::Deserialize<'de> for Xgafv { + fn deserialize(deserializer: D) -> ::std::result::Result + where + D: ::serde::de::Deserializer<'de>, + { + let value: &'de str = <&str>::deserialize(deserializer)?; + Ok(match value { + "1" => Xgafv::_1, + "2" => Xgafv::_2, + _ => { + return Err(::serde::de::Error::custom(format!( + "invalid enum for #name: {}", + value + ))) + } + }) + } + } + impl ::google_field_selector::FieldSelector for Xgafv { + fn fields() -> Vec<::google_field_selector::Field> { + Vec::new() + } + } + impl ::google_field_selector::ToFieldType for Xgafv { + fn field_type() -> ::google_field_selector::FieldType { + ::google_field_selector::FieldType::Leaf + } + } +} +pub struct Client { + reqwest: ::reqwest::Client, + auth: Box, +} +impl Client { + pub fn new(auth: A) -> Self + where + A: Into>, + { + Client::with_reqwest_client( + auth, + ::reqwest::Client::builder().timeout(None).build().unwrap(), + ) + } + pub fn with_reqwest_client(auth: A, reqwest: ::reqwest::Client) -> Self + where + A: Into>, + { + Client { + reqwest, + auth: auth.into(), + } + } + fn auth_ref(&self) -> &dyn ::google_api_auth::GetAccessToken { + self.auth.as_ref() + } + #[doc = "Actions that can be performed on the albums resource"] + pub fn albums(&self) -> crate::resources::albums::AlbumsActions { + crate::resources::albums::AlbumsActions { + reqwest: &self.reqwest, + auth: self.auth_ref(), + } + } + #[doc = "Actions that can be performed on the media_items resource"] + pub fn media_items(&self) -> crate::resources::media_items::MediaItemsActions { + crate::resources::media_items::MediaItemsActions { + reqwest: &self.reqwest, + auth: self.auth_ref(), + } + } + #[doc = "Actions that can be performed on the shared_albums resource"] + pub fn shared_albums(&self) -> crate::resources::shared_albums::SharedAlbumsActions { + crate::resources::shared_albums::SharedAlbumsActions { + reqwest: &self.reqwest, + auth: self.auth_ref(), + } + } +} +pub mod resources { + pub mod albums { + pub mod params {} + pub struct AlbumsActions<'a> { + pub(crate) reqwest: &'a reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + } + impl<'a> AlbumsActions<'a> { + fn auth_ref(&self) -> &dyn ::google_api_auth::GetAccessToken { + self.auth + } + #[doc = "Adds an enrichment at a specified position in a defined album."] + pub fn add_enrichment( + &self, + request: crate::schemas::AddEnrichmentToAlbumRequest, + album_id: impl Into, + ) -> AddEnrichmentRequestBuilder { + AddEnrichmentRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + album_id: album_id.into(), + } + } + #[doc = "Adds one or more media items in a user's Google Photos library to\nan album. The media items and albums must have been created by the\ndeveloper via the API.\n\nMedia items are added to the end of the album. If multiple media items are\ngiven, they are added in the order specified in this call.\n\nEach album can contain up to 20,000 media items.\n\nOnly media items that are in the user's library can be added to an\nalbum. For albums that are shared, the album must either be owned by the\nuser or the user must have joined the album as a collaborator.\n\nPartial success is not supported. The entire request will fail if an\ninvalid media item or album is specified."] + pub fn batch_add_media_items( + &self, + request: crate::schemas::BatchAddMediaItemsToAlbumRequest, + album_id: impl Into, + ) -> BatchAddMediaItemsRequestBuilder { + BatchAddMediaItemsRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + album_id: album_id.into(), + } + } + #[doc = "Removes one or more media items from a specified album. The media items and\nthe album must have been created by the developer via the API.\n\nFor albums that are shared, this action is only supported for media items\nthat were added to the album by this user, or for all media items if the\nalbum was created by this user.\n\nPartial success is not supported. The entire request will fail and no\naction will be performed on the album if an invalid media item or album is\nspecified."] + pub fn batch_remove_media_items( + &self, + request: crate::schemas::BatchRemoveMediaItemsFromAlbumRequest, + album_id: impl Into, + ) -> BatchRemoveMediaItemsRequestBuilder { + BatchRemoveMediaItemsRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + album_id: album_id.into(), + } + } + #[doc = "Creates an album in a user's Google Photos library."] + pub fn create( + &self, + request: crate::schemas::CreateAlbumRequest, + ) -> CreateRequestBuilder { + CreateRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + } + } + #[doc = "Returns the album based on the specified `albumId`.\nThe `albumId` must be the ID of an album owned by the user or a shared\nalbum that the user has joined."] + pub fn get(&self, album_id: impl Into) -> GetRequestBuilder { + GetRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + album_id: album_id.into(), + } + } + #[doc = "Lists all albums shown to a user in the Albums tab of the Google\nPhotos app."] + pub fn list(&self) -> ListRequestBuilder { + ListRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + exclude_non_app_created_data: None, + page_size: None, + page_token: None, + } + } + #[doc = "Marks an album as shared and accessible to other users. This action can\nonly be performed on albums which were created by the developer via the\nAPI."] + pub fn share( + &self, + request: crate::schemas::ShareAlbumRequest, + album_id: impl Into, + ) -> ShareRequestBuilder { + ShareRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + album_id: album_id.into(), + } + } + #[doc = "Marks a previously shared album as private. This means that the album is\nno longer shared and all the non-owners will lose access to the album. All\nnon-owner content will be removed from the album. If a non-owner has\npreviously added the album to their library, they will retain all photos in\ntheir library. This action can only be performed on albums which were\ncreated by the developer via the API."] + pub fn unshare( + &self, + request: crate::schemas::UnshareAlbumRequest, + album_id: impl Into, + ) -> UnshareRequestBuilder { + UnshareRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + album_id: album_id.into(), + } + } + } + #[doc = "Created via [AlbumsActions::add_enrichment()](struct.AlbumsActions.html#method.add_enrichment)"] + #[derive(Debug, Clone)] + pub struct AddEnrichmentRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::AddEnrichmentToAlbumRequest, + album_id: String, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> AddEnrichmentRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/albums/"); + { + let var_as_str = &self.album_id; + output.extend(::percent_encoding::utf8_percent_encode( + &var_as_str, + crate::RESERVED, + )); + } + output.push_str(":addEnrichment"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [AlbumsActions::batch_add_media_items()](struct.AlbumsActions.html#method.batch_add_media_items)"] + #[derive(Debug, Clone)] + pub struct BatchAddMediaItemsRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::BatchAddMediaItemsToAlbumRequest, + album_id: String, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> BatchAddMediaItemsRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result + { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result + { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/albums/"); + { + let var_as_str = &self.album_id; + output.extend(::percent_encoding::utf8_percent_encode( + &var_as_str, + crate::RESERVED, + )); + } + output.push_str(":batchAddMediaItems"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [AlbumsActions::batch_remove_media_items()](struct.AlbumsActions.html#method.batch_remove_media_items)"] + #[derive(Debug, Clone)] + pub struct BatchRemoveMediaItemsRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::BatchRemoveMediaItemsFromAlbumRequest, + album_id: String, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> BatchRemoveMediaItemsRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result + { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result + { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/albums/"); + { + let var_as_str = &self.album_id; + output.extend(::percent_encoding::utf8_percent_encode( + &var_as_str, + crate::RESERVED, + )); + } + output.push_str(":batchRemoveMediaItems"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [AlbumsActions::create()](struct.AlbumsActions.html#method.create)"] + #[derive(Debug, Clone)] + pub struct CreateRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::CreateAlbumRequest, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> CreateRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields(self) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/albums"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [AlbumsActions::get()](struct.AlbumsActions.html#method.get)"] + #[derive(Debug, Clone)] + pub struct GetRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + album_id: String, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> GetRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields(self) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/albums/"); + { + let var_as_str = &self.album_id; + output.extend(::percent_encoding::utf8_percent_encode( + &var_as_str, + crate::RESERVED, + )); + } + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::GET, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [AlbumsActions::list()](struct.AlbumsActions.html#method.list)"] + #[derive(Debug, Clone)] + pub struct ListRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + exclude_non_app_created_data: Option, + page_size: Option, + page_token: Option, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> ListRequestBuilder<'a> { + #[doc = "If set, the results exclude media items that were not created by this app.\nDefaults to false (all albums are returned). This field is ignored if the\nphotoslibrary.readonly.appcreateddata scope is used."] + pub fn exclude_non_app_created_data(mut self, value: bool) -> Self { + self.exclude_non_app_created_data = Some(value); + self + } + #[doc = "Maximum number of albums to return in the response. Fewer albums might be\nreturned than the specified number. The default `pageSize` is 20, the\nmaximum is 50."] + pub fn page_size(mut self, value: i32) -> Self { + self.page_size = Some(value); + self + } + #[doc = "A continuation token to get the next page of the results. Adding this to\nthe request returns the rows after the `pageToken`. The `pageToken` should\nbe the value returned in the `nextPageToken` parameter in the response to\nthe `listAlbums` request."] + pub fn page_token(mut self, value: impl Into) -> Self { + self.page_token = Some(value.into()); + self + } + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are chosen by the caller of this"] + #[doc = r" method and must implement `Deserialize` and `FieldSelector`. The"] + #[doc = r" populated fields in the yielded items will be determined by the"] + #[doc = r" `FieldSelector` implementation."] + pub fn iter_albums(self) -> crate::iter::PageItemIter + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.iter_albums_with_fields(fields) + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are `#items_type`. The populated"] + #[doc = r" fields in `#items_type` will be the default fields populated by"] + #[doc = r" the server."] + pub fn iter_albums_with_default_fields( + self, + ) -> crate::iter::PageItemIter { + self.iter_albums_with_fields(None::) + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are `#items_type`. The populated"] + #[doc = r" fields in `#items_type` will be all fields available. This should"] + #[doc = r" primarily be used during developement and debugging as fetching"] + #[doc = r" all fields can be expensive both in bandwidth and server"] + #[doc = r" resources."] + pub fn iter_albums_with_all_fields( + self, + ) -> crate::iter::PageItemIter { + self.iter_albums_with_fields(Some("*")) + } + pub fn iter_albums_with_fields( + mut self, + fields: Option, + ) -> crate::iter::PageItemIter + where + T: ::serde::de::DeserializeOwned, + F: AsRef, + { + self.fields = Some({ + let mut selector = concat!("nextPageToken,", "albums").to_owned(); + let items_fields = fields.as_ref().map(|x| x.as_ref()).unwrap_or(""); + if !items_fields.is_empty() { + selector.push_str("("); + selector.push_str(items_fields); + selector.push_str(")"); + } + selector + }); + crate::iter::PageItemIter::new(self, "albums") + } + pub fn iter(self) -> crate::iter::PageIter + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.iter_with_fields(fields) + } + pub fn iter_with_default_fields( + self, + ) -> crate::iter::PageIter { + self.iter_with_fields(None::<&str>) + } + pub fn iter_with_all_fields( + self, + ) -> crate::iter::PageIter { + self.iter_with_fields(Some("*")) + } + pub fn iter_with_fields( + mut self, + fields: Option, + ) -> crate::iter::PageIter + where + T: ::serde::de::DeserializeOwned, + F: AsRef, + { + let mut fields = fields.as_ref().map(|x| x.as_ref()).unwrap_or("").to_owned(); + if !fields.is_empty() { + match fields.chars().rev().nth(0) { + Some(',') | None => {} + _ => fields.push_str(","), + } + fields.push_str("nextPageToken"); + self.fields = Some(fields); + } + crate::iter::PageIter::new(self) + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/albums"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::GET, path); + let req = req.query(&[( + "excludeNonAppCreatedData", + &self.exclude_non_app_created_data, + )]); + let req = req.query(&[("pageSize", &self.page_size)]); + let req = req.query(&[("pageToken", &self.page_token)]); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + impl<'a> crate::iter::IterableMethod for ListRequestBuilder<'a> { + fn set_page_token(&mut self, value: String) { + self.page_token = value.into(); + } + fn execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + self._execute() + } + } + #[doc = "Created via [AlbumsActions::share()](struct.AlbumsActions.html#method.share)"] + #[derive(Debug, Clone)] + pub struct ShareRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::ShareAlbumRequest, + album_id: String, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> ShareRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/albums/"); + { + let var_as_str = &self.album_id; + output.extend(::percent_encoding::utf8_percent_encode( + &var_as_str, + crate::RESERVED, + )); + } + output.push_str(":share"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [AlbumsActions::unshare()](struct.AlbumsActions.html#method.unshare)"] + #[derive(Debug, Clone)] + pub struct UnshareRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::UnshareAlbumRequest, + album_id: String, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> UnshareRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/albums/"); + { + let var_as_str = &self.album_id; + output.extend(::percent_encoding::utf8_percent_encode( + &var_as_str, + crate::RESERVED, + )); + } + output.push_str(":unshare"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + } + pub mod media_items { + pub mod params {} + pub struct MediaItemsActions<'a> { + pub(crate) reqwest: &'a reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + } + impl<'a> MediaItemsActions<'a> { + fn auth_ref(&self) -> &dyn ::google_api_auth::GetAccessToken { + self.auth + } + #[doc = "Creates one or more media items in a user's Google Photos library.\n\nThis is the second step for creating a media item. For details regarding\nStep 1, uploading the raw bytes to a Google Server, see\nUploading media.\n\nThis call adds the media item to the library. If an album `id` is\nspecified, the call adds the media item to the album too. Each album can\ncontain up to 20,000 media items. By default, the media item will be added\nto the end of the library or album.\n\nIf an album `id` and position are both defined, the media item is\nadded to the album at the specified position.\n\nIf the call contains multiple media items, they're added at the specified\nposition.\nIf you are creating a media item in a shared album where you are not the\nowner, you are not allowed to position the media item. Doing so will result\nin a `BAD REQUEST` error."] + pub fn batch_create( + &self, + request: crate::schemas::BatchCreateMediaItemsRequest, + ) -> BatchCreateRequestBuilder { + BatchCreateRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + } + } + #[doc = "Returns the list of media items for the specified media item identifiers.\nItems are returned in the same order as the supplied identifiers."] + pub fn batch_get(&self) -> BatchGetRequestBuilder { + BatchGetRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + media_item_ids: None, + } + } + #[doc = "Returns the media item for the specified media item identifier."] + pub fn get(&self, media_item_id: impl Into) -> GetRequestBuilder { + GetRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + media_item_id: media_item_id.into(), + } + } + #[doc = "List all media items from a user's Google Photos library."] + pub fn list(&self) -> ListRequestBuilder { + ListRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + page_size: None, + page_token: None, + } + } + #[doc = "Searches for media items in a user's Google Photos library.\nIf no filters are set, then all media items in the user's library are\nreturned.\nIf an album is set, all media items in the specified album are returned.\nIf filters are specified, media items that match the filters from the\nuser's library are listed. If you set both the album and the filters, the\nrequest results in an error."] + pub fn search( + &self, + request: crate::schemas::SearchMediaItemsRequest, + ) -> SearchRequestBuilder { + SearchRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + } + } + } + #[doc = "Created via [MediaItemsActions::batch_create()](struct.MediaItemsActions.html#method.batch_create)"] + #[derive(Debug, Clone)] + pub struct BatchCreateRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::BatchCreateMediaItemsRequest, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> BatchCreateRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/mediaItems:batchCreate"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [MediaItemsActions::batch_get()](struct.MediaItemsActions.html#method.batch_get)"] + #[derive(Debug, Clone)] + pub struct BatchGetRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + media_item_ids: Option>, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> BatchGetRequestBuilder<'a> { + #[doc = "Identifiers of the media items to be requested.\nMust not contain repeated identifiers and cannot be empty. The maximum\nnumber of media items that can be retrieved in one call is 50."] + pub fn media_item_ids(mut self, value: impl Into>) -> Self { + self.media_item_ids = Some(value.into()); + self + } + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/mediaItems:batchGet"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::GET, path); + let req = req.query(&[("mediaItemIds", &self.media_item_ids)]); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [MediaItemsActions::get()](struct.MediaItemsActions.html#method.get)"] + #[derive(Debug, Clone)] + pub struct GetRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + media_item_id: String, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> GetRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/mediaItems/"); + { + let var_as_str = &self.media_item_id; + output.extend(::percent_encoding::utf8_percent_encode( + &var_as_str, + crate::RESERVED, + )); + } + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::GET, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [MediaItemsActions::list()](struct.MediaItemsActions.html#method.list)"] + #[derive(Debug, Clone)] + pub struct ListRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + page_size: Option, + page_token: Option, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> ListRequestBuilder<'a> { + #[doc = "Maximum number of media items to return in the response. Fewer media items\nmight be returned than the specified number. The default `pageSize` is 25,\nthe maximum is 100."] + pub fn page_size(mut self, value: i32) -> Self { + self.page_size = Some(value); + self + } + #[doc = "A continuation token to get the next page of the results. Adding this to\nthe request returns the rows after the `pageToken`. The `pageToken` should\nbe the value returned in the `nextPageToken` parameter in the response to\nthe `listMediaItems` request."] + pub fn page_token(mut self, value: impl Into) -> Self { + self.page_token = Some(value.into()); + self + } + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are chosen by the caller of this"] + #[doc = r" method and must implement `Deserialize` and `FieldSelector`. The"] + #[doc = r" populated fields in the yielded items will be determined by the"] + #[doc = r" `FieldSelector` implementation."] + pub fn iter_media_items(self) -> crate::iter::PageItemIter + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.iter_media_items_with_fields(fields) + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are `#items_type`. The populated"] + #[doc = r" fields in `#items_type` will be the default fields populated by"] + #[doc = r" the server."] + pub fn iter_media_items_with_default_fields( + self, + ) -> crate::iter::PageItemIter { + self.iter_media_items_with_fields(None::) + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are `#items_type`. The populated"] + #[doc = r" fields in `#items_type` will be all fields available. This should"] + #[doc = r" primarily be used during developement and debugging as fetching"] + #[doc = r" all fields can be expensive both in bandwidth and server"] + #[doc = r" resources."] + pub fn iter_media_items_with_all_fields( + self, + ) -> crate::iter::PageItemIter { + self.iter_media_items_with_fields(Some("*")) + } + pub fn iter_media_items_with_fields( + mut self, + fields: Option, + ) -> crate::iter::PageItemIter + where + T: ::serde::de::DeserializeOwned, + F: AsRef, + { + self.fields = Some({ + let mut selector = concat!("nextPageToken,", "mediaItems").to_owned(); + let items_fields = fields.as_ref().map(|x| x.as_ref()).unwrap_or(""); + if !items_fields.is_empty() { + selector.push_str("("); + selector.push_str(items_fields); + selector.push_str(")"); + } + selector + }); + crate::iter::PageItemIter::new(self, "mediaItems") + } + pub fn iter(self) -> crate::iter::PageIter + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.iter_with_fields(fields) + } + pub fn iter_with_default_fields( + self, + ) -> crate::iter::PageIter { + self.iter_with_fields(None::<&str>) + } + pub fn iter_with_all_fields( + self, + ) -> crate::iter::PageIter { + self.iter_with_fields(Some("*")) + } + pub fn iter_with_fields( + mut self, + fields: Option, + ) -> crate::iter::PageIter + where + T: ::serde::de::DeserializeOwned, + F: AsRef, + { + let mut fields = fields.as_ref().map(|x| x.as_ref()).unwrap_or("").to_owned(); + if !fields.is_empty() { + match fields.chars().rev().nth(0) { + Some(',') | None => {} + _ => fields.push_str(","), + } + fields.push_str("nextPageToken"); + self.fields = Some(fields); + } + crate::iter::PageIter::new(self) + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/mediaItems"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::GET, path); + let req = req.query(&[("pageSize", &self.page_size)]); + let req = req.query(&[("pageToken", &self.page_token)]); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + impl<'a> crate::iter::IterableMethod for ListRequestBuilder<'a> { + fn set_page_token(&mut self, value: String) { + self.page_token = value.into(); + } + fn execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + self._execute() + } + } + #[doc = "Created via [MediaItemsActions::search()](struct.MediaItemsActions.html#method.search)"] + #[derive(Debug, Clone)] + pub struct SearchRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::SearchMediaItemsRequest, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> SearchRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/mediaItems:search"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + } + pub mod shared_albums { + pub mod params {} + pub struct SharedAlbumsActions<'a> { + pub(crate) reqwest: &'a reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + } + impl<'a> SharedAlbumsActions<'a> { + fn auth_ref(&self) -> &dyn ::google_api_auth::GetAccessToken { + self.auth + } + #[doc = "Returns the album based on the specified `shareToken`."] + pub fn get(&self, share_token: impl Into) -> GetRequestBuilder { + GetRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + share_token: share_token.into(), + } + } + #[doc = "Joins a shared album on behalf of the Google Photos user."] + pub fn join( + &self, + request: crate::schemas::JoinSharedAlbumRequest, + ) -> JoinRequestBuilder { + JoinRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + } + } + #[doc = "Leaves a previously-joined shared album on behalf of the Google Photos\nuser. The user must not own this album."] + pub fn leave( + &self, + request: crate::schemas::LeaveSharedAlbumRequest, + ) -> LeaveRequestBuilder { + LeaveRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + request, + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + } + } + #[doc = "Lists all shared albums available in the Sharing tab of the\nuser's Google Photos app."] + pub fn list(&self) -> ListRequestBuilder { + ListRequestBuilder { + reqwest: &self.reqwest, + auth: self.auth_ref(), + access_token: None, + alt: None, + callback: None, + fields: None, + key: None, + oauth_token: None, + pretty_print: None, + quota_user: None, + upload_protocol: None, + upload_type: None, + xgafv: None, + exclude_non_app_created_data: None, + page_size: None, + page_token: None, + } + } + } + #[doc = "Created via [SharedAlbumsActions::get()](struct.SharedAlbumsActions.html#method.get)"] + #[derive(Debug, Clone)] + pub struct GetRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + share_token: String, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> GetRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields(self) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/sharedAlbums/"); + { + let var_as_str = &self.share_token; + output.extend(::percent_encoding::utf8_percent_encode( + &var_as_str, + crate::RESERVED, + )); + } + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::GET, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [SharedAlbumsActions::join()](struct.SharedAlbumsActions.html#method.join)"] + #[derive(Debug, Clone)] + pub struct JoinRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::JoinSharedAlbumRequest, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> JoinRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/sharedAlbums:join"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [SharedAlbumsActions::leave()](struct.SharedAlbumsActions.html#method.leave)"] + #[derive(Debug, Clone)] + pub struct LeaveRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + request: crate::schemas::LeaveSharedAlbumRequest, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> LeaveRequestBuilder<'a> { + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + let req = req.json(&self.request); + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/sharedAlbums:leave"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::POST, path); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + #[doc = "Created via [SharedAlbumsActions::list()](struct.SharedAlbumsActions.html#method.list)"] + #[derive(Debug, Clone)] + pub struct ListRequestBuilder<'a> { + pub(crate) reqwest: &'a ::reqwest::Client, + pub(crate) auth: &'a dyn ::google_api_auth::GetAccessToken, + exclude_non_app_created_data: Option, + page_size: Option, + page_token: Option, + access_token: Option, + alt: Option, + callback: Option, + fields: Option, + key: Option, + oauth_token: Option, + pretty_print: Option, + quota_user: Option, + upload_protocol: Option, + upload_type: Option, + xgafv: Option, + } + impl<'a> ListRequestBuilder<'a> { + #[doc = "If set, the results exclude media items that were not created by this app.\nDefaults to false (all albums are returned). This field is ignored if the\nphotoslibrary.readonly.appcreateddata scope is used."] + pub fn exclude_non_app_created_data(mut self, value: bool) -> Self { + self.exclude_non_app_created_data = Some(value); + self + } + #[doc = "Maximum number of albums to return in the response. Fewer albums might be\nreturned than the specified number. The default `pageSize` is 20, the\nmaximum is 50."] + pub fn page_size(mut self, value: i32) -> Self { + self.page_size = Some(value); + self + } + #[doc = "A continuation token to get the next page of the results. Adding this to\nthe request returns the rows after the `pageToken`. The `pageToken` should\nbe the value returned in the `nextPageToken` parameter in the response to\nthe `listSharedAlbums` request."] + pub fn page_token(mut self, value: impl Into) -> Self { + self.page_token = Some(value.into()); + self + } + #[doc = "OAuth access token."] + pub fn access_token(mut self, value: impl Into) -> Self { + self.access_token = Some(value.into()); + self + } + #[doc = "JSONP"] + pub fn callback(mut self, value: impl Into) -> Self { + self.callback = Some(value.into()); + self + } + #[doc = "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."] + pub fn key(mut self, value: impl Into) -> Self { + self.key = Some(value.into()); + self + } + #[doc = "OAuth 2.0 token for the current user."] + pub fn oauth_token(mut self, value: impl Into) -> Self { + self.oauth_token = Some(value.into()); + self + } + #[doc = "Returns response with indentations and line breaks."] + pub fn pretty_print(mut self, value: bool) -> Self { + self.pretty_print = Some(value); + self + } + #[doc = "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."] + pub fn quota_user(mut self, value: impl Into) -> Self { + self.quota_user = Some(value.into()); + self + } + #[doc = "Upload protocol for media (e.g. \"raw\", \"multipart\")."] + pub fn upload_protocol(mut self, value: impl Into) -> Self { + self.upload_protocol = Some(value.into()); + self + } + #[doc = "Legacy upload protocol for media (e.g. \"media\", \"multipart\")."] + pub fn upload_type(mut self, value: impl Into) -> Self { + self.upload_type = Some(value.into()); + self + } + #[doc = "V1 error format."] + pub fn xgafv(mut self, value: crate::params::Xgafv) -> Self { + self.xgafv = Some(value); + self + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are chosen by the caller of this"] + #[doc = r" method and must implement `Deserialize` and `FieldSelector`. The"] + #[doc = r" populated fields in the yielded items will be determined by the"] + #[doc = r" `FieldSelector` implementation."] + pub fn iter_shared_albums(self) -> crate::iter::PageItemIter + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.iter_shared_albums_with_fields(fields) + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are `#items_type`. The populated"] + #[doc = r" fields in `#items_type` will be the default fields populated by"] + #[doc = r" the server."] + pub fn iter_shared_albums_with_default_fields( + self, + ) -> crate::iter::PageItemIter { + self.iter_shared_albums_with_fields(None::) + } + #[doc = r" Return an iterator that iterates over all `#prop_ident`. The"] + #[doc = r" items yielded by the iterator are `#items_type`. The populated"] + #[doc = r" fields in `#items_type` will be all fields available. This should"] + #[doc = r" primarily be used during developement and debugging as fetching"] + #[doc = r" all fields can be expensive both in bandwidth and server"] + #[doc = r" resources."] + pub fn iter_shared_albums_with_all_fields( + self, + ) -> crate::iter::PageItemIter { + self.iter_shared_albums_with_fields(Some("*")) + } + pub fn iter_shared_albums_with_fields( + mut self, + fields: Option, + ) -> crate::iter::PageItemIter + where + T: ::serde::de::DeserializeOwned, + F: AsRef, + { + self.fields = Some({ + let mut selector = concat!("nextPageToken,", "sharedAlbums").to_owned(); + let items_fields = fields.as_ref().map(|x| x.as_ref()).unwrap_or(""); + if !items_fields.is_empty() { + selector.push_str("("); + selector.push_str(items_fields); + selector.push_str(")"); + } + selector + }); + crate::iter::PageItemIter::new(self, "sharedAlbums") + } + pub fn iter(self) -> crate::iter::PageIter + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.iter_with_fields(fields) + } + pub fn iter_with_default_fields( + self, + ) -> crate::iter::PageIter { + self.iter_with_fields(None::<&str>) + } + pub fn iter_with_all_fields( + self, + ) -> crate::iter::PageIter { + self.iter_with_fields(Some("*")) + } + pub fn iter_with_fields( + mut self, + fields: Option, + ) -> crate::iter::PageIter + where + T: ::serde::de::DeserializeOwned, + F: AsRef, + { + let mut fields = fields.as_ref().map(|x| x.as_ref()).unwrap_or("").to_owned(); + if !fields.is_empty() { + match fields.chars().rev().nth(0) { + Some(',') | None => {} + _ => fields.push_str(","), + } + fields.push_str("nextPageToken"); + self.fields = Some(fields); + } + crate::iter::PageIter::new(self) + } + #[doc = r" Execute the given operation. The fields requested are"] + #[doc = r" determined by the FieldSelector attribute of the return type."] + #[doc = r" This allows for flexible and ergonomic partial responses. See"] + #[doc = r" `execute_standard` and `execute_debug` for interfaces that"] + #[doc = r" are not generic over the return type and deserialize the"] + #[doc = r" response into an auto-generated struct will all possible"] + #[doc = r" fields."] + pub fn execute(self) -> Result + where + T: ::serde::de::DeserializeOwned + ::google_field_selector::FieldSelector, + { + let fields = ::google_field_selector::to_string::(); + let fields: Option = if fields.is_empty() { + None + } else { + Some(fields) + }; + self.execute_with_fields(fields) + } + #[doc = r" Execute the given operation. This will not provide any"] + #[doc = r" `fields` selector indicating that the server will determine"] + #[doc = r" the fields returned. This typically includes the most common"] + #[doc = r" fields, but it will not include every possible attribute of"] + #[doc = r" the response resource."] + pub fn execute_with_default_fields( + self, + ) -> Result { + self.execute_with_fields(None::<&str>) + } + #[doc = r" Execute the given operation. This will provide a `fields`"] + #[doc = r" selector of `*`. This will include every attribute of the"] + #[doc = r" response resource and should be limited to use during"] + #[doc = r" development or debugging."] + pub fn execute_with_all_fields( + self, + ) -> Result { + self.execute_with_fields(Some("*")) + } + #[doc = r" Execute the given operation. This will use the `fields`"] + #[doc = r" selector provided and will deserialize the response into"] + #[doc = r" whatever return value is provided."] + pub fn execute_with_fields(mut self, fields: Option) -> Result + where + T: ::serde::de::DeserializeOwned, + F: Into, + { + self.fields = fields.map(Into::into); + self._execute() + } + fn _execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + let req = self._request(&self._path())?; + Ok(crate::error_from_response(req.send()?)?.json()?) + } + fn _path(&self) -> String { + let mut output = "https://photoslibrary.googleapis.com/".to_owned(); + output.push_str("v1/sharedAlbums"); + output + } + fn _request(&self, path: &str) -> Result<::reqwest::RequestBuilder, crate::Error> { + let req = self.reqwest.request(::reqwest::Method::GET, path); + let req = req.query(&[( + "excludeNonAppCreatedData", + &self.exclude_non_app_created_data, + )]); + let req = req.query(&[("pageSize", &self.page_size)]); + let req = req.query(&[("pageToken", &self.page_token)]); + let req = req.query(&[("access_token", &self.access_token)]); + let req = req.query(&[("alt", &self.alt)]); + let req = req.query(&[("callback", &self.callback)]); + let req = req.query(&[("fields", &self.fields)]); + let req = req.query(&[("key", &self.key)]); + let req = req.query(&[("oauth_token", &self.oauth_token)]); + let req = req.query(&[("prettyPrint", &self.pretty_print)]); + let req = req.query(&[("quotaUser", &self.quota_user)]); + let req = req.query(&[("upload_protocol", &self.upload_protocol)]); + let req = req.query(&[("uploadType", &self.upload_type)]); + let req = req.query(&[("$.xgafv", &self.xgafv)]); + let req = req.bearer_auth( + self.auth + .access_token() + .map_err(|err| crate::Error::OAuth2(err))?, + ); + Ok(req) + } + } + impl<'a> crate::iter::IterableMethod for ListRequestBuilder<'a> { + fn set_page_token(&mut self, value: String) { + self.page_token = value.into(); + } + fn execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned, + { + self._execute() + } + } + } +} +#[derive(Debug)] +pub enum Error { + OAuth2(Box), + JSON(::serde_json::Error), + Reqwest { + reqwest_err: ::reqwest::Error, + body: Option, + }, + Other(Box), +} + +impl Error { + pub fn json_error(&self) -> Option<&::serde_json::Error> { + match self { + Error::OAuth2(_) => None, + Error::JSON(err) => Some(err), + Error::Reqwest { reqwest_err, .. } => reqwest_err + .get_ref() + .and_then(|err| err.downcast_ref::<::serde_json::Error>()), + Error::Other(_) => None, + } + } +} + +impl ::std::fmt::Display for Error { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + Error::OAuth2(err) => write!(f, "OAuth2 Error: {}", err), + Error::JSON(err) => write!(f, "JSON Error: {}", err), + Error::Reqwest { reqwest_err, body } => { + write!(f, "Reqwest Error: {}", reqwest_err)?; + if let Some(body) = body { + write!(f, ": {}", body)?; + } + Ok(()) + } + Error::Other(err) => write!(f, "Uknown Error: {}", err), + } + } +} + +impl ::std::error::Error for Error {} + +impl From<::serde_json::Error> for Error { + fn from(err: ::serde_json::Error) -> Error { + Error::JSON(err) + } +} + +impl From<::reqwest::Error> for Error { + fn from(reqwest_err: ::reqwest::Error) -> Error { + Error::Reqwest { + reqwest_err, + body: None, + } + } +} + +/// Check the response to see if the status code represents an error. If so +/// convert it into the Reqwest variant of Error. +fn error_from_response(mut response: ::reqwest::Response) -> Result<::reqwest::Response, Error> { + match response.error_for_status_ref() { + Err(reqwest_err) => { + let body = response.text().ok(); + Err(Error::Reqwest { reqwest_err, body }) + } + Ok(_) => Ok(response), + } +} +#[allow(dead_code)] +const SIMPLE: &::percent_encoding::AsciiSet = &::percent_encoding::NON_ALPHANUMERIC + .remove(b'-') + .remove(b'.') + .remove(b'_') + .remove(b'~'); + +#[allow(dead_code)] +const RESERVED: &::percent_encoding::AsciiSet = &SIMPLE + .remove(b'%') + .remove(b':') + .remove(b'/') + .remove(b'?') + .remove(b'#') + .remove(b'[') + .remove(b']') + .remove(b'@') + .remove(b'!') + .remove(b'$') + .remove(b'&') + .remove(b'\'') + .remove(b'(') + .remove(b')') + .remove(b'*') + .remove(b'+') + .remove(b',') + .remove(b';') + .remove(b'='); +#[allow(dead_code)] +mod multipart { + pub(crate) struct RelatedMultiPart { + parts: Vec, + boundary: String, + } + + impl RelatedMultiPart { + pub(crate) fn new() -> Self { + RelatedMultiPart { + parts: Vec::new(), + boundary: ::textnonce::TextNonce::sized(68).unwrap().0, + } + } + + pub(crate) fn new_part(&mut self, part: Part) { + self.parts.push(part); + } + + pub(crate) fn boundary(&self) -> &str { + &self.boundary + } + + pub(crate) fn into_reader(self) -> RelatedMultiPartReader { + let boundary_marker = boundary_marker(&self.boundary); + RelatedMultiPartReader { + state: RelatedMultiPartReaderState::WriteBoundary { + start: 0, + boundary: format!("{}\r\n", &boundary_marker), + }, + boundary: boundary_marker, + next_body: None, + parts: self.parts.into_iter(), + } + } + } + + pub(crate) struct Part { + content_type: ::mime::Mime, + body: Box, + } + + impl Part { + pub(crate) fn new( + content_type: ::mime::Mime, + body: Box, + ) -> Part { + Part { content_type, body } + } + } + + pub(crate) struct RelatedMultiPartReader { + state: RelatedMultiPartReaderState, + boundary: String, + next_body: Option>, + parts: std::vec::IntoIter, + } + + enum RelatedMultiPartReaderState { + WriteBoundary { + start: usize, + boundary: String, + }, + WriteContentType { + start: usize, + content_type: Vec, + }, + WriteBody { + body: Box, + }, + } + + impl ::std::io::Read for RelatedMultiPartReader { + fn read(&mut self, buf: &mut [u8]) -> ::std::io::Result { + use RelatedMultiPartReaderState::*; + let mut bytes_written: usize = 0; + loop { + let rem_buf = &mut buf[bytes_written..]; + match &mut self.state { + WriteBoundary { start, boundary } => { + let bytes_to_copy = std::cmp::min(boundary.len() - *start, rem_buf.len()); + rem_buf[..bytes_to_copy] + .copy_from_slice(&boundary.as_bytes()[*start..*start + bytes_to_copy]); + *start += bytes_to_copy; + bytes_written += bytes_to_copy; + if *start == boundary.len() { + let next_part = match self.parts.next() { + None => break, + Some(part) => part, + }; + self.next_body = Some(next_part.body); + self.state = WriteContentType { + start: 0, + content_type: format!( + "Content-Type: {}\r\n\r\n", + next_part.content_type + ) + .into_bytes(), + }; + } else { + break; + } + } + WriteContentType { + start, + content_type, + } => { + let bytes_to_copy = + std::cmp::min(content_type.len() - *start, rem_buf.len()); + rem_buf[..bytes_to_copy] + .copy_from_slice(&content_type[*start..*start + bytes_to_copy]); + *start += bytes_to_copy; + bytes_written += bytes_to_copy; + if *start == content_type.len() { + self.state = WriteBody { + body: self.next_body.take().unwrap(), + }; + } else { + break; + } + } + WriteBody { body } => { + let written = body.read(rem_buf)?; + bytes_written += written; + if written == 0 { + self.state = WriteBoundary { + start: 0, + boundary: format!("\r\n{}\r\n", &self.boundary), + }; + } else { + break; + } + } + } + } + Ok(bytes_written) + } + } + + fn boundary_marker(boundary: &str) -> String { + let mut marker = String::with_capacity(boundary.len() + 2); + marker.push_str("--"); + marker.push_str(boundary); + marker + } +} +// A serde helper module that can be used with the `with` attribute +// to deserialize any string to a FromStr type and serialize any +// Display type to a String. Google API's encode i64, u64 values as +// strings. +#[allow(dead_code)] +mod parsed_string { + pub fn serialize( + value: &Option, + serializer: S, + ) -> ::std::result::Result + where + T: ::std::fmt::Display, + S: ::serde::Serializer, + { + use ::serde::Serialize; + value.as_ref().map(|x| x.to_string()).serialize(serializer) + } + + pub fn deserialize<'de, T, D>(deserializer: D) -> ::std::result::Result, D::Error> + where + T: ::std::str::FromStr, + T::Err: ::std::fmt::Display, + D: ::serde::de::Deserializer<'de>, + { + use ::serde::Deserialize; + match Option::::deserialize(deserializer)? { + Some(x) => Ok(Some(x.parse().map_err(::serde::de::Error::custom)?)), + None => Ok(None), + } + } +} +pub mod iter { + pub trait IterableMethod { + fn set_page_token(&mut self, value: String); + fn execute(&mut self) -> Result + where + T: ::serde::de::DeserializeOwned; + } + + pub struct PageIter { + pub method: M, + pub finished: bool, + pub _phantom: ::std::marker::PhantomData, + } + + impl PageIter + where + M: IterableMethod, + T: ::serde::de::DeserializeOwned, + { + pub(crate) fn new(method: M) -> Self { + PageIter { + method, + finished: false, + _phantom: ::std::marker::PhantomData, + } + } + } + + impl Iterator for PageIter + where + M: IterableMethod, + T: ::serde::de::DeserializeOwned, + { + type Item = Result; + + fn next(&mut self) -> Option> { + if self.finished { + return None; + } + let paginated_result: ::serde_json::Map = + match self.method.execute() { + Ok(r) => r, + Err(err) => return Some(Err(err)), + }; + if let Some(next_page_token) = paginated_result + .get("nextPageToken") + .and_then(|t| t.as_str()) + { + self.method.set_page_token(next_page_token.to_owned()); + } else { + self.finished = true; + } + + Some( + match ::serde_json::from_value(::serde_json::Value::Object(paginated_result)) { + Ok(resp) => Ok(resp), + Err(err) => Err(err.into()), + }, + ) + } + } + + pub struct PageItemIter { + items_field: &'static str, + page_iter: PageIter>, + items: ::std::vec::IntoIter, + } + + impl PageItemIter + where + M: IterableMethod, + T: ::serde::de::DeserializeOwned, + { + pub(crate) fn new(method: M, items_field: &'static str) -> Self { + PageItemIter { + items_field, + page_iter: PageIter::new(method), + items: Vec::new().into_iter(), + } + } + } + + impl Iterator for PageItemIter + where + M: IterableMethod, + T: ::serde::de::DeserializeOwned, + { + type Item = Result; + + fn next(&mut self) -> Option> { + loop { + if let Some(v) = self.items.next() { + return Some(Ok(v)); + } + + let next_page = self.page_iter.next(); + match next_page { + None => return None, + Some(Err(err)) => return Some(Err(err)), + Some(Ok(next_page)) => { + let mut next_page: ::serde_json::Map = + next_page; + let items_array = match next_page.remove(self.items_field) { + Some(items) => items, + None => { + return Some(Err(crate::Error::Other( + format!("no {} field found in iter response", self.items_field) + .into(), + ))) + } + }; + let items_vec: Result, _> = ::serde_json::from_value(items_array); + match items_vec { + Ok(items) => self.items = items.into_iter(), + Err(err) => return Some(Err(err.into())), + } + } + } + } + } + } +}