-
Notifications
You must be signed in to change notification settings - Fork 0
/
v1.ts
2413 lines (2338 loc) · 88.2 KB
/
v1.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2020 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-empty-interface */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable no-irregular-whitespace */
import {
OAuth2Client,
JWT,
Compute,
UserRefreshClient,
BaseExternalAccountClient,
GaxiosPromise,
GoogleConfigurable,
createAPIRequest,
MethodOptions,
StreamMethodOptions,
GlobalOptions,
GoogleAuth,
BodyResponseCallback,
APIRequestContext,
} from 'googleapis-common';
import {Readable} from 'stream';
export namespace cloudcommerceprocurement_v1 {
export interface Options extends GlobalOptions {
version: 'v1';
}
interface StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?:
| string
| OAuth2Client
| JWT
| Compute
| UserRefreshClient
| BaseExternalAccountClient
| GoogleAuth;
/**
* V1 error format.
*/
'$.xgafv'?: string;
/**
* OAuth access token.
*/
access_token?: string;
/**
* Data format for response.
*/
alt?: string;
/**
* JSONP
*/
callback?: string;
/**
* Selector specifying which fields to include in a partial response.
*/
fields?: string;
/**
* API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
*/
key?: string;
/**
* OAuth 2.0 token for the current user.
*/
oauth_token?: string;
/**
* Returns response with indentations and line breaks.
*/
prettyPrint?: boolean;
/**
* Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
*/
quotaUser?: string;
/**
* Legacy upload protocol for media (e.g. "media", "multipart").
*/
uploadType?: string;
/**
* Upload protocol for media (e.g. "raw", "multipart").
*/
upload_protocol?: string;
}
/**
* Cloud Commerce Partner Procurement API
*
* Partner API for the Cloud Commerce Procurement Service.
*
* @example
* ```js
* const {google} = require('googleapis');
* const cloudcommerceprocurement = google.cloudcommerceprocurement('v1');
* ```
*/
export class Cloudcommerceprocurement {
context: APIRequestContext;
providers: Resource$Providers;
constructor(options: GlobalOptions, google?: GoogleConfigurable) {
this.context = {
_options: options || {},
google,
};
this.providers = new Resource$Providers(this.context);
}
}
/**
* Represents an account that was established by the customer on the service provider's system.
*/
export interface Schema$Account {
/**
* Output only. The approvals for this account. These approvals are used to track actions that are permitted or have been completed by a customer within the context of the provider. This might include a sign up flow or a provisioning step, for example, that the provider can admit to having happened.
*/
approvals?: Schema$Approval[];
/**
* Output only. The creation timestamp.
*/
createTime?: string | null;
/**
* Output only. The custom properties that were collected from the user to create this account.
*/
inputProperties?: {[key: string]: any} | null;
/**
* Output only. The resource name of the account. Account names have the form `accounts/{account_id\}`.
*/
name?: string | null;
/**
* Output only. The identifier of the service provider that this account was created against. Each service provider is assigned a unique provider value when they onboard with Cloud Commerce platform.
*/
provider?: string | null;
/**
* Output only. The state of the account. This is used to decide whether the customer is in good standing with the provider and is able to make purchases. An account might not be able to make a purchase if the billing account is suspended, for example.
*/
state?: string | null;
/**
* Output only. The last update timestamp.
*/
updateTime?: string | null;
}
/**
* An approval for some action on an account.
*/
export interface Schema$Approval {
/**
* Output only. The name of the approval.
*/
name?: string | null;
/**
* Output only. An explanation for the state of the approval.
*/
reason?: string | null;
/**
* Output only. The state of the approval.
*/
state?: string | null;
/**
* Optional. The last update timestamp of the approval.
*/
updateTime?: string | null;
}
/**
* Request message for PartnerProcurementService.ApproveAccount.
*/
export interface Schema$ApproveAccountRequest {
/**
* The name of the approval being approved. If absent and there is only one approval possible, that approval will be granted. If absent and there are many approvals possible, the request will fail with a 400 Bad Request. Optional.
*/
approvalName?: string | null;
/**
* Set of properties that should be associated with the account. Optional.
*/
properties?: {[key: string]: string} | null;
/**
* Free form text string explaining the approval reason. Optional. Max allowed length: 256 bytes. Longer strings will be truncated.
*/
reason?: string | null;
}
/**
* Request message for [PartnerProcurementService.ApproveEntitlementPlanChange[].
*/
export interface Schema$ApproveEntitlementPlanChangeRequest {
/**
* Name of the pending plan that is being approved. Required.
*/
pendingPlanName?: string | null;
}
/**
* Request message for [PartnerProcurementService.ApproveEntitlement[].
*/
export interface Schema$ApproveEntitlementRequest {
/**
* Optional. The resource name of the entitlement that was migrated. Format: providers/{provider_id\}/entitlements/{entitlement_id\}. Should only be sent when resources have been migrated from entitlement_migrated to the new entitlement. Optional.
*/
entitlementMigrated?: string | null;
/**
* Set of properties that should be associated with the entitlement. Optional.
*/
properties?: {[key: string]: string} | null;
}
/**
* A resource using (consuming) this entitlement.
*/
export interface Schema$Consumer {
/**
* A project name with format `projects/`.
*/
project?: string | null;
}
/**
* A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); \}
*/
export interface Schema$Empty {}
/**
* Represents a procured product of a customer.
*/
export interface Schema$Entitlement {
/**
* Output only. The resource name of the account that this entitlement is based on, if any.
*/
account?: string | null;
/**
* Output only. The resources using this entitlement, if applicable.
*/
consumers?: Schema$Consumer[];
/**
* Output only. The creation timestamp.
*/
createTime?: string | null;
/**
* Output only. The custom properties that were collected from the user to create this entitlement.
*/
inputProperties?: {[key: string]: any} | null;
/**
* Provider-supplied message that is displayed to the end user. Currently this is used to communicate progress and ETA for provisioning. This field can be updated only when a user is waiting for an action from the provider, i.e. entitlement state is EntitlementState.ENTITLEMENT_ACTIVATION_REQUESTED or EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL. This field is cleared automatically when the entitlement state changes.
*/
messageToUser?: string | null;
/**
* Output only. The resource name of the entitlement. Entitlement names have the form `providers/{provider_id\}/entitlements/{entitlement_id\}`.
*/
name?: string | null;
/**
* Output only. The end time of the new offer. Field is empty if the pending plan change is not moving to an offer. If the offer was created with a term instead of a specified end date, this field is empty.
*/
newOfferEndTime?: string | null;
/**
* Output only. The name of the offer the entitlement is switching to upon a pending plan change. Only exists if the pending plan change is moving to an offer. Format: 'projects/{project\}/services/{service\}/privateOffers/{offer-id\}' OR 'projects/{project\}/services/{service\}/standardOffers/{offer-id\}', depending on whether the offer is private or public.
*/
newPendingOffer?: string | null;
/**
* Output only. The offer duration of the new offer in ISO 8601 duration format. Field is empty if the pending plan change is not moving to an offer since the entitlement is not pending, only the plan change is pending. If the offer was created with a specified end date instead of a duration, this field is empty.
*/
newPendingOfferDuration?: string | null;
/**
* Output only. The identifier of the pending new plan. Required if the product has plans and the entitlement has a pending plan change.
*/
newPendingPlan?: string | null;
/**
* Output only. The name of the offer that was procured. Field is empty if order was not made using an offer. Format: 'projects/{project\}/services/{service\}/privateOffers/{offer-id\}' OR 'projects/{project\}/services/{service\}/standardOffers/{offer-id\}', depending on whether the offer is private or public.
*/
offer?: string | null;
/**
* Output only. The offer duration of the current offer in ISO 8601 duration format. Field is empty if entitlement was not made using an offer. If the offer was created with a specified end date instead of a duration, this field is empty.
*/
offerDuration?: string | null;
/**
* Output only. End time for the Offer association corresponding to this entitlement. The field is only populated if the entitlement is currently associated with an Offer.
*/
offerEndTime?: string | null;
/**
* Output only. The identifier of the plan that was procured. Required if the product has plans.
*/
plan?: string | null;
/**
* Output only. The identifier of the entity that was purchased. This may actually represent a product, quote, or offer. It is highly recommended to use the more explicit fields productExternalName, quoteExternalName, or offer listed below based on your needs.
*/
product?: string | null;
/**
* Output only. The identifier of the product that was procured.
*/
productExternalName?: string | null;
/**
* Output only. The identifier of the service provider that this entitlement was created against. Each service provider is assigned a unique provider value when they onboard with Cloud Commerce platform.
*/
provider?: string | null;
/**
* Output only. The identifier of the quote that was used to procure. Empty if the order is not purchased using a quote.
*/
quoteExternalName?: string | null;
/**
* Output only. The state of the entitlement.
*/
state?: string | null;
/**
* Output only. End time for the subscription corresponding to this entitlement.
*/
subscriptionEndTime?: string | null;
/**
* Output only. The last update timestamp.
*/
updateTime?: string | null;
/**
* Output only. The consumerId to use when reporting usage through the Service Control API. See the consumerId field at [Reporting Metrics](https://cloud.google.com/service-control/reporting-metrics) for more details. This field is present only if the product has usage-based billing configured.
*/
usageReportingId?: string | null;
}
/**
* Response message for [PartnerProcurementService.ListAccounts[].
*/
export interface Schema$ListAccountsResponse {
/**
* The list of accounts in this response.
*/
accounts?: Schema$Account[];
/**
* The token for fetching the next page.
*/
nextPageToken?: string | null;
}
/**
* Response message for PartnerProcurementService.ListEntitlements.
*/
export interface Schema$ListEntitlementsResponse {
/**
* The list of entitlements in this response.
*/
entitlements?: Schema$Entitlement[];
/**
* The token for fetching the next page.
*/
nextPageToken?: string | null;
}
/**
* Request message for PartnerProcurementService.RejectAccount.
*/
export interface Schema$RejectAccountRequest {
/**
* The name of the approval being rejected. If absent and there is only one approval possible, that approval will be rejected. If absent and there are many approvals possible, the request will fail with a 400 Bad Request. Optional.
*/
approvalName?: string | null;
/**
* Free form text string explaining the rejection reason. Max allowed length: 256 bytes. Longer strings will be truncated.
*/
reason?: string | null;
}
/**
* Request message for PartnerProcurementService.RejectEntitlementPlanChange.
*/
export interface Schema$RejectEntitlementPlanChangeRequest {
/**
* Name of the pending plan that is being rejected. Required.
*/
pendingPlanName?: string | null;
/**
* Free form text string explaining the rejection reason. Max allowed length: 256 bytes. Longer strings will be truncated.
*/
reason?: string | null;
}
/**
* Request message for PartnerProcurementService.RejectEntitlement.
*/
export interface Schema$RejectEntitlementRequest {
/**
* Free form text string explaining the rejection reason. Max allowed length: 256 bytes. Longer strings will be truncated.
*/
reason?: string | null;
}
/**
* Request message for PartnerProcurementService.ResetAccount.
*/
export interface Schema$ResetAccountRequest {}
/**
* Request message for ParterProcurementService.SuspendEntitlement. This is not yet supported.
*/
export interface Schema$SuspendEntitlementRequest {
/**
* A free-form reason string, explaining the reason for suspension request.
*/
reason?: string | null;
}
export class Resource$Providers {
context: APIRequestContext;
accounts: Resource$Providers$Accounts;
entitlements: Resource$Providers$Entitlements;
constructor(context: APIRequestContext) {
this.context = context;
this.accounts = new Resource$Providers$Accounts(this.context);
this.entitlements = new Resource$Providers$Entitlements(this.context);
}
}
export class Resource$Providers$Accounts {
context: APIRequestContext;
constructor(context: APIRequestContext) {
this.context = context;
}
/**
* Grants an approval on an Account.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/cloudcommerceprocurement.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const cloudcommerceprocurement = google.cloudcommerceprocurement('v1');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await cloudcommerceprocurement.providers.accounts.approve({
* // The resource name of the account. Required.
* name: 'providers/my-provider/accounts/my-account',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {
* // "properties": {},
* // "reason": "my_reason",
* // "approvalName": "my_approvalName"
* // }
* },
* });
* console.log(res.data);
*
* // Example response
* // {}
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
approve(
params: Params$Resource$Providers$Accounts$Approve,
options: StreamMethodOptions
): GaxiosPromise<Readable>;
approve(
params?: Params$Resource$Providers$Accounts$Approve,
options?: MethodOptions
): GaxiosPromise<Schema$Empty>;
approve(
params: Params$Resource$Providers$Accounts$Approve,
options: StreamMethodOptions | BodyResponseCallback<Readable>,
callback: BodyResponseCallback<Readable>
): void;
approve(
params: Params$Resource$Providers$Accounts$Approve,
options: MethodOptions | BodyResponseCallback<Schema$Empty>,
callback: BodyResponseCallback<Schema$Empty>
): void;
approve(
params: Params$Resource$Providers$Accounts$Approve,
callback: BodyResponseCallback<Schema$Empty>
): void;
approve(callback: BodyResponseCallback<Schema$Empty>): void;
approve(
paramsOrCallback?:
| Params$Resource$Providers$Accounts$Approve
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>,
optionsOrCallback?:
| MethodOptions
| StreamMethodOptions
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>,
callback?:
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>
): void | GaxiosPromise<Schema$Empty> | GaxiosPromise<Readable> {
let params = (paramsOrCallback ||
{}) as Params$Resource$Providers$Accounts$Approve;
let options = (optionsOrCallback || {}) as MethodOptions;
if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Providers$Accounts$Approve;
options = {};
}
if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}
const rootUrl =
options.rootUrl || 'https://cloudcommerceprocurement.googleapis.com/';
const parameters = {
options: Object.assign(
{
url: (rootUrl + '/v1/{+name}:approve').replace(
/([^:]\/)\/+/g,
'$1'
),
method: 'POST',
},
options
),
params,
requiredParams: ['name'],
pathParams: ['name'],
context: this.context,
};
if (callback) {
createAPIRequest<Schema$Empty>(
parameters,
callback as BodyResponseCallback<unknown>
);
} else {
return createAPIRequest<Schema$Empty>(parameters);
}
}
/**
* Gets a requested Account resource.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/cloudcommerceprocurement.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const cloudcommerceprocurement = google.cloudcommerceprocurement('v1');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await cloudcommerceprocurement.providers.accounts.get({
* // The name of the account to retrieve.
* name: 'providers/my-provider/accounts/my-account',
* });
* console.log(res.data);
*
* // Example response
* // {
* // "state": "my_state",
* // "inputProperties": {},
* // "createTime": "my_createTime",
* // "provider": "my_provider",
* // "updateTime": "my_updateTime",
* // "name": "my_name",
* // "approvals": []
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
get(
params: Params$Resource$Providers$Accounts$Get,
options: StreamMethodOptions
): GaxiosPromise<Readable>;
get(
params?: Params$Resource$Providers$Accounts$Get,
options?: MethodOptions
): GaxiosPromise<Schema$Account>;
get(
params: Params$Resource$Providers$Accounts$Get,
options: StreamMethodOptions | BodyResponseCallback<Readable>,
callback: BodyResponseCallback<Readable>
): void;
get(
params: Params$Resource$Providers$Accounts$Get,
options: MethodOptions | BodyResponseCallback<Schema$Account>,
callback: BodyResponseCallback<Schema$Account>
): void;
get(
params: Params$Resource$Providers$Accounts$Get,
callback: BodyResponseCallback<Schema$Account>
): void;
get(callback: BodyResponseCallback<Schema$Account>): void;
get(
paramsOrCallback?:
| Params$Resource$Providers$Accounts$Get
| BodyResponseCallback<Schema$Account>
| BodyResponseCallback<Readable>,
optionsOrCallback?:
| MethodOptions
| StreamMethodOptions
| BodyResponseCallback<Schema$Account>
| BodyResponseCallback<Readable>,
callback?:
| BodyResponseCallback<Schema$Account>
| BodyResponseCallback<Readable>
): void | GaxiosPromise<Schema$Account> | GaxiosPromise<Readable> {
let params = (paramsOrCallback ||
{}) as Params$Resource$Providers$Accounts$Get;
let options = (optionsOrCallback || {}) as MethodOptions;
if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Providers$Accounts$Get;
options = {};
}
if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}
const rootUrl =
options.rootUrl || 'https://cloudcommerceprocurement.googleapis.com/';
const parameters = {
options: Object.assign(
{
url: (rootUrl + '/v1/{+name}').replace(/([^:]\/)\/+/g, '$1'),
method: 'GET',
},
options
),
params,
requiredParams: ['name'],
pathParams: ['name'],
context: this.context,
};
if (callback) {
createAPIRequest<Schema$Account>(
parameters,
callback as BodyResponseCallback<unknown>
);
} else {
return createAPIRequest<Schema$Account>(parameters);
}
}
/**
* Lists Accounts that the provider has access to.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/cloudcommerceprocurement.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const cloudcommerceprocurement = google.cloudcommerceprocurement('v1');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await cloudcommerceprocurement.providers.accounts.list({
* // The maximum number of entries that are requested The default page size is 25 and the maximum page size is 200.
* pageSize: 'placeholder-value',
* // The token for fetching the next page.
* pageToken: 'placeholder-value',
* // The parent resource name.
* parent: 'providers/my-provider',
* });
* console.log(res.data);
*
* // Example response
* // {
* // "accounts": [],
* // "nextPageToken": "my_nextPageToken"
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
list(
params: Params$Resource$Providers$Accounts$List,
options: StreamMethodOptions
): GaxiosPromise<Readable>;
list(
params?: Params$Resource$Providers$Accounts$List,
options?: MethodOptions
): GaxiosPromise<Schema$ListAccountsResponse>;
list(
params: Params$Resource$Providers$Accounts$List,
options: StreamMethodOptions | BodyResponseCallback<Readable>,
callback: BodyResponseCallback<Readable>
): void;
list(
params: Params$Resource$Providers$Accounts$List,
options:
| MethodOptions
| BodyResponseCallback<Schema$ListAccountsResponse>,
callback: BodyResponseCallback<Schema$ListAccountsResponse>
): void;
list(
params: Params$Resource$Providers$Accounts$List,
callback: BodyResponseCallback<Schema$ListAccountsResponse>
): void;
list(callback: BodyResponseCallback<Schema$ListAccountsResponse>): void;
list(
paramsOrCallback?:
| Params$Resource$Providers$Accounts$List
| BodyResponseCallback<Schema$ListAccountsResponse>
| BodyResponseCallback<Readable>,
optionsOrCallback?:
| MethodOptions
| StreamMethodOptions
| BodyResponseCallback<Schema$ListAccountsResponse>
| BodyResponseCallback<Readable>,
callback?:
| BodyResponseCallback<Schema$ListAccountsResponse>
| BodyResponseCallback<Readable>
):
| void
| GaxiosPromise<Schema$ListAccountsResponse>
| GaxiosPromise<Readable> {
let params = (paramsOrCallback ||
{}) as Params$Resource$Providers$Accounts$List;
let options = (optionsOrCallback || {}) as MethodOptions;
if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Providers$Accounts$List;
options = {};
}
if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}
const rootUrl =
options.rootUrl || 'https://cloudcommerceprocurement.googleapis.com/';
const parameters = {
options: Object.assign(
{
url: (rootUrl + '/v1/{+parent}/accounts').replace(
/([^:]\/)\/+/g,
'$1'
),
method: 'GET',
},
options
),
params,
requiredParams: ['parent'],
pathParams: ['parent'],
context: this.context,
};
if (callback) {
createAPIRequest<Schema$ListAccountsResponse>(
parameters,
callback as BodyResponseCallback<unknown>
);
} else {
return createAPIRequest<Schema$ListAccountsResponse>(parameters);
}
}
/**
* Rejects an approval on an Account.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/cloudcommerceprocurement.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const cloudcommerceprocurement = google.cloudcommerceprocurement('v1');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await cloudcommerceprocurement.providers.accounts.reject({
* // The resource name of the account. Required.
* name: 'providers/my-provider/accounts/my-account',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {
* // "reason": "my_reason",
* // "approvalName": "my_approvalName"
* // }
* },
* });
* console.log(res.data);
*
* // Example response
* // {}
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
reject(
params: Params$Resource$Providers$Accounts$Reject,
options: StreamMethodOptions
): GaxiosPromise<Readable>;
reject(
params?: Params$Resource$Providers$Accounts$Reject,
options?: MethodOptions
): GaxiosPromise<Schema$Empty>;
reject(
params: Params$Resource$Providers$Accounts$Reject,
options: StreamMethodOptions | BodyResponseCallback<Readable>,
callback: BodyResponseCallback<Readable>
): void;
reject(
params: Params$Resource$Providers$Accounts$Reject,
options: MethodOptions | BodyResponseCallback<Schema$Empty>,
callback: BodyResponseCallback<Schema$Empty>
): void;
reject(
params: Params$Resource$Providers$Accounts$Reject,
callback: BodyResponseCallback<Schema$Empty>
): void;
reject(callback: BodyResponseCallback<Schema$Empty>): void;
reject(
paramsOrCallback?:
| Params$Resource$Providers$Accounts$Reject
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>,
optionsOrCallback?:
| MethodOptions
| StreamMethodOptions
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>,
callback?:
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>
): void | GaxiosPromise<Schema$Empty> | GaxiosPromise<Readable> {
let params = (paramsOrCallback ||
{}) as Params$Resource$Providers$Accounts$Reject;
let options = (optionsOrCallback || {}) as MethodOptions;
if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Providers$Accounts$Reject;
options = {};
}
if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}
const rootUrl =
options.rootUrl || 'https://cloudcommerceprocurement.googleapis.com/';
const parameters = {
options: Object.assign(
{
url: (rootUrl + '/v1/{+name}:reject').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST',
},
options
),
params,
requiredParams: ['name'],
pathParams: ['name'],
context: this.context,
};
if (callback) {
createAPIRequest<Schema$Empty>(
parameters,
callback as BodyResponseCallback<unknown>
);
} else {
return createAPIRequest<Schema$Empty>(parameters);
}
}
/**
* Resets an Account and cancel all associated Entitlements. Partner can only reset accounts they own rather than customer accounts.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/cloudcommerceprocurement.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const cloudcommerceprocurement = google.cloudcommerceprocurement('v1');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await cloudcommerceprocurement.providers.accounts.reset({
* // The resource name of the account. Required.
* name: 'providers/my-provider/accounts/my-account',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {}
* },
* });
* console.log(res.data);
*