@origincloud/billing 0.26.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.
@@ -0,0 +1,325 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/billing/v1beta1/legal_document.proto
3
+
4
+ import {
5
+ type CalendarDate,
6
+ type CallOptions,
7
+ type Client,
8
+ type HttpBody,
9
+ type Service,
10
+ pathValue,
11
+ query,
12
+ } from "@origincloud/core";
13
+
14
+ /**
15
+ * Calls LegalDocumentService.
16
+ *
17
+ * The legal documents Origin Cloud publishes: the Terms of Service, the Data
18
+ * Processing Agreement, the Service Level Agreement and the Acceptable Use
19
+ * Policy a customer accepts, and the documents published beside them. Every
20
+ * version stays readable under its fixed name once it is published, and none
21
+ * is ever changed: a correction is a new version.
22
+ *
23
+ * Every method of this service is answered without an access token.
24
+ */
25
+ export class LegalDocumentClient {
26
+ /**
27
+ * The endpoint the client sends its calls to, which also serves the
28
+ * operations its methods answer with.
29
+ */
30
+ readonly service: Service;
31
+
32
+ /** A client of LegalDocumentService that sends its calls through `client`. */
33
+ constructor(client: Client) {
34
+ this.service = client.service("billing", false);
35
+ }
36
+
37
+ /**
38
+ * Lists the published legal documents, in a fixed order: `terms`, `dpa`,
39
+ * `sla`, `aup`, `subprocessors`, `toms`, `privacy`, `switching`,
40
+ * `shared-responsibility`. A document with no published version yet is
41
+ * left out.
42
+ */
43
+ async listLegalDocuments(request: ListLegalDocumentsRequest, options?: CallOptions): Promise<ListLegalDocumentsResponse> {
44
+ return this.service.call<ListLegalDocumentsResponse>(
45
+ {
46
+ method: "GET",
47
+ path: `/v1beta1/legalDocuments`,
48
+ query: query(request, []),
49
+ idempotent: true,
50
+ unauthenticated: true,
51
+ },
52
+ options,
53
+ );
54
+ }
55
+
56
+ /**
57
+ * Iterates over everything listLegalDocuments lists from the request's page on,
58
+ * fetching the next page as the loop reaches it. A page that fails ends
59
+ * the iteration with its error.
60
+ */
61
+ async *allLegalDocuments(request: ListLegalDocumentsRequest, options?: CallOptions): AsyncGenerator<LegalDocument, void, undefined> {
62
+ for (let page = request; ; ) {
63
+ const response = await this.listLegalDocuments(page, options);
64
+ yield* response.legalDocuments ?? [];
65
+ if (!response.nextPageToken) return;
66
+ page = { ...page, pageToken: response.nextPageToken };
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Returns a legal document, with the version in force now and the latest
72
+ * one published. Fails with `NOT_FOUND` for a document with no published
73
+ * version.
74
+ */
75
+ async getLegalDocument(request: GetLegalDocumentRequest, options?: CallOptions): Promise<LegalDocument> {
76
+ const p0 = pathValue("name", request.name, "legalDocuments/*");
77
+ return this.service.call<LegalDocument>(
78
+ {
79
+ method: "GET",
80
+ path: `/v1beta1/${p0}`,
81
+ query: query(request, ["name"]),
82
+ idempotent: true,
83
+ unauthenticated: true,
84
+ },
85
+ options,
86
+ );
87
+ }
88
+
89
+ /** Lists a legal document's published versions, the latest first. */
90
+ async listLegalDocumentVersions(request: ListLegalDocumentVersionsRequest, options?: CallOptions): Promise<ListLegalDocumentVersionsResponse> {
91
+ const p0 = pathValue("parent", request.parent, "legalDocuments/*");
92
+ return this.service.call<ListLegalDocumentVersionsResponse>(
93
+ {
94
+ method: "GET",
95
+ path: `/v1beta1/${p0}/versions`,
96
+ query: query(request, ["parent"]),
97
+ idempotent: true,
98
+ unauthenticated: true,
99
+ },
100
+ options,
101
+ );
102
+ }
103
+
104
+ /**
105
+ * Iterates over everything listLegalDocumentVersions lists from the request's page on,
106
+ * fetching the next page as the loop reaches it. A page that fails ends
107
+ * the iteration with its error.
108
+ */
109
+ async *allLegalDocumentVersions(request: ListLegalDocumentVersionsRequest, options?: CallOptions): AsyncGenerator<LegalDocumentVersion, void, undefined> {
110
+ for (let page = request; ; ) {
111
+ const response = await this.listLegalDocumentVersions(page, options);
112
+ yield* response.legalDocumentVersions ?? [];
113
+ if (!response.nextPageToken) return;
114
+ page = { ...page, pageToken: response.nextPageToken };
115
+ }
116
+ }
117
+
118
+ /** Returns one published version of a legal document, its text included. */
119
+ async getLegalDocumentVersion(request: GetLegalDocumentVersionRequest, options?: CallOptions): Promise<LegalDocumentVersion> {
120
+ const p0 = pathValue("name", request.name, "legalDocuments/*/versions/*");
121
+ return this.service.call<LegalDocumentVersion>(
122
+ {
123
+ method: "GET",
124
+ path: `/v1beta1/${p0}`,
125
+ query: query(request, ["name"]),
126
+ idempotent: true,
127
+ unauthenticated: true,
128
+ },
129
+ options,
130
+ );
131
+ }
132
+
133
+ /**
134
+ * Returns a published version as a PDF (`application/pdf`), the file
135
+ * itself rather than JSON. Every page's footer names the document, the
136
+ * version, the date it takes effect and its `sha256`.
137
+ *
138
+ * It answers with the file itself: its bytes, as they came, and their content type.
139
+ */
140
+ async downloadLegalDocumentVersion(request: DownloadLegalDocumentVersionRequest, options?: CallOptions): Promise<HttpBody> {
141
+ const p0 = pathValue("name", request.name, "legalDocuments/*/versions/*");
142
+ return this.service.download(
143
+ {
144
+ method: "GET",
145
+ path: `/v1beta1/${p0}:download`,
146
+ query: query(request, ["name"]),
147
+ idempotent: true,
148
+ unauthenticated: true,
149
+ },
150
+ options,
151
+ );
152
+ }
153
+ }
154
+
155
+ /**
156
+ * A legal document: every version of one kind of document, such as the Terms
157
+ * of Service.
158
+ */
159
+ export interface LegalDocument {
160
+ /**
161
+ * The document's resource name, `legalDocuments/{legal_document}`, where
162
+ * `{legal_document}` is one of `terms`, `dpa`, `sla`, `aup`,
163
+ * `subprocessors`, `toms`, `privacy`, `switching` and
164
+ * `shared-responsibility`.
165
+ */
166
+ name?: string;
167
+ /**
168
+ * The document's title, as its latest version names it, such as `Terms of
169
+ * Service`.
170
+ */
171
+ displayName?: string;
172
+ /**
173
+ * Whether a customer accepts this document. A `MATERIAL` version of one
174
+ * that is accepted needs a new acceptance; the other documents are
175
+ * published only.
176
+ */
177
+ acceptanceRequired?: boolean;
178
+ /**
179
+ * The version in force today, by its resource name. Empty while the first
180
+ * version has not taken effect yet.
181
+ */
182
+ currentVersion?: string;
183
+ /**
184
+ * The latest version published, by its resource name: `currentVersion`,
185
+ * or a version announced to take effect later.
186
+ */
187
+ latestVersion?: string;
188
+ }
189
+
190
+ /**
191
+ * One published version of a legal document. It never changes once
192
+ * published.
193
+ */
194
+ export interface LegalDocumentVersion {
195
+ /**
196
+ * The version's resource name,
197
+ * `legalDocuments/{legal_document}/versions/{version}`, where `{version}`
198
+ * is `YYYY-MM`, or `YYYY-MM-2`, `YYYY-MM-3` and so on for another version
199
+ * in the same month.
200
+ */
201
+ name?: string;
202
+ /** The version's title, such as `Terms of Service`. */
203
+ displayName?: string;
204
+ /**
205
+ * The day the version takes effect. It applies from that day until the
206
+ * next version of the document takes effect.
207
+ */
208
+ effectiveDate?: CalendarDate;
209
+ /** What the version changes. */
210
+ changeClass?: LegalDocumentVersion_ChangeClass;
211
+ /**
212
+ * A plain-language summary of what changed, as the acceptance dialog and
213
+ * the announcement show it.
214
+ */
215
+ changeSummary?: string;
216
+ /**
217
+ * The SHA-256 of `markdown`, in lowercase hexadecimal: what identifies the
218
+ * version, and what an acceptance of it records.
219
+ */
220
+ sha256?: string;
221
+ /**
222
+ * The version's source, Markdown with its YAML front matter, exactly as
223
+ * `sha256` is computed over it.
224
+ */
225
+ markdown?: string;
226
+ /**
227
+ * The version's text as an HTML fragment, without its title: safe to embed
228
+ * as it is. A reference to another legal document links the version of it
229
+ * in force on `effectiveDate`.
230
+ */
231
+ html?: string;
232
+ /**
233
+ * Where the version is published on the web, under a URL that never
234
+ * changes, such as `https://origincloud.eu/legal/terms/2026-12`.
235
+ */
236
+ uri?: string;
237
+ /** Where the version's PDF is downloaded from (DownloadLegalDocumentVersion). */
238
+ pdfUri?: string;
239
+ }
240
+
241
+ /** What a version changes, and so what publishing it asks of a customer. */
242
+ export const LegalDocumentVersion_ChangeClass = {
243
+ /** Not used. */
244
+ CHANGE_CLASS_UNSPECIFIED: "CHANGE_CLASS_UNSPECIFIED",
245
+ /**
246
+ * Changes rights or obligations. For a document customers accept, a
247
+ * customer accepts this version before it applies to them, and it is
248
+ * announced at least six weeks before it takes effect.
249
+ */
250
+ MATERIAL: "MATERIAL",
251
+ /**
252
+ * Announced ahead and never accepted, such as a new sub-processor,
253
+ * announced at least 30 days before it takes effect.
254
+ */
255
+ NOTICE: "NOTICE",
256
+ /** Wording, corrections and formatting. Asks nothing of anyone. */
257
+ EDITORIAL: "EDITORIAL",
258
+ } as const;
259
+
260
+ /** What a version changes, and so what publishing it asks of a customer. */
261
+ export type LegalDocumentVersion_ChangeClass = (typeof LegalDocumentVersion_ChangeClass)[keyof typeof LegalDocumentVersion_ChangeClass];
262
+
263
+ /** The request for ListLegalDocuments. */
264
+ export interface ListLegalDocumentsRequest {
265
+ /**
266
+ * The most documents to return; the server clamps it, and 0 means its
267
+ * default.
268
+ */
269
+ pageSize?: number;
270
+ /** A previous response's `nextPageToken`, for the page after it. */
271
+ pageToken?: string;
272
+ }
273
+
274
+ /** The response for ListLegalDocuments. */
275
+ export interface ListLegalDocumentsResponse {
276
+ /** The documents on this page. */
277
+ legalDocuments?: LegalDocument[];
278
+ /** The token for the next page; empty on the last one. */
279
+ nextPageToken?: string;
280
+ }
281
+
282
+ /** The request for GetLegalDocument. */
283
+ export interface GetLegalDocumentRequest {
284
+ /** The document to return, `legalDocuments/{legal_document}`. */
285
+ name?: string;
286
+ }
287
+
288
+ /** The request for ListLegalDocumentVersions. */
289
+ export interface ListLegalDocumentVersionsRequest {
290
+ /** The document whose versions to list, `legalDocuments/{legal_document}`. */
291
+ parent?: string;
292
+ /**
293
+ * The most versions to return; the server clamps it, and 0 means its
294
+ * default.
295
+ */
296
+ pageSize?: number;
297
+ /** A previous response's `nextPageToken`, for the page after it. */
298
+ pageToken?: string;
299
+ }
300
+
301
+ /** The response for ListLegalDocumentVersions. */
302
+ export interface ListLegalDocumentVersionsResponse {
303
+ /** The versions on this page. */
304
+ legalDocumentVersions?: LegalDocumentVersion[];
305
+ /** The token for the next page; empty on the last one. */
306
+ nextPageToken?: string;
307
+ }
308
+
309
+ /** The request for GetLegalDocumentVersion. */
310
+ export interface GetLegalDocumentVersionRequest {
311
+ /**
312
+ * The version to return,
313
+ * `legalDocuments/{legal_document}/versions/{version}`.
314
+ */
315
+ name?: string;
316
+ }
317
+
318
+ /** The request for DownloadLegalDocumentVersion. */
319
+ export interface DownloadLegalDocumentVersionRequest {
320
+ /**
321
+ * The version to download,
322
+ * `legalDocuments/{legal_document}/versions/{version}`.
323
+ */
324
+ name?: string;
325
+ }