/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { webhooksCreateSubscription } from "../funcs/webhooksCreateSubscription.js"; import { webhooksDeleteSubscription } from "../funcs/webhooksDeleteSubscription.js"; import { webhooksGetSubscription } from "../funcs/webhooksGetSubscription.js"; import { webhooksGetV1WebhooksHealthCheck } from "../funcs/webhooksGetV1WebhooksHealthCheck.js"; import { webhooksListSubscriptions } from "../funcs/webhooksListSubscriptions.js"; import { webhooksRequestVerificationToken } from "../funcs/webhooksRequestVerificationToken.js"; import { webhooksUpdateSubscription } from "../funcs/webhooksUpdateSubscription.js"; import { webhooksVerify } from "../funcs/webhooksVerify.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { DeleteV1WebhookSubscriptionUuidRequest, DeleteV1WebhookSubscriptionUuidResponse, DeleteV1WebhookSubscriptionUuidSecurity, } from "../models/operations/deletev1webhooksubscriptionuuid.js"; import { GetV1WebhooksHealthCheckRequest, GetV1WebhooksHealthCheckResponse, GetV1WebhooksHealthCheckSecurity, } from "../models/operations/getv1webhookshealthcheck.js"; import { GetV1WebhookSubscriptionsRequest, GetV1WebhookSubscriptionsResponse, GetV1WebhookSubscriptionsSecurity, } from "../models/operations/getv1webhooksubscriptions.js"; import { GetV1WebhookSubscriptionUuidRequest, GetV1WebhookSubscriptionUuidResponse, GetV1WebhookSubscriptionUuidSecurity, } from "../models/operations/getv1webhooksubscriptionuuid.js"; import { GetV1WebhookSubscriptionVerificationTokenUuidRequest, GetV1WebhookSubscriptionVerificationTokenUuidResponse, GetV1WebhookSubscriptionVerificationTokenUuidSecurity, } from "../models/operations/getv1webhooksubscriptionverificationtokenuuid.js"; import { PostV1WebhookSubscriptionRequest, PostV1WebhookSubscriptionResponse, PostV1WebhookSubscriptionSecurity, } from "../models/operations/postv1webhooksubscription.js"; import { PutV1VerifyWebhookSubscriptionUuidRequest, PutV1VerifyWebhookSubscriptionUuidResponse, PutV1VerifyWebhookSubscriptionUuidSecurity, } from "../models/operations/putv1verifywebhooksubscriptionuuid.js"; import { PutV1WebhookSubscriptionUuidRequest, PutV1WebhookSubscriptionUuidResponse, PutV1WebhookSubscriptionUuidSecurity, } from "../models/operations/putv1webhooksubscriptionuuid.js"; import { unwrapAsync } from "../types/fp.js"; export class Webhooks extends ClientSDK { /** * List webhook subscriptions * * @remarks * Returns all webhook subscriptions associated with the provided Partner API token. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:read` */ async listSubscriptions( security: GetV1WebhookSubscriptionsSecurity, request: GetV1WebhookSubscriptionsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksListSubscriptions( this, security, request, options, )); } /** * Create a webhook subscription * * @remarks * Create a webhook subscription to receive events of the specified subscription_types whenever there is a state change. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:write` */ async createSubscription( security: PostV1WebhookSubscriptionSecurity, request: PostV1WebhookSubscriptionRequest, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksCreateSubscription( this, security, request, options, )); } /** * Get a webhook subscription * * @remarks * Returns the Webhook Subscription associated with the provided UUID. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:read` */ async getSubscription( security: GetV1WebhookSubscriptionUuidSecurity, request: GetV1WebhookSubscriptionUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksGetSubscription( this, security, request, options, )); } /** * Update a webhook subscription * * @remarks * Updates the Webhook Subscription associated with the provided UUID. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:write` */ async updateSubscription( security: PutV1WebhookSubscriptionUuidSecurity, request: PutV1WebhookSubscriptionUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksUpdateSubscription( this, security, request, options, )); } /** * Delete a webhook subscription * * @remarks * Deletes the Webhook Subscription associated with the provided UUID. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:write` */ async deleteSubscription( security: DeleteV1WebhookSubscriptionUuidSecurity, request: DeleteV1WebhookSubscriptionUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksDeleteSubscription( this, security, request, options, )); } /** * Verify a webhook subscription * * @remarks * When a webhook subscription is created, a `verification_token` is POSTed to the registered webhook subscription URL. This `verify` endpoint needs to be called with `verification_token` before webhook events can be sent to the registered webhook URL. * * Use the /v1/webhook_subscriptions/{webhook_subscription_uuid}/request_verification_token API to resend the `verification_token` to the Subscriber. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:write` */ async verify( security: PutV1VerifyWebhookSubscriptionUuidSecurity, request: PutV1VerifyWebhookSubscriptionUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksVerify( this, security, request, options, )); } /** * Request a verification token for a webhook subscription * * @remarks * Request that the webhook subscription `verification_token` be POSTed to the Subscription URL. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:read` */ async requestVerificationToken( security: GetV1WebhookSubscriptionVerificationTokenUuidSecurity, request: GetV1WebhookSubscriptionVerificationTokenUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksRequestVerificationToken( this, security, request, options, )); } /** * Get the webhooks health status * * @remarks * Returns the health status (`healthy`, `unhealthy`, or `unknown`) of the webhooks system based on the last ten minutes of activity. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:read` */ async getV1WebhooksHealthCheck( security: GetV1WebhooksHealthCheckSecurity, request: GetV1WebhooksHealthCheckRequest, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksGetV1WebhooksHealthCheck( this, security, request, options, )); } }