Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed May 7, 2024
1 parent edf2a7e commit e071e59
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1275
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-66b404214530cc73c44f34f297dad6bc8da0645b63e61d9d4fcbeb301e127e65.yml
configured_endpoints: 1274
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6ad087215145bdd87a8fb698a148f42cf8f61d66010b60edb5e4842345953810.yml
2 changes: 0 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1344,15 +1344,13 @@ Types:
- <code><a href="./src/resources/custom-nameservers.ts">CustomNameserverDeleteResponse</a></code>
- <code><a href="./src/resources/custom-nameservers.ts">CustomNameserverAvailabiltyResponse</a></code>
- <code><a href="./src/resources/custom-nameservers.ts">CustomNameserverGetResponse</a></code>
- <code><a href="./src/resources/custom-nameservers.ts">CustomNameserverVerifyResponse</a></code>

Methods:

- <code title="post /accounts/{account_id}/custom_ns">client.customNameservers.<a href="./src/resources/custom-nameservers.ts">create</a>({ ...params }) -> CustomNameserver</code>
- <code title="delete /accounts/{account_id}/custom_ns/{custom_ns_id}">client.customNameservers.<a href="./src/resources/custom-nameservers.ts">delete</a>(customNSId, { ...params }) -> CustomNameserverDeleteResponse | null</code>
- <code title="get /accounts/{account_id}/custom_ns/availability">client.customNameservers.<a href="./src/resources/custom-nameservers.ts">availabilty</a>({ ...params }) -> CustomNameserverAvailabiltyResponse | null</code>
- <code title="get /accounts/{account_id}/custom_ns">client.customNameservers.<a href="./src/resources/custom-nameservers.ts">get</a>({ ...params }) -> CustomNameserverGetResponse | null</code>
- <code title="post /accounts/{account_id}/custom_ns/verify">client.customNameservers.<a href="./src/resources/custom-nameservers.ts">verify</a>({ ...params }) -> CustomNameserverVerifyResponse | null</code>

# DNS

Expand Down
32 changes: 1 addition & 31 deletions src/resources/custom-nameservers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,6 @@ export class CustomNameservers extends APIResource {
}>
)._thenUnwrap((obj) => obj.result);
}

/**
* Verify Account Custom Nameserver Glue Records
*/
verify(
params: CustomNameserverVerifyParams,
options?: Core.RequestOptions,
): Core.APIPromise<CustomNameserverVerifyResponse | null> {
const { account_id, body } = params;
return (
this._client.post(`/accounts/${account_id}/custom_ns/verify`, {
body: body,
...options,
}) as Core.APIPromise<{ result: CustomNameserverVerifyResponse | null }>
)._thenUnwrap((obj) => obj.result);
}
}

/**
Expand Down Expand Up @@ -126,14 +110,12 @@ export namespace CustomNameserver {
}
}

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

export type CustomNameserverAvailabiltyResponse = Array<string>;

export type CustomNameserverGetResponse = Array<CustomNameserver>;

export type CustomNameserverVerifyResponse = Array<CustomNameserver>;

export interface CustomNameserverCreateParams {
/**
* Path param: Account identifier tag.
Expand Down Expand Up @@ -171,15 +153,3 @@ export interface CustomNameserverGetParams {
*/
account_id: string;
}

export interface CustomNameserverVerifyParams {
/**
* Path param: Account identifier tag.
*/
account_id: string;

/**
* Body param:
*/
body: unknown;
}
4 changes: 2 additions & 2 deletions src/resources/zones/custom-nameservers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export class CustomNameservers extends APIResource {
}
}

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

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

export interface CustomNameserverUpdateParams {
/**
Expand Down
21 changes: 0 additions & 21 deletions tests/api-resources/custom-nameservers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,4 @@ describe('resource customNameservers', () => {
account_id: '372e67954025e0ba6aaa6d586b9e0b59',
});
});

test('verify: only required params', async () => {
const responsePromise = cloudflare.customNameservers.verify({
account_id: '372e67954025e0ba6aaa6d586b9e0b59',
body: {},
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});

test('verify: required and optional params', async () => {
const response = await cloudflare.customNameservers.verify({
account_id: '372e67954025e0ba6aaa6d586b9e0b59',
body: {},
});
});
});

0 comments on commit e071e59

Please sign in to comment.