cloudflare
Version:
The official TypeScript library for the Cloudflare API
56 lines • 1.88 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 BaseSubscriptions = /* @__PURE__ */ (() => {
class BaseSubscriptions extends APIResource {
/**
* Updates a user's subscriptions.
*
* @example
* ```ts
* const subscription = await client.user.subscriptions.update(
* '506e3185e9c882d175a2d0cb0093d9f2',
* );
* ```
*/
update(identifier, body, options) {
return this._client.put(path `/user/subscriptions/${identifier}`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Deletes a user's subscription.
*
* @example
* ```ts
* const subscription = await client.user.subscriptions.delete(
* '506e3185e9c882d175a2d0cb0093d9f2',
* );
* ```
*/
delete(identifier, options) {
return this._client.delete(path `/user/subscriptions/${identifier}`, options);
}
/**
* Lists all of a user's subscriptions.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const subscription of client.user.subscriptions.get()) {
* // ...
* }
* ```
*/
get(options) {
return this._client.getAPIList('/user/subscriptions', (SinglePage), options);
}
}
BaseSubscriptions._key = Object.freeze([
'user',
'subscriptions',
]);
return BaseSubscriptions;
})();
export class Subscriptions extends BaseSubscriptions {
}
//# sourceMappingURL=subscriptions.mjs.map