cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.2.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/addressing/loa-documents.ts

100lines · 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 create(
12 params: LOADocumentCreateParams,
13 options?: Core.RequestOptions,
14 ): Core.APIPromise<LOADocumentCreateResponse> {
15 const { account_id, ...body } = params;
16 return (
17 this._client.post(
18 `/accounts/${account_id}/addressing/loa_documents`,
19 Core.multipartFormRequestOptions({ body, ...options }),
20 ) as Core.APIPromise<{ result: LOADocumentCreateResponse }>
21 )._thenUnwrap((obj) => obj.result);
22 }
23
24 /**
25 * Download specified LOA document under the account.
26 */
27 get(
28 loaDocumentId: string | null,
29 params: LOADocumentGetParams,
30 options?: Core.RequestOptions,
31 ): Core.APIPromise<Response> {
32 const { account_id } = params;
33 return this._client.get(`/accounts/${account_id}/addressing/loa_documents/${loaDocumentId}/download`, {
34 ...options,
35 headers: { Accept: 'application/pdf', ...options?.headers },
36 __binaryResponse: true,
37 });
38 }
39}
40
41export interface LOADocumentCreateResponse {
42 /**
43 * Identifier for the uploaded LOA document.
44 */
45 id?: string | null;
46
47 /**
48 * Identifier of a Cloudflare account.
49 */
50 account_id?: string;
51
52 created?: string;
53
54 /**
55 * Name of LOA document. Max file size 10MB, and supported filetype is pdf.
56 */
57 filename?: string;
58
59 /**
60 * File size of the uploaded LOA document.
61 */
62 size_bytes?: number;
63
64 /**
65 * Whether the LOA has been verified by Cloudflare staff.
66 */
67 verified?: boolean;
68
69 /**
70 * Timestamp of the moment the LOA was marked as validated.
71 */
72 verified_at?: string | null;
73}
74
75export interface LOADocumentCreateParams {
76 /**
77 * Path param: Identifier of a Cloudflare account.
78 */
79 account_id: string;
80
81 /**
82 * Body param: LOA document to upload.
83 */
84 loa_document: string;
85}
86
87export interface LOADocumentGetParams {
88 /**
89 * Identifier of a Cloudflare account.
90 */
91 account_id: string;
92}
93
94export declare namespace LOADocuments {
95 export {
96 type LOADocumentCreateResponse as LOADocumentCreateResponse,
97 type LOADocumentCreateParams as LOADocumentCreateParams,
98 type LOADocumentGetParams as LOADocumentGetParams,
99 };
100}
101