/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { payrollDigestsGetV1PayrollDigestsPayrollDigestUuid } from "../funcs/payrollDigestsGetV1PayrollDigestsPayrollDigestUuid.js"; import { payrollDigestsPostV1PayrollDigests } from "../funcs/payrollDigestsPostV1PayrollDigests.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { GetV1PayrollDigestsPayrollDigestUuidRequest, GetV1PayrollDigestsPayrollDigestUuidResponse, GetV1PayrollDigestsPayrollDigestUuidSecurity, } from "../models/operations/getv1payrolldigestspayrolldigestuuid.js"; import { PostV1PayrollDigestsRequest, PostV1PayrollDigestsResponse, PostV1PayrollDigestsSecurity, } from "../models/operations/postv1payrolldigests.js"; import { unwrapAsync } from "../types/fp.js"; export class PayrollDigests extends ClientSDK { /** * Create a payroll digest batch * * @remarks * Triggers an asynchronous computation of payroll digest data (statuses, blockers, pay periods, totals) across up to 25 companies that the partner is mapped to. * * The batch is processed asynchronously. Use the returned batch UUID to poll `GET /v1/payroll_digests/{payroll_digest_uuid}` for status and results. * * Idempotency is scoped per `(partner, idempotency_key)`. A duplicate POST with the same `idempotency_key` returns a 409 Conflict referencing the existing batch UUID — no duplicate computation occurs. * * 📘 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: `payroll_digests:write` */ async postV1PayrollDigests( security: PostV1PayrollDigestsSecurity, request: PostV1PayrollDigestsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollDigestsPostV1PayrollDigests( this, security, request, options, )); } /** * Get a payroll digest batch * * @remarks * Returns the status and results of a payroll digest batch. * * Poll this endpoint until the batch `status` reaches a terminal value (`completed` or `failed`). Once terminal, the response includes the full `results` array (one entry per attempted company, each with its own per-company `status` — `success`, `partial_success`, or `failed`) and the `exclusions` array (one entry per company that could not be looked up or processed). * * Note that the top-level batch `status` (`pending` / `processing` / `completed` / `failed`) is distinct from the per-company `status` returned inside `results[]` and `exclusions[]`. A `completed` batch does not imply every company succeeded — inspect the arrays for per-company outcomes. * * Results are stored in Redis with a short TTL after completion. If the partner polls after results have expired, this endpoint returns 410 Gone — partners should re-submit a new batch to fetch fresh data. * * 📘 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: `payroll_digests:read` */ async getV1PayrollDigestsPayrollDigestUuid( security: GetV1PayrollDigestsPayrollDigestUuidSecurity, request: GetV1PayrollDigestsPayrollDigestUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(payrollDigestsGetV1PayrollDigestsPayrollDigestUuid( this, security, request, options, )); } }