Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#455)
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 3550554 commit 12127fa
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 4 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: 1267
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-6229bf7c4bed6b9026088be8817d3c8111576b2d12ff5220d193f479f230e449.yml
configured_endpoints: 1268
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-7a581c61bc42c6e3e48c58c941255dca8f4b7b2e5aafd402a61c6438c2830071.yml
5 changes: 5 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3143,6 +3143,11 @@ Methods:
Types:

- <code><a href="./src/resources/intel/whois.ts">Whois</a></code>
- <code><a href="./src/resources/intel/whois.ts">WhoisGetResponse</a></code>

Methods:

- <code title="get /accounts/{account_id}/intel/whois">client.intel.whois.<a href="./src/resources/intel/whois.ts">get</a>({ ...params }) -> WhoisGetResponse</code>

## IndicatorFeeds

Expand Down
2 changes: 1 addition & 1 deletion src/resources/intel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ export {
Miscategorizations,
} from './miscategorizations';
export { Sinkhole, SinkholeListParams, SinkholesSinglePage, Sinkholes } from './sinkholes';
export { Whois } from './whois';
export { Whois, WhoisGetResponse, WhoisGetParams } from './whois';
2 changes: 2 additions & 0 deletions src/resources/intel/intel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export namespace Intel {
export import MiscategorizationCreateResponse = MiscategorizationsAPI.MiscategorizationCreateResponse;
export import MiscategorizationCreateParams = MiscategorizationsAPI.MiscategorizationCreateParams;
export import Whois = WhoisAPI.Whois;
export import WhoisGetResponse = WhoisAPI.WhoisGetResponse;
export import WhoisGetParams = WhoisAPI.WhoisGetParams;
export import IndicatorFeeds = IndicatorFeedsAPI.IndicatorFeeds;
export import IndicatorFeedCreateResponse = IndicatorFeedsAPI.IndicatorFeedCreateResponse;
export import IndicatorFeedUpdateResponse = IndicatorFeedsAPI.IndicatorFeedUpdateResponse;
Expand Down
207 changes: 206 additions & 1 deletion src/resources/intel/whois.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as WhoisAPI from 'cloudflare/resources/intel/whois';

export class Whois extends APIResource {}
export class Whois extends APIResource {
/**
* Get WHOIS Record
*/
get(params: WhoisGetParams, options?: Core.RequestOptions): Core.APIPromise<WhoisGetResponse> {
const { account_id, ...query } = params;
return (
this._client.get(`/accounts/${account_id}/intel/whois`, { query, ...options }) as Core.APIPromise<{
result: WhoisGetResponse;
}>
)._thenUnwrap((obj) => obj.result);
}
}

export interface Whois {
created_date?: string;
Expand All @@ -25,6 +38,198 @@ export interface Whois {
updated_date?: string;
}

export interface WhoisGetResponse {
dnnsec: unknown;

domain: string;

extension: string;

found: boolean;

nameservers: Array<string>;

punycode: string;

registrant: string;

registrar: string;

id?: string;

administrative_city?: string;

administrative_country?: string;

administrative_email?: string;

administrative_fax?: string;

administrative_fax_ext?: string;

administrative_id?: string;

administrative_name?: string;

administrative_org?: string;

administrative_phone?: string;

administrative_phone_ext?: string;

administrative_postal_code?: string;

administrative_province?: string;

administrative_referral_url?: string;

administrative_street?: string;

billing_city?: string;

billing_country?: string;

billing_email?: string;

billing_fax?: string;

billing_fax_ext?: string;

billing_id?: string;

billing_name?: string;

billing_org?: string;

billing_phone?: string;

billing_phone_ext?: string;

billing_postal_code?: string;

billing_province?: string;

billing_referral_url?: string;

billing_street?: string;

created_date?: string;

created_date_raw?: string;

dnssec?: boolean;

expiration_date?: string;

expiration_date_raw?: string;

registrant_city?: string;

registrant_country?: string;

registrant_email?: string;

registrant_fax?: string;

registrant_fax_ext?: string;

registrant_id?: string;

registrant_name?: string;

registrant_org?: string;

registrant_phone?: string;

registrant_phone_ext?: string;

registrant_postal_code?: string;

registrant_province?: string;

registrant_referral_url?: string;

registrant_street?: string;

registrar_city?: string;

registrar_country?: string;

registrar_email?: string;

registrar_fax?: string;

registrar_fax_ext?: string;

registrar_id?: string;

registrar_name?: string;

registrar_org?: string;

registrar_phone?: string;

registrar_phone_ext?: string;

registrar_postal_code?: string;

registrar_province?: string;

registrar_referral_url?: string;

registrar_street?: string;

status?: Array<string>;

technical_city?: string;

technical_country?: string;

technical_email?: string;

technical_fax?: string;

technical_fax_ext?: string;

technical_id?: string;

technical_name?: string;

technical_org?: string;

technical_phone?: string;

technical_phone_ext?: string;

technical_postal_code?: string;

technical_province?: string;

technical_referral_url?: string;

technical_street?: string;

updated_date?: string;

updated_date_raw?: string;

whois_server?: string;
}

export interface WhoisGetParams {
/**
* Path param: Identifier
*/
account_id: string;

/**
* Query param:
*/
domain?: string;
}

export namespace Whois {
export import Whois = WhoisAPI.Whois;
export import WhoisGetResponse = WhoisAPI.WhoisGetResponse;
export import WhoisGetParams = WhoisAPI.WhoisGetParams;
}
30 changes: 30 additions & 0 deletions tests/api-resources/intel/whois.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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',
apiEmail: 'user@example.com',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource whois', () => {
test('get: only required params', async () => {
const responsePromise = cloudflare.intel.whois.get({ 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.intel.whois.get({
account_id: '023e105f4ecef8ad9ca31a8372d0c353',
domain: 'string',
});
});
});

0 comments on commit 12127fa

Please sign in to comment.