cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v5.2.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/addressing/loa-documents.ts

121lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import { APIResource } from '../../resource';
4import * as Core from '../../core';
5import { type Response } from '../../_shims/index';
6
7export class LOADocuments extends APIResource {
8 /**
9 * Submit LOA document (pdf format) under the account.
10 *
11 * @example
12 * ```ts
13 * const loaDocument =
14 * await client.addressing.loaDocuments.create({
15 * account_id: '258def64c72dae45f3e4c8516e2111f2',
16 * loa_document: '@document.pdf',
17 * });
18 * ```
19 */
20 create(
21 params: LOADocumentCreateParams,
22 options?: Core.RequestOptions,
23 ): Core.APIPromise<LOADocumentCreateResponse> {
24 const { account_id, ...body } = params;
25 return (
26 this._client.post(
27 `/accounts/${account_id}/addressing/loa_documents`,
28 Core.multipartFormRequestOptions({ body, ...options }),
29 ) as Core.APIPromise<{ result: LOADocumentCreateResponse }>
30 )._thenUnwrap((obj) => obj.result);
31 }
32
33 /**
34 * Download specified LOA document under the account.
35 *
36 * @example
37 * ```ts
38 * const loaDocument =
39 * await client.addressing.loaDocuments.get(
40 * 'd933b1530bc56c9953cf8ce166da8004',
41 * { account_id: '258def64c72dae45f3e4c8516e2111f2' },
42 * );
43 *
44 * const content = await loaDocument.blob();
45 * console.log(content);
46 * ```
47 */
48 get(
49 loaDocumentId: string | null,
50 params: LOADocumentGetParams,
51 options?: Core.RequestOptions,
52 ): Core.APIPromise<Response> {
53 const { account_id } = params;
54 return this._client.get(`/accounts/${account_id}/addressing/loa_documents/${loaDocumentId}/download`, {
55 ...options,
56 headers: { Accept: 'application/pdf', ...options?.headers },
57 __binaryResponse: true,
58 });
59 }
60}
61
62export interface LOADocumentCreateResponse {
63 /**
64 * Identifier for the uploaded LOA document.
65 */
66 id?: string | null;
67
68 /**
69 * Identifier of a Cloudflare account.
70 */
71 account_id?: string;
72
73 created?: string;
74
75 /**
76 * Name of LOA document. Max file size 10MB, and supported filetype is pdf.
77 */
78 filename?: string;
79
80 /**
81 * File size of the uploaded LOA document.
82 */
83 size_bytes?: number;
84
85 /**
86 * Whether the LOA has been verified by Cloudflare staff.
87 */
88 verified?: boolean;
89
90 /**
91 * Timestamp of the moment the LOA was marked as validated.
92 */
93 verified_at?: string | null;
94}
95
96export interface LOADocumentCreateParams {
97 /**
98 * Path param: Identifier of a Cloudflare account.
99 */
100 account_id: string;
101
102 /**
103 * Body param: LOA document to upload.
104 */
105 loa_document: string;
106}
107
108export interface LOADocumentGetParams {
109 /**
110 * Identifier of a Cloudflare account.
111 */
112 account_id: string;
113}
114
115export declare namespace LOADocuments {
116 export {
117 type LOADocumentCreateResponse as LOADocumentCreateResponse,
118 type LOADocumentCreateParams as LOADocumentCreateParams,
119 type LOADocumentGetParams as LOADocumentGetParams,
120 };
121}
122