0.6.3 • Published 4 months ago

@gusto/embedded-api v0.6.3

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

gusto-embedded

Developer-friendly & type-safe Typescript SDK specifically catered to leverage gusto-embedded API.

!IMPORTANT This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.

Summary

Gusto API: Welcome to Gusto's Embedded Payroll API documentation!

Table of Contents

SDK Installation

The SDK can be installed with either npm, pnpm, bun or yarn package managers.

NPM

npm add @gusto/embedded-api
# Install optional peer dependencies if you plan to use React hooks
npm add @tanstack/react-query react react-dom

PNPM

pnpm add @gusto/embedded-api
# Install optional peer dependencies if you plan to use React hooks
pnpm add @tanstack/react-query react react-dom

Bun

bun add @gusto/embedded-api
# Install optional peer dependencies if you plan to use React hooks
bun add @tanstack/react-query react react-dom

Yarn

yarn add @gusto/embedded-api zod
# Install optional peer dependencies if you plan to use React hooks
yarn add @tanstack/react-query react react-dom

# Note that Yarn does not install peer dependencies automatically. You will need
# to install zod as shown above.

!NOTE This package is published as an ES Module (ESM) only. For applications using CommonJS, use await import("@gusto/embedded-api") to import and use this package.

Requirements

For supported JavaScript runtimes, please consult RUNTIMES.md.

SDK Example Usage

Example

import { GustoEmbedded } from "@gusto/embedded-api";

const gustoEmbedded = new GustoEmbedded({
  companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});

async function run() {
  const result = await gustoEmbedded.introspection.getInfo({});

  console.log(result);
}

run();

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

NameTypeSchemeEnvironment Variable
companyAccessAuthhttpHTTP BearerGUSTOEMBEDDED_COMPANY_ACCESS_AUTH

To authenticate with the API the companyAccessAuth parameter must be set when initializing the SDK client instance. For example:

import { GustoEmbedded } from "@gusto/embedded-api";

const gustoEmbedded = new GustoEmbedded({
  companyAccessAuth: process.env["GUSTOEMBEDDED_COMPANY_ACCESS_AUTH"] ?? "",
});

async function run() {
  const result = await gustoEmbedded.introspection.getInfo({});

  console.log(result);
}

run();

Per-Operation Security Schemes

Some operations in this SDK require the security scheme to be specified at the request level. For example:

import { GustoEmbedded } from "@gusto/embedded-api";

const gustoEmbedded = new GustoEmbedded();

async function run() {
  const result = await gustoEmbedded.companies.createPartnerManaged({
    systemAccessAuth: process.env["GUSTOEMBEDDED_SYSTEM_ACCESS_AUTH"] ?? "",
  }, {
    requestBody: {
      user: {
        firstName: "Frank",
        lastName: "Ocean",
        email: "frank@example.com",
        phone: "2345558899",
      },
      company: {
        name: "Frank's Ocean, LLC",
        tradeName: "Frank’s Ocean",
        ein: "123456789",
        contractorOnly: false,
      },
    },
  });

  console.log(result);
}

run();

Available Resources and Operations

achTransactions

  • getAll - Get all ACH transactions for a company

bankAccounts

  • create - Create a company bank account
  • get - Get all company bank accounts
  • verify - Verify a company bank account
  • createFromPlaidToken - Create a bank account from a plaid processor token

companies

companies.suspensions

  • get - Get suspensions for this company
  • suspend - Suspend a company's account

companyAttachment

  • getDownloadUrl - Get a temporary url to download the Company Attachment file

companyAttachments

  • getDetails - Get Company Attachment Details
  • getList - Get List of Company Attachments
  • create - Create Company Attachment and Upload File

companyBenefits

companyForms

  • getAll - Get all company forms
  • get - Get a company form
  • getPdf - Get a company form pdf
  • sign - Sign a company form

contractorDocuments

  • getAll - Get all contractor documents
  • get - Get a contractor document
  • getPdf - Get the contractor document pdf
  • sign - Sign a contractor document

contractorForms

