OLD | NEW |
(Empty) | |
| 1 library googleapis.licensing.v1; |
| 2 |
| 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; |
| 7 |
| 8 import "package:crypto/crypto.dart" as crypto; |
| 9 import 'package:http/http.dart' as http; |
| 10 import '../src/common_internal.dart' as common_internal; |
| 11 import '../common/common.dart' as common; |
| 12 |
| 13 export '../common/common.dart' show ApiRequestError; |
| 14 export '../common/common.dart' show DetailedApiRequestError; |
| 15 |
| 16 /** Licensing API to view and manage license for your domain. */ |
| 17 class LicensingApi { |
| 18 |
| 19 final common_internal.ApiRequester _requester; |
| 20 |
| 21 LicenseAssignmentsResourceApi get licenseAssignments => new LicenseAssignments
ResourceApi(_requester); |
| 22 |
| 23 LicensingApi(http.Client client) : |
| 24 _requester = new common_internal.ApiRequester(client, "https://www.googlea
pis.com/", "/apps/licensing/v1/product/"); |
| 25 } |
| 26 |
| 27 |
| 28 /** Not documented yet. */ |
| 29 class LicenseAssignmentsResourceApi { |
| 30 final common_internal.ApiRequester _requester; |
| 31 |
| 32 LicenseAssignmentsResourceApi(common_internal.ApiRequester client) : |
| 33 _requester = client; |
| 34 |
| 35 /** |
| 36 * Revoke License. |
| 37 * |
| 38 * Request parameters: |
| 39 * |
| 40 * [productId] - Name for product |
| 41 * |
| 42 * [skuId] - Name for sku |
| 43 * |
| 44 * [userId] - email id or unique Id of the user |
| 45 * |
| 46 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 47 * error. |
| 48 * |
| 49 * If the used [http.Client] completes with an error when making a REST call, |
| 50 * this method will complete with the same error. |
| 51 */ |
| 52 async.Future delete(core.String productId, core.String skuId, core.String user
Id) { |
| 53 var _url = null; |
| 54 var _queryParams = new core.Map(); |
| 55 var _uploadMedia = null; |
| 56 var _uploadOptions = null; |
| 57 var _downloadOptions = common.DownloadOptions.Metadata; |
| 58 var _body = null; |
| 59 |
| 60 if (productId == null) { |
| 61 throw new core.ArgumentError("Parameter productId is required."); |
| 62 } |
| 63 if (skuId == null) { |
| 64 throw new core.ArgumentError("Parameter skuId is required."); |
| 65 } |
| 66 if (userId == null) { |
| 67 throw new core.ArgumentError("Parameter userId is required."); |
| 68 } |
| 69 |
| 70 _downloadOptions = null; |
| 71 |
| 72 _url = common_internal.Escaper.ecapeVariable('$productId') + '/sku/' + commo
n_internal.Escaper.ecapeVariable('$skuId') + '/user/' + common_internal.Escaper.
ecapeVariable('$userId'); |
| 73 |
| 74 var _response = _requester.request(_url, |
| 75 "DELETE", |
| 76 body: _body, |
| 77 queryParams: _queryParams, |
| 78 uploadOptions: _uploadOptions, |
| 79 uploadMedia: _uploadMedia, |
| 80 downloadOptions: _downloadOptions); |
| 81 return _response.then((data) => null); |
| 82 } |
| 83 |
| 84 /** |
| 85 * Get license assignment of a particular product and sku for a user |
| 86 * |
| 87 * Request parameters: |
| 88 * |
| 89 * [productId] - Name for product |
| 90 * |
| 91 * [skuId] - Name for sku |
| 92 * |
| 93 * [userId] - email id or unique Id of the user |
| 94 * |
| 95 * Completes with a [LicenseAssignment]. |
| 96 * |
| 97 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 98 * error. |
| 99 * |
| 100 * If the used [http.Client] completes with an error when making a REST call, |
| 101 * this method will complete with the same error. |
| 102 */ |
| 103 async.Future<LicenseAssignment> get(core.String productId, core.String skuId,
core.String userId) { |
| 104 var _url = null; |
| 105 var _queryParams = new core.Map(); |
| 106 var _uploadMedia = null; |
| 107 var _uploadOptions = null; |
| 108 var _downloadOptions = common.DownloadOptions.Metadata; |
| 109 var _body = null; |
| 110 |
| 111 if (productId == null) { |
| 112 throw new core.ArgumentError("Parameter productId is required."); |
| 113 } |
| 114 if (skuId == null) { |
| 115 throw new core.ArgumentError("Parameter skuId is required."); |
| 116 } |
| 117 if (userId == null) { |
| 118 throw new core.ArgumentError("Parameter userId is required."); |
| 119 } |
| 120 |
| 121 |
| 122 _url = common_internal.Escaper.ecapeVariable('$productId') + '/sku/' + commo
n_internal.Escaper.ecapeVariable('$skuId') + '/user/' + common_internal.Escaper.
ecapeVariable('$userId'); |
| 123 |
| 124 var _response = _requester.request(_url, |
| 125 "GET", |
| 126 body: _body, |
| 127 queryParams: _queryParams, |
| 128 uploadOptions: _uploadOptions, |
| 129 uploadMedia: _uploadMedia, |
| 130 downloadOptions: _downloadOptions); |
| 131 return _response.then((data) => new LicenseAssignment.fromJson(data)); |
| 132 } |
| 133 |
| 134 /** |
| 135 * Assign License. |
| 136 * |
| 137 * [request] - The metadata request object. |
| 138 * |
| 139 * Request parameters: |
| 140 * |
| 141 * [productId] - Name for product |
| 142 * |
| 143 * [skuId] - Name for sku |
| 144 * |
| 145 * Completes with a [LicenseAssignment]. |
| 146 * |
| 147 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 148 * error. |
| 149 * |
| 150 * If the used [http.Client] completes with an error when making a REST call, |
| 151 * this method will complete with the same error. |
| 152 */ |
| 153 async.Future<LicenseAssignment> insert(LicenseAssignmentInsert request, core.S
tring productId, core.String skuId) { |
| 154 var _url = null; |
| 155 var _queryParams = new core.Map(); |
| 156 var _uploadMedia = null; |
| 157 var _uploadOptions = null; |
| 158 var _downloadOptions = common.DownloadOptions.Metadata; |
| 159 var _body = null; |
| 160 |
| 161 if (request != null) { |
| 162 _body = convert.JSON.encode((request).toJson()); |
| 163 } |
| 164 if (productId == null) { |
| 165 throw new core.ArgumentError("Parameter productId is required."); |
| 166 } |
| 167 if (skuId == null) { |
| 168 throw new core.ArgumentError("Parameter skuId is required."); |
| 169 } |
| 170 |
| 171 |
| 172 _url = common_internal.Escaper.ecapeVariable('$productId') + '/sku/' + commo
n_internal.Escaper.ecapeVariable('$skuId') + '/user'; |
| 173 |
| 174 var _response = _requester.request(_url, |
| 175 "POST", |
| 176 body: _body, |
| 177 queryParams: _queryParams, |
| 178 uploadOptions: _uploadOptions, |
| 179 uploadMedia: _uploadMedia, |
| 180 downloadOptions: _downloadOptions); |
| 181 return _response.then((data) => new LicenseAssignment.fromJson(data)); |
| 182 } |
| 183 |
| 184 /** |
| 185 * List license assignments for given product of the customer. |
| 186 * |
| 187 * Request parameters: |
| 188 * |
| 189 * [productId] - Name for product |
| 190 * |
| 191 * [customerId] - CustomerId represents the customer for whom |
| 192 * licenseassignments are queried |
| 193 * |
| 194 * [maxResults] - Maximum number of campaigns to return at one time. Must be |
| 195 * positive. Optional. Default value is 100. |
| 196 * Value must be between "1" and "1000". |
| 197 * |
| 198 * [pageToken] - Token to fetch the next page.Optional. By default server will |
| 199 * return first page |
| 200 * |
| 201 * Completes with a [LicenseAssignmentList]. |
| 202 * |
| 203 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 204 * error. |
| 205 * |
| 206 * If the used [http.Client] completes with an error when making a REST call, |
| 207 * this method will complete with the same error. |
| 208 */ |
| 209 async.Future<LicenseAssignmentList> listForProduct(core.String productId, core
.String customerId, {core.int maxResults, core.String pageToken}) { |
| 210 var _url = null; |
| 211 var _queryParams = new core.Map(); |
| 212 var _uploadMedia = null; |
| 213 var _uploadOptions = null; |
| 214 var _downloadOptions = common.DownloadOptions.Metadata; |
| 215 var _body = null; |
| 216 |
| 217 if (productId == null) { |
| 218 throw new core.ArgumentError("Parameter productId is required."); |
| 219 } |
| 220 if (customerId == null) { |
| 221 throw new core.ArgumentError("Parameter customerId is required."); |
| 222 } |
| 223 _queryParams["customerId"] = [customerId]; |
| 224 if (maxResults != null) { |
| 225 _queryParams["maxResults"] = ["${maxResults}"]; |
| 226 } |
| 227 if (pageToken != null) { |
| 228 _queryParams["pageToken"] = [pageToken]; |
| 229 } |
| 230 |
| 231 |
| 232 _url = common_internal.Escaper.ecapeVariable('$productId') + '/users'; |
| 233 |
| 234 var _response = _requester.request(_url, |
| 235 "GET", |
| 236 body: _body, |
| 237 queryParams: _queryParams, |
| 238 uploadOptions: _uploadOptions, |
| 239 uploadMedia: _uploadMedia, |
| 240 downloadOptions: _downloadOptions); |
| 241 return _response.then((data) => new LicenseAssignmentList.fromJson(data)); |
| 242 } |
| 243 |
| 244 /** |
| 245 * List license assignments for given product and sku of the customer. |
| 246 * |
| 247 * Request parameters: |
| 248 * |
| 249 * [productId] - Name for product |
| 250 * |
| 251 * [skuId] - Name for sku |
| 252 * |
| 253 * [customerId] - CustomerId represents the customer for whom |
| 254 * licenseassignments are queried |
| 255 * |
| 256 * [maxResults] - Maximum number of campaigns to return at one time. Must be |
| 257 * positive. Optional. Default value is 100. |
| 258 * Value must be between "1" and "1000". |
| 259 * |
| 260 * [pageToken] - Token to fetch the next page.Optional. By default server will |
| 261 * return first page |
| 262 * |
| 263 * Completes with a [LicenseAssignmentList]. |
| 264 * |
| 265 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 266 * error. |
| 267 * |
| 268 * If the used [http.Client] completes with an error when making a REST call, |
| 269 * this method will complete with the same error. |
| 270 */ |
| 271 async.Future<LicenseAssignmentList> listForProductAndSku(core.String productId
, core.String skuId, core.String customerId, {core.int maxResults, core.String p
ageToken}) { |
| 272 var _url = null; |
| 273 var _queryParams = new core.Map(); |
| 274 var _uploadMedia = null; |
| 275 var _uploadOptions = null; |
| 276 var _downloadOptions = common.DownloadOptions.Metadata; |
| 277 var _body = null; |
| 278 |
| 279 if (productId == null) { |
| 280 throw new core.ArgumentError("Parameter productId is required."); |
| 281 } |
| 282 if (skuId == null) { |
| 283 throw new core.ArgumentError("Parameter skuId is required."); |
| 284 } |
| 285 if (customerId == null) { |
| 286 throw new core.ArgumentError("Parameter customerId is required."); |
| 287 } |
| 288 _queryParams["customerId"] = [customerId]; |
| 289 if (maxResults != null) { |
| 290 _queryParams["maxResults"] = ["${maxResults}"]; |
| 291 } |
| 292 if (pageToken != null) { |
| 293 _queryParams["pageToken"] = [pageToken]; |
| 294 } |
| 295 |
| 296 |
| 297 _url = common_internal.Escaper.ecapeVariable('$productId') + '/sku/' + commo
n_internal.Escaper.ecapeVariable('$skuId') + '/users'; |
| 298 |
| 299 var _response = _requester.request(_url, |
| 300 "GET", |
| 301 body: _body, |
| 302 queryParams: _queryParams, |
| 303 uploadOptions: _uploadOptions, |
| 304 uploadMedia: _uploadMedia, |
| 305 downloadOptions: _downloadOptions); |
| 306 return _response.then((data) => new LicenseAssignmentList.fromJson(data)); |
| 307 } |
| 308 |
| 309 /** |
| 310 * Assign License. This method supports patch semantics. |
| 311 * |
| 312 * [request] - The metadata request object. |
| 313 * |
| 314 * Request parameters: |
| 315 * |
| 316 * [productId] - Name for product |
| 317 * |
| 318 * [skuId] - Name for sku for which license would be revoked |
| 319 * |
| 320 * [userId] - email id or unique Id of the user |
| 321 * |
| 322 * Completes with a [LicenseAssignment]. |
| 323 * |
| 324 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 325 * error. |
| 326 * |
| 327 * If the used [http.Client] completes with an error when making a REST call, |
| 328 * this method will complete with the same error. |
| 329 */ |
| 330 async.Future<LicenseAssignment> patch(LicenseAssignment request, core.String p
roductId, core.String skuId, core.String userId) { |
| 331 var _url = null; |
| 332 var _queryParams = new core.Map(); |
| 333 var _uploadMedia = null; |
| 334 var _uploadOptions = null; |
| 335 var _downloadOptions = common.DownloadOptions.Metadata; |
| 336 var _body = null; |
| 337 |
| 338 if (request != null) { |
| 339 _body = convert.JSON.encode((request).toJson()); |
| 340 } |
| 341 if (productId == null) { |
| 342 throw new core.ArgumentError("Parameter productId is required."); |
| 343 } |
| 344 if (skuId == null) { |
| 345 throw new core.ArgumentError("Parameter skuId is required."); |
| 346 } |
| 347 if (userId == null) { |
| 348 throw new core.ArgumentError("Parameter userId is required."); |
| 349 } |
| 350 |
| 351 |
| 352 _url = common_internal.Escaper.ecapeVariable('$productId') + '/sku/' + commo
n_internal.Escaper.ecapeVariable('$skuId') + '/user/' + common_internal.Escaper.
ecapeVariable('$userId'); |
| 353 |
| 354 var _response = _requester.request(_url, |
| 355 "PATCH", |
| 356 body: _body, |
| 357 queryParams: _queryParams, |
| 358 uploadOptions: _uploadOptions, |
| 359 uploadMedia: _uploadMedia, |
| 360 downloadOptions: _downloadOptions); |
| 361 return _response.then((data) => new LicenseAssignment.fromJson(data)); |
| 362 } |
| 363 |
| 364 /** |
| 365 * Assign License. |
| 366 * |
| 367 * [request] - The metadata request object. |
| 368 * |
| 369 * Request parameters: |
| 370 * |
| 371 * [productId] - Name for product |
| 372 * |
| 373 * [skuId] - Name for sku for which license would be revoked |
| 374 * |
| 375 * [userId] - email id or unique Id of the user |
| 376 * |
| 377 * Completes with a [LicenseAssignment]. |
| 378 * |
| 379 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 380 * error. |
| 381 * |
| 382 * If the used [http.Client] completes with an error when making a REST call, |
| 383 * this method will complete with the same error. |
| 384 */ |
| 385 async.Future<LicenseAssignment> update(LicenseAssignment request, core.String
productId, core.String skuId, core.String userId) { |
| 386 var _url = null; |
| 387 var _queryParams = new core.Map(); |
| 388 var _uploadMedia = null; |
| 389 var _uploadOptions = null; |
| 390 var _downloadOptions = common.DownloadOptions.Metadata; |
| 391 var _body = null; |
| 392 |
| 393 if (request != null) { |
| 394 _body = convert.JSON.encode((request).toJson()); |
| 395 } |
| 396 if (productId == null) { |
| 397 throw new core.ArgumentError("Parameter productId is required."); |
| 398 } |
| 399 if (skuId == null) { |
| 400 throw new core.ArgumentError("Parameter skuId is required."); |
| 401 } |
| 402 if (userId == null) { |
| 403 throw new core.ArgumentError("Parameter userId is required."); |
| 404 } |
| 405 |
| 406 |
| 407 _url = common_internal.Escaper.ecapeVariable('$productId') + '/sku/' + commo
n_internal.Escaper.ecapeVariable('$skuId') + '/user/' + common_internal.Escaper.
ecapeVariable('$userId'); |
| 408 |
| 409 var _response = _requester.request(_url, |
| 410 "PUT", |
| 411 body: _body, |
| 412 queryParams: _queryParams, |
| 413 uploadOptions: _uploadOptions, |
| 414 uploadMedia: _uploadMedia, |
| 415 downloadOptions: _downloadOptions); |
| 416 return _response.then((data) => new LicenseAssignment.fromJson(data)); |
| 417 } |
| 418 |
| 419 } |
| 420 |
| 421 |
| 422 |
| 423 /** Template for LiscenseAssignment Resource */ |
| 424 class LicenseAssignment { |
| 425 /** ETag of the resource. */ |
| 426 core.String etags; |
| 427 |
| 428 /** Identifies the resource as a LicenseAssignment. */ |
| 429 core.String kind; |
| 430 |
| 431 /** Name of the product. */ |
| 432 core.String productId; |
| 433 |
| 434 /** Link to this page. */ |
| 435 core.String selfLink; |
| 436 |
| 437 /** Name of the sku of the product. */ |
| 438 core.String skuId; |
| 439 |
| 440 /** Email id of the user. */ |
| 441 core.String userId; |
| 442 |
| 443 |
| 444 LicenseAssignment(); |
| 445 |
| 446 LicenseAssignment.fromJson(core.Map _json) { |
| 447 if (_json.containsKey("etags")) { |
| 448 etags = _json["etags"]; |
| 449 } |
| 450 if (_json.containsKey("kind")) { |
| 451 kind = _json["kind"]; |
| 452 } |
| 453 if (_json.containsKey("productId")) { |
| 454 productId = _json["productId"]; |
| 455 } |
| 456 if (_json.containsKey("selfLink")) { |
| 457 selfLink = _json["selfLink"]; |
| 458 } |
| 459 if (_json.containsKey("skuId")) { |
| 460 skuId = _json["skuId"]; |
| 461 } |
| 462 if (_json.containsKey("userId")) { |
| 463 userId = _json["userId"]; |
| 464 } |
| 465 } |
| 466 |
| 467 core.Map toJson() { |
| 468 var _json = new core.Map(); |
| 469 if (etags != null) { |
| 470 _json["etags"] = etags; |
| 471 } |
| 472 if (kind != null) { |
| 473 _json["kind"] = kind; |
| 474 } |
| 475 if (productId != null) { |
| 476 _json["productId"] = productId; |
| 477 } |
| 478 if (selfLink != null) { |
| 479 _json["selfLink"] = selfLink; |
| 480 } |
| 481 if (skuId != null) { |
| 482 _json["skuId"] = skuId; |
| 483 } |
| 484 if (userId != null) { |
| 485 _json["userId"] = userId; |
| 486 } |
| 487 return _json; |
| 488 } |
| 489 } |
| 490 |
| 491 |
| 492 /** Template for LicenseAssignment Insert request */ |
| 493 class LicenseAssignmentInsert { |
| 494 /** Email id of the user */ |
| 495 core.String userId; |
| 496 |
| 497 |
| 498 LicenseAssignmentInsert(); |
| 499 |
| 500 LicenseAssignmentInsert.fromJson(core.Map _json) { |
| 501 if (_json.containsKey("userId")) { |
| 502 userId = _json["userId"]; |
| 503 } |
| 504 } |
| 505 |
| 506 core.Map toJson() { |
| 507 var _json = new core.Map(); |
| 508 if (userId != null) { |
| 509 _json["userId"] = userId; |
| 510 } |
| 511 return _json; |
| 512 } |
| 513 } |
| 514 |
| 515 |
| 516 /** LicesnseAssignment List for a given product/sku for a customer. */ |
| 517 class LicenseAssignmentList { |
| 518 /** ETag of the resource. */ |
| 519 core.String etag; |
| 520 |
| 521 /** The LicenseAssignments in this page of results. */ |
| 522 core.List<LicenseAssignment> items; |
| 523 |
| 524 /** Identifies the resource as a collection of LicenseAssignments. */ |
| 525 core.String kind; |
| 526 |
| 527 /** |
| 528 * The continuation token, used to page through large result sets. Provide |
| 529 * this value in a subsequent request to return the next page of results. |
| 530 */ |
| 531 core.String nextPageToken; |
| 532 |
| 533 |
| 534 LicenseAssignmentList(); |
| 535 |
| 536 LicenseAssignmentList.fromJson(core.Map _json) { |
| 537 if (_json.containsKey("etag")) { |
| 538 etag = _json["etag"]; |
| 539 } |
| 540 if (_json.containsKey("items")) { |
| 541 items = _json["items"].map((value) => new LicenseAssignment.fromJson(value
)).toList(); |
| 542 } |
| 543 if (_json.containsKey("kind")) { |
| 544 kind = _json["kind"]; |
| 545 } |
| 546 if (_json.containsKey("nextPageToken")) { |
| 547 nextPageToken = _json["nextPageToken"]; |
| 548 } |
| 549 } |
| 550 |
| 551 core.Map toJson() { |
| 552 var _json = new core.Map(); |
| 553 if (etag != null) { |
| 554 _json["etag"] = etag; |
| 555 } |
| 556 if (items != null) { |
| 557 _json["items"] = items.map((value) => (value).toJson()).toList(); |
| 558 } |
| 559 if (kind != null) { |
| 560 _json["kind"] = kind; |
| 561 } |
| 562 if (nextPageToken != null) { |
| 563 _json["nextPageToken"] = nextPageToken; |
| 564 } |
| 565 return _json; |
| 566 } |
| 567 } |
| 568 |
| 569 |
OLD | NEW |