OLD | NEW |
(Empty) | |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
| 3 library googleapis.cloudsearch.v1; |
| 4 |
| 5 import 'dart:core' as core; |
| 6 import 'dart:collection' as collection; |
| 7 import 'dart:async' as async; |
| 8 import 'dart:convert' as convert; |
| 9 |
| 10 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 11 import 'package:crypto/crypto.dart' as crypto; |
| 12 import 'package:http/http.dart' as http; |
| 13 |
| 14 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show |
| 15 ApiRequestError, DetailedApiRequestError; |
| 16 |
| 17 const core.String USER_AGENT = 'dart-api-client cloudsearch/v1'; |
| 18 |
| 19 /** |
| 20 * The Google Cloud Search API defines an application interface to index |
| 21 * documents that contain structured data and to search those indexes. It |
| 22 * supports full text search. |
| 23 */ |
| 24 class CloudsearchApi { |
| 25 /** View and manage your data across Google Cloud Platform services */ |
| 26 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; |
| 27 |
| 28 /** FOR TESTING ONLY */ |
| 29 static const CloudsearchScope = "https://www.googleapis.com/auth/cloudsearch"; |
| 30 |
| 31 /** View your email address */ |
| 32 static const UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.em
ail"; |
| 33 |
| 34 |
| 35 final commons.ApiRequester _requester; |
| 36 |
| 37 ProjectsResourceApi get projects => new ProjectsResourceApi(_requester); |
| 38 |
| 39 CloudsearchApi(http.Client client, {core.String rootUrl: "https://cloudsearch.
googleapis.com/", core.String servicePath: ""}) : |
| 40 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
| 41 } |
| 42 |
| 43 |
| 44 class ProjectsResourceApi { |
| 45 final commons.ApiRequester _requester; |
| 46 |
| 47 ProjectsIndexesResourceApi get indexes => new ProjectsIndexesResourceApi(_requ
ester); |
| 48 |
| 49 ProjectsResourceApi(commons.ApiRequester client) : |
| 50 _requester = client; |
| 51 } |
| 52 |
| 53 |
| 54 class ProjectsIndexesResourceApi { |
| 55 final commons.ApiRequester _requester; |
| 56 |
| 57 ProjectsIndexesDocumentsResourceApi get documents => new ProjectsIndexesDocume
ntsResourceApi(_requester); |
| 58 |
| 59 ProjectsIndexesResourceApi(commons.ApiRequester client) : |
| 60 _requester = client; |
| 61 |
| 62 /** |
| 63 * Lists search indexes belonging to the specified project. |
| 64 * |
| 65 * Request parameters: |
| 66 * |
| 67 * [projectId] - The project from which to retrieve indexes. It cannot be the |
| 68 * empty string. |
| 69 * |
| 70 * [indexNamePrefix] - The prefix of the index name. It is used to list all |
| 71 * indexes with names that have this prefix. |
| 72 * |
| 73 * [pageSize] - The maximum number of indexes to return per page. If not |
| 74 * specified, 100 indexes are returned per page. |
| 75 * |
| 76 * [pageToken] - A `nextPageToken` returned from previous list indexes call as |
| 77 * the starting point for this call. If not specified, list indexes from the |
| 78 * beginning. |
| 79 * |
| 80 * [view] - Specifies which parts of the IndexInfo resource is returned in the |
| 81 * response. If not specified, `ID_ONLY` is used. |
| 82 * Possible string values are: |
| 83 * - "INDEX_VIEW_UNSPECIFIED" : A INDEX_VIEW_UNSPECIFIED. |
| 84 * - "ID_ONLY" : A ID_ONLY. |
| 85 * - "FULL" : A FULL. |
| 86 * |
| 87 * Completes with a [ListIndexesResponse]. |
| 88 * |
| 89 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 90 * error. |
| 91 * |
| 92 * If the used [http.Client] completes with an error when making a REST call, |
| 93 * this method will complete with the same error. |
| 94 */ |
| 95 async.Future<ListIndexesResponse> list(core.String projectId, {core.String ind
exNamePrefix, core.int pageSize, core.String pageToken, core.String view}) { |
| 96 var _url = null; |
| 97 var _queryParams = new core.Map(); |
| 98 var _uploadMedia = null; |
| 99 var _uploadOptions = null; |
| 100 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 101 var _body = null; |
| 102 |
| 103 if (projectId == null) { |
| 104 throw new core.ArgumentError("Parameter projectId is required."); |
| 105 } |
| 106 if (indexNamePrefix != null) { |
| 107 _queryParams["indexNamePrefix"] = [indexNamePrefix]; |
| 108 } |
| 109 if (pageSize != null) { |
| 110 _queryParams["pageSize"] = ["${pageSize}"]; |
| 111 } |
| 112 if (pageToken != null) { |
| 113 _queryParams["pageToken"] = [pageToken]; |
| 114 } |
| 115 if (view != null) { |
| 116 _queryParams["view"] = [view]; |
| 117 } |
| 118 |
| 119 |
| 120 _url = 'v1/projects/' + commons.Escaper.ecapeVariable('$projectId') + '/inde
xes'; |
| 121 |
| 122 var _response = _requester.request(_url, |
| 123 "GET", |
| 124 body: _body, |
| 125 queryParams: _queryParams, |
| 126 uploadOptions: _uploadOptions, |
| 127 uploadMedia: _uploadMedia, |
| 128 downloadOptions: _downloadOptions); |
| 129 return _response.then((data) => new ListIndexesResponse.fromJson(data)); |
| 130 } |
| 131 |
| 132 /** |
| 133 * Lists the documents in the named index that match the query. |
| 134 * |
| 135 * Request parameters: |
| 136 * |
| 137 * [projectId] - The project associated with the index for searching document. |
| 138 * It cannot be the empty string. |
| 139 * |
| 140 * [indexId] - The index to search. It cannot be the empty string. |
| 141 * |
| 142 * [query] - The query string in search query syntax. If the query is missing |
| 143 * or empty, all documents are returned. |
| 144 * |
| 145 * [fieldExpressions] - Customized expressions used in `orderBy` or |
| 146 * `returnFields`. The expression can contain fields in `Document`, the |
| 147 * built-in fields ( `_rank`, the document rank, and `_score` if scoring is |
| 148 * enabled) and fields defined in `fieldExpressions`. Each field expression is |
| 149 * represented in a json object with the following fields: * `name`: the name |
| 150 * of the field expression in string. * `expression`: the expression to be |
| 151 * computed. It can be a combination of supported functions encoded in string. |
| 152 * Expressions involving number fields can use the arithmetical operators |
| 153 * (`+`, `-`, `*`, `/`) and the built-in numeric functions (`max`, `min`, |
| 154 * `pow`, `count`, `log`, `abs`). Expressions involving geopoint fields can |
| 155 * use the `geopoint` and `distance` functions. Expressions for text and html |
| 156 * fields can use the `snippet` function. For example: ``` |
| 157 * fieldExpressions={name: "TotalPrice", expression: "(Price+Tax)"} ``` ``` |
| 158 * fieldExpressions={name: "snippet", expression: "snippet('good times', |
| 159 * content)"} ``` The field expression names can be used in `orderBy` and |
| 160 * `returnFields` after they are defined in `fieldExpressions`. |
| 161 * |
| 162 * [pageSize] - The maximum number of search results to return per page. |
| 163 * Searches perform best when the `pageSize` is kept as small as possible. If |
| 164 * not specified, 10 results are returned per page. |
| 165 * |
| 166 * [pageToken] - A `nextPageToken` returned from previous Search call as the |
| 167 * starting point for this call. Pagination tokens provide better performance |
| 168 * and consistency than offsets, and they cannot be used in combination with |
| 169 * offsets. |
| 170 * |
| 171 * [offset] - Offset is used to move to an arbitrary result, independent of |
| 172 * the previous results. Offsets are inefficient when compared to `pageToken`. |
| 173 * `pageToken` and `offset` cannot be both set. The default value of `offset` |
| 174 * is 0. |
| 175 * |
| 176 * [matchedCountAccuracy] - Minimum accuracy requirement for `matchedCount` in |
| 177 * search response. If specified, `matchedCount` will be accurate up to at |
| 178 * least that number. For example, when set to 100, any `matchedCount <= 100` |
| 179 * is accurate. This option may add considerable latency/expense. By default |
| 180 * (when it is not specified or set to 0), the accuracy is the same as |
| 181 * `pageSize`. |
| 182 * |
| 183 * [orderBy] - Comma-separated list of fields for sorting on the search |
| 184 * result, including fields from `Document`, the built-in fields (`_rank` and |
| 185 * `_score`), and fields defined in `fieldExpressions`. For example: |
| 186 * `orderBy="foo,bar"`. The default sorting order is ascending. To specify |
| 187 * descending order for a field, a suffix `" desc"` should be appended to the |
| 188 * field name. For example: `orderBy="foo desc,bar"`. The default value for |
| 189 * text sort is the empty string, and the default value for numeric sort is 0. |
| 190 * If not specified, the search results are automatically sorted by descending |
| 191 * `_rank`. Sorting by ascending `_rank` is not allowed. |
| 192 * |
| 193 * [scorer] - The scoring function to invoke on a search result for this |
| 194 * query. If `scorer` is not set, scoring is disabled and `_score` is 0 for |
| 195 * all documents in the search result. To enable document relevancy score |
| 196 * based on term frequency, set `"scorer=generic"`. |
| 197 * |
| 198 * [scorerSize] - Maximum number of top retrieved results to score. It is |
| 199 * valid only when `scorer` is set. If not specified, 100 retrieved results |
| 200 * are scored. |
| 201 * |
| 202 * [returnFields] - List of fields to return in `SearchResult` objects. It can |
| 203 * be fields from `Document`, the built-in fields `_rank` and `_score`, and |
| 204 * fields defined in `fieldExpressions`. Use `"*"` to return all fields from |
| 205 * `Document`. |
| 206 * |
| 207 * Completes with a [SearchResponse]. |
| 208 * |
| 209 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 210 * error. |
| 211 * |
| 212 * If the used [http.Client] completes with an error when making a REST call, |
| 213 * this method will complete with the same error. |
| 214 */ |
| 215 async.Future<SearchResponse> search(core.String projectId, core.String indexId
, {core.String query, core.List<core.String> fieldExpressions, core.int pageSize
, core.String pageToken, core.int offset, core.int matchedCountAccuracy, core.St
ring orderBy, core.String scorer, core.int scorerSize, core.List<core.String> re
turnFields}) { |
| 216 var _url = null; |
| 217 var _queryParams = new core.Map(); |
| 218 var _uploadMedia = null; |
| 219 var _uploadOptions = null; |
| 220 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 221 var _body = null; |
| 222 |
| 223 if (projectId == null) { |
| 224 throw new core.ArgumentError("Parameter projectId is required."); |
| 225 } |
| 226 if (indexId == null) { |
| 227 throw new core.ArgumentError("Parameter indexId is required."); |
| 228 } |
| 229 if (query != null) { |
| 230 _queryParams["query"] = [query]; |
| 231 } |
| 232 if (fieldExpressions != null) { |
| 233 _queryParams["fieldExpressions"] = fieldExpressions; |
| 234 } |
| 235 if (pageSize != null) { |
| 236 _queryParams["pageSize"] = ["${pageSize}"]; |
| 237 } |
| 238 if (pageToken != null) { |
| 239 _queryParams["pageToken"] = [pageToken]; |
| 240 } |
| 241 if (offset != null) { |
| 242 _queryParams["offset"] = ["${offset}"]; |
| 243 } |
| 244 if (matchedCountAccuracy != null) { |
| 245 _queryParams["matchedCountAccuracy"] = ["${matchedCountAccuracy}"]; |
| 246 } |
| 247 if (orderBy != null) { |
| 248 _queryParams["orderBy"] = [orderBy]; |
| 249 } |
| 250 if (scorer != null) { |
| 251 _queryParams["scorer"] = [scorer]; |
| 252 } |
| 253 if (scorerSize != null) { |
| 254 _queryParams["scorerSize"] = ["${scorerSize}"]; |
| 255 } |
| 256 if (returnFields != null) { |
| 257 _queryParams["returnFields"] = returnFields; |
| 258 } |
| 259 |
| 260 |
| 261 _url = 'v1/projects/' + commons.Escaper.ecapeVariable('$projectId') + '/inde
xes/' + commons.Escaper.ecapeVariable('$indexId') + '/search'; |
| 262 |
| 263 var _response = _requester.request(_url, |
| 264 "GET", |
| 265 body: _body, |
| 266 queryParams: _queryParams, |
| 267 uploadOptions: _uploadOptions, |
| 268 uploadMedia: _uploadMedia, |
| 269 downloadOptions: _downloadOptions); |
| 270 return _response.then((data) => new SearchResponse.fromJson(data)); |
| 271 } |
| 272 |
| 273 } |
| 274 |
| 275 |
| 276 class ProjectsIndexesDocumentsResourceApi { |
| 277 final commons.ApiRequester _requester; |
| 278 |
| 279 ProjectsIndexesDocumentsResourceApi(commons.ApiRequester client) : |
| 280 _requester = client; |
| 281 |
| 282 /** |
| 283 * Inserts a document for indexing or updates an indexed document. The |
| 284 * returned document contains only the ID of the new document. When `docId` is |
| 285 * absent from the document, it is provided by the server. |
| 286 * |
| 287 * [request] - The metadata request object. |
| 288 * |
| 289 * Request parameters: |
| 290 * |
| 291 * [projectId] - The project associated with the index for adding document. It |
| 292 * cannot be the empty string. |
| 293 * |
| 294 * [indexId] - The index to add document to. It cannot be the empty string. |
| 295 * |
| 296 * Completes with a [Document]. |
| 297 * |
| 298 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 299 * error. |
| 300 * |
| 301 * If the used [http.Client] completes with an error when making a REST call, |
| 302 * this method will complete with the same error. |
| 303 */ |
| 304 async.Future<Document> create(Document request, core.String projectId, core.St
ring indexId) { |
| 305 var _url = null; |
| 306 var _queryParams = new core.Map(); |
| 307 var _uploadMedia = null; |
| 308 var _uploadOptions = null; |
| 309 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 310 var _body = null; |
| 311 |
| 312 if (request != null) { |
| 313 _body = convert.JSON.encode((request).toJson()); |
| 314 } |
| 315 if (projectId == null) { |
| 316 throw new core.ArgumentError("Parameter projectId is required."); |
| 317 } |
| 318 if (indexId == null) { |
| 319 throw new core.ArgumentError("Parameter indexId is required."); |
| 320 } |
| 321 |
| 322 |
| 323 _url = 'v1/projects/' + commons.Escaper.ecapeVariable('$projectId') + '/inde
xes/' + commons.Escaper.ecapeVariable('$indexId') + '/documents'; |
| 324 |
| 325 var _response = _requester.request(_url, |
| 326 "POST", |
| 327 body: _body, |
| 328 queryParams: _queryParams, |
| 329 uploadOptions: _uploadOptions, |
| 330 uploadMedia: _uploadMedia, |
| 331 downloadOptions: _downloadOptions); |
| 332 return _response.then((data) => new Document.fromJson(data)); |
| 333 } |
| 334 |
| 335 /** |
| 336 * Deletes a document from an index. |
| 337 * |
| 338 * Request parameters: |
| 339 * |
| 340 * [projectId] - The project associated with the index for deleting document. |
| 341 * It cannot be the empty string. |
| 342 * |
| 343 * [indexId] - The index from which to delete the document. It cannot be the |
| 344 * empty string. |
| 345 * |
| 346 * [docId] - The document to be deleted. It cannot be the empty string. |
| 347 * |
| 348 * Completes with a [Empty]. |
| 349 * |
| 350 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 351 * error. |
| 352 * |
| 353 * If the used [http.Client] completes with an error when making a REST call, |
| 354 * this method will complete with the same error. |
| 355 */ |
| 356 async.Future<Empty> delete(core.String projectId, core.String indexId, core.St
ring docId) { |
| 357 var _url = null; |
| 358 var _queryParams = new core.Map(); |
| 359 var _uploadMedia = null; |
| 360 var _uploadOptions = null; |
| 361 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 362 var _body = null; |
| 363 |
| 364 if (projectId == null) { |
| 365 throw new core.ArgumentError("Parameter projectId is required."); |
| 366 } |
| 367 if (indexId == null) { |
| 368 throw new core.ArgumentError("Parameter indexId is required."); |
| 369 } |
| 370 if (docId == null) { |
| 371 throw new core.ArgumentError("Parameter docId is required."); |
| 372 } |
| 373 |
| 374 |
| 375 _url = 'v1/projects/' + commons.Escaper.ecapeVariable('$projectId') + '/inde
xes/' + commons.Escaper.ecapeVariable('$indexId') + '/documents/' + commons.Esca
per.ecapeVariable('$docId'); |
| 376 |
| 377 var _response = _requester.request(_url, |
| 378 "DELETE", |
| 379 body: _body, |
| 380 queryParams: _queryParams, |
| 381 uploadOptions: _uploadOptions, |
| 382 uploadMedia: _uploadMedia, |
| 383 downloadOptions: _downloadOptions); |
| 384 return _response.then((data) => new Empty.fromJson(data)); |
| 385 } |
| 386 |
| 387 /** |
| 388 * Retrieves a document from an index. |
| 389 * |
| 390 * Request parameters: |
| 391 * |
| 392 * [projectId] - The project associated with the index for retrieving the |
| 393 * document. It cannot be the empty string. |
| 394 * |
| 395 * [indexId] - The index from which to retrieve the document. It cannot be the |
| 396 * empty string. |
| 397 * |
| 398 * [docId] - The identifier of the document to retrieve. It cannot be the |
| 399 * empty string. |
| 400 * |
| 401 * Completes with a [Document]. |
| 402 * |
| 403 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 404 * error. |
| 405 * |
| 406 * If the used [http.Client] completes with an error when making a REST call, |
| 407 * this method will complete with the same error. |
| 408 */ |
| 409 async.Future<Document> get(core.String projectId, core.String indexId, core.St
ring docId) { |
| 410 var _url = null; |
| 411 var _queryParams = new core.Map(); |
| 412 var _uploadMedia = null; |
| 413 var _uploadOptions = null; |
| 414 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 415 var _body = null; |
| 416 |
| 417 if (projectId == null) { |
| 418 throw new core.ArgumentError("Parameter projectId is required."); |
| 419 } |
| 420 if (indexId == null) { |
| 421 throw new core.ArgumentError("Parameter indexId is required."); |
| 422 } |
| 423 if (docId == null) { |
| 424 throw new core.ArgumentError("Parameter docId is required."); |
| 425 } |
| 426 |
| 427 |
| 428 _url = 'v1/projects/' + commons.Escaper.ecapeVariable('$projectId') + '/inde
xes/' + commons.Escaper.ecapeVariable('$indexId') + '/documents/' + commons.Esca
per.ecapeVariable('$docId'); |
| 429 |
| 430 var _response = _requester.request(_url, |
| 431 "GET", |
| 432 body: _body, |
| 433 queryParams: _queryParams, |
| 434 uploadOptions: _uploadOptions, |
| 435 uploadMedia: _uploadMedia, |
| 436 downloadOptions: _downloadOptions); |
| 437 return _response.then((data) => new Document.fromJson(data)); |
| 438 } |
| 439 |
| 440 /** |
| 441 * Lists documents in the specified search index. Intended for batch |
| 442 * processing. |
| 443 * |
| 444 * Request parameters: |
| 445 * |
| 446 * [projectId] - The project associated with the index for listing documents. |
| 447 * It cannot be the empty string. |
| 448 * |
| 449 * [indexId] - The index from which to list the documents. It cannot be the |
| 450 * empty string. |
| 451 * |
| 452 * [pageSize] - The maximum number of documents to return per page. If not |
| 453 * specified, 100 documents are returned per page. |
| 454 * |
| 455 * [pageToken] - A `nextPageToken` returned from previous list documents call |
| 456 * as the starting point for this call. If not specified, list documents from |
| 457 * the beginning. |
| 458 * |
| 459 * [view] - Specifies which part of the document resource is returned in the |
| 460 * response. If not specified, `ID_ONLY` is used. |
| 461 * Possible string values are: |
| 462 * - "DOCUMENT_VIEW_UNSPECIFIED" : A DOCUMENT_VIEW_UNSPECIFIED. |
| 463 * - "ID_ONLY" : A ID_ONLY. |
| 464 * - "FULL" : A FULL. |
| 465 * |
| 466 * Completes with a [ListDocumentsResponse]. |
| 467 * |
| 468 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 469 * error. |
| 470 * |
| 471 * If the used [http.Client] completes with an error when making a REST call, |
| 472 * this method will complete with the same error. |
| 473 */ |
| 474 async.Future<ListDocumentsResponse> list(core.String projectId, core.String in
dexId, {core.int pageSize, core.String pageToken, core.String view}) { |
| 475 var _url = null; |
| 476 var _queryParams = new core.Map(); |
| 477 var _uploadMedia = null; |
| 478 var _uploadOptions = null; |
| 479 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 480 var _body = null; |
| 481 |
| 482 if (projectId == null) { |
| 483 throw new core.ArgumentError("Parameter projectId is required."); |
| 484 } |
| 485 if (indexId == null) { |
| 486 throw new core.ArgumentError("Parameter indexId is required."); |
| 487 } |
| 488 if (pageSize != null) { |
| 489 _queryParams["pageSize"] = ["${pageSize}"]; |
| 490 } |
| 491 if (pageToken != null) { |
| 492 _queryParams["pageToken"] = [pageToken]; |
| 493 } |
| 494 if (view != null) { |
| 495 _queryParams["view"] = [view]; |
| 496 } |
| 497 |
| 498 |
| 499 _url = 'v1/projects/' + commons.Escaper.ecapeVariable('$projectId') + '/inde
xes/' + commons.Escaper.ecapeVariable('$indexId') + '/documents'; |
| 500 |
| 501 var _response = _requester.request(_url, |
| 502 "GET", |
| 503 body: _body, |
| 504 queryParams: _queryParams, |
| 505 uploadOptions: _uploadOptions, |
| 506 uploadMedia: _uploadMedia, |
| 507 downloadOptions: _downloadOptions); |
| 508 return _response.then((data) => new ListDocumentsResponse.fromJson(data)); |
| 509 } |
| 510 |
| 511 } |
| 512 |
| 513 |
| 514 |
| 515 /** The message representing a document resource. */ |
| 516 class Document { |
| 517 /** |
| 518 * The unique identifier of the document. It must contain only visible, |
| 519 * printable ASCII characters (ASCII codes 33 through 126 inclusive) and be no |
| 520 * longer than 500 characters. It cannot begin with an exclamation point |
| 521 * ('!'), and it can't begin and end with double underscores ("__"). If |
| 522 * missing, it is automatically assigned for the document. |
| 523 */ |
| 524 core.String docId; |
| 525 |
| 526 /** |
| 527 * The list of fields in the document. It cannot be the empty list. Each field |
| 528 * has a name and a list of values. The field name is unique to a document and |
| 529 * is case sensitive. The name can only contain ASCII characters. It must |
| 530 * start with a letter and can contain letters, digits, or underscore. It |
| 531 * cannot be longer than 500 characters and cannot be the empty string. A |
| 532 * field can have multiple values with same or different types, however, it |
| 533 * cannot have multiple Timestamp or number values. |
| 534 */ |
| 535 core.Map<core.String, FieldValueList> fields; |
| 536 |
| 537 /** |
| 538 * A positive integer which determines the default ordering of documents |
| 539 * returned from a search. The rank can be set explicitly when the document is |
| 540 * created. It is a bad idea to assign the same rank to many documents, and |
| 541 * the same rank should never be assigned to more than 10,000 documents. By |
| 542 * default (when it is not specified or set to 0), it is set at the time the |
| 543 * document is created to the number of seconds since January 1, 2011. The |
| 544 * rank can be used in field_expressions, order_by or return_fields in a |
| 545 * search request, where it is referenced as `_rank`. |
| 546 */ |
| 547 core.int rank; |
| 548 |
| 549 |
| 550 Document(); |
| 551 |
| 552 Document.fromJson(core.Map _json) { |
| 553 if (_json.containsKey("docId")) { |
| 554 docId = _json["docId"]; |
| 555 } |
| 556 if (_json.containsKey("fields")) { |
| 557 fields = commons.mapMap(_json["fields"], (item) => new FieldValueList.from
Json(item)); |
| 558 } |
| 559 if (_json.containsKey("rank")) { |
| 560 rank = _json["rank"]; |
| 561 } |
| 562 } |
| 563 |
| 564 core.Map toJson() { |
| 565 var _json = new core.Map(); |
| 566 if (docId != null) { |
| 567 _json["docId"] = docId; |
| 568 } |
| 569 if (fields != null) { |
| 570 _json["fields"] = commons.mapMap(fields, (item) => (item).toJson()); |
| 571 } |
| 572 if (rank != null) { |
| 573 _json["rank"] = rank; |
| 574 } |
| 575 return _json; |
| 576 } |
| 577 } |
| 578 |
| 579 |
| 580 /** |
| 581 * A generic empty message that you can re-use to avoid defining duplicated |
| 582 * empty messages in your APIs. A typical example is to use it as the request or |
| 583 * the response type of an API method. For instance: service Foo { rpc |
| 584 * Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } |
| 585 */ |
| 586 class Empty { |
| 587 |
| 588 Empty(); |
| 589 |
| 590 Empty.fromJson(core.Map _json) { |
| 591 } |
| 592 |
| 593 core.Map toJson() { |
| 594 var _json = new core.Map(); |
| 595 return _json; |
| 596 } |
| 597 } |
| 598 |
| 599 |
| 600 /** Names of indexed fields. */ |
| 601 class FieldNames { |
| 602 /** The names of fields in which ATOM values are stored. */ |
| 603 core.List<core.String> atomFields; |
| 604 |
| 605 /** The names of fields in which DATE values are stored. */ |
| 606 core.List<core.String> dateFields; |
| 607 |
| 608 /** The names of fields in which GEO values are stored. */ |
| 609 core.List<core.String> geoFields; |
| 610 |
| 611 /** The names of fields in which HTML values are stored. */ |
| 612 core.List<core.String> htmlFields; |
| 613 |
| 614 /** The names of fields in which NUMBER values are stored. */ |
| 615 core.List<core.String> numberFields; |
| 616 |
| 617 /** The names of fields in which TEXT values are stored. */ |
| 618 core.List<core.String> textFields; |
| 619 |
| 620 |
| 621 FieldNames(); |
| 622 |
| 623 FieldNames.fromJson(core.Map _json) { |
| 624 if (_json.containsKey("atomFields")) { |
| 625 atomFields = _json["atomFields"]; |
| 626 } |
| 627 if (_json.containsKey("dateFields")) { |
| 628 dateFields = _json["dateFields"]; |
| 629 } |
| 630 if (_json.containsKey("geoFields")) { |
| 631 geoFields = _json["geoFields"]; |
| 632 } |
| 633 if (_json.containsKey("htmlFields")) { |
| 634 htmlFields = _json["htmlFields"]; |
| 635 } |
| 636 if (_json.containsKey("numberFields")) { |
| 637 numberFields = _json["numberFields"]; |
| 638 } |
| 639 if (_json.containsKey("textFields")) { |
| 640 textFields = _json["textFields"]; |
| 641 } |
| 642 } |
| 643 |
| 644 core.Map toJson() { |
| 645 var _json = new core.Map(); |
| 646 if (atomFields != null) { |
| 647 _json["atomFields"] = atomFields; |
| 648 } |
| 649 if (dateFields != null) { |
| 650 _json["dateFields"] = dateFields; |
| 651 } |
| 652 if (geoFields != null) { |
| 653 _json["geoFields"] = geoFields; |
| 654 } |
| 655 if (htmlFields != null) { |
| 656 _json["htmlFields"] = htmlFields; |
| 657 } |
| 658 if (numberFields != null) { |
| 659 _json["numberFields"] = numberFields; |
| 660 } |
| 661 if (textFields != null) { |
| 662 _json["textFields"] = textFields; |
| 663 } |
| 664 return _json; |
| 665 } |
| 666 } |
| 667 |
| 668 |
| 669 /** |
| 670 * The value of a document field and associated metadata. Exactly one of the |
| 671 * value fields may be set. |
| 672 */ |
| 673 class FieldValue { |
| 674 /** |
| 675 * The value of a GEO-valued field, represented in string with any of the |
| 676 * listed [ways of writing |
| 677 * coordinates](http://en.wikipedia.org/wiki/Geographic_coordinate_conversion#
Ways_of_writing_coordinates) |
| 678 */ |
| 679 core.String geoValue; |
| 680 |
| 681 /** |
| 682 * The language of a string value. If given, the language must be a valid `ISO |
| 683 * 639-1` code. |
| 684 */ |
| 685 core.String lang; |
| 686 |
| 687 /** The value of a number-valued field. */ |
| 688 core.double numberValue; |
| 689 |
| 690 /** |
| 691 * The format of a string value. By default, the string format is `DEFAULT`, |
| 692 * where a format will be automatically detected. |
| 693 * Possible string values are: |
| 694 * - "DEFAULT" : A DEFAULT. |
| 695 * - "ATOM" : A ATOM. |
| 696 * - "TEXT" : A TEXT. |
| 697 * - "HTML" : A HTML. |
| 698 */ |
| 699 core.String stringFormat; |
| 700 |
| 701 /** The value of a string-valued field. */ |
| 702 core.String stringValue; |
| 703 |
| 704 /** The value of a timestamp-valued field. */ |
| 705 core.String timestampValue; |
| 706 |
| 707 |
| 708 FieldValue(); |
| 709 |
| 710 FieldValue.fromJson(core.Map _json) { |
| 711 if (_json.containsKey("geoValue")) { |
| 712 geoValue = _json["geoValue"]; |
| 713 } |
| 714 if (_json.containsKey("lang")) { |
| 715 lang = _json["lang"]; |
| 716 } |
| 717 if (_json.containsKey("numberValue")) { |
| 718 numberValue = _json["numberValue"]; |
| 719 } |
| 720 if (_json.containsKey("stringFormat")) { |
| 721 stringFormat = _json["stringFormat"]; |
| 722 } |
| 723 if (_json.containsKey("stringValue")) { |
| 724 stringValue = _json["stringValue"]; |
| 725 } |
| 726 if (_json.containsKey("timestampValue")) { |
| 727 timestampValue = _json["timestampValue"]; |
| 728 } |
| 729 } |
| 730 |
| 731 core.Map toJson() { |
| 732 var _json = new core.Map(); |
| 733 if (geoValue != null) { |
| 734 _json["geoValue"] = geoValue; |
| 735 } |
| 736 if (lang != null) { |
| 737 _json["lang"] = lang; |
| 738 } |
| 739 if (numberValue != null) { |
| 740 _json["numberValue"] = numberValue; |
| 741 } |
| 742 if (stringFormat != null) { |
| 743 _json["stringFormat"] = stringFormat; |
| 744 } |
| 745 if (stringValue != null) { |
| 746 _json["stringValue"] = stringValue; |
| 747 } |
| 748 if (timestampValue != null) { |
| 749 _json["timestampValue"] = timestampValue; |
| 750 } |
| 751 return _json; |
| 752 } |
| 753 } |
| 754 |
| 755 |
| 756 /** The values of a document field under the same field name. */ |
| 757 class FieldValueList { |
| 758 /** The list of typed values. */ |
| 759 core.List<FieldValue> values; |
| 760 |
| 761 |
| 762 FieldValueList(); |
| 763 |
| 764 FieldValueList.fromJson(core.Map _json) { |
| 765 if (_json.containsKey("values")) { |
| 766 values = _json["values"].map((value) => new FieldValue.fromJson(value)).to
List(); |
| 767 } |
| 768 } |
| 769 |
| 770 core.Map toJson() { |
| 771 var _json = new core.Map(); |
| 772 if (values != null) { |
| 773 _json["values"] = values.map((value) => (value).toJson()).toList(); |
| 774 } |
| 775 return _json; |
| 776 } |
| 777 } |
| 778 |
| 779 |
| 780 /** Information about an index. */ |
| 781 class IndexInfo { |
| 782 /** |
| 783 * The index identifier. It cannot be the empty string. It must contain only |
| 784 * visible, printable ASCII characters (ASCII codes 33 through 126 inclusive) |
| 785 * and be no longer than 100 characters. It cannot begin with an exclamation |
| 786 * point ('!'), and it can't begin and end with double underscores ("__"). |
| 787 */ |
| 788 core.String indexId; |
| 789 |
| 790 /** Names of indexed fields. */ |
| 791 FieldNames indexedField; |
| 792 |
| 793 /** The project associated with the index. It cannot be the empty string. */ |
| 794 core.String projectId; |
| 795 |
| 796 |
| 797 IndexInfo(); |
| 798 |
| 799 IndexInfo.fromJson(core.Map _json) { |
| 800 if (_json.containsKey("indexId")) { |
| 801 indexId = _json["indexId"]; |
| 802 } |
| 803 if (_json.containsKey("indexedField")) { |
| 804 indexedField = new FieldNames.fromJson(_json["indexedField"]); |
| 805 } |
| 806 if (_json.containsKey("projectId")) { |
| 807 projectId = _json["projectId"]; |
| 808 } |
| 809 } |
| 810 |
| 811 core.Map toJson() { |
| 812 var _json = new core.Map(); |
| 813 if (indexId != null) { |
| 814 _json["indexId"] = indexId; |
| 815 } |
| 816 if (indexedField != null) { |
| 817 _json["indexedField"] = (indexedField).toJson(); |
| 818 } |
| 819 if (projectId != null) { |
| 820 _json["projectId"] = projectId; |
| 821 } |
| 822 return _json; |
| 823 } |
| 824 } |
| 825 |
| 826 |
| 827 /** A response returned from a listing documents request. */ |
| 828 class ListDocumentsResponse { |
| 829 /** The list of documents. */ |
| 830 core.List<Document> documents; |
| 831 |
| 832 /** |
| 833 * If there are more results, retrieve them by invoking list documents call |
| 834 * with the same arguments and this `nextPageToken`. If there are no more |
| 835 * results, this field is not set. |
| 836 */ |
| 837 core.String nextPageToken; |
| 838 |
| 839 |
| 840 ListDocumentsResponse(); |
| 841 |
| 842 ListDocumentsResponse.fromJson(core.Map _json) { |
| 843 if (_json.containsKey("documents")) { |
| 844 documents = _json["documents"].map((value) => new Document.fromJson(value)
).toList(); |
| 845 } |
| 846 if (_json.containsKey("nextPageToken")) { |
| 847 nextPageToken = _json["nextPageToken"]; |
| 848 } |
| 849 } |
| 850 |
| 851 core.Map toJson() { |
| 852 var _json = new core.Map(); |
| 853 if (documents != null) { |
| 854 _json["documents"] = documents.map((value) => (value).toJson()).toList(); |
| 855 } |
| 856 if (nextPageToken != null) { |
| 857 _json["nextPageToken"] = nextPageToken; |
| 858 } |
| 859 return _json; |
| 860 } |
| 861 } |
| 862 |
| 863 |
| 864 /** A response returned from a listing indexes request. */ |
| 865 class ListIndexesResponse { |
| 866 /** The information about available indexes. */ |
| 867 core.List<IndexInfo> indexes; |
| 868 |
| 869 /** |
| 870 * If there are more results, retrieve them by invoking list indexes call with |
| 871 * the same arguments and this `nextPageToken`. If there are no more results, |
| 872 * this field is not set. |
| 873 */ |
| 874 core.String nextPageToken; |
| 875 |
| 876 |
| 877 ListIndexesResponse(); |
| 878 |
| 879 ListIndexesResponse.fromJson(core.Map _json) { |
| 880 if (_json.containsKey("indexes")) { |
| 881 indexes = _json["indexes"].map((value) => new IndexInfo.fromJson(value)).t
oList(); |
| 882 } |
| 883 if (_json.containsKey("nextPageToken")) { |
| 884 nextPageToken = _json["nextPageToken"]; |
| 885 } |
| 886 } |
| 887 |
| 888 core.Map toJson() { |
| 889 var _json = new core.Map(); |
| 890 if (indexes != null) { |
| 891 _json["indexes"] = indexes.map((value) => (value).toJson()).toList(); |
| 892 } |
| 893 if (nextPageToken != null) { |
| 894 _json["nextPageToken"] = nextPageToken; |
| 895 } |
| 896 return _json; |
| 897 } |
| 898 } |
| 899 |
| 900 |
| 901 /** A response returned from a search request. */ |
| 902 class SearchResponse { |
| 903 /** |
| 904 * The number of documents that match the query. It is greater than or equal |
| 905 * to the number of documents actually returned. This is an approximation and |
| 906 * not an exact count unless it is less than or equal to |
| 907 * `matchedCountAccuracy` in search parameter. |
| 908 */ |
| 909 core.String matchedCount; |
| 910 |
| 911 /** The list of documents that match the search query. */ |
| 912 core.List<SearchResult> results; |
| 913 |
| 914 |
| 915 SearchResponse(); |
| 916 |
| 917 SearchResponse.fromJson(core.Map _json) { |
| 918 if (_json.containsKey("matchedCount")) { |
| 919 matchedCount = _json["matchedCount"]; |
| 920 } |
| 921 if (_json.containsKey("results")) { |
| 922 results = _json["results"].map((value) => new SearchResult.fromJson(value)
).toList(); |
| 923 } |
| 924 } |
| 925 |
| 926 core.Map toJson() { |
| 927 var _json = new core.Map(); |
| 928 if (matchedCount != null) { |
| 929 _json["matchedCount"] = matchedCount; |
| 930 } |
| 931 if (results != null) { |
| 932 _json["results"] = results.map((value) => (value).toJson()).toList(); |
| 933 } |
| 934 return _json; |
| 935 } |
| 936 } |
| 937 |
| 938 |
| 939 /** A document returned in a SearchResponse. */ |
| 940 class SearchResult { |
| 941 /** The unique identifier of the document. */ |
| 942 core.String docId; |
| 943 |
| 944 /** |
| 945 * The list of fields in the result. Each field is either from the stored |
| 946 * document, the built-in fields (`_rank`, the document rank, and `_score` if |
| 947 * scoring is enabled), or computed from any extra `fieldExpressions` defined |
| 948 * in the request. For example, if a request contains a `fieldExpressions` |
| 949 * named `"TotalPrice"` and expressed as `"Price + Tax"`, the result will have |
| 950 * a field whose name is `"TotalPrice"` and whose value is set to the computed |
| 951 * sum of the value of field `"Price"` and the value of field `"Tax"`. If a |
| 952 * request contains a `fieldExpressions` named `"snippet"` and expressed as |
| 953 * `"snippet(\"good times\", content)"`, the result will have a field whose |
| 954 * name is `"snippet"` and whose value contains a snippet of text from field |
| 955 * `"content"` matching the query "good times". |
| 956 */ |
| 957 core.Map<core.String, FieldValueList> fields; |
| 958 |
| 959 /** |
| 960 * If there are more results, retrieve them by invoking search call with the |
| 961 * same arguments and this `nextPageToken`. If there are no more results, this |
| 962 * field is not set. |
| 963 */ |
| 964 core.String nextPageToken; |
| 965 |
| 966 |
| 967 SearchResult(); |
| 968 |
| 969 SearchResult.fromJson(core.Map _json) { |
| 970 if (_json.containsKey("docId")) { |
| 971 docId = _json["docId"]; |
| 972 } |
| 973 if (_json.containsKey("fields")) { |
| 974 fields = commons.mapMap(_json["fields"], (item) => new FieldValueList.from
Json(item)); |
| 975 } |
| 976 if (_json.containsKey("nextPageToken")) { |
| 977 nextPageToken = _json["nextPageToken"]; |
| 978 } |
| 979 } |
| 980 |
| 981 core.Map toJson() { |
| 982 var _json = new core.Map(); |
| 983 if (docId != null) { |
| 984 _json["docId"] = docId; |
| 985 } |
| 986 if (fields != null) { |
| 987 _json["fields"] = commons.mapMap(fields, (item) => (item).toJson()); |
| 988 } |
| 989 if (nextPageToken != null) { |
| 990 _json["nextPageToken"] = nextPageToken; |
| 991 } |
| 992 return _json; |
| 993 } |
| 994 } |
OLD | NEW |