cloudflare
Version:
The official TypeScript library for the Cloudflare API
56 lines • 2.18 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { buildHeaders } from "../../internal/headers.mjs";
import { multipartFormRequestOptions } from "../../internal/uploads.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseLOADocuments = /* @__PURE__ */ (() => {
class BaseLOADocuments extends APIResource {
/**
* Submit LOA document (pdf format) under the account.
*
* @example
* ```ts
* const loaDocument =
* await client.addressing.loaDocuments.create({
* account_id: '258def64c72dae45f3e4c8516e2111f2',
* loa_document: '@document.pdf',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/addressing/loa_documents`, multipartFormRequestOptions({ body, ...options }, this._client))._thenUnwrap((obj) => obj.result);
}
/**
* Download specified LOA document under the account.
*
* @example
* ```ts
* const loaDocument =
* await client.addressing.loaDocuments.get(
* 'd933b1530bc56c9953cf8ce166da8004',
* { account_id: '258def64c72dae45f3e4c8516e2111f2' },
* );
*
* const content = await loaDocument.blob();
* console.log(content);
* ```
*/
get(loaDocumentID, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/addressing/loa_documents/${loaDocumentID}/download`, {
...options,
headers: buildHeaders([{ Accept: 'application/pdf' }, options?.headers]),
__binaryResponse: true,
});
}
}
BaseLOADocuments._key = Object.freeze([
'addressing',
'loaDocuments',
]);
return BaseLOADocuments;
})();
export class LOADocuments extends BaseLOADocuments {
}
//# sourceMappingURL=loa-documents.mjs.map