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