cloudflare/cloudflare-typescript
Publicmirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/botnet-feed/asn.ts
86lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import { APIResource } from '../../resource'; |
| 4 | import * as Core from '../../core'; |
| 5 | import * as ASNAPI from './asn'; |
| 6 | |
| 7 | export class ASN extends APIResource { |
| 8 | /** |
| 9 | * Gets all the data the botnet tracking database has for a given ASN registered to |
| 10 | * user account for given date. If no date is given, it will return results for the |
| 11 | * previous day. |
| 12 | */ |
| 13 | dayReport( |
| 14 | asnId: number, |
| 15 | params: ASNDayReportParams, |
| 16 | options?: Core.RequestOptions, |
| 17 | ): Core.APIPromise<ASNDayReportResponse> { |
| 18 | const { account_id, ...query } = params; |
| 19 | return ( |
| 20 | this._client.get(`/accounts/${account_id}/botnet_feed/asn/${asnId}/day_report`, { |
| 21 | query, |
| 22 | ...options, |
| 23 | }) as Core.APIPromise<{ result: ASNDayReportResponse }> |
| 24 | )._thenUnwrap((obj) => obj.result); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Gets all the data the botnet threat feed tracking database has for a given ASN |
| 29 | * registered to user account. |
| 30 | */ |
| 31 | fullReport( |
| 32 | asnId: number, |
| 33 | params: ASNFullReportParams, |
| 34 | options?: Core.RequestOptions, |
| 35 | ): Core.APIPromise<ASNFullReportResponse> { |
| 36 | const { account_id } = params; |
| 37 | return ( |
| 38 | this._client.get( |
| 39 | `/accounts/${account_id}/botnet_feed/asn/${asnId}/full_report`, |
| 40 | options, |
| 41 | ) as Core.APIPromise<{ result: ASNFullReportResponse }> |
| 42 | )._thenUnwrap((obj) => obj.result); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | export interface ASNDayReportResponse { |
| 47 | cidr?: string; |
| 48 | |
| 49 | date?: string; |
| 50 | |
| 51 | offense_count?: number; |
| 52 | } |
| 53 | |
| 54 | export interface ASNFullReportResponse { |
| 55 | cidr?: string; |
| 56 | |
| 57 | date?: string; |
| 58 | |
| 59 | offense_count?: number; |
| 60 | } |
| 61 | |
| 62 | export interface ASNDayReportParams { |
| 63 | /** |
| 64 | * Path param: Identifier |
| 65 | */ |
| 66 | account_id: string; |
| 67 | |
| 68 | /** |
| 69 | * Query param: |
| 70 | */ |
| 71 | date?: string; |
| 72 | } |
| 73 | |
| 74 | export interface ASNFullReportParams { |
| 75 | /** |
| 76 | * Identifier |
| 77 | */ |
| 78 | account_id: string; |
| 79 | } |
| 80 | |
| 81 | export namespace ASN { |
| 82 | export import ASNDayReportResponse = ASNAPI.ASNDayReportResponse; |
| 83 | export import ASNFullReportResponse = ASNAPI.ASNFullReportResponse; |
| 84 | export import ASNDayReportParams = ASNAPI.ASNDayReportParams; |
| 85 | export import ASNFullReportParams = ASNAPI.ASNFullReportParams; |
| 86 | } |
| 87 | |