Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 15, 2024
1 parent fdbf303 commit 7da6798
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 38 deletions.
8 changes: 4 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4388,12 +4388,12 @@ Types:

- <code><a href="./src/resources/zero-trust/access/certificates/settings.ts">AccessSettings</a></code>
- <code><a href="./src/resources/zero-trust/access/certificates/settings.ts">SettingUpdateResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/certificates/settings.ts">SettingListResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/certificates/settings.ts">SettingGetResponse</a></code>

Methods:

- <code title="put /{account_or_zone}/{account_or_zone_id}/access/certificates/settings">client.zeroTrust.access.certificates.settings.<a href="./src/resources/zero-trust/access/certificates/settings.ts">update</a>({ ...params }) -> SettingUpdateResponse | null</code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/access/certificates/settings">client.zeroTrust.access.certificates.settings.<a href="./src/resources/zero-trust/access/certificates/settings.ts">list</a>({ ...params }) -> SettingListResponse | null</code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/access/certificates/settings">client.zeroTrust.access.certificates.settings.<a href="./src/resources/zero-trust/access/certificates/settings.ts">get</a>({ ...params }) -> SettingGetResponse | null</code>

### Groups

Expand Down Expand Up @@ -4450,13 +4450,13 @@ Methods:
Types:

- <code><a href="./src/resources/zero-trust/access/keys.ts">KeyUpdateResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/keys.ts">KeyListResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/keys.ts">KeyGetResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/keys.ts">KeyRotateResponse</a></code>

Methods:

- <code title="put /accounts/{identifier}/access/keys">client.zeroTrust.access.keys.<a href="./src/resources/zero-trust/access/keys.ts">update</a>(identifier, { ...params }) -> KeyUpdateResponse</code>
- <code title="get /accounts/{identifier}/access/keys">client.zeroTrust.access.keys.<a href="./src/resources/zero-trust/access/keys.ts">list</a>(identifier) -> KeyListResponse</code>
- <code title="get /accounts/{identifier}/access/keys">client.zeroTrust.access.keys.<a href="./src/resources/zero-trust/access/keys.ts">get</a>(identifier) -> KeyGetResponse</code>
- <code title="post /accounts/{identifier}/access/keys/rotate">client.zeroTrust.access.keys.<a href="./src/resources/zero-trust/access/keys.ts">rotate</a>(identifier) -> KeyRotateResponse</code>

