Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: generated/googleapis/lib/acceleratedmobilepageurl/v1.dart

Issue 2039113004: Api-roll 37: 2016-06-06 (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « generated/googleapis/README.md ('k') | generated/googleapis/lib/adexchangebuyer/v1_4.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // This is a generated file (see the discoveryapis_generator project).
2
3 library googleapis.acceleratedmobilepageurl.v1;
4
5 import 'dart:core' as core;
6 import 'dart:async' as async;
7 import 'dart:convert' as convert;
8
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons;
10 import 'package:http/http.dart' as http;
11
12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show
13 ApiRequestError, DetailedApiRequestError;
14
15 const core.String USER_AGENT = 'dart-api-client acceleratedmobilepageurl/v1';
16
17 /**
18 * This API contains a single method, batchGet. Call this method to retrieve the
19 * AMP URL (and equivalent AMP Cache URL) for given public URL(s).
20 */
21 class AcceleratedmobilepageurlApi {
22
23 final commons.ApiRequester _requester;
24
25 AmpUrlsResourceApi get ampUrls => new AmpUrlsResourceApi(_requester);
26
27 AcceleratedmobilepageurlApi(http.Client client, {core.String rootUrl: "https:/ /acceleratedmobilepageurl.googleapis.com/", core.String servicePath: ""}) :
28 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A GENT);
29 }
30
31
32 class AmpUrlsResourceApi {
33 final commons.ApiRequester _requester;
34
35 AmpUrlsResourceApi(commons.ApiRequester client) :
36 _requester = client;
37
38 /**
39 * Returns AMP URL(s) and equivalent
40 * [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format).
41 *
42 * [request] - The metadata request object.
43 *
44 * Request parameters:
45 *
46 * Completes with a [BatchGetAmpUrlsResponse].
47 *
48 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
49 * error.
50 *
51 * If the used [http.Client] completes with an error when making a REST call,
52 * this method will complete with the same error.
53 */
54 async.Future<BatchGetAmpUrlsResponse> batchGet(BatchGetAmpUrlsRequest request) {
55 var _url = null;
56 var _queryParams = new core.Map();
57 var _uploadMedia = null;
58 var _uploadOptions = null;
59 var _downloadOptions = commons.DownloadOptions.Metadata;
60 var _body = null;
61
62 if (request != null) {
63 _body = convert.JSON.encode((request).toJson());
64 }
65
66 _url = 'v1/ampUrls:batchGet';
67
68 var _response = _requester.request(_url,
69 "POST",
70 body: _body,
71 queryParams: _queryParams,
72 uploadOptions: _uploadOptions,
73 uploadMedia: _uploadMedia,
74 downloadOptions: _downloadOptions);
75 return _response.then((data) => new BatchGetAmpUrlsResponse.fromJson(data));
76 }
77
78 }
79
80
81
82 /** AMP URL response for a requested 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;
93
94 AmpUrl();
95
96 AmpUrl.fromJson(core.Map _json) {
97 if (_json.containsKey("ampUrl")) {
98 ampUrl = _json["ampUrl"];
99 }
100 if (_json.containsKey("cdnAmpUrl")) {
101 cdnAmpUrl = _json["cdnAmpUrl"];
102 }
103 if (_json.containsKey("originalUrl")) {
104 originalUrl = _json["originalUrl"];
105 }
106 }
107
108 core.Map toJson() {
109 var _json = new core.Map();
110 if (ampUrl != null) {
111 _json["ampUrl"] = ampUrl;
112 }
113 if (cdnAmpUrl != null) {
114 _json["cdnAmpUrl"] = cdnAmpUrl;
115 }
116 if (originalUrl != null) {
117 _json["originalUrl"] = originalUrl;
118 }
119 return _json;
120 }
121 }
122
123 /** AMP URL Error resource for a requested URL that couldn't be found. */
124 class AmpUrlError {
125 /**
126 * The error code of an API call.
127 * Possible string values are:
128 * - "ERROR_CODE_UNSPECIFIED" : Not specified error.
129 * - "INPUT_URL_NOT_FOUND" : Indicates the requested URL is not found for some
130 * reason -- for example,
131 * we receive an HTTP error code 404 when it is crawled.
132 * - "NO_AMP_URL" : Indicates no AMP URL has been found in the HTML of the
133 * requested URL.
134 * - "APPLICATION_ERROR" : Indicates some kind of application error occurred
135 * at the server.
136 * Client advised to retry.
137 * - "URL_IS_VALID_AMP" : Indicates the requested URL is a valid AMP URL.
138 * - "URL_IS_INVALID_AMP" : Indicates that the requested URL is an invalid AMP
139 * URL.
140 */
141 core.String errorCode;
142 /** An optional descriptive error message. */
143 core.String errorMessage;
144 /** The original non-AMP URL. */
145 core.String originalUrl;
146
147 AmpUrlError();
148
149 AmpUrlError.fromJson(core.Map _json) {
150 if (_json.containsKey("errorCode")) {
151 errorCode = _json["errorCode"];
152 }
153 if (_json.containsKey("errorMessage")) {
154 errorMessage = _json["errorMessage"];
155 }
156 if (_json.containsKey("originalUrl")) {
157 originalUrl = _json["originalUrl"];
158 }
159 }
160
161 core.Map toJson() {
162 var _json = new core.Map();
163 if (errorCode != null) {
164 _json["errorCode"] = errorCode;
165 }
166 if (errorMessage != null) {
167 _json["errorMessage"] = errorMessage;
168 }
169 if (originalUrl != null) {
170 _json["originalUrl"] = originalUrl;
171 }
172 return _json;
173 }
174 }
175
176 /** AMP URL request for a batch of URLs. */
177 class BatchGetAmpUrlsRequest {
178 /**
179 * List of URLs to look up for the paired AMP URLs.
180 * The URLs are case-sensitive. Up to 10 URLs per lookup
181 * (see [Usage Limits](/amp/cache/reference/limits)).
182 */
183 core.List<core.String> urls;
184
185 BatchGetAmpUrlsRequest();
186
187 BatchGetAmpUrlsRequest.fromJson(core.Map _json) {
188 if (_json.containsKey("urls")) {
189 urls = _json["urls"];
190 }
191 }
192
193 core.Map toJson() {
194 var _json = new core.Map();
195 if (urls != null) {
196 _json["urls"] = urls;
197 }
198 return _json;
199 }
200 }
201
202 /** Batch AMP URL response. */
203 class BatchGetAmpUrlsResponse {
204 /**
205 * For each URL in BatchAmpUrlsRequest, the URL response. The response might
206 * not be in the same order as URLs in the batch request.
207 * If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated
208 * only once.
209 */
210 core.List<AmpUrl> ampUrls;
211 /** The errors for requested URLs that have no AMP URL. */
212 core.List<AmpUrlError> urlErrors;
213
214 BatchGetAmpUrlsResponse();
215
216 BatchGetAmpUrlsResponse.fromJson(core.Map _json) {
217 if (_json.containsKey("ampUrls")) {
218 ampUrls = _json["ampUrls"].map((value) => new AmpUrl.fromJson(value)).toLi st();
219 }
220 if (_json.containsKey("urlErrors")) {
221 urlErrors = _json["urlErrors"].map((value) => new AmpUrlError.fromJson(val ue)).toList();
222 }
223 }
224
225 core.Map toJson() {
226 var _json = new core.Map();
227 if (ampUrls != null) {
228 _json["ampUrls"] = ampUrls.map((value) => (value).toJson()).toList();
229 }
230 if (urlErrors != null) {
231 _json["urlErrors"] = urlErrors.map((value) => (value).toJson()).toList();
232 }
233 return _json;
234 }
235 }
OLDNEW
« no previous file with comments | « generated/googleapis/README.md ('k') | generated/googleapis/lib/adexchangebuyer/v1_4.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698