| OLD | NEW |
| 1 // This is a generated file (see the discoveryapis_generator project). | 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 | 2 |
| 3 library googleapis.acceleratedmobilepageurl.v1; | 3 library googleapis.acceleratedmobilepageurl.v1; |
| 4 | 4 |
| 5 import 'dart:core' as core; | 5 import 'dart:core' as core; |
| 6 import 'dart:async' as async; | 6 import 'dart:async' as async; |
| 7 import 'dart:convert' as convert; | 7 import 'dart:convert' as convert; |
| 8 | 8 |
| 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; | 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
| 11 | 11 |
| 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show | 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' |
| 13 ApiRequestError, DetailedApiRequestError; | 13 show ApiRequestError, DetailedApiRequestError; |
| 14 | 14 |
| 15 const core.String USER_AGENT = 'dart-api-client acceleratedmobilepageurl/v1'; | 15 const core.String USER_AGENT = 'dart-api-client acceleratedmobilepageurl/v1'; |
| 16 | 16 |
| 17 /** | 17 /// Retrieves the list of AMP URLs (and equivalent AMP Cache URLs) for a given |
| 18 * Retrieves the list of AMP URLs (and equivalent AMP Cache URLs) for a given | 18 /// list of public URL(s). |
| 19 * list of public URL(s). | |
| 20 */ | |
| 21 class AcceleratedmobilepageurlApi { | 19 class AcceleratedmobilepageurlApi { |
| 22 | |
| 23 final commons.ApiRequester _requester; | 20 final commons.ApiRequester _requester; |
| 24 | 21 |
| 25 AmpUrlsResourceApi get ampUrls => new AmpUrlsResourceApi(_requester); | 22 AmpUrlsResourceApi get ampUrls => new AmpUrlsResourceApi(_requester); |
| 26 | 23 |
| 27 AcceleratedmobilepageurlApi(http.Client client, {core.String rootUrl: "https:/
/acceleratedmobilepageurl.googleapis.com/", core.String servicePath: ""}) : | 24 AcceleratedmobilepageurlApi(http.Client client, |
| 28 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | 25 {core.String rootUrl: "https://acceleratedmobilepageurl.googleapis.com/", |
| 26 core.String servicePath: ""}) |
| 27 : _requester = |
| 28 new commons.ApiRequester(client, rootUrl, servicePath, USER_AGENT); |
| 29 } | 29 } |
| 30 | 30 |
| 31 | |
| 32 class AmpUrlsResourceApi { | 31 class AmpUrlsResourceApi { |
| 33 final commons.ApiRequester _requester; | 32 final commons.ApiRequester _requester; |
| 34 | 33 |
| 35 AmpUrlsResourceApi(commons.ApiRequester client) : | 34 AmpUrlsResourceApi(commons.ApiRequester client) : _requester = client; |
| 36 _requester = client; | |
| 37 | 35 |
| 38 /** | 36 /// Returns AMP URL(s) and equivalent |
| 39 * Returns AMP URL(s) and equivalent | 37 /// [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format). |
| 40 * [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format). | 38 /// |
| 41 * | 39 /// [request] - The metadata request object. |
| 42 * [request] - The metadata request object. | 40 /// |
| 43 * | 41 /// Request parameters: |
| 44 * Request parameters: | 42 /// |
| 45 * | 43 /// Completes with a [BatchGetAmpUrlsResponse]. |
| 46 * Completes with a [BatchGetAmpUrlsResponse]. | 44 /// |
| 47 * | 45 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
| 48 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 46 /// an error. |
| 49 * error. | 47 /// |
| 50 * | 48 /// If the used [http.Client] completes with an error when making a REST |
| 51 * If the used [http.Client] completes with an error when making a REST call, | 49 /// call, this method will complete with the same error. |
| 52 * this method will complete with the same error. | 50 async.Future<BatchGetAmpUrlsResponse> batchGet( |
| 53 */ | 51 BatchGetAmpUrlsRequest request) { |
| 54 async.Future<BatchGetAmpUrlsResponse> batchGet(BatchGetAmpUrlsRequest request)
{ | |
| 55 var _url = null; | 52 var _url = null; |
| 56 var _queryParams = new core.Map(); | 53 var _queryParams = new core.Map(); |
| 57 var _uploadMedia = null; | 54 var _uploadMedia = null; |
| 58 var _uploadOptions = null; | 55 var _uploadOptions = null; |
| 59 var _downloadOptions = commons.DownloadOptions.Metadata; | 56 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 60 var _body = null; | 57 var _body = null; |
| 61 | 58 |
| 62 if (request != null) { | 59 if (request != null) { |
| 63 _body = convert.JSON.encode((request).toJson()); | 60 _body = convert.JSON.encode((request).toJson()); |
| 64 } | 61 } |
| 65 | 62 |
| 66 _url = 'v1/ampUrls:batchGet'; | 63 _url = 'v1/ampUrls:batchGet'; |
| 67 | 64 |
| 68 var _response = _requester.request(_url, | 65 var _response = _requester.request(_url, "POST", |
| 69 "POST", | 66 body: _body, |
| 70 body: _body, | 67 queryParams: _queryParams, |
| 71 queryParams: _queryParams, | 68 uploadOptions: _uploadOptions, |
| 72 uploadOptions: _uploadOptions, | 69 uploadMedia: _uploadMedia, |
| 73 uploadMedia: _uploadMedia, | 70 downloadOptions: _downloadOptions); |
| 74 downloadOptions: _downloadOptions); | |
| 75 return _response.then((data) => new BatchGetAmpUrlsResponse.fromJson(data)); | 71 return _response.then((data) => new BatchGetAmpUrlsResponse.fromJson(data)); |
| 76 } | 72 } |
| 77 | |
| 78 } | 73 } |
| 79 | 74 |
| 75 /// AMP URL response for a requested URL. |
| 76 class AmpUrl { |
| 77 /// The AMP URL pointing to the publisher's web server. |
| 78 core.String ampUrl; |
| 80 | 79 |
| 80 /// The [AMP Cache URL](/amp/cache/overview#amp-cache-url-format) pointing to |
| 81 /// the cached document in the Google AMP Cache. |
| 82 core.String cdnAmpUrl; |
| 81 | 83 |
| 82 /** AMP URL response for a requested URL. */ | 84 /// The original non-AMP URL. |
| 83 class AmpUrl { | |
| 84 /** The AMP URL pointing to the publisher's web server. */ | |
| 85 core.String ampUrl; | |
| 86 /** | |
| 87 * The [AMP Cache URL](/amp/cache/overview#amp-cache-url-format) pointing to | |
| 88 * the cached document in the Google AMP Cache. | |
| 89 */ | |
| 90 core.String cdnAmpUrl; | |
| 91 /** The original non-AMP URL. */ | |
| 92 core.String originalUrl; | 85 core.String originalUrl; |
| 93 | 86 |
| 94 AmpUrl(); | 87 AmpUrl(); |
| 95 | 88 |
| 96 AmpUrl.fromJson(core.Map _json) { | 89 AmpUrl.fromJson(core.Map _json) { |
| 97 if (_json.containsKey("ampUrl")) { | 90 if (_json.containsKey("ampUrl")) { |
| 98 ampUrl = _json["ampUrl"]; | 91 ampUrl = _json["ampUrl"]; |
| 99 } | 92 } |
| 100 if (_json.containsKey("cdnAmpUrl")) { | 93 if (_json.containsKey("cdnAmpUrl")) { |
| 101 cdnAmpUrl = _json["cdnAmpUrl"]; | 94 cdnAmpUrl = _json["cdnAmpUrl"]; |
| 102 } | 95 } |
| 103 if (_json.containsKey("originalUrl")) { | 96 if (_json.containsKey("originalUrl")) { |
| 104 originalUrl = _json["originalUrl"]; | 97 originalUrl = _json["originalUrl"]; |
| 105 } | 98 } |
| 106 } | 99 } |
| 107 | 100 |
| 108 core.Map<core.String, core.Object> toJson() { | 101 core.Map<core.String, core.Object> toJson() { |
| 109 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 102 final core.Map<core.String, core.Object> _json = |
| 103 new core.Map<core.String, core.Object>(); |
| 110 if (ampUrl != null) { | 104 if (ampUrl != null) { |
| 111 _json["ampUrl"] = ampUrl; | 105 _json["ampUrl"] = ampUrl; |
| 112 } | 106 } |
| 113 if (cdnAmpUrl != null) { | 107 if (cdnAmpUrl != null) { |
| 114 _json["cdnAmpUrl"] = cdnAmpUrl; | 108 _json["cdnAmpUrl"] = cdnAmpUrl; |
| 115 } | 109 } |
| 116 if (originalUrl != null) { | 110 if (originalUrl != null) { |
| 117 _json["originalUrl"] = originalUrl; | 111 _json["originalUrl"] = originalUrl; |
| 118 } | 112 } |
| 119 return _json; | 113 return _json; |
| 120 } | 114 } |
| 121 } | 115 } |
| 122 | 116 |
| 123 /** AMP URL Error resource for a requested URL that couldn't be found. */ | 117 /// AMP URL Error resource for a requested URL that couldn't be found. |
| 124 class AmpUrlError { | 118 class AmpUrlError { |
| 125 /** | 119 /// The error code of an API call. |
| 126 * The error code of an API call. | 120 /// Possible string values are: |
| 127 * Possible string values are: | 121 /// - "ERROR_CODE_UNSPECIFIED" : Not specified error. |
| 128 * - "ERROR_CODE_UNSPECIFIED" : Not specified error. | 122 /// - "INPUT_URL_NOT_FOUND" : Indicates the requested URL is not found in the |
| 129 * - "INPUT_URL_NOT_FOUND" : Indicates the requested URL is not found in the | 123 /// index, possibly because |
| 130 * index, possibly because | 124 /// it's unable to be found, not able to be accessed by Googlebot, or some |
| 131 * it's unable to be found, not able to be accessed by Googlebot, or some | 125 /// other error. |
| 132 * other error. | 126 /// - "NO_AMP_URL" : Indicates no AMP URL has been found that corresponds to |
| 133 * - "NO_AMP_URL" : Indicates no AMP URL has been found that corresponds to | 127 /// the requested |
| 134 * the requested | 128 /// URL. |
| 135 * URL. | 129 /// - "APPLICATION_ERROR" : Indicates some kind of application error occurred |
| 136 * - "APPLICATION_ERROR" : Indicates some kind of application error occurred | 130 /// at the server. |
| 137 * at the server. | 131 /// Client advised to retry. |
| 138 * Client advised to retry. | 132 /// - "URL_IS_VALID_AMP" : DEPRECATED: Indicates the requested URL is a valid |
| 139 * - "URL_IS_VALID_AMP" : DEPRECATED: Indicates the requested URL is a valid | 133 /// AMP URL. This is a |
| 140 * AMP URL. This is a | 134 /// non-error state, should not be relied upon as a sign of success or |
| 141 * non-error state, should not be relied upon as a sign of success or | 135 /// failure. It will be removed in future versions of the API. |
| 142 * failure. It will be removed in future versions of the API. | 136 /// - "URL_IS_INVALID_AMP" : Indicates that an AMP URL has been found that |
| 143 * - "URL_IS_INVALID_AMP" : Indicates that an AMP URL has been found that | 137 /// corresponds to the request |
| 144 * corresponds to the request | 138 /// URL, but it is not valid AMP HTML. |
| 145 * URL, but it is not valid AMP HTML. | |
| 146 */ | |
| 147 core.String errorCode; | 139 core.String errorCode; |
| 148 /** An optional descriptive error message. */ | 140 |
| 141 /// An optional descriptive error message. |
| 149 core.String errorMessage; | 142 core.String errorMessage; |
| 150 /** The original non-AMP URL. */ | 143 |
| 144 /// The original non-AMP URL. |
| 151 core.String originalUrl; | 145 core.String originalUrl; |
| 152 | 146 |
| 153 AmpUrlError(); | 147 AmpUrlError(); |
| 154 | 148 |
| 155 AmpUrlError.fromJson(core.Map _json) { | 149 AmpUrlError.fromJson(core.Map _json) { |
| 156 if (_json.containsKey("errorCode")) { | 150 if (_json.containsKey("errorCode")) { |
| 157 errorCode = _json["errorCode"]; | 151 errorCode = _json["errorCode"]; |
| 158 } | 152 } |
| 159 if (_json.containsKey("errorMessage")) { | 153 if (_json.containsKey("errorMessage")) { |
| 160 errorMessage = _json["errorMessage"]; | 154 errorMessage = _json["errorMessage"]; |
| 161 } | 155 } |
| 162 if (_json.containsKey("originalUrl")) { | 156 if (_json.containsKey("originalUrl")) { |
| 163 originalUrl = _json["originalUrl"]; | 157 originalUrl = _json["originalUrl"]; |
| 164 } | 158 } |
| 165 } | 159 } |
| 166 | 160 |
| 167 core.Map<core.String, core.Object> toJson() { | 161 core.Map<core.String, core.Object> toJson() { |
| 168 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 162 final core.Map<core.String, core.Object> _json = |
| 163 new core.Map<core.String, core.Object>(); |
| 169 if (errorCode != null) { | 164 if (errorCode != null) { |
| 170 _json["errorCode"] = errorCode; | 165 _json["errorCode"] = errorCode; |
| 171 } | 166 } |
| 172 if (errorMessage != null) { | 167 if (errorMessage != null) { |
| 173 _json["errorMessage"] = errorMessage; | 168 _json["errorMessage"] = errorMessage; |
| 174 } | 169 } |
| 175 if (originalUrl != null) { | 170 if (originalUrl != null) { |
| 176 _json["originalUrl"] = originalUrl; | 171 _json["originalUrl"] = originalUrl; |
| 177 } | 172 } |
| 178 return _json; | 173 return _json; |
| 179 } | 174 } |
| 180 } | 175 } |
| 181 | 176 |
| 182 /** AMP URL request for a batch of URLs. */ | 177 /// AMP URL request for a batch of URLs. |
| 183 class BatchGetAmpUrlsRequest { | 178 class BatchGetAmpUrlsRequest { |
| 184 /** | 179 /// The lookup_strategy being requested. |
| 185 * The lookup_strategy being requested. | 180 /// Possible string values are: |
| 186 * Possible string values are: | 181 /// - "FETCH_LIVE_DOC" : FETCH_LIVE_DOC strategy involves live document fetch |
| 187 * - "FETCH_LIVE_DOC" : FETCH_LIVE_DOC strategy involves live document fetch | 182 /// of URLs not found in |
| 188 * of URLs not found in | 183 /// the index. Any request URL not found in the index is crawled in realtime |
| 189 * the index. Any request URL not found in the index is crawled in realtime | 184 /// to validate if there is a corresponding AMP URL. This strategy has higher |
| 190 * to validate if there is a corresponding AMP URL. This strategy has higher | 185 /// coverage but with extra latency introduced by realtime crawling. This is |
| 191 * coverage but with extra latency introduced by realtime crawling. This is | 186 /// the default strategy. Applications using this strategy should set higher |
| 192 * the default strategy. Applications using this strategy should set higher | 187 /// HTTP timeouts of the API calls. |
| 193 * HTTP timeouts of the API calls. | 188 /// - "IN_INDEX_DOC" : IN_INDEX_DOC strategy skips fetching live documents of |
| 194 * - "IN_INDEX_DOC" : IN_INDEX_DOC strategy skips fetching live documents of | 189 /// URL(s) not found |
| 195 * URL(s) not found | 190 /// in index. For applications which need low latency use of IN_INDEX_DOC |
| 196 * in index. For applications which need low latency use of IN_INDEX_DOC | 191 /// strategy is recommended. |
| 197 * strategy is recommended. | |
| 198 */ | |
| 199 core.String lookupStrategy; | 192 core.String lookupStrategy; |
| 200 /** | 193 |
| 201 * List of URLs to look up for the paired AMP URLs. | 194 /// List of URLs to look up for the paired AMP URLs. |
| 202 * The URLs are case-sensitive. Up to 50 URLs per lookup | 195 /// The URLs are case-sensitive. Up to 50 URLs per lookup |
| 203 * (see [Usage Limits](/amp/cache/reference/limits)). | 196 /// (see [Usage Limits](/amp/cache/reference/limits)). |
| 204 */ | |
| 205 core.List<core.String> urls; | 197 core.List<core.String> urls; |
| 206 | 198 |
| 207 BatchGetAmpUrlsRequest(); | 199 BatchGetAmpUrlsRequest(); |
| 208 | 200 |
| 209 BatchGetAmpUrlsRequest.fromJson(core.Map _json) { | 201 BatchGetAmpUrlsRequest.fromJson(core.Map _json) { |
| 210 if (_json.containsKey("lookupStrategy")) { | 202 if (_json.containsKey("lookupStrategy")) { |
| 211 lookupStrategy = _json["lookupStrategy"]; | 203 lookupStrategy = _json["lookupStrategy"]; |
| 212 } | 204 } |
| 213 if (_json.containsKey("urls")) { | 205 if (_json.containsKey("urls")) { |
| 214 urls = _json["urls"]; | 206 urls = _json["urls"]; |
| 215 } | 207 } |
| 216 } | 208 } |
| 217 | 209 |
| 218 core.Map<core.String, core.Object> toJson() { | 210 core.Map<core.String, core.Object> toJson() { |
| 219 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 211 final core.Map<core.String, core.Object> _json = |
| 212 new core.Map<core.String, core.Object>(); |
| 220 if (lookupStrategy != null) { | 213 if (lookupStrategy != null) { |
| 221 _json["lookupStrategy"] = lookupStrategy; | 214 _json["lookupStrategy"] = lookupStrategy; |
| 222 } | 215 } |
| 223 if (urls != null) { | 216 if (urls != null) { |
| 224 _json["urls"] = urls; | 217 _json["urls"] = urls; |
| 225 } | 218 } |
| 226 return _json; | 219 return _json; |
| 227 } | 220 } |
| 228 } | 221 } |
| 229 | 222 |
| 230 /** Batch AMP URL response. */ | 223 /// Batch AMP URL response. |
| 231 class BatchGetAmpUrlsResponse { | 224 class BatchGetAmpUrlsResponse { |
| 232 /** | 225 /// For each URL in BatchAmpUrlsRequest, the URL response. The response might |
| 233 * For each URL in BatchAmpUrlsRequest, the URL response. The response might | 226 /// not be in the same order as URLs in the batch request. |
| 234 * not be in the same order as URLs in the batch request. | 227 /// If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated |
| 235 * If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated | 228 /// only once. |
| 236 * only once. | |
| 237 */ | |
| 238 core.List<AmpUrl> ampUrls; | 229 core.List<AmpUrl> ampUrls; |
| 239 /** The errors for requested URLs that have no AMP URL. */ | 230 |
| 231 /// The errors for requested URLs that have no AMP URL. |
| 240 core.List<AmpUrlError> urlErrors; | 232 core.List<AmpUrlError> urlErrors; |
| 241 | 233 |
| 242 BatchGetAmpUrlsResponse(); | 234 BatchGetAmpUrlsResponse(); |
| 243 | 235 |
| 244 BatchGetAmpUrlsResponse.fromJson(core.Map _json) { | 236 BatchGetAmpUrlsResponse.fromJson(core.Map _json) { |
| 245 if (_json.containsKey("ampUrls")) { | 237 if (_json.containsKey("ampUrls")) { |
| 246 ampUrls = _json["ampUrls"].map((value) => new AmpUrl.fromJson(value)).toLi
st(); | 238 ampUrls = |
| 239 _json["ampUrls"].map((value) => new AmpUrl.fromJson(value)).toList(); |
| 247 } | 240 } |
| 248 if (_json.containsKey("urlErrors")) { | 241 if (_json.containsKey("urlErrors")) { |
| 249 urlErrors = _json["urlErrors"].map((value) => new AmpUrlError.fromJson(val
ue)).toList(); | 242 urlErrors = _json["urlErrors"] |
| 243 .map((value) => new AmpUrlError.fromJson(value)) |
| 244 .toList(); |
| 250 } | 245 } |
| 251 } | 246 } |
| 252 | 247 |
| 253 core.Map<core.String, core.Object> toJson() { | 248 core.Map<core.String, core.Object> toJson() { |
| 254 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 249 final core.Map<core.String, core.Object> _json = |
| 250 new core.Map<core.String, core.Object>(); |
| 255 if (ampUrls != null) { | 251 if (ampUrls != null) { |
| 256 _json["ampUrls"] = ampUrls.map((value) => (value).toJson()).toList(); | 252 _json["ampUrls"] = ampUrls.map((value) => (value).toJson()).toList(); |
| 257 } | 253 } |
| 258 if (urlErrors != null) { | 254 if (urlErrors != null) { |
| 259 _json["urlErrors"] = urlErrors.map((value) => (value).toJson()).toList(); | 255 _json["urlErrors"] = urlErrors.map((value) => (value).toJson()).toList(); |
| 260 } | 256 } |
| 261 return _json; | 257 return _json; |
| 262 } | 258 } |
| 263 } | 259 } |
| OLD | NEW |