diff --git a/etc/api/adexchangeseller/v1.1/adexchangeseller-api.json b/etc/api/adexchangeseller/v1.1/adexchangeseller-api.json index edbac7fac1..cc1b470e0c 100644 --- a/etc/api/adexchangeseller/v1.1/adexchangeseller-api.json +++ b/etc/api/adexchangeseller/v1.1/adexchangeseller-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/LJI9qShCZjBHg072lrR-8ZdwqHs\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/aZqXglKYhHRY6tGe90wBk2vmheM\"", "discoveryVersion": "v1", "id": "adexchangeseller:v1.1", "name": "adexchangeseller", "canonicalName": "Ad Exchange Seller", "version": "v1.1", - "revision": "20150225", + "revision": "20150313", "title": "Ad Exchange Seller API", "description": "Gives Ad Exchange seller users access to their inventory and the ability to generate reports", "ownerDomain": "google.com", diff --git a/etc/api/adexchangeseller/v1/adexchangeseller-api.json b/etc/api/adexchangeseller/v1/adexchangeseller-api.json index 45dd198bf2..8a5529410c 100644 --- a/etc/api/adexchangeseller/v1/adexchangeseller-api.json +++ b/etc/api/adexchangeseller/v1/adexchangeseller-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/Udv6xd2CTeF5gBc5RK-Xrdwi5BU\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/gjjXjsHj8UTCjwoWB0KNSdU5LXw\"", "discoveryVersion": "v1", "id": "adexchangeseller:v1", "name": "adexchangeseller", "canonicalName": "Ad Exchange Seller", "version": "v1", - "revision": "20150225", + "revision": "20150313", "title": "Ad Exchange Seller API", "description": "Gives Ad Exchange seller users access to their inventory and the ability to generate reports", "ownerDomain": "google.com", diff --git a/etc/api/adexchangeseller/v2.0/adexchangeseller-api.json b/etc/api/adexchangeseller/v2.0/adexchangeseller-api.json index cbd6f172e4..e47f556439 100644 --- a/etc/api/adexchangeseller/v2.0/adexchangeseller-api.json +++ b/etc/api/adexchangeseller/v2.0/adexchangeseller-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/-2ppmthl020S47FH8VO33hbOboc\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/eWJUNKoCWvcmB-gqHTIWg1zs684\"", "discoveryVersion": "v1", "id": "adexchangeseller:v2.0", "name": "adexchangeseller", "canonicalName": "Ad Exchange Seller", "version": "v2.0", - "revision": "20150225", + "revision": "20150313", "title": "Ad Exchange Seller API", "description": "Gives Ad Exchange seller users access to their inventory and the ability to generate reports", "ownerDomain": "google.com", diff --git a/etc/api/adsense/v1.2/adsense-api.json b/etc/api/adsense/v1.2/adsense-api.json index f68c5437d0..9d86a93e03 100644 --- a/etc/api/adsense/v1.2/adsense-api.json +++ b/etc/api/adsense/v1.2/adsense-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/qR09Xr4WyuppZd0FxNauFU4HZEY\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/_i2OsA9ICnxLuGp5SQSlE-RCl-A\"", "discoveryVersion": "v1", "id": "adsense:v1.2", "name": "adsense", "canonicalName": "AdSense", "version": "v1.2", - "revision": "20150126", + "revision": "20150312", "title": "AdSense Management API", "description": "Gives AdSense publishers access to their inventory and the ability to generate reports", "ownerDomain": "google.com", diff --git a/etc/api/adsense/v1.3/adsense-api.json b/etc/api/adsense/v1.3/adsense-api.json index da6c83d023..22857d36f0 100644 --- a/etc/api/adsense/v1.3/adsense-api.json +++ b/etc/api/adsense/v1.3/adsense-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/QLzYLvfST0FjKuQb6H8Y9VPJgoE\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/Y1tUkFc0QQNBtKHfd75UEcFQizo\"", "discoveryVersion": "v1", "id": "adsense:v1.3", "name": "adsense", "canonicalName": "AdSense", "version": "v1.3", - "revision": "20150126", + "revision": "20150312", "title": "AdSense Management API", "description": "Gives AdSense publishers access to their inventory and the ability to generate reports", "ownerDomain": "google.com", diff --git a/etc/api/adsense/v1.4/adsense-api.json b/etc/api/adsense/v1.4/adsense-api.json index c3acb67dd4..27420c6010 100644 --- a/etc/api/adsense/v1.4/adsense-api.json +++ b/etc/api/adsense/v1.4/adsense-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/GwVBOvnObENRnA8st3Br2OCaQxE\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/WPPN58Hu3NNElRYylPbHwGhmbWg\"", "discoveryVersion": "v1", "id": "adsense:v1.4", "name": "adsense", "canonicalName": "AdSense", "version": "v1.4", - "revision": "20150126", + "revision": "20150312", "title": "AdSense Management API", "description": "Gives AdSense publishers access to their inventory and the ability to generate reports", "ownerDomain": "google.com", diff --git a/etc/api/adsensehost/v4.1/adsensehost-api.json b/etc/api/adsensehost/v4.1/adsensehost-api.json index 6e45505941..72ad85279e 100644 --- a/etc/api/adsensehost/v4.1/adsensehost-api.json +++ b/etc/api/adsensehost/v4.1/adsensehost-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/Ot75-sAq1Vj9vLc-q6gHNxVJqjQ\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/VI6vr1MPx9avVWB1RXoHKqps2IQ\"", "discoveryVersion": "v1", "id": "adsensehost:v4.1", "name": "adsensehost", "canonicalName": "AdSense Host", "version": "v4.1", - "revision": "20150118", + "revision": "20150302", "title": "AdSense Host API", "description": "Gives AdSense Hosts access to report generation, ad code generation, and publisher management capabilities.", "ownerDomain": "google.com", diff --git a/etc/api/analytics/v2.4/analytics-api.json b/etc/api/analytics/v2.4/analytics-api.json index b8f0186b2c..7bd47810d8 100644 --- a/etc/api/analytics/v2.4/analytics-api.json +++ b/etc/api/analytics/v2.4/analytics-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/RcOjYGQDsg144Y5EM1meYl_XNYw\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/IldvChjq6UkiEW0nig_gOjP89aY\"", "discoveryVersion": "v1", "id": "analytics:v2.4", "name": "analytics", "version": "v2.4", - "revision": "20141118", + "revision": "20150308", "title": "Google Analytics API", "description": "View and manage your Google Analytics data", "ownerDomain": "google.com", diff --git a/etc/api/analytics/v3/analytics-api.json b/etc/api/analytics/v3/analytics-api.json index 1abb61e406..47a70936b0 100644 --- a/etc/api/analytics/v3/analytics-api.json +++ b/etc/api/analytics/v3/analytics-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/aw3TpXPEnqSVSodmCVhPn55WgQk\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/6NlFUYEBMf81bxiwpXwPhu5e1RQ\"", "discoveryVersion": "v1", "id": "analytics:v3", "name": "analytics", "version": "v3", - "revision": "20141118", + "revision": "20150308", "title": "Google Analytics API", "description": "View and manage your Google Analytics data", "ownerDomain": "google.com", diff --git a/etc/api/bigquery/v2/bigquery-api.json b/etc/api/bigquery/v2/bigquery-api.json index 3da6591a4c..d32c8a1011 100644 --- a/etc/api/bigquery/v2/bigquery-api.json +++ b/etc/api/bigquery/v2/bigquery-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/MCWK2CQLEDojVXJw1b4YdNiAmeY\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/QxG7oirHrzfDxJoQseQwOqPzaG0\"", "discoveryVersion": "v1", "id": "bigquery:v2", "name": "bigquery", "version": "v2", - "revision": "20150309", + "revision": "20141112", "title": "BigQuery API", "description": "A data platform for customers to create, manage, share and query data.", "ownerDomain": "google.com", @@ -1071,6 +1071,10 @@ "id": "TableDataInsertAllRequest", "type": "object", "properties": { + "ignoreUnknownValues": { + "type": "boolean", + "description": "[Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors." + }, "kind": { "type": "string", "description": "The resource type of the response.", @@ -1092,6 +1096,10 @@ } } } + }, + "skipInvalidRows": { + "type": "boolean", + "description": "[Optional] Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist." } } }, diff --git a/etc/api/books/v1/books-api.json b/etc/api/books/v1/books-api.json index 8f105fc9a4..3ccd50121d 100644 --- a/etc/api/books/v1/books-api.json +++ b/etc/api/books/v1/books-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/kNB4QIeM_hYb1gDtvlVUUPro4uQ\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/7vCHfrhi9Lj_cY5xxg_5Db6xPtw\"", "discoveryVersion": "v1", "id": "books:v1", "name": "books", "version": "v1", - "revision": "20150115", + "revision": "20150309", "title": "Books API", "description": "Lets you search for books and manage your Google Books library.", "ownerDomain": "google.com", @@ -2817,34 +2817,6 @@ "https://www.googleapis.com/auth/books" ] }, - "get": { - "id": "books.mylibrary.annotations.get", - "path": "mylibrary/annotations/{annotationId}", - "httpMethod": "GET", - "description": "Gets an annotation by its ID.", - "parameters": { - "annotationId": { - "type": "string", - "description": "The ID for the annotation to retrieve.", - "required": true, - "location": "path" - }, - "source": { - "type": "string", - "description": "String to identify the originator of this request.", - "location": "query" - } - }, - "parameterOrder": [ - "annotationId" - ], - "response": { - "$ref": "Annotation" - }, - "scopes": [ - "https://www.googleapis.com/auth/books" - ] - }, "insert": { "id": "books.mylibrary.annotations.insert", "path": "mylibrary/annotations", @@ -2907,12 +2879,6 @@ "maximum": "40", "location": "query" }, - "pageIds": { - "type": "string", - "description": "The page ID(s) for the volume that is being queried.", - "repeated": true, - "location": "query" - }, "pageToken": { "type": "string", "description": "The value of the nextToken from the previous page.", diff --git a/etc/api/calendar/v3/calendar-api.json b/etc/api/calendar/v3/calendar-api.json index a5bedbe9b4..425fe07526 100644 --- a/etc/api/calendar/v3/calendar-api.json +++ b/etc/api/calendar/v3/calendar-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/43YyX2L2OP2AOVrWhgb-fE2Qsgk\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/chLcvyYPKZ3ZS_IQi224D9BXunY\"", "discoveryVersion": "v1", "id": "calendar:v3", "name": "calendar", "version": "v3", - "revision": "20150118", + "revision": "20141123", "title": "Calendar API", "description": "Lets you manipulate events and other calendar data.", "ownerDomain": "google.com", diff --git a/etc/api/compute/v1/compute-api.json b/etc/api/compute/v1/compute-api.json index d71ae53f02..7f4d58e79f 100644 --- a/etc/api/compute/v1/compute-api.json +++ b/etc/api/compute/v1/compute-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/kwpiRqjQBcnxhE5-xYxQ0kF3ilA\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/O_5j_7aKimaeibrW3NmYraO3Ajs\"", "discoveryVersion": "v1", "id": "compute:v1", "name": "compute", "version": "v1", - "revision": "20150303", + "revision": "20150302", "title": "Compute Engine API", "description": "API for the Google Compute Engine service.", "ownerDomain": "google.com", @@ -803,11 +803,11 @@ "properties": { "destinationZone": { "type": "string", - "description": "The URL of the zone to which the disk will be moved." + "description": "The URL of the destination zone to move the disk to. This can be a full or partial URL. For example, the following are all valid URLs to a zone: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone \n- projects/project/zones/zone \n- zones/zone" }, "targetDisk": { "type": "string", - "description": "The URL of the target disk to be moved." + "description": "The URL of the target disk to move. This can be a full or partial URL. For example, the following are all valid URLs to a disk: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone/disks/disk \n- projects/project/zones/zone/disks/disk \n- zones/zone/disks/disk" } } }, @@ -1880,11 +1880,11 @@ "properties": { "destinationZone": { "type": "string", - "description": "The URL of the zone to move the instance to." + "description": "The URL of the destination zone to move the instance to. This can be a full or partial URL. For example, the following are all valid URLs to a zone: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone \n- projects/project/zones/zone \n- zones/zone" }, "targetInstance": { "type": "string", - "description": "The URL of the target instance to move." + "description": "The URL of the target instance to move. This can be a full or partial URL. For example, the following are all valid URLs to an instance: \n- https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/instance \n- projects/project/zones/zone/instances/instance \n- zones/zone/instances/instance" } } }, @@ -2948,20 +2948,14 @@ "enum": [ "BACKEND_SERVICES", "CPUS", - "DISKS", "DISKS_TOTAL_GB", - "EPHEMERAL_ADDRESSES", "FIREWALLS", "FORWARDING_RULES", "HEALTH_CHECKS", "IMAGES", - "IMAGES_TOTAL_GB", "IN_USE_ADDRESSES", - "KERNELS", - "KERNELS_TOTAL_GB", "LOCAL_SSD_TOTAL_GB", "NETWORKS", - "OPERATIONS", "ROUTES", "SNAPSHOTS", "SSD_TOTAL_GB", @@ -2989,12 +2983,6 @@ "", "", "", - "", - "", - "", - "", - "", - "", "" ] }, @@ -5030,6 +5018,7 @@ "id": "compute.disks.createSnapshot", "path": "{project}/zones/{zone}/disks/{disk}/createSnapshot", "httpMethod": "POST", + "description": "Creates a snapshot of this disk.", "parameters": { "disk": { "type": "string", diff --git a/etc/api/deploymentmanager/v2beta1/deploymentmanager-api.json b/etc/api/deploymentmanager/v2beta1/deploymentmanager-api.json index 866b5568cb..d0b277fbec 100644 --- a/etc/api/deploymentmanager/v2beta1/deploymentmanager-api.json +++ b/etc/api/deploymentmanager/v2beta1/deploymentmanager-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/ruh8vDKnI53dg6K4wnCZiPZpScI\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/aHn3JVvIgem2cQ4taTnQ3LnIpWc\"", "discoveryVersion": "v1", "id": "deploymentmanager:v2beta1", "name": "deploymentmanager", "version": "v2beta1", - "revision": "20150210", + "revision": "20141215", "title": "Google Cloud Deployment Manager API V2", "description": "The Deployment Manager API allows users to declaratively configure, deploy and run complex solutions on the Google Cloud Platform.", "ownerDomain": "google.com", diff --git a/etc/api/genomics/v1beta2/genomics-api.json b/etc/api/genomics/v1beta2/genomics-api.json index 5571e2526d..7ccf6f2ddc 100644 --- a/etc/api/genomics/v1beta2/genomics-api.json +++ b/etc/api/genomics/v1beta2/genomics-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/uftxkEqaj-t-6C93huW22geUJjs\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/Avr5yLDEaSyBxOoYvm8FoDAE8-g\"", "discoveryVersion": "v1", "id": "genomics:v1beta2", "name": "genomics", "version": "v1beta2", - "revision": "20150307", + "revision": "20150303", "title": "Genomics API", "description": "Provides access to Genomics data.", "ownerDomain": "google.com", @@ -552,7 +552,7 @@ "properties": { "exportUri": { "type": "string", - "description": "A Google Cloud Storage URI where the exported BAM file will be created. The currently authenticated user must have write access to the new file location. An error will be returned if the URI already contains data." + "description": "A Google Cloud Storage URI for the exported BAM file. The currently authenticated user must have write access to the new file. An error will be returned if the URI already contains data." }, "projectNumber": { "type": "string", @@ -1484,7 +1484,7 @@ }, "description": { "type": "string", - "description": "free text description of this reference set." + "description": "Free text description of this reference set." }, "id": { "type": "string", @@ -1765,7 +1765,7 @@ }, "pageSize": { "type": "integer", - "description": "Specifies number of results to return in a single page. If unspecified, it will default to 128. The maximum value is 1024.", + "description": "Specifies number of results to return in a single page. If unspecified, it will default to 256. The maximum value is 1024.", "format": "int32" }, "pageToken": { @@ -2856,12 +2856,11 @@ "id": "genomics.datasets.list", "path": "datasets", "httpMethod": "GET", - "description": "Lists all datasets.", + "description": "Lists datasets within a project.", "parameters": { "pageSize": { "type": "integer", - "description": "The maximum number of results returned by this request.", - "default": "50", + "description": "The maximum number of results returned by this request. If unspecified, defaults to 50.", "format": "int32", "location": "query" }, @@ -3241,7 +3240,6 @@ "pageSize": { "type": "integer", "description": "The maximum number of results to return in a single page. If unspecified, defaults to 1024. The maximum value is 2048.", - "default": "1024", "format": "int32", "location": "query" }, diff --git a/etc/api/gmail/v1/gmail-api.json b/etc/api/gmail/v1/gmail-api.json index 789248bdaa..be0cc18516 100644 --- a/etc/api/gmail/v1/gmail-api.json +++ b/etc/api/gmail/v1/gmail-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/u55VLYY4MP7i0aXvJvy-8Bykhic\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/5025FW69eRcOdd_mm4_PTDhGzHE\"", "discoveryVersion": "v1", "id": "gmail:v1", "name": "gmail", "version": "v1", - "revision": "20150303", + "revision": "20150313", "title": "Gmail API", "description": "The Gmail REST API.", "ownerDomain": "google.com", @@ -1333,6 +1333,12 @@ "httpMethod": "POST", "description": "Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.", "parameters": { + "deleted": { + "type": "boolean", + "description": "Mark the email as permanently deleted (not TRASH) and only visible in Google Apps Vault to a Vault administrator. Only used for Google Apps for Work accounts.", + "default": "false", + "location": "query" + }, "internalDateSource": { "type": "string", "description": "Source for Gmail's internal date of the message.", diff --git a/etc/api/groupsmigration/v1/groupsmigration-api.json b/etc/api/groupsmigration/v1/groupsmigration-api.json index 98f76ca60a..0b6a2daaba 100644 --- a/etc/api/groupsmigration/v1/groupsmigration-api.json +++ b/etc/api/groupsmigration/v1/groupsmigration-api.json @@ -1,6 +1,6 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/uMvgRqCygYBIh2d3lXb4f8cUWOw\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/8sBrpk7dyPsmoiW1fArUb0ZoCGY\"", "discoveryVersion": "v1", "id": "groupsmigration:v1", "name": "groupsmigration", @@ -67,6 +67,15 @@ "location": "query" } }, + "auth": { + "oauth2": { + "scopes": { + "https://www.googleapis.com/auth/apps.groups.migration": { + "description": "Manage messages in groups on your domain" + } + } + } + }, "schemas": { "Groups": { "id": "Groups", @@ -107,6 +116,9 @@ "response": { "$ref": "Groups" }, + "scopes": [ + "https://www.googleapis.com/auth/apps.groups.migration" + ], "supportsMediaUpload": true, "mediaUpload": { "accept": [ diff --git a/etc/api/plus/v1/plus-api.json b/etc/api/plus/v1/plus-api.json index a20a485006..a8ef170480 100644 --- a/etc/api/plus/v1/plus-api.json +++ b/etc/api/plus/v1/plus-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/q8dY4UIVNRcK1B68dybhQ1dBwWc\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/ORNICSF2Z1YjV7yMXdU4V945lGo\"", "discoveryVersion": "v1", "id": "plus:v1", "name": "plus", "version": "v1", - "revision": "20150122", + "revision": "20150303", "title": "Google+ API", "description": "The Google+ API enables developers to build on top of the Google+ platform.", "ownerDomain": "google.com", diff --git a/etc/api/plusdomains/v1/plusdomains-api.json b/etc/api/plusdomains/v1/plusdomains-api.json index 4bb265a610..e9aee4fda5 100644 --- a/etc/api/plusdomains/v1/plusdomains-api.json +++ b/etc/api/plusdomains/v1/plusdomains-api.json @@ -1,11 +1,11 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/D2Y34Y6W4h84dfzmMIBIqWNmCLk\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/pzJb3bipFURG3pTFQAI_x_KdTEY\"", "discoveryVersion": "v1", "id": "plusDomains:v1", "name": "plusDomains", "version": "v1", - "revision": "20150122", + "revision": "20150303", "title": "Google+ Domains API", "description": "The Google+ API enables developers to build on top of the Google+ platform.", "ownerDomain": "google.com", diff --git a/etc/api/youtubeanalytics/v1/youtubeanalytics-api.json b/etc/api/youtubeanalytics/v1/youtubeanalytics-api.json index dc29e59a51..5913f52b1e 100644 --- a/etc/api/youtubeanalytics/v1/youtubeanalytics-api.json +++ b/etc/api/youtubeanalytics/v1/youtubeanalytics-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/Zoj2QNc62Iq34KyKgNb23b-JnD8\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/lfXuvexGjLWvv2bGYOX_MVmrKM4\"", "discoveryVersion": "v1", "id": "youtubeAnalytics:v1", "name": "youtubeAnalytics", "canonicalName": "YouTube Analytics", "version": "v1", - "revision": "20150227", + "revision": "20150304", "title": "YouTube Analytics API", "description": "Retrieve your YouTube Analytics reports.", "ownerDomain": "google.com", @@ -638,6 +638,12 @@ "httpMethod": "GET", "description": "Retrieve your YouTube Analytics reports.", "parameters": { + "currency": { + "type": "string", + "description": "The currency to which financial metrics should be converted. The default is US Dollar (USD). If the result contains no financial metrics, this flag will be ignored. Responds with an error if the specified currency is not recognized.", + "pattern": "[A-Z]{3}", + "location": "query" + }, "dimensions": { "type": "string", "description": "A comma-separated list of YouTube Analytics dimensions, such as views or ageGroup,gender. See the Available Reports document for a list of the reports that you can retrieve and the dimensions used for those reports. Also see the Dimensions document for definitions of those dimensions.", diff --git a/etc/api/youtubeanalytics/v1beta1/youtubeanalytics-api.json b/etc/api/youtubeanalytics/v1beta1/youtubeanalytics-api.json index 8d32a159a4..e79008b7f8 100644 --- a/etc/api/youtubeanalytics/v1beta1/youtubeanalytics-api.json +++ b/etc/api/youtubeanalytics/v1beta1/youtubeanalytics-api.json @@ -1,12 +1,12 @@ { "kind": "discovery#restDescription", - "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/OA1845UIyhDx4Pbq_uwDYxxJabA\"", + "etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/ID2nf7n7eRyIPf4mFz5QF1inEVE\"", "discoveryVersion": "v1", "id": "youtubeAnalytics:v1beta1", "name": "youtubeAnalytics", "canonicalName": "YouTube Analytics", "version": "v1beta1", - "revision": "20150227", + "revision": "20150304", "title": "YouTube Analytics API", "description": "Retrieve your YouTube Analytics reports.", "ownerDomain": "google.com", @@ -641,6 +641,12 @@ "httpMethod": "GET", "description": "Retrieve your YouTube Analytics reports.", "parameters": { + "currency": { + "type": "string", + "description": "The currency to which financial metrics should be converted. The default is US Dollar (USD). If the result contains no financial metrics, this flag will be ignored. Responds with an error if the specified currency is not recognized.", + "pattern": "[A-Z]{3}", + "location": "query" + }, "dimensions": { "type": "string", "description": "A comma-separated list of YouTube Analytics dimensions, such as views or ageGroup,gender. See the Available Reports document for a list of the reports that you can retrieve and the dimensions used for those reports. Also see the Dimensions document for definitions of those dimensions.", diff --git a/gen/youtube3/README.md b/gen/youtube3/README.md index 308e340716..03e625157a 100644 --- a/gen/youtube3/README.md +++ b/gen/youtube3/README.md @@ -76,7 +76,7 @@ To use this library, you would put the following lines into your `Cargo.toml` fi ```toml [dependencies] -youtube3 = "0.0.1" +google-youtube3 = "0.0.1" ``` ## A complete example @@ -85,7 +85,7 @@ youtube3 = "0.0.1" extern crate hyper; extern crate "yup-oauth2" as oauth2; extern crate "rustc-serialize" as rustc_serialize; -extern crate youtube3; +extern crate "google-youtube3" as youtube3; use youtube3::cmn::Result; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; diff --git a/gen/youtube3/cargo.toml b/gen/youtube3/cargo.toml index a7ad7073c3..2207e17468 100644 --- a/gen/youtube3/cargo.toml +++ b/gen/youtube3/cargo.toml @@ -3,7 +3,7 @@ # DO NOT EDIT ! [package] -name = "youtube3" +name = "google-youtube3" version = "0.0.1" authors = ["Sebastian Thiel "] description = "A complete library to interact with YouTube (protocol v3)" diff --git a/gen/youtube3/src/cmn.rs b/gen/youtube3/src/cmn.rs index feab536b86..ebc983fd4f 100644 --- a/gen/youtube3/src/cmn.rs +++ b/gen/youtube3/src/cmn.rs @@ -2,7 +2,6 @@ // DO NOT EDIT use std::marker::MarkerTrait; use std::io::{self, Read, Seek, Cursor, Write, SeekFrom}; -use std::default::Default; use mime::{Mime, TopLevel, SubLevel, Attr, Value}; use oauth2; @@ -186,22 +185,28 @@ impl<'a> MultiPartReader<'a> { impl<'a> Read for MultiPartReader<'a> { fn read(&mut self, buf: &mut [u8]) -> io::Result { - if self.last_part_boundary.is_some() { - let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); - if br < buf.len() { - self.last_part_boundary = None; + match (self.raw_parts.len(), + self.current_part.is_none(), + self.last_part_boundary.is_none()) { + (_, _, false) => { + let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0); + if br < buf.len() { + self.last_part_boundary = None; + } + return Ok(br) + }, + (0, true, true) => return Ok(0), + (n, true, _) if n > 0 => { + let (headers, reader) = self.raw_parts.remove(0); + let mut c = Cursor::new(Vec::::new()); + write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, + headers, LINE_ENDING).unwrap(); + c.seek(SeekFrom::Start(0)).unwrap(); + self.current_part = Some((c, reader)); } - return Ok(br) - } else if self.is_depleted() { - return Ok(0) - } else if self.raw_parts.len() > 0 && self.current_part.is_none() { - let (headers, reader) = self.raw_parts.remove(0); - let mut c = Cursor::new(Vec::::new()); - write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING, - headers, LINE_ENDING).unwrap(); - c.seek(SeekFrom::Start(0)).unwrap(); - self.current_part = Some((c, reader)); + _ => {}, } + // read headers as long as possible let (hb, rr) = { let &mut (ref mut c, ref mut reader) = self.current_part.as_mut().unwrap(); diff --git a/gen/youtube3/src/lib.rs b/gen/youtube3/src/lib.rs index b42f8c8546..fa16feacb7 100644 --- a/gen/youtube3/src/lib.rs +++ b/gen/youtube3/src/lib.rs @@ -77,7 +77,7 @@ //! //! ```toml //! [dependencies] -//! youtube3 = "0.0.1" +//! google-youtube3 = "0.0.1" //! ``` //! //! ## A complete example @@ -86,7 +86,7 @@ //! extern crate hyper; //! extern crate "yup-oauth2" as oauth2; //! extern crate "rustc-serialize" as rustc_serialize; -//! extern crate youtube3; +//! extern crate "google-youtube3" as youtube3; //! use youtube3::cmn::Result; //! # #[test] fn egal() { //! use std::default::Default; @@ -263,7 +263,7 @@ impl Default for Scope { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// use youtube3::cmn::Result; /// # #[test] fn egal() { /// use std::default::Default; @@ -308,6 +308,7 @@ impl Default for Scope { pub struct YouTube { client: RefCell, auth: RefCell, + _user_agent: String, _m: PhantomData } @@ -321,6 +322,7 @@ impl<'a, C, NC, A> YouTube YouTube { client: RefCell::new(client), auth: RefCell::new(authenticator), + _user_agent: "google-api-rust-client/0.0.1".to_string(), _m: PhantomData } } @@ -376,6 +378,16 @@ impl<'a, C, NC, A> YouTube pub fn watermarks(&'a self) -> WatermarkMethodsBuilder<'a, C, NC, A> { WatermarkMethodsBuilder { hub: &self } } + + /// Set the user-agent header field to use in all requests to the server. + /// It defaults to `google-api-rust-client/0.0.1`. + /// + /// Returns the previously set user-agent. + pub fn user_agent(&mut self, agent_name: String) -> String { + let prev = self._user_agent.clone(); + self._user_agent = agent_name; + prev + } } @@ -5122,7 +5134,7 @@ impl ChannelContentDetailsRelatedPlaylists { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5178,7 +5190,7 @@ impl<'a, C, NC, A> I18nLanguageMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5238,7 +5250,7 @@ impl<'a, C, NC, A> ChannelBannerMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5342,7 +5354,7 @@ impl<'a, C, NC, A> ChannelSectionMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5400,7 +5412,7 @@ impl<'a, C, NC, A> GuideCategoryMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5507,7 +5519,7 @@ impl<'a, C, NC, A> PlaylistMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5563,7 +5575,7 @@ impl<'a, C, NC, A> ThumbnailMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5705,7 +5717,7 @@ impl<'a, C, NC, A> VideoMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5797,7 +5809,7 @@ impl<'a, C, NC, A> SubscriptionMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5881,7 +5893,7 @@ impl<'a, C, NC, A> SearchMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -5937,7 +5949,7 @@ impl<'a, C, NC, A> I18nRegionMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -6045,7 +6057,7 @@ impl<'a, C, NC, A> LiveStreamMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -6124,7 +6136,7 @@ impl<'a, C, NC, A> ChannelMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -6227,7 +6239,7 @@ impl<'a, C, NC, A> PlaylistItemMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -6298,7 +6310,7 @@ impl<'a, C, NC, A> WatermarkMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -6460,7 +6472,7 @@ impl<'a, C, NC, A> LiveBroadcastMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -6518,7 +6530,7 @@ impl<'a, C, NC, A> VideoCategoryMethodsBuilder<'a, C, NC, A> { /// extern crate hyper; /// extern crate "yup-oauth2" as oauth2; /// extern crate "rustc-serialize" as rustc_serialize; -/// extern crate youtube3; +/// extern crate "google-youtube3" as youtube3; /// /// # #[test] fn egal() { /// use std::default::Default; @@ -6619,7 +6631,7 @@ impl<'a, C, NC, A> ActivityMethodsBuilder<'a, C, NC, A> { /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -6658,10 +6670,8 @@ impl<'a, C, NC, A> I18nLanguageListMethodBuilder<'a, C, NC, A> where NC: hyper:: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, I18nLanguageListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._hl { params.push(("hl", value.to_string())); @@ -6675,6 +6685,8 @@ impl<'a, C, NC, A> I18nLanguageListMethodBuilder<'a, C, NC, A> where NC: hyper:: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/i18nLanguages".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -6696,10 +6708,10 @@ impl<'a, C, NC, A> I18nLanguageListMethodBuilder<'a, C, NC, A> where NC: hyper:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -6730,9 +6742,11 @@ impl<'a, C, NC, A> I18nLanguageListMethodBuilder<'a, C, NC, A> where NC: hyper:: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -6833,7 +6847,7 @@ impl<'a, C, NC, A> I18nLanguageListMethodBuilder<'a, C, NC, A> where NC: hyper:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::ChannelBannerResource; /// use std::fs; /// # #[test] fn egal() { @@ -6856,7 +6870,7 @@ impl<'a, C, NC, A> I18nLanguageListMethodBuilder<'a, C, NC, A> where NC: hyper:: /// // Values shown here are possibly random and not representative ! /// let result = hub.channel_banners().insert(&req) /// .on_behalf_of_content_owner("ipsum") -/// .upload(fs::File::open("file.ext").unwrap(), 282, "application/octet-stream".parse().unwrap()); +/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); /// # } /// ``` pub struct ChannelBannerInsertMethodBuilder<'a, C, NC, A> @@ -6876,13 +6890,11 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype /// Perform the operation you have build so far. - fn doit(mut self, mut stream: Option<(R, u64, mime::Mime)>, mut resumeable_stream: Option<(RS, u64, mime::Mime)>) -> cmn::Result<(hyper::client::Response, ChannelBannerResource)> where R: ReadSeek, RS: ReadSeek { + fn doit(mut self, mut stream: Option<(RS, mime::Mime)>, mut resumeable_stream: Option<(RS, mime::Mime)>) -> cmn::Result<(hyper::client::Response, ChannelBannerResource)> where RS: ReadSeek { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); } @@ -6895,6 +6907,8 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let (mut url, protocol) = if stream.is_some() { ("https://www.googleapis.com/upload/youtube/v3/channelBanners/insert".to_string(), "simple") } else if resumeable_stream.is_some() { @@ -6913,8 +6927,10 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -6925,15 +6941,15 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); - let mut request_value_reader = io::Cursor::new(json_encoded_request.clone().into_bytes()); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut mp_reader: cmn::MultiPartReader = Default::default(); let (mut body_reader, content_type) = match stream.as_mut() { - Some(&mut (ref mut reader, size, ref mime)) => { + Some(&mut (ref mut reader, ref mime)) => { mp_reader.reserve_exact(2); - let rsize = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - mp_reader.add_part(&mut request_value_reader, rsize, json_mime_type.clone()) + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) .add_part(reader, size, mime.clone()); let mime_type = mp_reader.mime_type(); (&mut mp_reader as &mut io::Read, ContentType(mime_type)) @@ -6942,7 +6958,7 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype }; let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(content_type) .body(body_reader.into_body()); @@ -6975,9 +6991,11 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -6990,9 +7008,9 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype /// * *max size*: 6MB /// * *multipart*: yes /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload(self, stream: R, size: u64, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, ChannelBannerResource)> - where R: ReadSeek { - self.doit(Some((stream, size, mime_type)), None::<(fs::File, u64, mime::Mime)>, ) + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, ChannelBannerResource)> + where RS: ReadSeek { + self.doit(Some((stream, mime_type)), None, ) } /// Upload media in a resumeable fashion. /// Even if the upload fails or is interrupted, it can be resumed for a @@ -7003,9 +7021,9 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype /// * *max size*: 6MB /// * *multipart*: yes /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload_resumable(self, resumeable_stream: RS, size: u64, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, ChannelBannerResource)> + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, ChannelBannerResource)> where RS: ReadSeek { - self.doit(None::<(fs::File, u64, mime::Mime)>, Some((resumeable_stream, size, mime_type)), ) + self.doit(None, Some((resumeable_stream, mime_type)), ) } /// Sets the *request* property to the given value. @@ -7108,7 +7126,7 @@ impl<'a, C, NC, A> ChannelBannerInsertMethodBuilder<'a, C, NC, A> where NC: hype /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -7153,10 +7171,8 @@ impl<'a, C, NC, A> ChannelSectionListMethodBuilder<'a, C, NC, A> where NC: hyper pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, ChannelSectionListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((7 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); @@ -7179,6 +7195,8 @@ impl<'a, C, NC, A> ChannelSectionListMethodBuilder<'a, C, NC, A> where NC: hyper params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/channelSections".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -7200,10 +7218,10 @@ impl<'a, C, NC, A> ChannelSectionListMethodBuilder<'a, C, NC, A> where NC: hyper if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -7234,9 +7252,11 @@ impl<'a, C, NC, A> ChannelSectionListMethodBuilder<'a, C, NC, A> where NC: hyper } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -7375,7 +7395,7 @@ impl<'a, C, NC, A> ChannelSectionListMethodBuilder<'a, C, NC, A> where NC: hyper /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::ChannelSection; /// # #[test] fn egal() { /// # use std::default::Default; @@ -7425,10 +7445,8 @@ impl<'a, C, NC, A> ChannelSectionInsertMethodBuilder<'a, C, NC, A> where NC: hyp pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, ChannelSection)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((6 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -7448,6 +7466,8 @@ impl<'a, C, NC, A> ChannelSectionInsertMethodBuilder<'a, C, NC, A> where NC: hyp params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/channelSections".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -7459,8 +7479,10 @@ impl<'a, C, NC, A> ChannelSectionInsertMethodBuilder<'a, C, NC, A> where NC: hyp url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -7471,14 +7493,15 @@ impl<'a, C, NC, A> ChannelSectionInsertMethodBuilder<'a, C, NC, A> where NC: hyp if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.channelSections.insert"), @@ -7508,9 +7531,11 @@ impl<'a, C, NC, A> ChannelSectionInsertMethodBuilder<'a, C, NC, A> where NC: hyp } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -7640,7 +7665,7 @@ impl<'a, C, NC, A> ChannelSectionInsertMethodBuilder<'a, C, NC, A> where NC: hyp /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -7679,9 +7704,8 @@ impl<'a, C, NC, A> ChannelSectionDeleteMethodBuilder<'a, C, NC, A> where NC: hyp pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((3 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); @@ -7695,6 +7719,7 @@ impl<'a, C, NC, A> ChannelSectionDeleteMethodBuilder<'a, C, NC, A> where NC: hyp params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/channelSections".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -7716,10 +7741,10 @@ impl<'a, C, NC, A> ChannelSectionDeleteMethodBuilder<'a, C, NC, A> where NC: hyp if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("DELETE".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -7857,7 +7882,7 @@ impl<'a, C, NC, A> ChannelSectionDeleteMethodBuilder<'a, C, NC, A> where NC: hyp /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::ChannelSection; /// # #[test] fn egal() { /// # use std::default::Default; @@ -7905,10 +7930,8 @@ impl<'a, C, NC, A> ChannelSectionUpdateMethodBuilder<'a, C, NC, A> where NC: hyp pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, ChannelSection)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((5 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -7925,6 +7948,8 @@ impl<'a, C, NC, A> ChannelSectionUpdateMethodBuilder<'a, C, NC, A> where NC: hyp params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/channelSections".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -7936,8 +7961,10 @@ impl<'a, C, NC, A> ChannelSectionUpdateMethodBuilder<'a, C, NC, A> where NC: hyp url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -7948,14 +7975,15 @@ impl<'a, C, NC, A> ChannelSectionUpdateMethodBuilder<'a, C, NC, A> where NC: hyp if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("PUT".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.channelSections.update"), @@ -7985,9 +8013,11 @@ impl<'a, C, NC, A> ChannelSectionUpdateMethodBuilder<'a, C, NC, A> where NC: hyp } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -8119,7 +8149,7 @@ impl<'a, C, NC, A> ChannelSectionUpdateMethodBuilder<'a, C, NC, A> where NC: hyp /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -8162,10 +8192,8 @@ impl<'a, C, NC, A> GuideCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, GuideCategoryListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((6 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._region_code { params.push(("regionCode", value.to_string())); @@ -8185,6 +8213,8 @@ impl<'a, C, NC, A> GuideCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/guideCategories".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -8206,10 +8236,10 @@ impl<'a, C, NC, A> GuideCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -8240,9 +8270,11 @@ impl<'a, C, NC, A> GuideCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -8370,7 +8402,7 @@ impl<'a, C, NC, A> GuideCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::Playlist; /// # #[test] fn egal() { /// # use std::default::Default; @@ -8420,10 +8452,8 @@ impl<'a, C, NC, A> PlaylistInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, Playlist)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((6 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -8443,6 +8473,8 @@ impl<'a, C, NC, A> PlaylistInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/playlists".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -8454,8 +8486,10 @@ impl<'a, C, NC, A> PlaylistInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -8466,14 +8500,15 @@ impl<'a, C, NC, A> PlaylistInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.playlists.insert"), @@ -8503,9 +8538,11 @@ impl<'a, C, NC, A> PlaylistInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -8651,7 +8688,7 @@ impl<'a, C, NC, A> PlaylistInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -8702,10 +8739,8 @@ impl<'a, C, NC, A> PlaylistListMethodBuilder<'a, C, NC, A> where NC: hyper::net: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, PlaylistListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((10 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -8737,6 +8772,8 @@ impl<'a, C, NC, A> PlaylistListMethodBuilder<'a, C, NC, A> where NC: hyper::net: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/playlists".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -8758,10 +8795,10 @@ impl<'a, C, NC, A> PlaylistListMethodBuilder<'a, C, NC, A> where NC: hyper::net: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -8792,9 +8829,11 @@ impl<'a, C, NC, A> PlaylistListMethodBuilder<'a, C, NC, A> where NC: hyper::net: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -8949,7 +8988,7 @@ impl<'a, C, NC, A> PlaylistListMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -8988,9 +9027,8 @@ impl<'a, C, NC, A> PlaylistDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::ne pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((3 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); @@ -9004,6 +9042,7 @@ impl<'a, C, NC, A> PlaylistDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::ne params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/playlists".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -9025,10 +9064,10 @@ impl<'a, C, NC, A> PlaylistDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("DELETE".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -9166,7 +9205,7 @@ impl<'a, C, NC, A> PlaylistDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::Playlist; /// # #[test] fn egal() { /// # use std::default::Default; @@ -9214,10 +9253,8 @@ impl<'a, C, NC, A> PlaylistUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::ne pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, Playlist)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((5 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -9234,6 +9271,8 @@ impl<'a, C, NC, A> PlaylistUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::ne params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/playlists".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -9245,8 +9284,10 @@ impl<'a, C, NC, A> PlaylistUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::ne url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -9257,14 +9298,15 @@ impl<'a, C, NC, A> PlaylistUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("PUT".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.playlists.update"), @@ -9294,9 +9336,11 @@ impl<'a, C, NC, A> PlaylistUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::ne } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -9416,7 +9460,7 @@ impl<'a, C, NC, A> PlaylistUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use std::fs; /// # #[test] fn egal() { /// # use std::default::Default; @@ -9433,7 +9477,7 @@ impl<'a, C, NC, A> PlaylistUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// // Values shown here are possibly random and not representative ! /// let result = hub.thumbnails().set("videoId") /// .on_behalf_of_content_owner("amet") -/// .upload(fs::File::open("file.ext").unwrap(), 282, "application/octet-stream".parse().unwrap()); +/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); /// # } /// ``` pub struct ThumbnailSetMethodBuilder<'a, C, NC, A> @@ -9453,13 +9497,11 @@ impl<'a, C, NC, A> ThumbnailSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// Perform the operation you have build so far. - fn doit(mut self, mut stream: Option<(R, u64, mime::Mime)>, mut resumeable_stream: Option<(RS, u64, mime::Mime)>) -> cmn::Result<(hyper::client::Response, ThumbnailSetResponse)> where R: ReadSeek, RS: ReadSeek { + fn doit(mut self, mut stream: Option<(RS, mime::Mime)>, mut resumeable_stream: Option<(RS, mime::Mime)>) -> cmn::Result<(hyper::client::Response, ThumbnailSetResponse)> where RS: ReadSeek { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("videoId", self._video_id.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); @@ -9473,6 +9515,8 @@ impl<'a, C, NC, A> ThumbnailSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let (mut url, protocol) = if stream.is_some() { ("https://www.googleapis.com/upload/youtube/v3/thumbnails/set".to_string(), "simple") } else if resumeable_stream.is_some() { @@ -9501,12 +9545,14 @@ impl<'a, C, NC, A> ThumbnailSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); - if let Some(&mut (ref mut reader, size, ref mime)) = stream.as_mut() { + if let Some(&mut (ref mut reader, ref mime)) = stream.as_mut() { + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); req = req.header(ContentType(mime.clone())) .header(ContentLength(size)) .body(reader.into_body()); @@ -9540,9 +9586,11 @@ impl<'a, C, NC, A> ThumbnailSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -9555,9 +9603,9 @@ impl<'a, C, NC, A> ThumbnailSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// * *max size*: 2MB /// * *multipart*: yes /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload(self, stream: R, size: u64, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, ThumbnailSetResponse)> - where R: ReadSeek { - self.doit(Some((stream, size, mime_type)), None::<(fs::File, u64, mime::Mime)>, ) + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, ThumbnailSetResponse)> + where RS: ReadSeek { + self.doit(Some((stream, mime_type)), None, ) } /// Upload media in a resumeable fashion. /// Even if the upload fails or is interrupted, it can be resumed for a @@ -9568,9 +9616,9 @@ impl<'a, C, NC, A> ThumbnailSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// * *max size*: 2MB /// * *multipart*: yes /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload_resumable(self, resumeable_stream: RS, size: u64, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, ThumbnailSetResponse)> + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, ThumbnailSetResponse)> where RS: ReadSeek { - self.doit(None::<(fs::File, u64, mime::Mime)>, Some((resumeable_stream, size, mime_type)), ) + self.doit(None, Some((resumeable_stream, mime_type)), ) } /// Sets the *video id* query property to the given value. @@ -9682,7 +9730,7 @@ impl<'a, C, NC, A> ThumbnailSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -9739,10 +9787,8 @@ impl<'a, C, NC, A> VideoListMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, VideoListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((13 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._video_category_id { params.push(("videoCategoryId", value.to_string())); @@ -9783,6 +9829,8 @@ impl<'a, C, NC, A> VideoListMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/videos".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -9804,10 +9852,10 @@ impl<'a, C, NC, A> VideoListMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -9838,9 +9886,11 @@ impl<'a, C, NC, A> VideoListMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -10028,7 +10078,7 @@ impl<'a, C, NC, A> VideoListMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -10068,9 +10118,8 @@ impl<'a, C, NC, A> VideoRateMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); params.push(("rating", self._rating.to_string())); if let Some(value) = self._on_behalf_of_content_owner { @@ -10085,6 +10134,7 @@ impl<'a, C, NC, A> VideoRateMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/videos/rate".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -10106,10 +10156,10 @@ impl<'a, C, NC, A> VideoRateMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -10244,7 +10294,7 @@ impl<'a, C, NC, A> VideoRateMethodBuilder<'a, C, NC, A> where NC: hyper::net::Ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -10283,10 +10333,8 @@ impl<'a, C, NC, A> VideoGetRatingMethodBuilder<'a, C, NC, A> where NC: hyper::ne pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, VideoGetRatingResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); @@ -10300,6 +10348,8 @@ impl<'a, C, NC, A> VideoGetRatingMethodBuilder<'a, C, NC, A> where NC: hyper::ne params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/videos/getRating".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -10321,10 +10371,10 @@ impl<'a, C, NC, A> VideoGetRatingMethodBuilder<'a, C, NC, A> where NC: hyper::ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -10355,9 +10405,11 @@ impl<'a, C, NC, A> VideoGetRatingMethodBuilder<'a, C, NC, A> where NC: hyper::ne } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -10451,7 +10503,7 @@ impl<'a, C, NC, A> VideoGetRatingMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -10490,9 +10542,8 @@ impl<'a, C, NC, A> VideoDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::net:: pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((3 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("id", self._id.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); @@ -10506,6 +10557,7 @@ impl<'a, C, NC, A> VideoDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::net:: params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/videos".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -10527,10 +10579,10 @@ impl<'a, C, NC, A> VideoDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::net:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("DELETE".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -10678,7 +10730,7 @@ impl<'a, C, NC, A> VideoDeleteMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::Video; /// # #[test] fn egal() { /// # use std::default::Default; @@ -10736,10 +10788,8 @@ impl<'a, C, NC, A> VideoUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net:: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, Video)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((5 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -10756,6 +10806,8 @@ impl<'a, C, NC, A> VideoUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net:: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/videos".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -10767,8 +10819,10 @@ impl<'a, C, NC, A> VideoUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net:: url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -10779,14 +10833,15 @@ impl<'a, C, NC, A> VideoUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("PUT".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.videos.update"), @@ -10816,9 +10871,11 @@ impl<'a, C, NC, A> VideoUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net:: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -10984,7 +11041,7 @@ impl<'a, C, NC, A> VideoUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::Video; /// use std::fs; /// # #[test] fn egal() { @@ -11023,7 +11080,7 @@ impl<'a, C, NC, A> VideoUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// .on_behalf_of_content_owner("vero") /// .notify_subscribers(false) /// .auto_levels(false) -/// .upload_resumable(fs::File::open("file.ext").unwrap(), 282, "application/octet-stream".parse().unwrap()); +/// .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); /// # } /// ``` pub struct VideoInsertMethodBuilder<'a, C, NC, A> @@ -11048,13 +11105,11 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// Perform the operation you have build so far. - fn doit(mut self, mut stream: Option<(R, u64, mime::Mime)>, mut resumeable_stream: Option<(RS, u64, mime::Mime)>) -> cmn::Result<(hyper::client::Response, Video)> where R: ReadSeek, RS: ReadSeek { + fn doit(mut self, mut stream: Option<(RS, mime::Mime)>, mut resumeable_stream: Option<(RS, mime::Mime)>) -> cmn::Result<(hyper::client::Response, Video)> where RS: ReadSeek { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((9 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -11083,6 +11138,8 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let (mut url, protocol) = if stream.is_some() { ("https://www.googleapis.com/upload/youtube/v3/videos".to_string(), "simple") } else if resumeable_stream.is_some() { @@ -11101,8 +11158,10 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -11113,15 +11172,15 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); - let mut request_value_reader = io::Cursor::new(json_encoded_request.clone().into_bytes()); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut mp_reader: cmn::MultiPartReader = Default::default(); let (mut body_reader, content_type) = match stream.as_mut() { - Some(&mut (ref mut reader, size, ref mime)) => { + Some(&mut (ref mut reader, ref mime)) => { mp_reader.reserve_exact(2); - let rsize = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - mp_reader.add_part(&mut request_value_reader, rsize, json_mime_type.clone()) + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) .add_part(reader, size, mime.clone()); let mime_type = mp_reader.mime_type(); (&mut mp_reader as &mut io::Read, ContentType(mime_type)) @@ -11130,7 +11189,7 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: }; let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(content_type) .body(body_reader.into_body()); @@ -11163,9 +11222,11 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -11178,9 +11239,9 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// * *max size*: 64GB /// * *multipart*: yes /// * *valid mime types*: 'application/octet-stream' and 'video/*' - pub fn upload(self, stream: R, size: u64, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, Video)> - where R: ReadSeek { - self.doit(Some((stream, size, mime_type)), None::<(fs::File, u64, mime::Mime)>, ) + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, Video)> + where RS: ReadSeek { + self.doit(Some((stream, mime_type)), None, ) } /// Upload media in a resumeable fashion. /// Even if the upload fails or is interrupted, it can be resumed for a @@ -11191,9 +11252,9 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// * *max size*: 64GB /// * *multipart*: yes /// * *valid mime types*: 'application/octet-stream' and 'video/*' - pub fn upload_resumable(self, resumeable_stream: RS, size: u64, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, Video)> + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> cmn::Result<(hyper::client::Response, Video)> where RS: ReadSeek { - self.doit(None::<(fs::File, u64, mime::Mime)>, Some((resumeable_stream, size, mime_type)), ) + self.doit(None, Some((resumeable_stream, mime_type)), ) } /// Sets the *request* property to the given value. @@ -11375,7 +11436,7 @@ impl<'a, C, NC, A> VideoInsertMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::Subscription; /// # #[test] fn egal() { /// # use std::default::Default; @@ -11421,10 +11482,8 @@ impl<'a, C, NC, A> SubscriptionInsertMethodBuilder<'a, C, NC, A> where NC: hyper pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, Subscription)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -11438,6 +11497,8 @@ impl<'a, C, NC, A> SubscriptionInsertMethodBuilder<'a, C, NC, A> where NC: hyper params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/subscriptions".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -11449,8 +11510,10 @@ impl<'a, C, NC, A> SubscriptionInsertMethodBuilder<'a, C, NC, A> where NC: hyper url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -11461,14 +11524,15 @@ impl<'a, C, NC, A> SubscriptionInsertMethodBuilder<'a, C, NC, A> where NC: hyper if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.subscriptions.insert"), @@ -11498,9 +11562,11 @@ impl<'a, C, NC, A> SubscriptionInsertMethodBuilder<'a, C, NC, A> where NC: hyper } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -11623,7 +11689,7 @@ impl<'a, C, NC, A> SubscriptionInsertMethodBuilder<'a, C, NC, A> where NC: hyper /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -11680,10 +11746,8 @@ impl<'a, C, NC, A> SubscriptionListMethodBuilder<'a, C, NC, A> where NC: hyper:: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, SubscriptionListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((13 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((13 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -11724,6 +11788,8 @@ impl<'a, C, NC, A> SubscriptionListMethodBuilder<'a, C, NC, A> where NC: hyper:: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/subscriptions".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -11745,10 +11811,10 @@ impl<'a, C, NC, A> SubscriptionListMethodBuilder<'a, C, NC, A> where NC: hyper:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -11779,9 +11845,11 @@ impl<'a, C, NC, A> SubscriptionListMethodBuilder<'a, C, NC, A> where NC: hyper:: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -11959,7 +12027,7 @@ impl<'a, C, NC, A> SubscriptionListMethodBuilder<'a, C, NC, A> where NC: hyper:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -11996,9 +12064,8 @@ impl<'a, C, NC, A> SubscriptionDeleteMethodBuilder<'a, C, NC, A> where NC: hyper pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((2 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); for &field in ["id"].iter() { if self._additional_params.contains_key(field) { @@ -12009,6 +12076,7 @@ impl<'a, C, NC, A> SubscriptionDeleteMethodBuilder<'a, C, NC, A> where NC: hyper params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/subscriptions".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -12030,10 +12098,10 @@ impl<'a, C, NC, A> SubscriptionDeleteMethodBuilder<'a, C, NC, A> where NC: hyper if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("DELETE".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -12162,7 +12230,7 @@ impl<'a, C, NC, A> SubscriptionDeleteMethodBuilder<'a, C, NC, A> where NC: hyper /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -12257,10 +12325,8 @@ impl<'a, C, NC, A> SearchListMethodBuilder<'a, C, NC, A> where NC: hyper::net::N pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, SearchListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((32 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((32 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._video_type { params.push(("videoType", value.to_string())); @@ -12358,6 +12424,8 @@ impl<'a, C, NC, A> SearchListMethodBuilder<'a, C, NC, A> where NC: hyper::net::N params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/search".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -12379,10 +12447,10 @@ impl<'a, C, NC, A> SearchListMethodBuilder<'a, C, NC, A> where NC: hyper::net::N if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -12413,9 +12481,11 @@ impl<'a, C, NC, A> SearchListMethodBuilder<'a, C, NC, A> where NC: hyper::net::N } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -12756,7 +12826,7 @@ impl<'a, C, NC, A> SearchListMethodBuilder<'a, C, NC, A> where NC: hyper::net::N /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -12795,10 +12865,8 @@ impl<'a, C, NC, A> I18nRegionListMethodBuilder<'a, C, NC, A> where NC: hyper::ne pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, I18nRegionListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._hl { params.push(("hl", value.to_string())); @@ -12812,6 +12880,8 @@ impl<'a, C, NC, A> I18nRegionListMethodBuilder<'a, C, NC, A> where NC: hyper::ne params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/i18nRegions".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -12833,10 +12903,10 @@ impl<'a, C, NC, A> I18nRegionListMethodBuilder<'a, C, NC, A> where NC: hyper::ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -12867,9 +12937,11 @@ impl<'a, C, NC, A> I18nRegionListMethodBuilder<'a, C, NC, A> where NC: hyper::ne } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -12980,7 +13052,7 @@ impl<'a, C, NC, A> I18nRegionListMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::LiveStream; /// # #[test] fn egal() { /// # use std::default::Default; @@ -13032,10 +13104,8 @@ impl<'a, C, NC, A> LiveStreamUpdateMethodBuilder<'a, C, NC, A> where NC: hyper:: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveStream)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((6 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -13055,6 +13125,8 @@ impl<'a, C, NC, A> LiveStreamUpdateMethodBuilder<'a, C, NC, A> where NC: hyper:: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -13066,8 +13138,10 @@ impl<'a, C, NC, A> LiveStreamUpdateMethodBuilder<'a, C, NC, A> where NC: hyper:: url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -13078,14 +13152,15 @@ impl<'a, C, NC, A> LiveStreamUpdateMethodBuilder<'a, C, NC, A> where NC: hyper:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("PUT".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.liveStreams.update"), @@ -13115,9 +13190,11 @@ impl<'a, C, NC, A> LiveStreamUpdateMethodBuilder<'a, C, NC, A> where NC: hyper:: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -13253,7 +13330,7 @@ impl<'a, C, NC, A> LiveStreamUpdateMethodBuilder<'a, C, NC, A> where NC: hyper:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -13294,9 +13371,8 @@ impl<'a, C, NC, A> LiveStreamDeleteMethodBuilder<'a, C, NC, A> where NC: hyper:: pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); if let Some(value) = self._on_behalf_of_content_owner_channel { params.push(("onBehalfOfContentOwnerChannel", value.to_string())); @@ -13313,6 +13389,7 @@ impl<'a, C, NC, A> LiveStreamDeleteMethodBuilder<'a, C, NC, A> where NC: hyper:: params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -13334,10 +13411,10 @@ impl<'a, C, NC, A> LiveStreamDeleteMethodBuilder<'a, C, NC, A> where NC: hyper:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("DELETE".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -13489,7 +13566,7 @@ impl<'a, C, NC, A> LiveStreamDeleteMethodBuilder<'a, C, NC, A> where NC: hyper:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -13538,10 +13615,8 @@ impl<'a, C, NC, A> LiveStreamListMethodBuilder<'a, C, NC, A> where NC: hyper::ne pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveStreamListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((9 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -13570,6 +13645,8 @@ impl<'a, C, NC, A> LiveStreamListMethodBuilder<'a, C, NC, A> where NC: hyper::ne params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -13591,10 +13668,10 @@ impl<'a, C, NC, A> LiveStreamListMethodBuilder<'a, C, NC, A> where NC: hyper::ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -13625,9 +13702,11 @@ impl<'a, C, NC, A> LiveStreamListMethodBuilder<'a, C, NC, A> where NC: hyper::ne } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -13786,7 +13865,7 @@ impl<'a, C, NC, A> LiveStreamListMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::LiveStream; /// # #[test] fn egal() { /// # use std::default::Default; @@ -13838,10 +13917,8 @@ impl<'a, C, NC, A> LiveStreamInsertMethodBuilder<'a, C, NC, A> where NC: hyper:: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveStream)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((6 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -13861,6 +13938,8 @@ impl<'a, C, NC, A> LiveStreamInsertMethodBuilder<'a, C, NC, A> where NC: hyper:: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveStreams".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -13872,8 +13951,10 @@ impl<'a, C, NC, A> LiveStreamInsertMethodBuilder<'a, C, NC, A> where NC: hyper:: url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -13884,14 +13965,15 @@ impl<'a, C, NC, A> LiveStreamInsertMethodBuilder<'a, C, NC, A> where NC: hyper:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.liveStreams.insert"), @@ -13921,9 +14003,11 @@ impl<'a, C, NC, A> LiveStreamInsertMethodBuilder<'a, C, NC, A> where NC: hyper:: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -14070,7 +14154,7 @@ impl<'a, C, NC, A> LiveStreamInsertMethodBuilder<'a, C, NC, A> where NC: hyper:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::Channel; /// # #[test] fn egal() { /// # use std::default::Default; @@ -14118,10 +14202,8 @@ impl<'a, C, NC, A> ChannelUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, Channel)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((5 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -14138,6 +14220,8 @@ impl<'a, C, NC, A> ChannelUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/channels".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -14149,8 +14233,10 @@ impl<'a, C, NC, A> ChannelUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -14161,14 +14247,15 @@ impl<'a, C, NC, A> ChannelUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("PUT".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.channels.update"), @@ -14198,9 +14285,11 @@ impl<'a, C, NC, A> ChannelUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -14337,7 +14426,7 @@ impl<'a, C, NC, A> ChannelUpdateMethodBuilder<'a, C, NC, A> where NC: hyper::net /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -14392,10 +14481,8 @@ impl<'a, C, NC, A> ChannelListMethodBuilder<'a, C, NC, A> where NC: hyper::net:: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, ChannelListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((12 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((12 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -14433,6 +14520,8 @@ impl<'a, C, NC, A> ChannelListMethodBuilder<'a, C, NC, A> where NC: hyper::net:: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/channels".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -14454,10 +14543,10 @@ impl<'a, C, NC, A> ChannelListMethodBuilder<'a, C, NC, A> where NC: hyper::net:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -14488,9 +14577,11 @@ impl<'a, C, NC, A> ChannelListMethodBuilder<'a, C, NC, A> where NC: hyper::net:: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -14657,7 +14748,7 @@ impl<'a, C, NC, A> ChannelListMethodBuilder<'a, C, NC, A> where NC: hyper::net:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -14694,9 +14785,8 @@ impl<'a, C, NC, A> PlaylistItemDeleteMethodBuilder<'a, C, NC, A> where NC: hyper pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((2 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((2 + self._additional_params.len())); params.push(("id", self._id.to_string())); for &field in ["id"].iter() { if self._additional_params.contains_key(field) { @@ -14707,6 +14797,7 @@ impl<'a, C, NC, A> PlaylistItemDeleteMethodBuilder<'a, C, NC, A> where NC: hyper params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -14728,10 +14819,10 @@ impl<'a, C, NC, A> PlaylistItemDeleteMethodBuilder<'a, C, NC, A> where NC: hyper if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("DELETE".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -14862,7 +14953,7 @@ impl<'a, C, NC, A> PlaylistItemDeleteMethodBuilder<'a, C, NC, A> where NC: hyper /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -14911,10 +15002,8 @@ impl<'a, C, NC, A> PlaylistItemListMethodBuilder<'a, C, NC, A> where NC: hyper:: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, PlaylistItemListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((9 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._video_id { params.push(("videoId", value.to_string())); @@ -14943,6 +15032,8 @@ impl<'a, C, NC, A> PlaylistItemListMethodBuilder<'a, C, NC, A> where NC: hyper:: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -14964,10 +15055,10 @@ impl<'a, C, NC, A> PlaylistItemListMethodBuilder<'a, C, NC, A> where NC: hyper:: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -14998,9 +15089,11 @@ impl<'a, C, NC, A> PlaylistItemListMethodBuilder<'a, C, NC, A> where NC: hyper:: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -15157,7 +15250,7 @@ impl<'a, C, NC, A> PlaylistItemListMethodBuilder<'a, C, NC, A> where NC: hyper:: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::PlaylistItem; /// # #[test] fn egal() { /// # use std::default::Default; @@ -15206,10 +15299,8 @@ impl<'a, C, NC, A> PlaylistItemInsertMethodBuilder<'a, C, NC, A> where NC: hyper pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, PlaylistItem)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((5 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((5 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -15226,6 +15317,8 @@ impl<'a, C, NC, A> PlaylistItemInsertMethodBuilder<'a, C, NC, A> where NC: hyper params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -15237,8 +15330,10 @@ impl<'a, C, NC, A> PlaylistItemInsertMethodBuilder<'a, C, NC, A> where NC: hyper url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -15249,14 +15344,15 @@ impl<'a, C, NC, A> PlaylistItemInsertMethodBuilder<'a, C, NC, A> where NC: hyper if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.playlistItems.insert"), @@ -15286,9 +15382,11 @@ impl<'a, C, NC, A> PlaylistItemInsertMethodBuilder<'a, C, NC, A> where NC: hyper } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -15422,7 +15520,7 @@ impl<'a, C, NC, A> PlaylistItemInsertMethodBuilder<'a, C, NC, A> where NC: hyper /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::PlaylistItem; /// # #[test] fn egal() { /// # use std::default::Default; @@ -15469,10 +15567,8 @@ impl<'a, C, NC, A> PlaylistItemUpdateMethodBuilder<'a, C, NC, A> where NC: hyper pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, PlaylistItem)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -15486,6 +15582,8 @@ impl<'a, C, NC, A> PlaylistItemUpdateMethodBuilder<'a, C, NC, A> where NC: hyper params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/playlistItems".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -15497,8 +15595,10 @@ impl<'a, C, NC, A> PlaylistItemUpdateMethodBuilder<'a, C, NC, A> where NC: hyper url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -15509,14 +15609,15 @@ impl<'a, C, NC, A> PlaylistItemUpdateMethodBuilder<'a, C, NC, A> where NC: hyper if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("PUT".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.playlistItems.update"), @@ -15546,9 +15647,11 @@ impl<'a, C, NC, A> PlaylistItemUpdateMethodBuilder<'a, C, NC, A> where NC: hyper } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -15660,7 +15763,7 @@ impl<'a, C, NC, A> PlaylistItemUpdateMethodBuilder<'a, C, NC, A> where NC: hyper /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::InvideoBranding; /// use std::fs; /// # #[test] fn egal() { @@ -15683,7 +15786,7 @@ impl<'a, C, NC, A> PlaylistItemUpdateMethodBuilder<'a, C, NC, A> where NC: hyper /// // Values shown here are possibly random and not representative ! /// let result = hub.watermarks().set(&req, "channelId") /// .on_behalf_of_content_owner("ut") -/// .upload(fs::File::open("file.ext").unwrap(), 282, "application/octet-stream".parse().unwrap()); +/// .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()); /// # } /// ``` pub struct WatermarkSetMethodBuilder<'a, C, NC, A> @@ -15704,12 +15807,11 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// Perform the operation you have build so far. - fn doit(mut self, mut stream: Option<(R, u64, mime::Mime)>, mut resumeable_stream: Option<(RS, u64, mime::Mime)>) -> cmn::Result where R: ReadSeek, RS: ReadSeek { + fn doit(mut self, mut stream: Option<(RS, mime::Mime)>, mut resumeable_stream: Option<(RS, mime::Mime)>) -> cmn::Result where RS: ReadSeek { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("channelId", self._channel_id.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); @@ -15723,6 +15825,7 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: params.push((&name, value.clone())); } + let (mut url, protocol) = if stream.is_some() { ("https://www.googleapis.com/upload/youtube/v3/watermarks/set".to_string(), "simple") } else if resumeable_stream.is_some() { @@ -15741,8 +15844,10 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -15753,15 +15858,15 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); - let mut request_value_reader = io::Cursor::new(json_encoded_request.clone().into_bytes()); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut mp_reader: cmn::MultiPartReader = Default::default(); let (mut body_reader, content_type) = match stream.as_mut() { - Some(&mut (ref mut reader, size, ref mime)) => { + Some(&mut (ref mut reader, ref mime)) => { mp_reader.reserve_exact(2); - let rsize = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - mp_reader.add_part(&mut request_value_reader, rsize, json_mime_type.clone()) + let size = reader.seek(io::SeekFrom::End(0)).unwrap(); + reader.seek(io::SeekFrom::Start(0)).unwrap(); + mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone()) .add_part(reader, size, mime.clone()); let mime_type = mp_reader.mime_type(); (&mut mp_reader as &mut io::Read, ContentType(mime_type)) @@ -15770,7 +15875,7 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: }; let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(content_type) .body(body_reader.into_body()); @@ -15816,9 +15921,9 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// * *max size*: 10MB /// * *multipart*: yes /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload(self, stream: R, size: u64, mime_type: mime::Mime) -> cmn::Result - where R: ReadSeek { - self.doit(Some((stream, size, mime_type)), None::<(fs::File, u64, mime::Mime)>, ) + pub fn upload(self, stream: RS, mime_type: mime::Mime) -> cmn::Result + where RS: ReadSeek { + self.doit(Some((stream, mime_type)), None, ) } /// Upload media in a resumeable fashion. /// Even if the upload fails or is interrupted, it can be resumed for a @@ -15829,9 +15934,9 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// * *max size*: 10MB /// * *multipart*: yes /// * *valid mime types*: 'application/octet-stream', 'image/jpeg' and 'image/png' - pub fn upload_resumable(self, resumeable_stream: RS, size: u64, mime_type: mime::Mime) -> cmn::Result + pub fn upload_resumable(self, resumeable_stream: RS, mime_type: mime::Mime) -> cmn::Result where RS: ReadSeek { - self.doit(None::<(fs::File, u64, mime::Mime)>, Some((resumeable_stream, size, mime_type)), ) + self.doit(None, Some((resumeable_stream, mime_type)), ) } /// Sets the *request* property to the given value. @@ -15927,7 +16032,7 @@ impl<'a, C, NC, A> WatermarkSetMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -15966,9 +16071,8 @@ impl<'a, C, NC, A> WatermarkUnsetMethodBuilder<'a, C, NC, A> where NC: hyper::ne pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((3 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((3 + self._additional_params.len())); params.push(("channelId", self._channel_id.to_string())); if let Some(value) = self._on_behalf_of_content_owner { params.push(("onBehalfOfContentOwner", value.to_string())); @@ -15982,6 +16086,7 @@ impl<'a, C, NC, A> WatermarkUnsetMethodBuilder<'a, C, NC, A> where NC: hyper::ne params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/watermarks/unset".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -16003,10 +16108,10 @@ impl<'a, C, NC, A> WatermarkUnsetMethodBuilder<'a, C, NC, A> where NC: hyper::ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -16143,7 +16248,7 @@ impl<'a, C, NC, A> WatermarkUnsetMethodBuilder<'a, C, NC, A> where NC: hyper::ne /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -16191,10 +16296,8 @@ impl<'a, C, NC, A> LiveBroadcastControlMethodBuilder<'a, C, NC, A> where NC: hyp pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveBroadcast)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((9 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((9 + self._additional_params.len())); params.push(("id", self._id.to_string())); params.push(("part", self._part.to_string())); if let Some(value) = self._walltime { @@ -16221,6 +16324,8 @@ impl<'a, C, NC, A> LiveBroadcastControlMethodBuilder<'a, C, NC, A> where NC: hyp params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/control".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -16242,10 +16347,10 @@ impl<'a, C, NC, A> LiveBroadcastControlMethodBuilder<'a, C, NC, A> where NC: hyp if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -16276,9 +16381,11 @@ impl<'a, C, NC, A> LiveBroadcastControlMethodBuilder<'a, C, NC, A> where NC: hyp } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -16443,7 +16550,7 @@ impl<'a, C, NC, A> LiveBroadcastControlMethodBuilder<'a, C, NC, A> where NC: hyp /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::LiveBroadcast; /// # #[test] fn egal() { /// # use std::default::Default; @@ -16495,10 +16602,8 @@ impl<'a, C, NC, A> LiveBroadcastUpdateMethodBuilder<'a, C, NC, A> where NC: hype pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveBroadcast)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((6 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -16518,6 +16623,8 @@ impl<'a, C, NC, A> LiveBroadcastUpdateMethodBuilder<'a, C, NC, A> where NC: hype params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -16529,8 +16636,10 @@ impl<'a, C, NC, A> LiveBroadcastUpdateMethodBuilder<'a, C, NC, A> where NC: hype url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -16541,14 +16650,15 @@ impl<'a, C, NC, A> LiveBroadcastUpdateMethodBuilder<'a, C, NC, A> where NC: hype if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("PUT".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.liveBroadcasts.update"), @@ -16578,9 +16688,11 @@ impl<'a, C, NC, A> LiveBroadcastUpdateMethodBuilder<'a, C, NC, A> where NC: hype } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -16730,7 +16842,7 @@ impl<'a, C, NC, A> LiveBroadcastUpdateMethodBuilder<'a, C, NC, A> where NC: hype /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::LiveBroadcast; /// # #[test] fn egal() { /// # use std::default::Default; @@ -16782,10 +16894,8 @@ impl<'a, C, NC, A> LiveBroadcastInsertMethodBuilder<'a, C, NC, A> where NC: hype pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveBroadcast)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((6 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -16805,6 +16915,8 @@ impl<'a, C, NC, A> LiveBroadcastInsertMethodBuilder<'a, C, NC, A> where NC: hype params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -16816,8 +16928,10 @@ impl<'a, C, NC, A> LiveBroadcastInsertMethodBuilder<'a, C, NC, A> where NC: hype url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -16828,14 +16942,15 @@ impl<'a, C, NC, A> LiveBroadcastInsertMethodBuilder<'a, C, NC, A> where NC: hype if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.liveBroadcasts.insert"), @@ -16865,9 +16980,11 @@ impl<'a, C, NC, A> LiveBroadcastInsertMethodBuilder<'a, C, NC, A> where NC: hype } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -17015,7 +17132,7 @@ impl<'a, C, NC, A> LiveBroadcastInsertMethodBuilder<'a, C, NC, A> where NC: hype /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -17059,10 +17176,8 @@ impl<'a, C, NC, A> LiveBroadcastBindMethodBuilder<'a, C, NC, A> where NC: hyper: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveBroadcast)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((7 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("id", self._id.to_string())); params.push(("part", self._part.to_string())); if let Some(value) = self._stream_id { @@ -17083,6 +17198,8 @@ impl<'a, C, NC, A> LiveBroadcastBindMethodBuilder<'a, C, NC, A> where NC: hyper: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/bind".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -17104,10 +17221,10 @@ impl<'a, C, NC, A> LiveBroadcastBindMethodBuilder<'a, C, NC, A> where NC: hyper: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -17138,9 +17255,11 @@ impl<'a, C, NC, A> LiveBroadcastBindMethodBuilder<'a, C, NC, A> where NC: hyper: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -17286,7 +17405,7 @@ impl<'a, C, NC, A> LiveBroadcastBindMethodBuilder<'a, C, NC, A> where NC: hyper: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -17337,10 +17456,8 @@ impl<'a, C, NC, A> LiveBroadcastListMethodBuilder<'a, C, NC, A> where NC: hyper: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveBroadcastListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((10 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((10 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._page_token { params.push(("pageToken", value.to_string())); @@ -17372,6 +17489,8 @@ impl<'a, C, NC, A> LiveBroadcastListMethodBuilder<'a, C, NC, A> where NC: hyper: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -17393,10 +17512,10 @@ impl<'a, C, NC, A> LiveBroadcastListMethodBuilder<'a, C, NC, A> where NC: hyper: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -17427,9 +17546,11 @@ impl<'a, C, NC, A> LiveBroadcastListMethodBuilder<'a, C, NC, A> where NC: hyper: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -17582,7 +17703,7 @@ impl<'a, C, NC, A> LiveBroadcastListMethodBuilder<'a, C, NC, A> where NC: hyper: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -17623,9 +17744,8 @@ impl<'a, C, NC, A> LiveBroadcastDeleteMethodBuilder<'a, C, NC, A> where NC: hype pub fn doit(mut self) -> cmn::Result { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); params.push(("id", self._id.to_string())); if let Some(value) = self._on_behalf_of_content_owner_channel { params.push(("onBehalfOfContentOwnerChannel", value.to_string())); @@ -17642,6 +17762,7 @@ impl<'a, C, NC, A> LiveBroadcastDeleteMethodBuilder<'a, C, NC, A> where NC: hype params.push((&name, value.clone())); } + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -17663,10 +17784,10 @@ impl<'a, C, NC, A> LiveBroadcastDeleteMethodBuilder<'a, C, NC, A> where NC: hype if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("DELETE".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -17817,7 +17938,7 @@ impl<'a, C, NC, A> LiveBroadcastDeleteMethodBuilder<'a, C, NC, A> where NC: hype /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -17860,10 +17981,8 @@ impl<'a, C, NC, A> LiveBroadcastTransitionMethodBuilder<'a, C, NC, A> where NC: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, LiveBroadcast)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((7 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((7 + self._additional_params.len())); params.push(("broadcastStatus", self._broadcast_status.to_string())); params.push(("id", self._id.to_string())); params.push(("part", self._part.to_string())); @@ -17882,6 +18001,8 @@ impl<'a, C, NC, A> LiveBroadcastTransitionMethodBuilder<'a, C, NC, A> where NC: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/liveBroadcasts/transition".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -17903,10 +18024,10 @@ impl<'a, C, NC, A> LiveBroadcastTransitionMethodBuilder<'a, C, NC, A> where NC: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -17937,9 +18058,11 @@ impl<'a, C, NC, A> LiveBroadcastTransitionMethodBuilder<'a, C, NC, A> where NC: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -18086,7 +18209,7 @@ impl<'a, C, NC, A> LiveBroadcastTransitionMethodBuilder<'a, C, NC, A> where NC: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -18129,10 +18252,8 @@ impl<'a, C, NC, A> VideoCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, VideoCategoryListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((6 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((6 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._region_code { params.push(("regionCode", value.to_string())); @@ -18152,6 +18273,8 @@ impl<'a, C, NC, A> VideoCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/videoCategories".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -18173,10 +18296,10 @@ impl<'a, C, NC, A> VideoCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -18207,9 +18330,11 @@ impl<'a, C, NC, A> VideoCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -18336,7 +18461,7 @@ impl<'a, C, NC, A> VideoCategoryListMethodBuilder<'a, C, NC, A> where NC: hyper: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; @@ -18389,10 +18514,8 @@ impl<'a, C, NC, A> ActivityListMethodBuilder<'a, C, NC, A> where NC: hyper::net: pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, ActivityListResponse)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((11 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((11 + self._additional_params.len())); params.push(("part", self._part.to_string())); if let Some(value) = self._region_code { params.push(("regionCode", value.to_string())); @@ -18427,6 +18550,8 @@ impl<'a, C, NC, A> ActivityListMethodBuilder<'a, C, NC, A> where NC: hyper::net: params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/activities".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Readonly.as_slice().to_string(), ()); @@ -18448,10 +18573,10 @@ impl<'a, C, NC, A> ActivityListMethodBuilder<'a, C, NC, A> where NC: hyper::net: if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("GET".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header); match self._delegate { @@ -18482,9 +18607,11 @@ impl<'a, C, NC, A> ActivityListMethodBuilder<'a, C, NC, A> where NC: hyper::net: } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } @@ -18654,7 +18781,7 @@ impl<'a, C, NC, A> ActivityListMethodBuilder<'a, C, NC, A> where NC: hyper::net: /// # extern crate hyper; /// # extern crate "yup-oauth2" as oauth2; /// # extern crate "rustc-serialize" as rustc_serialize; -/// # extern crate youtube3; +/// # extern crate "google-youtube3" as youtube3; /// use youtube3::Activity; /// # #[test] fn egal() { /// # use std::default::Default; @@ -18700,10 +18827,8 @@ impl<'a, C, NC, A> ActivityInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne pub fn doit(mut self) -> cmn::Result<(hyper::client::Response, Activity)> { use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((4 + self._additional_params.len())); - params.push(("alt", "json".to_string())); + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + self._additional_params.len())); if self._part.len() == 0 { self._part = self._request.to_parts(); } @@ -18717,6 +18842,8 @@ impl<'a, C, NC, A> ActivityInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne params.push((&name, value.clone())); } + params.push(("alt", "json".to_string())); + let mut url = "https://www.googleapis.com/youtube/v3/activities".to_string(); if self._scopes.len() == 0 { self._scopes.insert(Scope::Full.as_slice().to_string(), ()); @@ -18728,8 +18855,10 @@ impl<'a, C, NC, A> ActivityInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_slice())))); } - let json_encoded_request = json::encode(&self._request).unwrap(); let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); + let mut request_value_reader = io::Cursor::new(json::encode(&self._request).unwrap().into_bytes()); + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut client = &mut *self.hub.client.borrow_mut(); loop { @@ -18740,14 +18869,15 @@ impl<'a, C, NC, A> ActivityInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req = client.borrow_mut().request(hyper::method::Method::Extension("POST".to_string()), url.as_slice()) - .header(hyper::header::UserAgent("google-api-rust-client/0.0.1".to_string())) + .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header) .header(ContentType(json_mime_type.clone())) - .header(ContentLength(json_encoded_request.len() as u64)) - .body(json_encoded_request.as_slice()); + .header(ContentLength(request_size as u64)) + .body(request_value_reader.into_body()); match self._delegate { Some(ref mut d) => d.pre_request("youtube.activities.insert"), @@ -18777,9 +18907,11 @@ impl<'a, C, NC, A> ActivityInsertMethodBuilder<'a, C, NC, A> where NC: hyper::ne } return cmn::Result::Failure(res) } - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + let result_value = { + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }; return cmn::Result::Success(result_value) } } diff --git a/src/mako/deps.mako b/src/mako/deps.mako index 12c87f81aa..40ac09fd30 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -11,8 +11,8 @@ doc_root = directories.output + '/doc' doc_index = doc_root + '/index.html' - to_doc_root = lambda gen_root, api_name: gen_root + '/target/doc/' + api_name - central_api_index = lambda api_name: doc_root + '/' + api_name + '/index.html' + to_doc_root = lambda gen_root, crate_name: gen_root + '/target/doc/' + crate_name + central_api_index = lambda crate_name: doc_root + '/' + crate_name + '/index.html' discovery_url = 'https://www.googleapis.com/discovery/v1/' apis = json.loads(urllib2.urlopen(discovery_url + "apis").read()) @@ -27,6 +27,7 @@ import util import os api_name = util.library_name(an, version) + crate_name = util.library_to_crate_name(api_name) gen_root = directories.output + '/' + api_name gen_root_stamp = gen_root + '/.timestamp' api_common = gen_root + '/src/cmn.rs' @@ -34,7 +35,7 @@ api_cargo = api_name + '-cargo' api_doc = api_name + '-doc' - api_doc_root = to_doc_root(gen_root, api_name) + api_doc_root = to_doc_root(gen_root, crate_name) api_doc_index = api_doc_root + '/index.html' # source, destination of individual output files @@ -70,9 +71,9 @@ ${api_doc_index}: ${api_name} ${api_doc}: ${api_doc_index} -${central_api_index(api_name)}: ${api_doc_index} +${central_api_index(crate_name)}: ${api_doc_index} @mkdir -p ${doc_root} - cp -Rf ${os.path.dirname(to_doc_root(gen_root, api_name))}/* ${doc_root} + cp -Rf ${os.path.dirname(to_doc_root(gen_root, crate_name))}/* ${doc_root} ${api_clean}: -rm -Rf ${gen_root} @@ -83,7 +84,7 @@ clean-apis: ${space_join(1)} docs-clean cargo: ${space_join(2)} apis: ${space_join(0)} -${doc_index}: ${' '.join(central_api_index(a[0]) for a in api_info)} $(MAKO_STANDARD_DEPENDENCIES) +${doc_index}: ${' '.join(central_api_index(util.library_to_crate_name(a[0])) for a in api_info)} $(MAKO_STANDARD_DEPENDENCIES) $(MAKO) --var DOC_ROOT=${doc_root} -io $(MAKO_SRC)/index.html.mako=$@ --data-files $(API_SHARED_INFO) $(API_LIST) @echo Documentation index created at '$@' diff --git a/src/mako/lib/lib.mako b/src/mako/lib/lib.mako index 65d2f4cdaa..93d7b25f6c 100644 --- a/src/mako/lib/lib.mako +++ b/src/mako/lib/lib.mako @@ -132,6 +132,10 @@ ${link('Hub Delegate', delegate_url)}, or the ${link('Authenticator Delegate', u When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. +${'##'} About Uploads and Downlods + +TODO: 'alt' media for downloads, custom methods for uploads (simple, resumable) + ${'##'} About Customization/Callbacks You may alter the way an `${api.terms.action}()` method is called by providing a ${link('delegate', delegate_url)} to the diff --git a/src/mako/lib/mbuild.mako b/src/mako/lib/mbuild.mako index a245b0695e..4774dea1c0 100644 --- a/src/mako/lib/mbuild.mako +++ b/src/mako/lib/mbuild.mako @@ -35,6 +35,8 @@ fn_name = 'add_' + fn_name return fn_name + add_param_fn = 'param' + %>\ <%namespace name="util" file="util.mako"/>\ <%namespace name="lib" file="lib.mako"/>\ @@ -46,6 +48,8 @@ <% hub_type_name = hub_type(schemas,util.canonical_name()) m = c.fqan_map[to_fqan(c.rtc_map[resource], resource, method)] + response_schema = method_response(c, m) + # an identifier for a property. We prefix them to prevent clashes with the setters mb_tparams = mb_type_params_s(m) ThisType = mb_type(resource, method) + mb_tparams @@ -60,6 +64,15 @@ ${m.description | rust_doc_comment} /// % endif +% if m.get('supportsMediaDownload', False): +/// This method supports **media download**. To enable it, set the *alt* parameter to *media*, .i.e. +/// `.${add_param_fn}("alt", "media")`. +% if response_schema: +/// Please note that due to missing multi-part support on the server side, you will only receive the media, +/// but not the `${response_schema.id}` structure that you would usually get. The latter will be a default value. +% endif +/// +% endif ## supports media download /// A builder for the *${method}* method supported by a *${singular(resource)}* resource. /// It is not used directly, but through a `${rb_type(resource)}`. /// @@ -135,7 +148,7 @@ ${self._setter_fn(resource, method, m, p, part_prop, ThisType, c)}\ /// * *${opn}* (${op.location}-${op.type}) - ${op.description} % endfor % endif - pub fn param(mut self, name: T, value: T) -> ${ThisType} + pub fn ${add_param_fn}(mut self, name: T, value: T) -> ${ThisType} where T: Str { self.${api.properties.params}.insert(name.as_slice().to_string(), value.as_slice().to_string()); self @@ -370,10 +383,12 @@ match result { rtype = 'cmn::Result' response_schema = method_response(c, m) + supports_download = m.get('supportsMediaDownload', False); reserved_params = [] if response_schema: + if not supports_download: + reserved_params = ['alt'] rtype = 'cmn::Result<(hyper::client::Response, %s)>' % (response_schema.id) - reserved_params = ['alt'] mtype_param = 'RS' mtype_where = 'ReadSeek' @@ -462,12 +477,8 @@ match result { ## "the trait `core::marker::Sized` is not implemented for the type `std::io::Read`" use hyper::client::IntoBody; use std::io::{Read, Seek}; - use hyper::header::{ContentType, ContentLength}; - let mut params = Vec::new(); - params.reserve_exact((${len(params) + len(reserved_params)} + ${paddfields}.len())); - % if response_schema: - params.push(("alt", "json".to_string())); - % endif + use hyper::header::{ContentType, ContentLength, Authorization, UserAgent}; + let mut params: Vec<(&str, String)> = Vec::with_capacity((${len(params) + len(reserved_params)} + ${paddfields}.len())); % for p in field_params: <% pname = 'self.' + property(p.name) # property identifier @@ -510,6 +521,30 @@ match result { params.push((&name, value.clone())); } + % if response_schema: + % if supports_download: + let (json_field_missing, enable_resource_parsing) = { + let mut enable = true; + let mut field_present = true; + for &(name, ref value) in params.iter() { + if name == "alt" { + field_present = false; + if value.as_slice() != "json" { + enable = false; + } + break; + } + } + (field_present, enable) + }; + if json_field_missing { + params.push(("alt", "json".to_string())); + } + % else: + params.push(("alt", "json".to_string())); + % endif ## supportsMediaDownload + % endif ## response schema + % if media_params: let (mut url, protocol) = \ % for mp in media_params: @@ -613,7 +648,7 @@ else { if token.is_none() { return cmn::Result::MissingToken } - let auth_header = hyper::header::Authorization(token.unwrap().access_token); + let auth_header = Authorization(token.unwrap().access_token); % endif % if request_value: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); @@ -634,7 +669,7 @@ else { % endif let mut req = client.borrow_mut().request(hyper::method::Method::Extension("${m.httpMethod}".to_string()), url.as_slice()) - .header(hyper::header::UserAgent(self.hub._user_agent.clone()))\ + .header(UserAgent(self.hub._user_agent.clone()))\ % if supports_scopes(auth): .header(auth_header)\ @@ -690,9 +725,20 @@ else { return cmn::Result::Failure(res) } % if response_schema: - let mut json_response = String::new(); - res.read_to_string(&mut json_response).unwrap(); - let result_value = (res, json::decode(&json_response).unwrap()); + ## If 'alt' is not json, we cannot attempt to decode the response + let result_value = \ + % if supports_download: +if enable_resource_parsing \ + % endif +{ + let mut json_response = String::new(); + res.read_to_string(&mut json_response).unwrap(); + (res, json::decode(&json_response).unwrap()) + }\ + % if supports_download: + else { (res, Default::default()) }\ + % endif +; % else: let result_value = res; % endif diff --git a/src/mako/lib/util.mako b/src/mako/lib/util.mako index c73b7bd78f..3e71820ad8 100644 --- a/src/mako/lib/util.mako +++ b/src/mako/lib/util.mako @@ -24,7 +24,7 @@ ${util.library_name(name, version)}\ <%def name="crate_name()" buffered="True">\ -google-${self.library_name()}\ +${util.library_to_crate_name(util.library_name(name, version))}\ ## All crates and standard `use` declaration, required for all examples diff --git a/src/mako/lib/util.py b/src/mako/lib/util.py index 59adac0020..e748f90d8a 100644 --- a/src/mako/lib/util.py +++ b/src/mako/lib/util.py @@ -748,6 +748,10 @@ def library_name(name, version): version = 'v' + version return normalize_library_name(name) + version +# return crate name for given result of `library_name()` +def library_to_crate_name(name): + return 'google-' + name + # return type name of a resource method builder, from a resource name def rb_type(r): return "%sMethodsBuilder" % singular(canonical_type_name(r))