From 12127fa978d146054194013fb4fb3304ae45f68b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 21:00:55 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#455) --- .stats.yml | 4 +- api.md | 5 + src/resources/intel/index.ts | 2 +- src/resources/intel/intel.ts | 2 + src/resources/intel/whois.ts | 207 +++++++++++++++++++++++- tests/api-resources/intel/whois.test.ts | 30 ++++ 6 files changed, 246 insertions(+), 4 deletions(-) create mode 100644 tests/api-resources/intel/whois.test.ts diff --git a/.stats.yml b/.stats.yml index 7f7c7cf8f5..f959c2939b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 diff --git a/api.md b/api.md index b6456ce89c..eb730ea511 100644 --- a/api.md +++ b/api.md @@ -3143,6 +3143,11 @@ Methods: Types: - Whois +- WhoisGetResponse + +Methods: + +- client.intel.whois.get({ ...params }) -> WhoisGetResponse ## IndicatorFeeds diff --git a/src/resources/intel/index.ts b/src/resources/intel/index.ts index 26b82cdef1..8c8dadddaa 100644 --- a/src/resources/intel/index.ts +++ b/src/resources/intel/index.ts @@ -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'; diff --git a/src/resources/intel/intel.ts b/src/resources/intel/intel.ts index fee5316882..2b0881b649 100644 --- a/src/resources/intel/intel.ts +++ b/src/resources/intel/intel.ts @@ -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; diff --git a/src/resources/intel/whois.ts b/src/resources/intel/whois.ts index 7d8d49daae..e38b1c2782 100644 --- a/src/resources/intel/whois.ts +++ b/src/resources/intel/whois.ts @@ -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 { + 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; @@ -25,6 +38,198 @@ export interface Whois { updated_date?: string; } +export interface WhoisGetResponse { + dnnsec: unknown; + + domain: string; + + extension: string; + + found: boolean; + + nameservers: Array; + + 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; + + 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; } diff --git a/tests/api-resources/intel/whois.test.ts b/tests/api-resources/intel/whois.test.ts new file mode 100644 index 0000000000..f7f5c20c12 --- /dev/null +++ b/tests/api-resources/intel/whois.test.ts @@ -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', + }); + }); +});