Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 28, 2024
1 parent f0c7c22 commit 4445335
Show file tree
Hide file tree
Showing 215 changed files with 2,350 additions and 2,048 deletions.
312 changes: 125 additions & 187 deletions api.md

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class Cloudflare extends Core.APIClient {
workersForPlatforms: API.WorkersForPlatforms = new API.WorkersForPlatforms(this);
zeroTrust: API.ZeroTrust = new API.ZeroTrust(this);
challenges: API.Challenges = new API.Challenges(this);
hyperdrive: API.Hyperdrive = new API.Hyperdrive(this);
hyperdrive: API.HyperdriveResource = new API.HyperdriveResource(this);
rum: API.RUM = new API.RUM(this);
vectorize: API.Vectorize = new API.Vectorize(this);
urlScanner: API.URLScanner = new API.URLScanner(this);
Expand Down Expand Up @@ -402,9 +402,9 @@ export namespace Cloudflare {
export import OriginCACertificates = API.OriginCACertificates;
export import OriginCACertificate = API.OriginCACertificate;
export import OriginCACertificateCreateResponse = API.OriginCACertificateCreateResponse;
export import OriginCACertificateListResponse = API.OriginCACertificateListResponse;
export import OriginCACertificateDeleteResponse = API.OriginCACertificateDeleteResponse;
export import OriginCACertificateGetResponse = API.OriginCACertificateGetResponse;
export import OriginCACertificatesSinglePage = API.OriginCACertificatesSinglePage;
export import OriginCACertificateCreateParams = API.OriginCACertificateCreateParams;

export import IPs = API.IPs;
Expand Down Expand Up @@ -439,8 +439,8 @@ export namespace Cloudflare {

export import LoadBalancers = API.LoadBalancers;
export import LoadBalancer = API.LoadBalancer;
export import LoadBalancerListResponse = API.LoadBalancerListResponse;
export import LoadBalancerDeleteResponse = API.LoadBalancerDeleteResponse;
export import LoadBalancersSinglePage = API.LoadBalancersSinglePage;
export import LoadBalancerCreateParams = API.LoadBalancerCreateParams;
export import LoadBalancerUpdateParams = API.LoadBalancerUpdateParams;
export import LoadBalancerListParams = API.LoadBalancerListParams;
Expand All @@ -460,6 +460,7 @@ export namespace Cloudflare {
export import SubscriptionListResponse = API.SubscriptionListResponse;
export import SubscriptionDeleteResponse = API.SubscriptionDeleteResponse;
export import SubscriptionGetResponse = API.SubscriptionGetResponse;
export import SubscriptionListResponsesSinglePage = API.SubscriptionListResponsesSinglePage;
export import SubscriptionCreateParams = API.SubscriptionCreateParams;
export import SubscriptionUpdateParams = API.SubscriptionUpdateParams;

Expand All @@ -469,7 +470,7 @@ export namespace Cloudflare {

export import Plans = API.Plans;
export import AvailableRatePlan = API.AvailableRatePlan;
export import PlanListResponse = API.PlanListResponse;
export import AvailableRatePlansSinglePage = API.AvailableRatePlansSinglePage;

export import RatePlans = API.RatePlans;
export import RatePlan = API.RatePlan;
Expand Down Expand Up @@ -552,8 +553,8 @@ export namespace Cloudflare {

export import Healthchecks = API.Healthchecks;
export import Healthcheck = API.Healthcheck;
export import HealthcheckListResponse = API.HealthcheckListResponse;
export import HealthcheckDeleteResponse = API.HealthcheckDeleteResponse;
export import HealthchecksSinglePage = API.HealthchecksSinglePage;
export import HealthcheckCreateParams = API.HealthcheckCreateParams;
export import HealthcheckUpdateParams = API.HealthcheckUpdateParams;
export import HealthcheckListParams = API.HealthcheckListParams;
Expand All @@ -564,8 +565,8 @@ export namespace Cloudflare {
export import KeylessCertificates = API.KeylessCertificates;
export import KeylessCertificate = API.KeylessCertificate;
export import KeylessCertificateHostname = API.KeylessCertificateHostname;
export import KeylessCertificateListResponse = API.KeylessCertificateListResponse;
export import KeylessCertificateDeleteResponse = API.KeylessCertificateDeleteResponse;
export import KeylessCertificateHostnamesSinglePage = API.KeylessCertificateHostnamesSinglePage;
export import KeylessCertificateCreateParams = API.KeylessCertificateCreateParams;
export import KeylessCertificateListParams = API.KeylessCertificateListParams;
export import KeylessCertificateDeleteParams = API.KeylessCertificateDeleteParams;
Expand All @@ -582,6 +583,7 @@ export namespace Cloudflare {
export import OriginTLSClientAuthListResponse = API.OriginTLSClientAuthListResponse;
export import OriginTLSClientAuthDeleteResponse = API.OriginTLSClientAuthDeleteResponse;
export import OriginTLSClientAuthGetResponse = API.OriginTLSClientAuthGetResponse;
export import OriginTLSClientAuthListResponsesSinglePage = API.OriginTLSClientAuthListResponsesSinglePage;
export import OriginTLSClientAuthCreateParams = API.OriginTLSClientAuthCreateParams;
export import OriginTLSClientAuthListParams = API.OriginTLSClientAuthListParams;
export import OriginTLSClientAuthDeleteParams = API.OriginTLSClientAuthDeleteParams;
Expand Down Expand Up @@ -618,8 +620,8 @@ export namespace Cloudflare {

export import WaitingRooms = API.WaitingRooms;
export import WaitingRoom = API.WaitingRoom;
export import WaitingRoomListResponse = API.WaitingRoomListResponse;
export import WaitingRoomDeleteResponse = API.WaitingRoomDeleteResponse;
export import WaitingRoomsSinglePage = API.WaitingRoomsSinglePage;
export import WaitingRoomCreateParams = API.WaitingRoomCreateParams;
export import WaitingRoomUpdateParams = API.WaitingRoomUpdateParams;
export import WaitingRoomEditParams = API.WaitingRoomEditParams;
Expand All @@ -641,6 +643,7 @@ export namespace Cloudflare {
export import QueueListResponse = API.QueueListResponse;
export import QueueDeleteResponse = API.QueueDeleteResponse;
export import QueueGetResponse = API.QueueGetResponse;
export import QueueListResponsesSinglePage = API.QueueListResponsesSinglePage;
export import QueueCreateParams = API.QueueCreateParams;
export import QueueUpdateParams = API.QueueUpdateParams;
export import QueueListParams = API.QueueListParams;
Expand All @@ -660,8 +663,9 @@ export namespace Cloudflare {
export import PageShieldGetParams = API.PageShieldGetParams;

export import Rulesets = API.Rulesets;
export import RulesetsRulesetResponse = API.RulesetsRulesetResponse;
export import RulesetsRulesetsResponse = API.RulesetsRulesetsResponse;
export import Ruleset = API.Ruleset;
export import RulesetListResponse = API.RulesetListResponse;
export import RulesetListResponsesSinglePage = API.RulesetListResponsesSinglePage;
export import RulesetCreateParams = API.RulesetCreateParams;
export import RulesetUpdateParams = API.RulesetUpdateParams;
export import RulesetListParams = API.RulesetListParams;
Expand Down Expand Up @@ -704,7 +708,7 @@ export namespace Cloudflare {
export import MTLSCertificates = API.MTLSCertificates;
export import MTLSCertificate = API.MTLSCertificate;
export import MTLSCertificateUpdate = API.MTLSCertificateUpdate;
export import MTLSCertificateListResponse = API.MTLSCertificateListResponse;
export import MTLSCertificatesSinglePage = API.MTLSCertificatesSinglePage;
export import MTLSCertificateCreateParams = API.MTLSCertificateCreateParams;
export import MTLSCertificateListParams = API.MTLSCertificateListParams;
export import MTLSCertificateDeleteParams = API.MTLSCertificateDeleteParams;
Expand All @@ -716,6 +720,7 @@ export namespace Cloudflare {
export import PCAPCreateResponse = API.PCAPCreateResponse;
export import PCAPListResponse = API.PCAPListResponse;
export import PCAPGetResponse = API.PCAPGetResponse;
export import PCAPListResponsesSinglePage = API.PCAPListResponsesSinglePage;
export import PCAPCreateParams = API.PCAPCreateParams;
export import PCAPListParams = API.PCAPListParams;
export import PCAPGetParams = API.PCAPGetParams;
Expand All @@ -730,7 +735,7 @@ export namespace Cloudflare {

export import Stream = API.Stream;
export import StreamVideos = API.StreamVideos;
export import StreamListResponse = API.StreamListResponse;
export import StreamVideosSinglePage = API.StreamVideosSinglePage;
export import StreamCreateParams = API.StreamCreateParams;
export import StreamListParams = API.StreamListParams;
export import StreamDeleteParams = API.StreamDeleteParams;
Expand Down Expand Up @@ -763,6 +768,7 @@ export namespace Cloudflare {

export import Challenges = API.Challenges;

export import HyperdriveResource = API.HyperdriveResource;
export import Hyperdrive = API.Hyperdrive;

export import RUM = API.RUM;
Expand Down Expand Up @@ -801,14 +807,14 @@ export namespace Cloudflare {

export import Snippets = API.Snippets;
export import Snippet = API.Snippet;
export import SnippetListResponse = API.SnippetListResponse;
export import SnippetDeleteResponse = API.SnippetDeleteResponse;
export import SnippetsSinglePage = API.SnippetsSinglePage;
export import SnippetUpdateParams = API.SnippetUpdateParams;

export import Calls = API.Calls;
export import CallsApp = API.CallsApp;
export import CallsAppWithSecret = API.CallsAppWithSecret;
export import CallListResponse = API.CallListResponse;
export import CallsAppsSinglePage = API.CallsAppsSinglePage;
export import CallCreateParams = API.CallCreateParams;
export import CallUpdateParams = API.CallUpdateParams;
export import CallListParams = API.CallListParams;
Expand Down
12 changes: 7 additions & 5 deletions src/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,12 @@ export class CursorLimitPagination<Item>
}
}

export type SinglePageResponse<Item> = Item[];
export interface SinglePageResponse<Item> {
result: Array<Item>;
}

export class SinglePage<Item> extends AbstractPage<Item> {
items: Array<Item>;
export class SinglePage<Item> extends AbstractPage<Item> implements SinglePageResponse<Item> {
result: Array<Item>;

constructor(
client: APIClient,
Expand All @@ -277,11 +279,11 @@ export class SinglePage<Item> extends AbstractPage<Item> {
) {
super(client, response, body, options);

this.items = body || [];
this.result = body.result || [];
}

getPaginatedItems(): Item[] {
return this.items ?? [];
return this.result ?? [];
}

// @deprecated Please use `nextPageInfo()` instead
Expand Down
2 changes: 1 addition & 1 deletion src/resources/accounts/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ export namespace Accounts {
export import MemberGetParams = MembersAPI.MemberGetParams;
export import Roles = RolesAPI.Roles;
export import Role = RolesAPI.Role;
export import RoleListResponse = RolesAPI.RoleListResponse;
export import RoleGetResponse = RolesAPI.RoleGetResponse;
export import RolesSinglePage = RolesAPI.RolesSinglePage;
export import RoleListParams = RolesAPI.RoleListParams;
export import RoleGetParams = RolesAPI.RoleGetParams;
}
2 changes: 1 addition & 1 deletion src/resources/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export {
MemberListResponsesV4PagePaginationArray,
Members,
} from './members';
export { Role, RoleListResponse, RoleGetResponse, RoleListParams, RoleGetParams, Roles } from './roles';
export { Role, RoleGetResponse, RoleListParams, RoleGetParams, RolesSinglePage, Roles } from './roles';
15 changes: 6 additions & 9 deletions src/resources/accounts/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as RolesAPI from 'cloudflare/resources/accounts/roles';
import { SinglePage } from 'cloudflare/pagination';

export class Roles extends APIResource {
/**
* Get all available roles for an account.
*/
list(params: RoleListParams, options?: Core.RequestOptions): Core.APIPromise<RoleListResponse | null> {
list(params: RoleListParams, options?: Core.RequestOptions): Core.PagePromise<RolesSinglePage, Role> {
const { account_id } = params;
return (
this._client.get(`/accounts/${account_id}/roles`, options) as Core.APIPromise<{
result: RoleListResponse | null;
}>
)._thenUnwrap((obj) => obj.result);
return this._client.getAPIList(`/accounts/${account_id}/roles`, RolesSinglePage, options);
}

/**
Expand All @@ -34,6 +31,8 @@ export class Roles extends APIResource {
}
}

export class RolesSinglePage extends SinglePage<Role> {}

export interface Role {
/**
* Role identifier tag.
Expand All @@ -56,8 +55,6 @@ export interface Role {
permissions: Array<string>;
}

export type RoleListResponse = Array<Role>;

export type RoleGetResponse = unknown | string | null;

export interface RoleListParams {
Expand All @@ -70,8 +67,8 @@ export interface RoleGetParams {

export namespace Roles {
export import Role = RolesAPI.Role;
export import RoleListResponse = RolesAPI.RoleListResponse;
export import RoleGetResponse = RolesAPI.RoleGetResponse;
export import RolesSinglePage = RolesAPI.RolesSinglePage;
export import RoleListParams = RolesAPI.RoleListParams;
export import RoleGetParams = RolesAPI.RoleGetParams;
}
19 changes: 10 additions & 9 deletions src/resources/addressing/address-maps/address-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as AddressMapsAPI from 'cloudflare/resources/addressing/address-maps/ad
import * as AccountsAPI from 'cloudflare/resources/addressing/address-maps/accounts';
import * as IPsAPI from 'cloudflare/resources/addressing/address-maps/ips';
import * as ZonesAPI from 'cloudflare/resources/addressing/address-maps/zones';
import { SinglePage } from 'cloudflare/pagination';

export class AddressMaps extends APIResource {
accounts: AccountsAPI.Accounts = new AccountsAPI.Accounts(this._client);
Expand Down Expand Up @@ -34,13 +35,13 @@ export class AddressMaps extends APIResource {
list(
params: AddressMapListParams,
options?: Core.RequestOptions,
): Core.APIPromise<AddressMapListResponse | null> {
): Core.PagePromise<AddressingAddressMapsSinglePage, AddressingAddressMaps> {
const { account_id } = params;
return (
this._client.get(`/accounts/${account_id}/addressing/address_maps`, options) as Core.APIPromise<{
result: AddressMapListResponse | null;
}>
)._thenUnwrap((obj) => obj.result);
return this._client.getAPIList(
`/accounts/${account_id}/addressing/address_maps`,
AddressingAddressMapsSinglePage,
options,
);
}

/**
Expand Down Expand Up @@ -96,6 +97,8 @@ export class AddressMaps extends APIResource {
}
}

export class AddressingAddressMapsSinglePage extends SinglePage<AddressingAddressMaps> {}

export interface AddressingAddressMaps {
/**
* Identifier
Expand Down Expand Up @@ -225,8 +228,6 @@ export namespace AddressMapCreateResponse {
}
}

export type AddressMapListResponse = Array<AddressingAddressMaps>;

export type AddressMapDeleteResponse = unknown | Array<unknown> | string;

export interface AddressMapGetResponse {
Expand Down Expand Up @@ -385,9 +386,9 @@ export interface AddressMapGetParams {
export namespace AddressMaps {
export import AddressingAddressMaps = AddressMapsAPI.AddressingAddressMaps;
export import AddressMapCreateResponse = AddressMapsAPI.AddressMapCreateResponse;
export import AddressMapListResponse = AddressMapsAPI.AddressMapListResponse;
export import AddressMapDeleteResponse = AddressMapsAPI.AddressMapDeleteResponse;
export import AddressMapGetResponse = AddressMapsAPI.AddressMapGetResponse;
export import AddressingAddressMapsSinglePage = AddressMapsAPI.AddressingAddressMapsSinglePage;
export import AddressMapCreateParams = AddressMapsAPI.AddressMapCreateParams;
export import AddressMapListParams = AddressMapsAPI.AddressMapListParams;
export import AddressMapDeleteParams = AddressMapsAPI.AddressMapDeleteParams;
Expand Down
2 changes: 1 addition & 1 deletion src/resources/addressing/address-maps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ export {
export {
AddressingAddressMaps,
AddressMapCreateResponse,
AddressMapListResponse,
AddressMapDeleteResponse,
AddressMapGetResponse,
AddressMapCreateParams,
AddressMapListParams,
AddressMapDeleteParams,
AddressMapEditParams,
AddressMapGetParams,
AddressingAddressMapsSinglePage,
AddressMaps,
} from './address-maps';
export { IPUpdateResponse, IPDeleteResponse, IPUpdateParams, IPDeleteParams, IPs } from './ips';
Expand Down
5 changes: 3 additions & 2 deletions src/resources/addressing/addressing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ export class Addressing extends APIResource {
export namespace Addressing {
export import Services = ServicesAPI.Services;
export import ServiceListResponse = ServicesAPI.ServiceListResponse;
export import ServiceListResponsesSinglePage = ServicesAPI.ServiceListResponsesSinglePage;
export import ServiceListParams = ServicesAPI.ServiceListParams;
export import AddressMaps = AddressMapsAPI.AddressMaps;
export import AddressingAddressMaps = AddressMapsAPI.AddressingAddressMaps;
export import AddressMapCreateResponse = AddressMapsAPI.AddressMapCreateResponse;
export import AddressMapListResponse = AddressMapsAPI.AddressMapListResponse;
export import AddressMapDeleteResponse = AddressMapsAPI.AddressMapDeleteResponse;
export import AddressMapGetResponse = AddressMapsAPI.AddressMapGetResponse;
export import AddressingAddressMapsSinglePage = AddressMapsAPI.AddressingAddressMapsSinglePage;
export import AddressMapCreateParams = AddressMapsAPI.AddressMapCreateParams;
export import AddressMapListParams = AddressMapsAPI.AddressMapListParams;
export import AddressMapDeleteParams = AddressMapsAPI.AddressMapDeleteParams;
Expand All @@ -33,8 +34,8 @@ export namespace Addressing {
export import LOADocumentCreateParams = LOADocumentsAPI.LOADocumentCreateParams;
export import Prefixes = PrefixesAPI.Prefixes;
export import AddressingIpamPrefixes = PrefixesAPI.AddressingIpamPrefixes;
export import PrefixListResponse = PrefixesAPI.PrefixListResponse;
export import PrefixDeleteResponse = PrefixesAPI.PrefixDeleteResponse;
export import AddressingIpamPrefixesSinglePage = PrefixesAPI.AddressingIpamPrefixesSinglePage;
export import PrefixCreateParams = PrefixesAPI.PrefixCreateParams;
export import PrefixListParams = PrefixesAPI.PrefixListParams;
export import PrefixDeleteParams = PrefixesAPI.PrefixDeleteParams;
Expand Down
6 changes: 3 additions & 3 deletions src/resources/addressing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ export { Addressing } from './addressing';
export {
AddressingAddressMaps,
AddressMapCreateResponse,
AddressMapListResponse,
AddressMapDeleteResponse,
AddressMapGetResponse,
AddressMapCreateParams,
AddressMapListParams,
AddressMapDeleteParams,
AddressMapEditParams,
AddressMapGetParams,
AddressingAddressMapsSinglePage,
AddressMaps,
} from './address-maps/index';
export {
AddressingIpamPrefixes,
PrefixListResponse,
PrefixDeleteResponse,
PrefixCreateParams,
PrefixListParams,
PrefixDeleteParams,
PrefixEditParams,
PrefixGetParams,
AddressingIpamPrefixesSinglePage,
Prefixes,
} from './prefixes/index';
export { LOADocumentCreateResponse, LOADocumentCreateParams, LOADocuments } from './loa-documents/index';
export { ServiceListResponse, ServiceListParams, Services } from './services';
export { ServiceListResponse, ServiceListParams, ServiceListResponsesSinglePage, Services } from './services';
4 changes: 2 additions & 2 deletions src/resources/addressing/prefixes/bgp/bgp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ export class BGP extends APIResource {
export namespace BGP {
export import Bindings = BindingsAPI.Bindings;
export import AddressingServiceBinding = BindingsAPI.AddressingServiceBinding;
export import BindingListResponse = BindingsAPI.BindingListResponse;
export import BindingDeleteResponse = BindingsAPI.BindingDeleteResponse;
export import AddressingServiceBindingsSinglePage = BindingsAPI.AddressingServiceBindingsSinglePage;
export import BindingCreateParams = BindingsAPI.BindingCreateParams;
export import BindingListParams = BindingsAPI.BindingListParams;
export import BindingDeleteParams = BindingsAPI.BindingDeleteParams;
export import BindingGetParams = BindingsAPI.BindingGetParams;
export import Prefixes = PrefixesAPI.Prefixes;
export import AddressingIpamBGPPrefixes = PrefixesAPI.AddressingIpamBGPPrefixes;
export import PrefixListResponse = PrefixesAPI.PrefixListResponse;
export import AddressingIpamBGPPrefixesSinglePage = PrefixesAPI.AddressingIpamBGPPrefixesSinglePage;
export import PrefixListParams = PrefixesAPI.PrefixListParams;
export import PrefixEditParams = PrefixesAPI.PrefixEditParams;
export import PrefixGetParams = PrefixesAPI.PrefixGetParams;
Expand Down
Loading

0 comments on commit 4445335

Please sign in to comment.