diff --git a/.stats.yml b/.stats.yml index b195777d..663d380a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-da8075d6f26ac858d52626cb7f8e9607322b2250184696c6ef1119033e7242c9.yml +configured_endpoints: 20 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/new%2Fblockaid-f9b9d0b0f1cedf56f0b5f9084b5862d5f5aa70fe89034338deb374d214c8ccff.yml diff --git a/api.md b/api.md index bb51908a..79620554 100644 --- a/api.md +++ b/api.md @@ -199,6 +199,16 @@ Methods: - client.site.report({ ...params }) -> unknown - client.site.scan({ ...params }) -> SiteScanResponse +# Scan + +Types: + +- ScanStatusResponse + +Methods: + +- client.scan.status({ ...params }) -> unknown + # Token Types: diff --git a/src/index.ts b/src/index.ts index a8c1de73..6da72cc5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import * as Core from './core'; import * as Errors from './error'; import * as Uploads from './uploads'; import * as API from './resources/index'; +import { Scan, ScanStatusParams, ScanStatusResponse } from './resources/scan'; import { Site, SiteReportParams, @@ -255,6 +256,7 @@ export class Blockaid extends Core.APIClient { bitcoin: API.Bitcoin = new API.Bitcoin(this); starknet: API.Starknet = new API.Starknet(this); site: API.Site = new API.Site(this); + scan: API.Scan = new API.Scan(this); token: API.Token = new API.Token(this); tokenBulk: API.TokenBulk = new API.TokenBulk(this); @@ -344,6 +346,7 @@ Blockaid.Stellar = Stellar; Blockaid.Bitcoin = Bitcoin; Blockaid.Starknet = Starknet; Blockaid.Site = Site; +Blockaid.Scan = Scan; Blockaid.Token = Token; Blockaid.TokenBulk = TokenBulk; export declare namespace Blockaid { @@ -451,6 +454,12 @@ export declare namespace Blockaid { type SiteScanParams as SiteScanParams, }; + export { + Scan as Scan, + type ScanStatusResponse as ScanStatusResponse, + type ScanStatusParams as ScanStatusParams, + }; + export { Token as Token, type TokenReportResponse as TokenReportResponse, diff --git a/src/resources/index.ts b/src/resources/index.ts index 0f478c66..ddb58cde 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -30,6 +30,7 @@ export { type TransactionValidationError, type UsdDiff, } from './evm/evm'; +export { Scan, type ScanStatusResponse, type ScanStatusParams } from './scan'; export { Site, type SiteScanHitResponse, diff --git a/src/resources/scan.ts b/src/resources/scan.ts new file mode 100644 index 00000000..eaa430d2 --- /dev/null +++ b/src/resources/scan.ts @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; +import * as Core from '../core'; + +export class Scan extends APIResource { + /** + * Report whether the end-user accepted the Blockaid classification on the entity + * being scanned. + */ + status(body: ScanStatusParams, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post('/v0/scan/status/', { body, ...options }); + } +} + +export type ScanStatusResponse = unknown; + +export interface ScanStatusParams { + /** + * The x-request-id header returned from the previous Blockaid api request + */ + request_id: string; + + /** + * An enumeration. + */ + status: 'accepted' | 'rejected'; +} + +export declare namespace Scan { + export { type ScanStatusResponse as ScanStatusResponse, type ScanStatusParams as ScanStatusParams }; +} diff --git a/tests/api-resources/scan.test.ts b/tests/api-resources/scan.test.ts new file mode 100644 index 00000000..ecc7093e --- /dev/null +++ b/tests/api-resources/scan.test.ts @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Blockaid from '@blockaid/client'; +import { Response } from 'node-fetch'; + +const client = new Blockaid({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource scan', () => { + test('status: only required params', async () => { + const responsePromise = client.scan.status({ + request_id: '7f959417-76c1-4c4d-89e8-5fdedab76a8d', + status: 'accepted', + }); + 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('status: required and optional params', async () => { + const response = await client.scan.status({ + request_id: '7f959417-76c1-4c4d-89e8-5fdedab76a8d', + status: 'accepted', + }); + }); +});