### Logs
Expand Down
2 changes: 1 addition & 1 deletion src/resources/zero-trust/access/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export namespace Access {
export import BookmarkDeleteResponse = BookmarksAPI.BookmarkDeleteResponse;
export import Keys = KeysAPI.Keys;
export import KeyUpdateResponse = KeysAPI.KeyUpdateResponse;
export import KeyListResponse = KeysAPI.KeyListResponse;
export import KeyGetResponse = KeysAPI.KeyGetResponse;
export import KeyRotateResponse = KeysAPI.KeyRotateResponse;
export import KeyUpdateParams = KeysAPI.KeyUpdateParams;
export import Logs = LogsAPI.Logs;
Expand Down
4 changes: 2 additions & 2 deletions src/resources/zero-trust/access/certificates/certificates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export namespace Certificates {
export import Settings = SettingsAPI.Settings;
export import AccessSettings = SettingsAPI.AccessSettings;
export import SettingUpdateResponse = SettingsAPI.SettingUpdateResponse;
export import SettingListResponse = SettingsAPI.SettingListResponse;
export import SettingGetResponse = SettingsAPI.SettingGetResponse;
export import SettingUpdateParams = SettingsAPI.SettingUpdateParams;
export import SettingListParams = SettingsAPI.SettingListParams;
export import SettingGetParams = SettingsAPI.SettingGetParams;
}
4 changes: 2 additions & 2 deletions src/resources/zero-trust/access/certificates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export {
export {
AccessSettings,
SettingUpdateResponse,
SettingListResponse,
SettingGetResponse,
SettingUpdateParams,
SettingListParams,
SettingGetParams,
Settings,
} from './settings';
25 changes: 11 additions & 14 deletions src/resources/zero-trust/access/certificates/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,14 @@ export class Settings extends APIResource {
/**
* List all mTLS hostname settings for this account or zone.
*/
list(
params?: SettingListParams,
get(params?: SettingGetParams, options?: Core.RequestOptions): Core.APIPromise<SettingGetResponse | null>;
get(options?: Core.RequestOptions): Core.APIPromise<SettingGetResponse | null>;
get(
params: SettingGetParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<SettingListResponse | null>;
list(options?: Core.RequestOptions): Core.APIPromise<SettingListResponse | null>;
list(
params: SettingListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<SettingListResponse | null> {
): Core.APIPromise<SettingGetResponse | null> {
if (isRequestOptions(params)) {
return this.list({}, params);
return this.get({}, params);
}
const { account_id, zone_id } = params;
if (!account_id && !zone_id) {
Expand All @@ -75,7 +72,7 @@ export class Settings extends APIResource {
this._client.get(
`/${accountOrZone}/${accountOrZoneId}/access/certificates/settings`,
options,
) as Core.APIPromise<{ result: SettingListResponse | null }>
) as Core.APIPromise<{ result: SettingGetResponse | null }>
)._thenUnwrap((obj) => obj.result);
}
}
Expand All @@ -102,7 +99,7 @@ export interface AccessSettings {

export type SettingUpdateResponse = Array<AccessSettings>;

export type SettingListResponse = Array<AccessSettings>;
export type SettingGetResponse = Array<AccessSettings>;

export interface SettingUpdateParams {
/**
Expand All @@ -123,7 +120,7 @@ export interface SettingUpdateParams {
zone_id?: string;
}

export interface SettingListParams {
export interface SettingGetParams {
/**
* The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
*/
Expand All @@ -138,7 +135,7 @@ export interface SettingListParams {
export namespace Settings {
export import AccessSettings = SettingsAPI.AccessSettings;
export import SettingUpdateResponse = SettingsAPI.SettingUpdateResponse;
export import SettingListResponse = SettingsAPI.SettingListResponse;
export import SettingGetResponse = SettingsAPI.SettingGetResponse;
export import SettingUpdateParams = SettingsAPI.SettingUpdateParams;
export import SettingListParams = SettingsAPI.SettingListParams;
export import SettingGetParams = SettingsAPI.SettingGetParams;
}
2 changes: 1 addition & 1 deletion src/resources/zero-trust/access/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ export {
Tags,
} from './tags';
export { AccessUsers, UserListResponse, Users } from './users/index';
export { KeyUpdateResponse, KeyListResponse, KeyRotateResponse, KeyUpdateParams, Keys } from './keys';
export { KeyUpdateResponse, KeyGetResponse, KeyRotateResponse, KeyUpdateParams, Keys } from './keys';
export { Logs } from './logs/index';
8 changes: 4 additions & 4 deletions src/resources/zero-trust/access/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export class Keys extends APIResource {
/**
* Gets the Access key rotation settings for an account.
*/
list(identifier: string, options?: Core.RequestOptions): Core.APIPromise<KeyListResponse> {
get(identifier: string, options?: Core.RequestOptions): Core.APIPromise<KeyGetResponse> {
return (
this._client.get(`/accounts/${identifier}/access/keys`, options) as Core.APIPromise<{
result: KeyListResponse;
result: KeyGetResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
Expand All @@ -45,7 +45,7 @@ export class Keys extends APIResource {

export type KeyUpdateResponse = unknown | string;

export type KeyListResponse = unknown | string;
export type KeyGetResponse = unknown | string;

export type KeyRotateResponse = unknown | string;

Expand All @@ -58,7 +58,7 @@ export interface KeyUpdateParams {

export namespace Keys {
export import KeyUpdateResponse = KeysAPI.KeyUpdateResponse;
export import KeyListResponse = KeysAPI.KeyListResponse;
export import KeyGetResponse = KeysAPI.KeyGetResponse;
export import KeyRotateResponse = KeysAPI.KeyRotateResponse;
export import KeyUpdateParams = KeysAPI.KeyUpdateParams;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe('resource settings', () => {
});

// skipped: tests are disabled for the time being
test.skip('list', async () => {
const responsePromise = cloudflare.zeroTrust.access.certificates.settings.list();
test.skip('get', async () => {
const responsePromise = cloudflare.zeroTrust.access.certificates.settings.get();
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -54,18 +54,18 @@ describe('resource settings', () => {
});

// skipped: tests are disabled for the time being
test.skip('list: request options instead of params are passed correctly', async () => {
test.skip('get: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
cloudflare.zeroTrust.access.certificates.settings.list({ path: '/_stainless_unknown_path' }),
cloudflare.zeroTrust.access.certificates.settings.get({ path: '/_stainless_unknown_path' }),
).rejects.toThrow(Cloudflare.NotFoundError);
});

// skipped: tests are disabled for the time being
test.skip('list: request options and params are passed correctly', async () => {
test.skip('get: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
cloudflare.zeroTrust.access.certificates.settings.list(
cloudflare.zeroTrust.access.certificates.settings.get(
{ account_id: 'string', zone_id: 'string' },
{ path: '/_stainless_unknown_path' },
),
Expand Down
8 changes: 4 additions & 4 deletions tests/api-resources/zero-trust/access/keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ describe('resource keys', () => {
});

// skipped: tests are disabled for the time being
test.skip('list', async () => {
const responsePromise = cloudflare.zeroTrust.access.keys.list('023e105f4ecef8ad9ca31a8372d0c353');
test.skip('get', async () => {
const responsePromise = cloudflare.zeroTrust.access.keys.get('023e105f4ecef8ad9ca31a8372d0c353');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -44,10 +44,10 @@ describe('resource keys', () => {
});

// skipped: tests are disabled for the time being
test.skip('list: request options instead of params are passed correctly', async () => {
test.skip('get: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
cloudflare.zeroTrust.access.keys.list('023e105f4ecef8ad9ca31a8372d0c353', {
cloudflare.zeroTrust.access.keys.get('023e105f4ecef8ad9ca31a8372d0c353', {
path: '/_stainless_unknown_path',
}),
).rejects.toThrow(Cloudflare.NotFoundError);
Expand Down

0 comments on commit 7da6798

Please sign in to comment.