cloudflare
Version:
The official TypeScript library for the Cloudflare API
54 lines • 1.81 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { SinglePage } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseInvites = /* @__PURE__ */ (() => {
class BaseInvites extends APIResource {
/**
* Lists all invitations associated with my user.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const invite of client.user.invites.list()) {
* // ...
* }
* ```
*/
list(options) {
return this._client.getAPIList('/user/invites', (SinglePage), options);
}
/**
* Responds to an invitation.
*
* @example
* ```ts
* const invite = await client.user.invites.edit(
* '4f5f0c14a2a41d5063dd301b2f829f04',
* { status: 'accepted' },
* );
* ```
*/
edit(inviteID, body, options) {
return this._client.patch(path `/user/invites/${inviteID}`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Gets the details of an invitation.
*
* @example
* ```ts
* const invite = await client.user.invites.get(
* '4f5f0c14a2a41d5063dd301b2f829f04',
* );
* ```
*/
get(inviteID, options) {
return this._client.get(path `/user/invites/${inviteID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseInvites._key = Object.freeze(['user', 'invites']);
return BaseInvites;
})();
export class Invites extends BaseInvites {
}
//# sourceMappingURL=invites.mjs.map