CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
webhooks.d.ts532 linesDownload Raw Back to resources
1import { APIResource } from "../core/resource.js";2import { HeadersLike } from "../internal/headers.js";3export declare class Webhooks extends APIResource {4    #private;5    /**6     * Validates that the given payload was sent by OpenAI and parses the payload.7     */8    unwrap(payload: string, headers: HeadersLike, secret?: string | undefined | null, tolerance?: number): Promise<UnwrapWebhookEvent>;9    /**10     * Validates whether or not the webhook payload was sent by OpenAI.11     *12     * An error will be raised if the webhook payload was not sent by OpenAI.13     *14     * @param payload - The webhook payload15     * @param headers - The webhook headers16     * @param secret - The webhook secret (optional, will use client secret if not provided)17     * @param tolerance - Maximum age of the webhook in seconds (default: 300 = 5 minutes)18     */19    verifySignature(payload: string, headers: HeadersLike, secret?: string | undefined | null, tolerance?: number): Promise<void>;20}21/**22 * Sent when a batch API request has been cancelled.23 */24export interface BatchCancelledWebhookEvent {25    /**26     * The unique ID of the event.27     */28    id: string;29    /**30     * The Unix timestamp (in seconds) of when the batch API request was cancelled.31     */32    created_at: number;33    /**34     * Event data payload.35     */36    data: BatchCancelledWebhookEvent.Data;37    /**38     * The type of the event. Always `batch.cancelled`.39     */40    type: 'batch.cancelled';41    /**42     * The object of the event. Always `event`.43     */44    object?: 'event';45}46export declare namespace BatchCancelledWebhookEvent {47    /**48     * Event data payload.49     */50    interface Data {51        /**52         * The unique ID of the batch API request.53         */54        id: string;55    }56}57/**58 * Sent when a batch API request has been completed.59 */60export interface BatchCompletedWebhookEvent {61    /**62     * The unique ID of the event.63     */64    id: string;65    /**66     * The Unix timestamp (in seconds) of when the batch API request was completed.67     */68    created_at: number;69    /**70     * Event data payload.71     */72    data: BatchCompletedWebhookEvent.Data;73    /**74     * The type of the event. Always `batch.completed`.75     */76    type: 'batch.completed';77    /**78     * The object of the event. Always `event`.79     */80    object?: 'event';81}82export declare namespace BatchCompletedWebhookEvent {83    /**84     * Event data payload.85     */86    interface Data {87        /**88         * The unique ID of the batch API request.89         */90        id: string;91    }92}93/**94 * Sent when a batch API request has expired.95 */96export interface BatchExpiredWebhookEvent {97    /**98     * The unique ID of the event.99     */100    id: string;101    /**102     * The Unix timestamp (in seconds) of when the batch API request expired.103     */104    created_at: number;105    /**106     * Event data payload.107     */108    data: BatchExpiredWebhookEvent.Data;109    /**110     * The type of the event. Always `batch.expired`.111     */112    type: 'batch.expired';113    /**114     * The object of the event. Always `event`.115     */116    object?: 'event';117}118export declare namespace BatchExpiredWebhookEvent {119    /**120     * Event data payload.121     */122    interface Data {123        /**124         * The unique ID of the batch API request.125         */126        id: string;127    }128}129/**130 * Sent when a batch API request has failed.131 */132export interface BatchFailedWebhookEvent {133    /**134     * The unique ID of the event.135     */136    id: string;137    /**138     * The Unix timestamp (in seconds) of when the batch API request failed.139     */140    created_at: number;141    /**142     * Event data payload.143     */144    data: BatchFailedWebhookEvent.Data;145    /**146     * The type of the event. Always `batch.failed`.147     */148    type: 'batch.failed';149    /**150     * The object of the event. Always `event`.151     */152    object?: 'event';153}154export declare namespace BatchFailedWebhookEvent {155    /**156     * Event data payload.157     */158    interface Data {159        /**160         * The unique ID of the batch API request.161         */162        id: string;163    }164}165/**166 * Sent when an eval run has been canceled.167 */168export interface EvalRunCanceledWebhookEvent {169    /**170     * The unique ID of the event.171     */172    id: string;173    /**174     * The Unix timestamp (in seconds) of when the eval run was canceled.175     */176    created_at: number;177    /**178     * Event data payload.179     */180    data: EvalRunCanceledWebhookEvent.Data;181    /**182     * The type of the event. Always `eval.run.canceled`.183     */184    type: 'eval.run.canceled';185    /**186     * The object of the event. Always `event`.187     */188    object?: 'event';189}190export declare namespace EvalRunCanceledWebhookEvent {191    /**192     * Event data payload.193     */194    interface Data {195        /**196         * The unique ID of the eval run.197         */198        id: string;199    }200}201/**202 * Sent when an eval run has failed.203 */204export interface EvalRunFailedWebhookEvent {205    /**206     * The unique ID of the event.207     */208    id: string;209    /**210     * The Unix timestamp (in seconds) of when the eval run failed.211     */212    created_at: number;213    /**214     * Event data payload.215     */216    data: EvalRunFailedWebhookEvent.Data;217    /**218     * The type of the event. Always `eval.run.failed`.219     */220    type: 'eval.run.failed';221    /**222     * The object of the event. Always `event`.223     */224    object?: 'event';225}226export declare namespace EvalRunFailedWebhookEvent {227    /**228     * Event data payload.229     */230    interface Data {231        /**232         * The unique ID of the eval run.233         */234        id: string;235    }236}237/**238 * Sent when an eval run has succeeded.239 */240export interface EvalRunSucceededWebhookEvent {241    /**242     * The unique ID of the event.243     */244    id: string;245    /**246     * The Unix timestamp (in seconds) of when the eval run succeeded.247     */248    created_at: number;249    /**250     * Event data payload.251     */252    data: EvalRunSucceededWebhookEvent.Data;253    /**254     * The type of the event. Always `eval.run.succeeded`.255     */256    type: 'eval.run.succeeded';257    /**258     * The object of the event. Always `event`.259     */260    object?: 'event';261}262export declare namespace EvalRunSucceededWebhookEvent {263    /**264     * Event data payload.265     */266    interface Data {267        /**268         * The unique ID of the eval run.269         */270        id: string;271    }272}273/**274 * Sent when a fine-tuning job has been cancelled.275 */276export interface FineTuningJobCancelledWebhookEvent {277    /**278     * The unique ID of the event.279     */280    id: string;281    /**282     * The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.283     */284    created_at: number;285    /**286     * Event data payload.287     */288    data: FineTuningJobCancelledWebhookEvent.Data;289    /**290     * The type of the event. Always `fine_tuning.job.cancelled`.291     */292    type: 'fine_tuning.job.cancelled';293    /**294     * The object of the event. Always `event`.295     */296    object?: 'event';297}298export declare namespace FineTuningJobCancelledWebhookEvent {299    /**300     * Event data payload.301     */302    interface Data {303        /**304         * The unique ID of the fine-tuning job.305         */306        id: string;307    }308}309/**310 * Sent when a fine-tuning job has failed.311 */312export interface FineTuningJobFailedWebhookEvent {313    /**314     * The unique ID of the event.315     */316    id: string;317    /**318     * The Unix timestamp (in seconds) of when the fine-tuning job failed.319     */320    created_at: number;321    /**322     * Event data payload.323     */324    data: FineTuningJobFailedWebhookEvent.Data;325    /**326     * The type of the event. Always `fine_tuning.job.failed`.327     */328    type: 'fine_tuning.job.failed';329    /**330     * The object of the event. Always `event`.331     */332    object?: 'event';333}334export declare namespace FineTuningJobFailedWebhookEvent {335    /**336     * Event data payload.337     */338    interface Data {339        /**340         * The unique ID of the fine-tuning job.341         */342        id: string;343    }344}345/**346 * Sent when a fine-tuning job has succeeded.347 */348export interface FineTuningJobSucceededWebhookEvent {349    /**350     * The unique ID of the event.351     */352    id: string;353    /**354     * The Unix timestamp (in seconds) of when the fine-tuning job succeeded.355     */356    created_at: number;357    /**358     * Event data payload.359     */360    data: FineTuningJobSucceededWebhookEvent.Data;361    /**362     * The type of the event. Always `fine_tuning.job.succeeded`.363     */364    type: 'fine_tuning.job.succeeded';365    /**366     * The object of the event. Always `event`.367     */368    object?: 'event';369}370export declare namespace FineTuningJobSucceededWebhookEvent {371    /**372     * Event data payload.373     */374    interface Data {375        /**376         * The unique ID of the fine-tuning job.377         */378        id: string;379    }380}381/**382 * Sent when a background response has been cancelled.383 */384export interface ResponseCancelledWebhookEvent {385    /**386     * The unique ID of the event.387     */388    id: string;389    /**390     * The Unix timestamp (in seconds) of when the model response was cancelled.391     */392    created_at: number;393    /**394     * Event data payload.395     */396    data: ResponseCancelledWebhookEvent.Data;397    /**398     * The type of the event. Always `response.cancelled`.399     */400    type: 'response.cancelled';401    /**402     * The object of the event. Always `event`.403     */404    object?: 'event';405}406export declare namespace ResponseCancelledWebhookEvent {407    /**408     * Event data payload.409     */410    interface Data {411        /**412         * The unique ID of the model response.413         */414        id: string;415    }416}417/**418 * Sent when a background response has been completed.419 */420export interface ResponseCompletedWebhookEvent {421    /**422     * The unique ID of the event.423     */424    id: string;425    /**426     * The Unix timestamp (in seconds) of when the model response was completed.427     */428    created_at: number;429    /**430     * Event data payload.431     */432    data: ResponseCompletedWebhookEvent.Data;433    /**434     * The type of the event. Always `response.completed`.435     */436    type: 'response.completed';437    /**438     * The object of the event. Always `event`.439     */440    object?: 'event';441}442export declare namespace ResponseCompletedWebhookEvent {443    /**444     * Event data payload.445     */446    interface Data {447        /**448         * The unique ID of the model response.449         */450        id: string;451    }452}453/**454 * Sent when a background response has failed.455 */456export interface ResponseFailedWebhookEvent {457    /**458     * The unique ID of the event.459     */460    id: string;461    /**462     * The Unix timestamp (in seconds) of when the model response failed.463     */464    created_at: number;465    /**466     * Event data payload.467     */468    data: ResponseFailedWebhookEvent.Data;469    /**470     * The type of the event. Always `response.failed`.471     */472    type: 'response.failed';473    /**474     * The object of the event. Always `event`.475     */476    object?: 'event';477}478export declare namespace ResponseFailedWebhookEvent {479    /**480     * Event data payload.481     */482    interface Data {483        /**484         * The unique ID of the model response.485         */486        id: string;487    }488}489/**490 * Sent when a background response has been interrupted.491 */492export interface ResponseIncompleteWebhookEvent {493    /**494     * The unique ID of the event.495     */496    id: string;497    /**498     * The Unix timestamp (in seconds) of when the model response was interrupted.499     */500    created_at: number;501    /**502     * Event data payload.503     */504    data: ResponseIncompleteWebhookEvent.Data;505    /**506     * The type of the event. Always `response.incomplete`.507     */508    type: 'response.incomplete';509    /**510     * The object of the event. Always `event`.511     */512    object?: 'event';513}514export declare namespace ResponseIncompleteWebhookEvent {515    /**516     * Event data payload.517     */518    interface Data {519        /**520         * The unique ID of the model response.521         */522        id: string;523    }524}525/**526 * Sent when a batch API request has been cancelled.527 */528export type UnwrapWebhookEvent = BatchCancelledWebhookEvent | BatchCompletedWebhookEvent | BatchExpiredWebhookEvent | BatchFailedWebhookEvent | EvalRunCanceledWebhookEvent | EvalRunFailedWebhookEvent | EvalRunSucceededWebhookEvent | FineTuningJobCancelledWebhookEvent | FineTuningJobFailedWebhookEvent | FineTuningJobSucceededWebhookEvent | ResponseCancelledWebhookEvent | ResponseCompletedWebhookEvent | ResponseFailedWebhookEvent | ResponseIncompleteWebhookEvent;529export declare namespace Webhooks {530    export { type BatchCancelledWebhookEvent as BatchCancelledWebhookEvent, type BatchCompletedWebhookEvent as BatchCompletedWebhookEvent, type BatchExpiredWebhookEvent as BatchExpiredWebhookEvent, type BatchFailedWebhookEvent as BatchFailedWebhookEvent, type EvalRunCanceledWebhookEvent as EvalRunCanceledWebhookEvent, type EvalRunFailedWebhookEvent as EvalRunFailedWebhookEvent, type EvalRunSucceededWebhookEvent as EvalRunSucceededWebhookEvent, type FineTuningJobCancelledWebhookEvent as FineTuningJobCancelledWebhookEvent, type FineTuningJobFailedWebhookEvent as FineTuningJobFailedWebhookEvent, type FineTuningJobSucceededWebhookEvent as FineTuningJobSucceededWebhookEvent, type ResponseCancelledWebhookEvent as ResponseCancelledWebhookEvent, type ResponseCompletedWebhookEvent as ResponseCompletedWebhookEvent, type ResponseFailedWebhookEvent as ResponseFailedWebhookEvent, type ResponseIncompleteWebhookEvent as ResponseIncompleteWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, };531}532//# sourceMappingURL=webhooks.d.ts.map
basant307/AI_Governance_Project · CoolFace