UNPKG

@attachmentav/virus-scan-sdk-ts

Version:

An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos.

576 lines (566 loc) 20.8 kB
/** * attachmentAV * An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ declare const BASE_PATH: string; interface ConfigurationParameters { basePath?: string; fetchApi?: FetchAPI; middleware?: Middleware[]; queryParamsStringify?: (params: HTTPQuery) => string; username?: string; password?: string; apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); headers?: HTTPHeaders; credentials?: RequestCredentials; } declare class Configuration { private configuration; constructor(configuration?: ConfigurationParameters); set config(configuration: Configuration); get basePath(): string; get fetchApi(): FetchAPI | undefined; get middleware(): Middleware[]; get queryParamsStringify(): (params: HTTPQuery) => string; get username(): string | undefined; get password(): string | undefined; get apiKey(): ((name: string) => string | Promise<string>) | undefined; get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined; get headers(): HTTPHeaders | undefined; get credentials(): RequestCredentials | undefined; } declare const DefaultConfig: Configuration; /** * This is the base class for all generated API classes. */ declare class BaseAPI { protected configuration: Configuration; private static readonly jsonRegex; private middleware; constructor(configuration?: Configuration); withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T; withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T; withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T; /** * Check if the given MIME is a JSON MIME. * JSON MIME examples: * application/json * application/json; charset=UTF8 * APPLICATION/JSON * application/vnd.company+json * @param mime - MIME (Multipurpose Internet Mail Extensions) * @return True if the given MIME is JSON, false otherwise. */ protected isJsonMime(mime: string | null | undefined): boolean; protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>; private createFetchParams; private fetchApi; /** * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ private clone; } declare class ResponseError extends Error { response: Response; name: "ResponseError"; constructor(response: Response, msg?: string); } declare class FetchError extends Error { cause: Error; name: "FetchError"; constructor(cause: Error, msg?: string); } declare class RequiredError extends Error { field: string; name: "RequiredError"; constructor(field: string, msg?: string); } declare const COLLECTION_FORMATS: { csv: string; ssv: string; tsv: string; pipes: string; }; type FetchAPI = WindowOrWorkerGlobalScope['fetch']; type Json = any; type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; type HTTPHeaders = { [key: string]: string; }; type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery; }; type HTTPBody = Json | FormData | URLSearchParams; type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody; }; type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; type InitOverrideFunction = (requestContext: { init: HTTPRequestInit; context: RequestOpts; }) => Promise<RequestInit>; interface FetchParams { url: string; init: RequestInit; } interface RequestOpts { path: string; method: HTTPMethod; headers: HTTPHeaders; query?: HTTPQuery; body?: HTTPBody; } declare function querystring(params: HTTPQuery, prefix?: string): string; declare function exists(json: any, key: string): boolean; declare function mapValues(data: any, fn: (item: any) => any): { [key: string]: any; }; declare function canConsumeForm(consumes: Consume[]): boolean; interface Consume { contentType: string; } interface RequestContext { fetch: FetchAPI; url: string; init: RequestInit; } interface ResponseContext { fetch: FetchAPI; url: string; init: RequestInit; response: Response; } interface ErrorContext { fetch: FetchAPI; url: string; init: RequestInit; error: unknown; response?: Response; } interface Middleware { pre?(context: RequestContext): Promise<FetchParams | void>; post?(context: ResponseContext): Promise<Response | void>; onError?(context: ErrorContext): Promise<Response | void>; } interface ApiResponse<T> { raw: Response; value(): Promise<T>; } interface ResponseTransformer<T> { (json: any): T; } declare class JSONApiResponse<T> { raw: Response; private transformer; constructor(raw: Response, transformer?: ResponseTransformer<T>); value(): Promise<T>; } declare class VoidApiResponse { raw: Response; constructor(raw: Response); value(): Promise<void>; } declare class BlobApiResponse { raw: Response; constructor(raw: Response); value(): Promise<Blob>; } declare class TextApiResponse { raw: Response; constructor(raw: Response); value(): Promise<string>; } /** * attachmentAV * An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AsyncDownloadScanRequest */ interface AsyncDownloadScanRequest { /** * * @type {string} * @memberof AsyncDownloadScanRequest */ downloadUrl: string; /** * * @type {{ [key: string]: string; }} * @memberof AsyncDownloadScanRequest */ downloadHeaders?: { [key: string]: string; }; /** * * @type {string} * @memberof AsyncDownloadScanRequest */ callbackUrl: string; /** * * @type {{ [key: string]: string; }} * @memberof AsyncDownloadScanRequest */ callbackHeaders?: { [key: string]: string; }; /** * * @type {string} * @memberof AsyncDownloadScanRequest */ traceId?: string; /** * * @type {string} * @memberof AsyncDownloadScanRequest */ customData?: string; } /** * Check if a given object implements the AsyncDownloadScanRequest interface. */ declare function instanceOfAsyncDownloadScanRequest(value: object): value is AsyncDownloadScanRequest; declare function AsyncDownloadScanRequestFromJSON(json: any): AsyncDownloadScanRequest; declare function AsyncDownloadScanRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): AsyncDownloadScanRequest; declare function AsyncDownloadScanRequestToJSON(json: any): AsyncDownloadScanRequest; declare function AsyncDownloadScanRequestToJSONTyped(value?: AsyncDownloadScanRequest | null, ignoreDiscriminator?: boolean): any; /** * attachmentAV * An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AsyncS3ScanRequest */ interface AsyncS3ScanRequest { /** * * @type {string} * @memberof AsyncS3ScanRequest */ bucket: string; /** * * @type {string} * @memberof AsyncS3ScanRequest */ key: string; /** * * @type {string} * @memberof AsyncS3ScanRequest */ version?: string; /** * * @type {string} * @memberof AsyncS3ScanRequest */ callbackUrl: string; /** * * @type {{ [key: string]: string; }} * @memberof AsyncS3ScanRequest */ callbackHeaders?: { [key: string]: string; }; /** * * @type {string} * @memberof AsyncS3ScanRequest */ traceId?: string; /** * * @type {string} * @memberof AsyncS3ScanRequest */ customData?: string; } /** * Check if a given object implements the AsyncS3ScanRequest interface. */ declare function instanceOfAsyncS3ScanRequest(value: object): value is AsyncS3ScanRequest; declare function AsyncS3ScanRequestFromJSON(json: any): AsyncS3ScanRequest; declare function AsyncS3ScanRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): AsyncS3ScanRequest; declare function AsyncS3ScanRequestToJSON(json: any): AsyncS3ScanRequest; declare function AsyncS3ScanRequestToJSONTyped(value?: AsyncS3ScanRequest | null, ignoreDiscriminator?: boolean): any; /** * attachmentAV * An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface ScanResult */ interface ScanResult { /** * * @type {string} * @memberof ScanResult */ status?: string; /** * * @type {string} * @memberof ScanResult */ finding?: string; /** * * @type {string} * @memberof ScanResult */ size?: string; /** * * @type {string} * @memberof ScanResult */ realfiletype?: string; } /** * Check if a given object implements the ScanResult interface. */ declare function instanceOfScanResult(value: object): value is ScanResult; declare function ScanResultFromJSON(json: any): ScanResult; declare function ScanResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): ScanResult; declare function ScanResultToJSON(json: any): ScanResult; declare function ScanResultToJSONTyped(value?: ScanResult | null, ignoreDiscriminator?: boolean): any; /** * attachmentAV * An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface SyncDownloadScanRequest */ interface SyncDownloadScanRequest { /** * * @type {string} * @memberof SyncDownloadScanRequest */ downloadUrl: string; /** * * @type {{ [key: string]: string; }} * @memberof SyncDownloadScanRequest */ downloadHeaders?: { [key: string]: string; }; } /** * Check if a given object implements the SyncDownloadScanRequest interface. */ declare function instanceOfSyncDownloadScanRequest(value: object): value is SyncDownloadScanRequest; declare function SyncDownloadScanRequestFromJSON(json: any): SyncDownloadScanRequest; declare function SyncDownloadScanRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SyncDownloadScanRequest; declare function SyncDownloadScanRequestToJSON(json: any): SyncDownloadScanRequest; declare function SyncDownloadScanRequestToJSONTyped(value?: SyncDownloadScanRequest | null, ignoreDiscriminator?: boolean): any; /** * attachmentAV * An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface SyncS3ScanRequest */ interface SyncS3ScanRequest { /** * * @type {string} * @memberof SyncS3ScanRequest */ bucket: string; /** * * @type {string} * @memberof SyncS3ScanRequest */ key: string; /** * * @type {string} * @memberof SyncS3ScanRequest */ version?: string; } /** * Check if a given object implements the SyncS3ScanRequest interface. */ declare function instanceOfSyncS3ScanRequest(value: object): value is SyncS3ScanRequest; declare function SyncS3ScanRequestFromJSON(json: any): SyncS3ScanRequest; declare function SyncS3ScanRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SyncS3ScanRequest; declare function SyncS3ScanRequestToJSON(json: any): SyncS3ScanRequest; declare function SyncS3ScanRequestToJSONTyped(value?: SyncS3ScanRequest | null, ignoreDiscriminator?: boolean): any; /** * attachmentAV * An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface Whoami */ interface Whoami { /** * * @type {string} * @memberof Whoami */ tenantId?: string; } /** * Check if a given object implements the Whoami interface. */ declare function instanceOfWhoami(value: object): value is Whoami; declare function WhoamiFromJSON(json: any): Whoami; declare function WhoamiFromJSONTyped(json: any, ignoreDiscriminator: boolean): Whoami; declare function WhoamiToJSON(json: any): Whoami; declare function WhoamiToJSONTyped(value?: Whoami | null, ignoreDiscriminator?: boolean): any; /** * attachmentAV * An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ interface ScanAsyncDownloadPostRequest { asyncDownloadScanRequest: AsyncDownloadScanRequest; } interface ScanAsyncS3PostRequest { asyncS3ScanRequest: AsyncS3ScanRequest; } interface ScanSyncBinaryPostRequest { body: Blob; } interface ScanSyncDownloadPostRequest { syncDownloadScanRequest: SyncDownloadScanRequest; } interface ScanSyncS3PostRequest { syncS3ScanRequest: SyncS3ScanRequest; } /** * */ declare class AttachmentAVApi extends BaseAPI { /** * Download a file from a remote location (HTTP/HTTPS), scan the file, and post the scan result to your callback URL. */ scanAsyncDownloadPostRaw(requestParameters: ScanAsyncDownloadPostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<void>>; /** * Download a file from a remote location (HTTP/HTTPS), scan the file, and post the scan result to your callback URL. */ scanAsyncDownloadPost(requestParameters: ScanAsyncDownloadPostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<void>; /** * Download a file from S3, scan the file, and post the scan result to your callback URL. A bucket policy is required to grant attachmentAV access to the S3 objects. */ scanAsyncS3PostRaw(requestParameters: ScanAsyncS3PostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<void>>; /** * Download a file from S3, scan the file, and post the scan result to your callback URL. A bucket policy is required to grant attachmentAV access to the S3 objects. */ scanAsyncS3Post(requestParameters: ScanAsyncS3PostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<void>; /** * Upload a file, scan the file, and return the scan result. */ scanSyncBinaryPostRaw(requestParameters: ScanSyncBinaryPostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<ScanResult>>; /** * Upload a file, scan the file, and return the scan result. */ scanSyncBinaryPost(requestParameters: ScanSyncBinaryPostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ScanResult>; /** * Download a file from a remote location (HTTP/HTTPS), scan the file, and return the scan result. */ scanSyncDownloadPostRaw(requestParameters: ScanSyncDownloadPostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<ScanResult>>; /** * Download a file from a remote location (HTTP/HTTPS), scan the file, and return the scan result. */ scanSyncDownloadPost(requestParameters: ScanSyncDownloadPostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ScanResult>; /** * Download a file from S3, scan the file, and return the scan result. A bucket policy is required to grant attachmentAV access to the S3 objects. */ scanSyncS3PostRaw(requestParameters: ScanSyncS3PostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<ScanResult>>; /** * Download a file from S3, scan the file, and return the scan result. A bucket policy is required to grant attachmentAV access to the S3 objects. */ scanSyncS3Post(requestParameters: ScanSyncS3PostRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ScanResult>; /** * Get information abour yourself. */ whoamiGetRaw(initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Whoami>>; /** * Get information abour yourself. */ whoamiGet(initOverrides?: RequestInit | InitOverrideFunction): Promise<Whoami>; } export { type ApiResponse, type AsyncDownloadScanRequest, AsyncDownloadScanRequestFromJSON, AsyncDownloadScanRequestFromJSONTyped, AsyncDownloadScanRequestToJSON, AsyncDownloadScanRequestToJSONTyped, type AsyncS3ScanRequest, AsyncS3ScanRequestFromJSON, AsyncS3ScanRequestFromJSONTyped, AsyncS3ScanRequestToJSON, AsyncS3ScanRequestToJSONTyped, AttachmentAVApi, BASE_PATH, BaseAPI, BlobApiResponse, COLLECTION_FORMATS, Configuration, type ConfigurationParameters, type Consume, DefaultConfig, type ErrorContext, type FetchAPI, FetchError, type FetchParams, type HTTPBody, type HTTPHeaders, type HTTPMethod, type HTTPQuery, type HTTPRequestInit, type InitOverrideFunction, JSONApiResponse, type Json, type Middleware, type ModelPropertyNaming, type RequestContext, type RequestOpts, RequiredError, type ResponseContext, ResponseError, type ResponseTransformer, type ScanAsyncDownloadPostRequest, type ScanAsyncS3PostRequest, type ScanResult, ScanResultFromJSON, ScanResultFromJSONTyped, ScanResultToJSON, ScanResultToJSONTyped, type ScanSyncBinaryPostRequest, type ScanSyncDownloadPostRequest, type ScanSyncS3PostRequest, type SyncDownloadScanRequest, SyncDownloadScanRequestFromJSON, SyncDownloadScanRequestFromJSONTyped, SyncDownloadScanRequestToJSON, SyncDownloadScanRequestToJSONTyped, type SyncS3ScanRequest, SyncS3ScanRequestFromJSON, SyncS3ScanRequestFromJSONTyped, SyncS3ScanRequestToJSON, SyncS3ScanRequestToJSONTyped, TextApiResponse, VoidApiResponse, type Whoami, WhoamiFromJSON, WhoamiFromJSONTyped, WhoamiToJSON, WhoamiToJSONTyped, canConsumeForm, exists, instanceOfAsyncDownloadScanRequest, instanceOfAsyncS3ScanRequest, instanceOfScanResult, instanceOfSyncDownloadScanRequest, instanceOfSyncS3ScanRequest, instanceOfWhoami, mapValues, querystring };