@origincloud/billing 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  export * from "./billing_account.js";
2
2
  export * from "./cost.js";
3
+ export * from "./legal_acceptance.js";
3
4
  export * from "./legal_document.js";
4
5
  export * from "./price_list.js";
5
6
  export * from "./spend_limit.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
2
  export * from "./billing_account.js";
3
3
  export * from "./cost.js";
4
+ export * from "./legal_acceptance.js";
4
5
  export * from "./legal_document.js";
5
6
  export * from "./price_list.js";
6
7
  export * from "./spend_limit.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,194 @@
1
+ import { type CalendarDate, type CallOptions, type Client, type Service } from "@origincloud/core";
2
+ import type { BillingAddress } from "./billing_account.js";
3
+ /**
4
+ * Calls LegalAcceptanceService.
5
+ *
6
+ * A billing account's acceptances of the legal documents customers accept:
7
+ * the Terms of Service, the Data Processing Agreement, the Service Level
8
+ * Agreement and the Acceptable Use Policy. The billing account is the legal
9
+ * entity that accepts. An acceptance is a record that never changes, and it
10
+ * is kept after the billing account and its organization are deleted.
11
+ */
12
+ export declare class LegalAcceptanceClient {
13
+ /**
14
+ * The endpoint the client sends its calls to, which also serves the
15
+ * operations its methods answer with.
16
+ */
17
+ readonly service: Service;
18
+ /** A client of LegalAcceptanceService that sends its calls through `client`. */
19
+ constructor(client: Client);
20
+ /**
21
+ * Lists a billing account's acceptances, the latest first. Needs
22
+ * `admin.billing_account.get` on the organization.
23
+ */
24
+ listLegalAcceptances(request: ListLegalAcceptancesRequest, options?: CallOptions): Promise<ListLegalAcceptancesResponse>;
25
+ /**
26
+ * Iterates over everything listLegalAcceptances lists from the request's page on,
27
+ * fetching the next page as the loop reaches it. A page that fails ends
28
+ * the iteration with its error.
29
+ */
30
+ allLegalAcceptances(request: ListLegalAcceptancesRequest, options?: CallOptions): AsyncGenerator<LegalAcceptance, void, undefined>;
31
+ /**
32
+ * Returns one of a billing account's acceptances. Needs
33
+ * `admin.billing_account.get` on the organization.
34
+ */
35
+ getLegalAcceptance(request: GetLegalAcceptanceRequest, options?: CallOptions): Promise<LegalAcceptance>;
36
+ /**
37
+ * Accepts versions of legal documents for a billing account, all of them
38
+ * or none. Each version is named with the `sha256` of the text the caller
39
+ * showed, and must be the version in force or one published to take effect
40
+ * later. A version the account accepted before is returned as it was then.
41
+ * `actsAsBusiness` must be true: the services are offered to businesses
42
+ * only. Needs `admin.billing_account.update` on the organization.
43
+ */
44
+ acceptLegalDocuments(request: AcceptLegalDocumentsRequest, options?: CallOptions): Promise<ListLegalAcceptancesResponse>;
45
+ /**
46
+ * Returns the legal document versions a billing account has yet to
47
+ * accept. A version is `blocking` once it is in force: until the account
48
+ * accepts it, creating or growing billable resources charged to the
49
+ * account is refused. Running resources are never affected. Needs
50
+ * `admin.billing_account.get` on the organization.
51
+ */
52
+ queryLegalRequirements(request: QueryLegalRequirementsRequest, options?: CallOptions): Promise<QueryLegalRequirementsResponse>;
53
+ }
54
+ /** A billing account's acceptance of one version of a legal document. */
55
+ export interface LegalAcceptance {
56
+ /** The acceptance's resource name. */
57
+ name?: string;
58
+ /**
59
+ * The version accepted,
60
+ * `legalDocuments/{legal_document}/versions/{version}`.
61
+ */
62
+ legalDocumentVersion?: string;
63
+ /** The SHA-256 of the text accepted: the version's `sha256`. */
64
+ sha256?: string;
65
+ /**
66
+ * Who accepted: `user:{id}`, or `service_account:{id}` for a service
67
+ * account.
68
+ */
69
+ accepter?: string;
70
+ /** When the version was accepted. */
71
+ acceptTime?: string;
72
+ /** How the acceptance came about. */
73
+ method?: LegalAcceptance_Method;
74
+ /** Whether the accepter confirmed acting as a business. Always true. */
75
+ actsAsBusiness?: boolean;
76
+ /**
77
+ * The legal entity that accepted, as it was at `acceptTime`: the
78
+ * organization's name.
79
+ */
80
+ organizationDisplayName?: string;
81
+ /**
82
+ * The billing account's address at `acceptTime`; unset for an account
83
+ * that had none.
84
+ */
85
+ billingAddress?: BillingAddress;
86
+ /**
87
+ * The billing account's VAT identification number at `acceptTime`;
88
+ * empty when it had none.
89
+ */
90
+ vatId?: string;
91
+ }
92
+ /** How the acceptance came about. */
93
+ export declare const LegalAcceptance_Method: {
94
+ /** Not used. */
95
+ readonly METHOD_UNSPECIFIED: "METHOD_UNSPECIFIED";
96
+ /** When the organization or the billing account was created. */
97
+ readonly SIGNUP: "SIGNUP";
98
+ /** A changed version of a document the account had accepted before. */
99
+ readonly CHANGE: "CHANGE";
100
+ /**
101
+ * The first version of a document, by an account that existed before
102
+ * the document was published.
103
+ */
104
+ readonly MIGRATION: "MIGRATION";
105
+ };
106
+ /** How the acceptance came about. */
107
+ export type LegalAcceptance_Method = (typeof LegalAcceptance_Method)[keyof typeof LegalAcceptance_Method];
108
+ /** A legal document version a billing account has yet to accept. */
109
+ export interface LegalRequirement {
110
+ /** The version, `legalDocuments/{legal_document}/versions/{version}`. */
111
+ legalDocumentVersion?: string;
112
+ /** The version's title, such as `Terms of Service`. */
113
+ displayName?: string;
114
+ /** The day the version takes effect. */
115
+ effectiveDate?: CalendarDate;
116
+ /** A plain-language summary of what changed. */
117
+ changeSummary?: string;
118
+ /** The version's `sha256`, to accept it by. */
119
+ sha256?: string;
120
+ /**
121
+ * In force already: until it is accepted, creating or growing billable
122
+ * resources charged to the account is refused.
123
+ */
124
+ blocking?: boolean;
125
+ }
126
+ /** A version to accept, with the text it was shown as. */
127
+ export interface LegalDocumentVersionToAccept {
128
+ /** The version, `legalDocuments/{legal_document}/versions/{version}`. */
129
+ legalDocumentVersion?: string;
130
+ /**
131
+ * The version's `sha256`, as read with it: an acceptance is refused when
132
+ * the text shown isn't the version's.
133
+ */
134
+ sha256?: string;
135
+ }
136
+ /** The request for ListLegalAcceptances. */
137
+ export interface ListLegalAcceptancesRequest {
138
+ /**
139
+ * The billing account,
140
+ * `organizations/{organization}/billingAccounts/{billing_account}`.
141
+ */
142
+ parent?: string;
143
+ /**
144
+ * The most acceptances to return; the server clamps it, and 0 means its
145
+ * default.
146
+ */
147
+ pageSize?: number;
148
+ /** A previous response's `nextPageToken`, for the page after it. */
149
+ pageToken?: string;
150
+ }
151
+ /** The response for ListLegalAcceptances and AcceptLegalDocuments. */
152
+ export interface ListLegalAcceptancesResponse {
153
+ /**
154
+ * The acceptances on this page; for AcceptLegalDocuments, one per version
155
+ * accepted, in the order requested.
156
+ */
157
+ legalAcceptances?: LegalAcceptance[];
158
+ /** The token for the next page; empty on the last one. */
159
+ nextPageToken?: string;
160
+ }
161
+ /** The request for GetLegalAcceptance. */
162
+ export interface GetLegalAcceptanceRequest {
163
+ /** The acceptance to return. */
164
+ name?: string;
165
+ }
166
+ /** The request for AcceptLegalDocuments. */
167
+ export interface AcceptLegalDocumentsRequest {
168
+ /**
169
+ * The billing account that accepts,
170
+ * `organizations/{organization}/billingAccounts/{billing_account}`.
171
+ */
172
+ name?: string;
173
+ /** The versions to accept. */
174
+ versions?: LegalDocumentVersionToAccept[];
175
+ /**
176
+ * That the caller acts as a business (§ 14 BGB) for the billing account's
177
+ * legal entity. Must be true.
178
+ */
179
+ actsAsBusiness?: boolean;
180
+ }
181
+ /** The request for QueryLegalRequirements. */
182
+ export interface QueryLegalRequirementsRequest {
183
+ /**
184
+ * The billing account,
185
+ * `organizations/{organization}/billingAccounts/{billing_account}`.
186
+ */
187
+ name?: string;
188
+ }
189
+ /** The response for QueryLegalRequirements. */
190
+ export interface QueryLegalRequirementsResponse {
191
+ /** The versions to accept, by document, then by the day they take effect. */
192
+ requirements?: LegalRequirement[];
193
+ }
194
+ //# sourceMappingURL=legal_acceptance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legal_acceptance.d.ts","sourceRoot":"","sources":["../../src/v1beta1/legal_acceptance.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,OAAO,EAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;GAQG;AACH,qBAAa,qBAAqB;IAChC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,gFAAgF;gBACpE,MAAM,EAAE,MAAM;IAI1B;;;OAGG;IACG,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,O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,OAAO,CAAC;CAC1B;AAED,8CAA8C;AAC9C,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,+CAA+C;AAC/C,MAAM,WAAW,8BAA8B;IAC7C,6EAA6E;IAC7E,YAAY,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC"}
@@ -0,0 +1,111 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/billing/v1beta1/legal_acceptance.proto
3
+ import { pathValue, query, } from "@origincloud/core";
4
+ /**
5
+ * Calls LegalAcceptanceService.
6
+ *
7
+ * A billing account's acceptances of the legal documents customers accept:
8
+ * the Terms of Service, the Data Processing Agreement, the Service Level
9
+ * Agreement and the Acceptable Use Policy. The billing account is the legal
10
+ * entity that accepts. An acceptance is a record that never changes, and it
11
+ * is kept after the billing account and its organization are deleted.
12
+ */
13
+ export class LegalAcceptanceClient {
14
+ /**
15
+ * The endpoint the client sends its calls to, which also serves the
16
+ * operations its methods answer with.
17
+ */
18
+ service;
19
+ /** A client of LegalAcceptanceService that sends its calls through `client`. */
20
+ constructor(client) {
21
+ this.service = client.service("billing", false);
22
+ }
23
+ /**
24
+ * Lists a billing account's acceptances, the latest first. Needs
25
+ * `admin.billing_account.get` on the organization.
26
+ */
27
+ async listLegalAcceptances(request, options) {
28
+ const p0 = pathValue("parent", request.parent, "organizations/*/billingAccounts/*");
29
+ return this.service.call({
30
+ method: "GET",
31
+ path: `/v1beta1/${p0}/legalAcceptances`,
32
+ query: query(request, ["parent"]),
33
+ idempotent: true,
34
+ }, options);
35
+ }
36
+ /**
37
+ * Iterates over everything listLegalAcceptances lists from the request's page on,
38
+ * fetching the next page as the loop reaches it. A page that fails ends
39
+ * the iteration with its error.
40
+ */
41
+ async *allLegalAcceptances(request, options) {
42
+ for (let page = request;;) {
43
+ const response = await this.listLegalAcceptances(page, options);
44
+ yield* response.legalAcceptances ?? [];
45
+ if (!response.nextPageToken)
46
+ return;
47
+ page = { ...page, pageToken: response.nextPageToken };
48
+ }
49
+ }
50
+ /**
51
+ * Returns one of a billing account's acceptances. Needs
52
+ * `admin.billing_account.get` on the organization.
53
+ */
54
+ async getLegalAcceptance(request, options) {
55
+ const p0 = pathValue("name", request.name, "organizations/*/billingAccounts/*/legalAcceptances/*");
56
+ return this.service.call({
57
+ method: "GET",
58
+ path: `/v1beta1/${p0}`,
59
+ query: query(request, ["name"]),
60
+ idempotent: true,
61
+ }, options);
62
+ }
63
+ /**
64
+ * Accepts versions of legal documents for a billing account, all of them
65
+ * or none. Each version is named with the `sha256` of the text the caller
66
+ * showed, and must be the version in force or one published to take effect
67
+ * later. A version the account accepted before is returned as it was then.
68
+ * `actsAsBusiness` must be true: the services are offered to businesses
69
+ * only. Needs `admin.billing_account.update` on the organization.
70
+ */
71
+ async acceptLegalDocuments(request, options) {
72
+ const p0 = pathValue("name", request.name, "organizations/*/billingAccounts/*");
73
+ return this.service.call({
74
+ method: "POST",
75
+ path: `/v1beta1/${p0}:acceptLegalDocuments`,
76
+ body: request,
77
+ idempotent: true,
78
+ }, options);
79
+ }
80
+ /**
81
+ * Returns the legal document versions a billing account has yet to
82
+ * accept. A version is `blocking` once it is in force: until the account
83
+ * accepts it, creating or growing billable resources charged to the
84
+ * account is refused. Running resources are never affected. Needs
85
+ * `admin.billing_account.get` on the organization.
86
+ */
87
+ async queryLegalRequirements(request, options) {
88
+ const p0 = pathValue("name", request.name, "organizations/*/billingAccounts/*");
89
+ return this.service.call({
90
+ method: "GET",
91
+ path: `/v1beta1/${p0}:queryLegalRequirements`,
92
+ query: query(request, ["name"]),
93
+ idempotent: true,
94
+ }, options);
95
+ }
96
+ }
97
+ /** How the acceptance came about. */
98
+ export const LegalAcceptance_Method = {
99
+ /** Not used. */
100
+ METHOD_UNSPECIFIED: "METHOD_UNSPECIFIED",
101
+ /** When the organization or the billing account was created. */
102
+ SIGNUP: "SIGNUP",
103
+ /** A changed version of a document the account had accepted before. */
104
+ CHANGE: "CHANGE",
105
+ /**
106
+ * The first version of a document, by an account that existed before
107
+ * the document was published.
108
+ */
109
+ MIGRATION: "MIGRATION",
110
+ };
111
+ //# sourceMappingURL=legal_acceptance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legal_acceptance.js","sourceRoot":"","sources":["../../src/v1beta1/legal_acceptance.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,6DAA6D;AAE7D,OAAO,EAKL,SAAS,EACT,KAAK,GACN,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;GAQG;AACH,MAAM,OAAO,qBAAqB;IAChC;;;OAGG;IACM,OAAO,CAAU;IAE1B,gFAAgF;IAChF,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,oBAAoB,CAAC,OAAoC,EAAE,OAAqB;QACpF,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,mCAAmC,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,YAAY,EAAE,mBAAmB;YACvC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;YACjC,UAAU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,CAAC,mBAAmB,CAAC,OAAoC,EAAE,OAAqB;QACpF,KAAK,IAAI,IAAI,GAAG,OAAO,IAAM,CAAC;YAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAChE,KAAK,CAAC,CAAC,QAAQ,CAAC,gBAAgB,IAAI,EAAE,CAAC;YACvC,IAAI,CAAC,QAAQ,C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AU,EAAE,IAAI;SACjB,EACD,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAyCD,qCAAqC;AACrC,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,gBAAgB;IAChB,kBAAkB,EAAE,oBAAoB;IACxC,gEAAgE;IAChE,MAAM,EAAE,QAAQ;IAChB,uEAAuE;IACvE,MAAM,EAAE,QAAQ;IAChB;;;OAGG;IACH,SAAS,EAAE,WAAW;CACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@origincloud/billing",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Origin Cloud's billing service: billing accounts and the projects they pay for, payment methods, cost and usage, spend limits and the price list.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/origincloudhq/sdk-typescript#readme",
@@ -34,9 +34,9 @@
34
34
  "!dist/**/*.tsbuildinfo"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@origincloud/core": "^0.27.0"