contractorPaymentGroups

  • create - Create a contractor payment group
  • getList - Get contractor payment groups for a company
  • preview - Preview a contractor payment group
  • get - Fetch a contractor payment group
  • delete - Cancel a contractor payment group
  • fund - Fund a contractor payment group DEMO

contractorPaymentMethod

  • getBankAccounts - Get all contractor bank accounts
  • get - Get a contractor's payment method
  • update - Update a contractor's payment method

contractorPaymentMethods

contractorPayments

  • getReceipt - Get a single contractor payment receipt
  • fund - Fund a contractor payment DEMO
  • create - Create a contractor payment
  • list - Get contractor payments for a company
  • get - Get a single contractor payment
  • delete - Cancel a contractor payment

contractors

departments

earningTypes

  • create - Create a custom earning type
  • list - Get all earning types for a company
  • update - Update an earning type
  • delete - Deactivate an earning type

employeeAddresses

employeeBenefits

employeeEmployments

employeeForms

employeePaymentMethod

employeePaymentMethods

employees

employeeTaxSetup

events

  • get - Get all events

externalPayrolls

federalTaxDetails

  • get - Get Federal Tax Details
  • update - Update Federal Tax Details

flows

garnishments

generatedDocuments

  • get - Get a generated document

historicalEmployees

  • update - Update a historical employee

holidayPayPolicies

  • get - Get a company's holiday pay policy
  • create - Create a holiday pay policy for a company
  • update - Update a company's holiday pay policy
  • delete - Delete a company's holiday pay policy
  • addEmployees - Add employees to a company's holiday pay policy
  • removeEmployees - Remove employees from a company's holiday pay policy

i9Verification

industrySelection

  • get - Get a company industry selection
  • update - Update a company industry selection

informationRequests

introspection

invoices

  • get - Retrieve invoicing data for companies

jobsAndCompensations

locations

notifications

paymentConfigs

  • get - Get a company's payment configs
  • update - Update a company's payment configs

payrolls

paySchedules

recoveryCases

  • get - Get all recovery cases for a company
  • redebit - Initiate a redebit for a recovery case

reports

signatories

  • create - Create a signatory
  • list - Get all company signatories
  • invite - Invite a signatory
  • update - Update a signatory
  • delete - Delete a signatory

taxRequirements

  • get - Get State Tax Requirements
  • updateState - Update State Tax Requirements
  • getAll - Get All Tax Requirement States

timeOffPolicies

webhooks

wireInRequests

  • get - Get a single Wire In Request
  • submit - Submit a wire in request
  • list - Get all Wire In Requests for a company

Standalone functions

All the methods listed above are available as standalone functions. These functions are ideal for use in applications running in the browser, serverless runtimes or other environments where application bundle size is a primary concern. When using a bundler to build your application, all unused functionality will be either excluded from the final bundle or tree-shaken away.

To read more about standalone functions, check FUNCTIONS.md.

React hooks with TanStack Query

React hooks built on TanStack Query are included in this SDK. These hooks and the utility functions provided alongside them can be used to build rich applications that pull data from the API using one of the most popular asynchronous state management library.

To learn about this feature and how to get started, check REACT_QUERY.md.

!WARNING

This feature is currently in preview and is subject to breaking changes within the current major version of the SDK as we gather user feedback on it.

0.6.3

4 months ago

0.6.2

4 months ago

0.6.1

5 months ago

0.6.0

5 months ago

0.5.13

6 months ago

0.5.12

6 months ago

0.5.11

6 months ago

0.5.10

6 months ago

0.5.9

7 months ago

0.5.8

7 months ago

0.5.7

7 months ago

0.5.6

7 months ago

0.5.5

7 months ago

0.5.4

7 months ago

0.5.3

7 months ago

0.5.2

7 months ago

0.5.1

7 months ago

0.5.0

8 months ago

0.4.1

8 months ago

0.4.0

8 months ago

0.3.0

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.19

8 months ago

0.1.18

9 months ago

0.1.5

9 months ago

1.0.0

2 years ago

0.0.2

2 years ago