Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jun 7, 2024
1 parent 59bd980 commit 01274e2
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1343
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0053e474edb7f838f2b1d38334a7ccb983db09216cca0173a3c3d5401cadcf82.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d780b9eb98465e97c30112eb2c9e586883852508d23a6684bd28e5a9cb7da7a1.yml
6 changes: 1 addition & 5 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3020,13 +3020,9 @@ Methods:

### Downloads

Types:

- <code><a href="./src/resources/addressing/loa-documents/downloads.ts">DownloadGetResponse</a></code>

Methods:

- <code title="get /accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download">client.addressing.loaDocuments.downloads.<a href="./src/resources/addressing/loa-documents/downloads.ts">get</a>(loaDocumentId, { ...params }) -> unknown</code>
- <code title="get /accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download">client.addressing.loaDocuments.downloads.<a href="./src/resources/addressing/loa-documents/downloads.ts">get</a>(loaDocumentId, { ...params }) -> Response</code>

## Prefixes

Expand Down
34 changes: 32 additions & 2 deletions src/resources/addressing/address-maps/address-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ export interface AddressMap {
*/
export type Kind = 'zone' | 'account';

/**
* The type of the membership.
*/
export type KindParam = 'zone' | 'account';

export interface AddressMapCreateResponse {
/**
* Identifier
Expand Down Expand Up @@ -222,7 +227,7 @@ export namespace AddressMapCreateResponse {
created_at?: string;

/**
* Identifier
* The identifier for the membership (eg. a zone or account tag).
*/
identifier?: string;

Expand Down Expand Up @@ -309,7 +314,7 @@ export namespace AddressMapGetResponse {
created_at?: string;

/**
* Identifier
* The identifier for the membership (eg. a zone or account tag).
*/
identifier?: string;

Expand Down Expand Up @@ -337,6 +342,31 @@ export interface AddressMapCreateParams {
* respond with IP addresses on an Address Map until the map is enabled.
*/
enabled?: boolean | null;

/**
* Body param:
*/
ips?: Array<string>;

/**
* Body param: Zones and Accounts which will be assigned IPs on this Address Map. A
* zone membership will take priority over an account membership.
*/
memberships?: Array<AddressMapCreateParams.Membership>;
}

export namespace AddressMapCreateParams {
export interface Membership {
/**
* The identifier for the membership (eg. a zone or account tag).
*/
identifier?: string;

/**
* The type of the membership.
*/
kind?: AddressMapsAPI.KindParam;
}
}

export interface AddressMapListParams {
Expand Down
14 changes: 6 additions & 8 deletions src/resources/addressing/loa-documents/downloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import * as Core from '../../../core';
import { APIResource } from '../../../resource';
import { type Response } from '../../../_shims/index';
import * as DownloadsAPI from './downloads';

export class Downloads extends APIResource {
Expand All @@ -12,17 +13,15 @@ export class Downloads extends APIResource {
loaDocumentId: string | null,
params: DownloadGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<unknown> {
): Core.APIPromise<Response> {
const { account_id } = params;
return this._client.get(
`/accounts/${account_id}/addressing/loa_documents/${loaDocumentId}/download`,
options,
);
return this._client.get(`/accounts/${account_id}/addressing/loa_documents/${loaDocumentId}/download`, {
...options,
__binaryResponse: true,
});
}
}

export type DownloadGetResponse = unknown;

export interface DownloadGetParams {
/**
* Identifier
Expand All @@ -31,6 +30,5 @@ export interface DownloadGetParams {
}

export namespace Downloads {
export import DownloadGetResponse = DownloadsAPI.DownloadGetResponse;
export import DownloadGetParams = DownloadsAPI.DownloadGetParams;
}
2 changes: 1 addition & 1 deletion src/resources/addressing/loa-documents/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { DownloadGetResponse, DownloadGetParams, Downloads } from './downloads';
export { DownloadGetParams, Downloads } from './downloads';
export { LOADocumentCreateResponse, LOADocumentCreateParams, LOADocuments } from './loa-documents';
1 change: 0 additions & 1 deletion src/resources/addressing/loa-documents/loa-documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ export namespace LOADocuments {
export import LOADocumentCreateResponse = LOADocumentsAPI.LOADocumentCreateResponse;
export import LOADocumentCreateParams = LOADocumentsAPI.LOADocumentCreateParams;
export import Downloads = DownloadsAPI.Downloads;
export import DownloadGetResponse = DownloadsAPI.DownloadGetResponse;
export import DownloadGetParams = DownloadsAPI.DownloadGetParams;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ describe('resource addressMaps', () => {
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
description: 'My Ecommerce zones',
enabled: true,
ips: ['192.0.2.1', '192.0.2.1', '192.0.2.1'],
memberships: [
{ identifier: '023e105f4ecef8ad9ca31a8372d0c353', kind: 'zone' },
{ identifier: '023e105f4ecef8ad9ca31a8372d0c353', kind: 'zone' },
{ identifier: '023e105f4ecef8ad9ca31a8372d0c353', kind: 'zone' },
],
});
});

Expand Down
15 changes: 0 additions & 15 deletions tests/api-resources/addressing/loa-documents/downloads.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Cloudflare from 'cloudflare';
import { Response } from 'node-fetch';

const cloudflare = new Cloudflare({
apiKey: '144c9defac04969c7bfad8efaa8ea194',
Expand All @@ -10,20 +9,6 @@ const cloudflare = new Cloudflare({
});

describe('resource downloads', () => {
test('get: only required params', async () => {
const responsePromise = cloudflare.addressing.loaDocuments.downloads.get(
'd933b1530bc56c9953cf8ce166da8004',
{ account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
);
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('get: required and optional params', async () => {
const response = await cloudflare.addressing.loaDocuments.downloads.get(
'd933b1530bc56c9953cf8ce166da8004',
Expand Down

0 comments on commit 01274e2

Please sign in to comment.