37
+ "@origincloud/core": "^0.28.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@origincloud/core": "^0.27.0"
40
+ "@origincloud/core": "^0.28.0"
41
41
  }
42
42
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  export * from "./billing_account.js";
4
4
  export * from "./cost.js";
5
+ export * from "./legal_acceptance.js";
5
6
  export * from "./legal_document.js";
6
7
  export * from "./price_list.js";
7
8
  export * from "./spend_limit.js";
@@ -0,0 +1,274 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/billing/v1beta1/legal_acceptance.proto
3
+
4
+ import {
5
+ type CalendarDate,
6
+ type CallOptions,
7
+ type Client,
8
+ type Service,
9
+ pathValue,
10
+ query,
11
+ } from "@origincloud/core";
12
+ import type { BillingAddress } from "./billing_account.js";
13
+
14
+ /**
15
+ * Calls LegalAcceptanceService.
16
+ *
17
+ * A billing account's acceptances of the legal documents customers accept:
18
+ * the Terms of Service, the Data Processing Agreement, the Service Level
19
+ * Agreement and the Acceptable Use Policy. The billing account is the legal
20
+ * entity that accepts. An acceptance is a record that never changes, and it
21
+ * is kept after the billing account and its organization are deleted.
22
+ */
23
+ export class LegalAcceptanceClient {
24
+ /**
25
+ * The endpoint the client sends its calls to, which also serves the
26
+ * operations its methods answer with.
27
+ */
28
+ readonly service: Service;
29
+
30
+ /** A client of LegalAcceptanceService that sends its calls through `client`. */
31
+ constructor(client: Client) {
32
+ this.service = client.service("billing", false);
33
+ }
34
+
35
+ /**
36
+ * Lists a billing account's acceptances, the latest first. Needs
37
+ * `admin.billing_account.get` on the organization.
38
+ */
39
+ async listLegalAcceptances(request: ListLegalAcceptancesRequest, options?: CallOptions): Promise<ListLegalAcceptancesResponse> {
40
+ const p0 = pathValue("parent", request.parent, "organizations/*/billingAccounts/*");
41
+ return this.service.call<ListLegalAcceptancesResponse>(
42
+ {
43
+ method: "GET",
44
+ path: `/v1beta1/${p0}/legalAcceptances`,
45
+ query: query(request, ["parent"]),
46
+ idempotent: true,
47
+ },
48
+ options,
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Iterates over everything listLegalAcceptances lists from the request's page on,
54
+ * fetching the next page as the loop reaches it. A page that fails ends
55
+ * the iteration with its error.
56
+ */
57
+ async *allLegalAcceptances(request: ListLegalAcceptancesRequest, options?: CallOptions): AsyncGenerator<LegalAcceptance, void, undefined> {
58
+ for (let page = request; ; ) {
59
+ const response = await this.listLegalAcceptances(page, options);
60
+ yield* response.legalAcceptances ?? [];
61
+ if (!response.nextPageToken) return;
62
+ page = { ...page, pageToken: response.nextPageToken };
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Returns one of a billing account's acceptances. Needs
68
+ * `admin.billing_account.get` on the organization.
69
+ */
70
+ async getLegalAcceptance(request: GetLegalAcceptanceRequest, options?: CallOptions): Promise<LegalAcceptance> {
71
+ const p0 = pathValue("name", request.name, "organizations/*/billingAccounts/*/legalAcceptances/*");
72
+ return this.service.call<LegalAcceptance>(
73
+ {
74
+ method: "GET",
75
+ path: `/v1beta1/${p0}`,
76
+ query: query(request, ["name"]),
77
+ idempotent: true,
78
+ },
79
+ options,
80
+ );
81
+ }
82
+
83
+ /**
84
+ * Accepts versions of legal documents for a billing account, all of them
85
+ * or none. Each version is named with the `sha256` of the text the caller
86
+ * showed, and must be the version in force or one published to take effect
87
+ * later. A version the account accepted before is returned as it was then.
88
+ * `actsAsBusiness` must be true: the services are offered to businesses
89
+ * only. Needs `admin.billing_account.update` on the organization.
90
+ */
91
+ async acceptLegalDocuments(request: AcceptLegalDocumentsRequest, options?: CallOptions): Promise<ListLegalAcceptancesResponse> {
92
+ const p0 = pathValue("name", request.name, "organizations/*/billingAccounts/*");
93
+ return this.service.call<ListLegalAcceptancesResponse>(
94
+ {
95
+ method: "POST",
96
+ path: `/v1beta1/${p0}:acceptLegalDocuments`,
97
+ body: request,
98
+ idempotent: true,
99
+ },
100
+ options,
101
+ );
102
+ }
103
+
104
+ /**
105
+ * Returns the legal document versions a billing account has yet to
106
+ * accept. A version is `blocking` once it is in force: until the account
107
+ * accepts it, creating or growing billable resources charged to the
108
+ * account is refused. Running resources are never affected. Needs
109
+ * `admin.billing_account.get` on the organization.
110
+ */
111
+ async queryLegalRequirements(request: QueryLegalRequirementsRequest, options?: CallOptions): Promise<QueryLegalRequirementsResponse> {
112
+ const p0 = pathValue("name", request.name, "organizations/*/billingAccounts/*");
113
+ return this.service.call<QueryLegalRequirementsResponse>(
114
+ {
115
+ method: "GET",
116
+ path: `/v1beta1/${p0}:queryLegalRequirements`,
117
+ query: query(request, ["name"]),
118
+ idempotent: true,
119
+ },
120
+ options,
121
+ );
122
+ }
123
+ }
124
+
125
+ /** A billing account's acceptance of one version of a legal document. */
126
+ export interface LegalAcceptance {
127
+ /** The acceptance's resource name. */
128
+ name?: string;
129
+ /**
130
+ * The version accepted,
131
+ * `legalDocuments/{legal_document}/versions/{version}`.
132
+ */
133
+ legalDocumentVersion?: string;
134
+ /** The SHA-256 of the text accepted: the version's `sha256`. */
135
+ sha256?: string;
136
+ /**
137
+ * Who accepted: `user:{id}`, or `service_account:{id}` for a service
138
+ * account.
139
+ */
140
+ accepter?: string;
141
+ /** When the version was accepted. */
142
+ acceptTime?: string;
143
+ /** How the acceptance came about. */
144
+ method?: LegalAcceptance_Method;
145
+ /** Whether the accepter confirmed acting as a business. Always true. */
146
+ actsAsBusiness?: boolean;
147
+ /**
148
+ * The legal entity that accepted, as it was at `acceptTime`: the
149
+ * organization's name.
150
+ */
151
+ organizationDisplayName?: string;
152
+ /**
153
+ * The billing account's address at `acceptTime`; unset for an account
154
+ * that had none.
155
+ */
156
+ billingAddress?: BillingAddress;
157
+ /**
158
+ * The billing account's VAT identification number at `acceptTime`;
159
+ * empty when it had none.
160
+ */
161
+ vatId?: string;
162
+ }
163
+
164
+ /** How the acceptance came about. */
165
+ export const LegalAcceptance_Method = {
166
+ /** Not used. */
167
+ METHOD_UNSPECIFIED: "METHOD_UNSPECIFIED",
168
+ /** When the organization or the billing account was created. */
169
+ SIGNUP: "SIGNUP",
170
+ /** A changed version of a document the account had accepted before. */
171
+ CHANGE: "CHANGE",
172
+ /**
173
+ * The first version of a document, by an account that existed before
174
+ * the document was published.
175
+ */
176
+ MIGRATION: "MIGRATION",
177
+ } as const;
178
+
179
+ /** How the acceptance came about. */
180
+ export type LegalAcceptance_Method = (typeof LegalAcceptance_Method)[keyof typeof LegalAcceptance_Method];
181
+
182
+ /** A legal document version a billing account has yet to accept. */
183
+ export interface LegalRequirement {
184
+ /** The version, `legalDocuments/{legal_document}/versions/{version}`. */
185
+ legalDocumentVersion?: string;
186
+ /** The version's title, such as `Terms of Service`. */
187
+ displayName?: string;
188
+ /** The day the version takes effect. */
189
+ effectiveDate?: CalendarDate;
190
+ /** A plain-language summary of what changed. */
191
+ changeSummary?: string;
192
+ /** The version's `sha256`, to accept it by. */
193
+ sha256?: string;
194
+ /**
195
+ * In force already: until it is accepted, creating or growing billable
196
+ * resources charged to the account is refused.
197
+ */
198
+ blocking?: boolean;
199
+ }
200
+
201
+ /** A version to accept, with the text it was shown as. */
202
+ export interface LegalDocumentVersionToAccept {
203
+ /** The version, `legalDocuments/{legal_document}/versions/{version}`. */
204
+ legalDocumentVersion?: string;
205
+ /**
206
+ * The version's `sha256`, as read with it: an acceptance is refused when
207
+ * the text shown isn't the version's.
208
+ */
209
+ sha256?: string;
210
+ }
211
+
212
+ /** The request for ListLegalAcceptances. */
213
+ export interface ListLegalAcceptancesRequest {
214
+ /**
215
+ * The billing account,
216
+ * `organizations/{organization}/billingAccounts/{billing_account}`.
217
+ */
218
+ parent?: string;
219
+ /**
220
+ * The most acceptances to return; the server clamps it, and 0 means its
221
+ * default.
222
+ */
223
+ pageSize?: number;
224
+ /** A previous response's `nextPageToken`, for the page after it. */
225
+ pageToken?: string;
226
+ }
227
+
228
+ /** The response for ListLegalAcceptances and AcceptLegalDocuments. */
229
+ export interface ListLegalAcceptancesResponse {
230
+ /**
231
+ * The acceptances on this page; for AcceptLegalDocuments, one per version
232
+ * accepted, in the order requested.
233
+ */
234
+ legalAcceptances?: LegalAcceptance[];
235
+ /** The token for the next page; empty on the last one. */
236
+ nextPageToken?: string;
237
+ }
238
+
239
+ /** The request for GetLegalAcceptance. */
240
+ export interface GetLegalAcceptanceRequest {
241
+ /** The acceptance to return. */
242
+ name?: string;
243
+ }
244
+
245
+ /** The request for AcceptLegalDocuments. */
246
+ export interface AcceptLegalDocumentsRequest {
247
+ /**
248
+ * The billing account that accepts,
249
+ * `organizations/{organization}/billingAccounts/{billing_account}`.
250
+ */
251
+ name?: string;
252
+ /** The versions to accept. */
253
+ versions?: LegalDocumentVersionToAccept[];
254
+ /**
255
+ * That the caller acts as a business (§ 14 BGB) for the billing account's
256
+ * legal entity. Must be true.
257
+ */
258
+ actsAsBusiness?: boolean;
259
+ }
260
+
261
+ /** The request for QueryLegalRequirements. */
262
+ export interface QueryLegalRequirementsRequest {
263
+ /**
264
+ * The billing account,
265
+ * `organizations/{organization}/billingAccounts/{billing_account}`.
266
+ */
267
+ name?: string;
268
+ }
269
+
270
+ /** The response for QueryLegalRequirements. */
271
+ export interface QueryLegalRequirementsResponse {
272
+ /** The versions to accept, by document, then by the day they take effect. */
273
+ requirements?: LegalRequirement[];
274
+ }