diff --git a/.stats.yml b/.stats.yml
index c125dfb..f6819ec 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 23
+configured_endpoints: 33
diff --git a/account.go b/account.go
index 0533fba..d3471b6 100644
--- a/account.go
+++ b/account.go
@@ -8,6 +8,7 @@ import (
"github.com/Finch-API/finch-api-go/internal/apijson"
"github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/internal/shared"
"github.com/Finch-API/finch-api-go/option"
)
@@ -66,7 +67,8 @@ func (r *DisconnectResponse) UnmarshalJSON(data []byte) (err error) {
type Introspection struct {
// The Finch uuid of the account used to connect this company.
- AccountID string `json:"account_id,required"`
+ AccountID string `json:"account_id,required"`
+ AuthenticationMethods IntrospectionAuthenticationMethods `json:"authentication_methods,required"`
// The client id of the application associated with the `access_token`.
ClientID string `json:"client_id,required"`
// The type of application associated with a token.
@@ -94,23 +96,62 @@ type Introspection struct {
// introspectionJSON contains the JSON metadata for the struct [Introspection]
type introspectionJSON struct {
- AccountID apijson.Field
- ClientID apijson.Field
- ClientType apijson.Field
- CompanyID apijson.Field
- ConnectionType apijson.Field
- Manual apijson.Field
- PayrollProviderID apijson.Field
- Products apijson.Field
- Username apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
+ AccountID apijson.Field
+ AuthenticationMethods apijson.Field
+ ClientID apijson.Field
+ ClientType apijson.Field
+ CompanyID apijson.Field
+ ConnectionType apijson.Field
+ Manual apijson.Field
+ PayrollProviderID apijson.Field
+ Products apijson.Field
+ Username apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
}
func (r *Introspection) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
+type IntrospectionAuthenticationMethods struct {
+ ConnectionStatus IntrospectionAuthenticationMethodsConnectionStatus `json:"connection_status"`
+ Type string `json:"type"`
+ JSON introspectionAuthenticationMethodsJSON `json:"-"`
+}
+
+// introspectionAuthenticationMethodsJSON contains the JSON metadata for the struct
+// [IntrospectionAuthenticationMethods]
+type introspectionAuthenticationMethodsJSON struct {
+ ConnectionStatus apijson.Field
+ Type apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *IntrospectionAuthenticationMethods) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type IntrospectionAuthenticationMethodsConnectionStatus struct {
+ Message string `json:"message"`
+ Status shared.IntrospectResponseConnectionStatus `json:"status"`
+ JSON introspectionAuthenticationMethodsConnectionStatusJSON `json:"-"`
+}
+
+// introspectionAuthenticationMethodsConnectionStatusJSON contains the JSON
+// metadata for the struct [IntrospectionAuthenticationMethodsConnectionStatus]
+type introspectionAuthenticationMethodsConnectionStatusJSON struct {
+ Message apijson.Field
+ Status apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *IntrospectionAuthenticationMethodsConnectionStatus) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The type of application associated with a token.
type IntrospectionClientType string
diff --git a/aliases.go b/aliases.go
index 9f90394..2073a12 100644
--- a/aliases.go
+++ b/aliases.go
@@ -9,6 +9,27 @@ import (
type Error = apierror.Error
+// This is an alias to an internal type.
+type IntrospectResponseConnectionStatus = shared.IntrospectResponseConnectionStatus
+
+// This is an alias to an internal value.
+const IntrospectResponseConnectionStatusPending = shared.IntrospectResponseConnectionStatusPending
+
+// This is an alias to an internal value.
+const IntrospectResponseConnectionStatusProcessing = shared.IntrospectResponseConnectionStatusProcessing
+
+// This is an alias to an internal value.
+const IntrospectResponseConnectionStatusConnected = shared.IntrospectResponseConnectionStatusConnected
+
+// This is an alias to an internal value.
+const IntrospectResponseConnectionStatusErrorNoAccountSetup = shared.IntrospectResponseConnectionStatusErrorNoAccountSetup
+
+// This is an alias to an internal value.
+const IntrospectResponseConnectionStatusErrorPermissions = shared.IntrospectResponseConnectionStatusErrorPermissions
+
+// This is an alias to an internal value.
+const IntrospectResponseConnectionStatusReauth = shared.IntrospectResponseConnectionStatusReauth
+
// - `supported`: This operation is supported by both the provider and Finch
//
// - `not_supported_by_finch`: This operation is not supported by Finch but
diff --git a/api.md b/api.md
index f23d4f5..9536d8d 100644
--- a/api.md
+++ b/api.md
@@ -1,5 +1,10 @@
+# Shared Params Types
+
+- shared.IntrospectResponseConnectionStatus
+
# Shared Response Types
+- shared.IntrospectResponseConnectionStatus
- shared.OperationSupport
- shared.OperationSupportMatrix
- shared.Paging
@@ -24,6 +29,12 @@ Methods:
# HRIS
+Params Types:
+
+- finchgo.IncomeParam
+- finchgo.LocationParam
+- finchgo.MoneyParam
+
Response Types:
- finchgo.Income
@@ -198,3 +209,96 @@ Response Types:
Methods:
- client.Jobs.Manual.Get(ctx context.Context, jobID string) (finchgo.ManualAsyncJob, error)
+
+# Auth
+
+Methods:
+
+- client.Auth.NewToken(ctx context.Context, body finchgo.AuthNewTokenParams) (finchgo.CreateAccessTokenResponse, error)
+
+# Sandbox
+
+## Connections
+
+Response Types:
+
+- finchgo.SandboxConnectionNewResponse
+
+Methods:
+
+- client.Sandbox.Connections.New(ctx context.Context, body finchgo.SandboxConnectionNewParams) (finchgo.SandboxConnectionNewResponse, error)
+
+### Accounts
+
+Response Types:
+
+- finchgo.SandboxConnectionAccountNewResponse
+- finchgo.SandboxConnectionAccountUpdateResponse
+
+Methods:
+
+- client.Sandbox.Connections.Accounts.New(ctx context.Context, body finchgo.SandboxConnectionAccountNewParams) (finchgo.SandboxConnectionAccountNewResponse, error)
+- client.Sandbox.Connections.Accounts.Update(ctx context.Context, body finchgo.SandboxConnectionAccountUpdateParams) (finchgo.SandboxConnectionAccountUpdateResponse, error)
+
+## Company
+
+Response Types:
+
+- finchgo.SandboxCompanyUpdateResponse
+
+Methods:
+
+- client.Sandbox.Company.Update(ctx context.Context, body finchgo.SandboxCompanyUpdateParams) (finchgo.SandboxCompanyUpdateResponse, error)
+
+## Directory
+
+Response Types:
+
+- finchgo.SandboxDirectoryNewResponse
+
+Methods:
+
+- client.Sandbox.Directory.New(ctx context.Context, body finchgo.SandboxDirectoryNewParams) ([]finchgo.SandboxDirectoryNewResponse, error)
+
+## Individual
+
+Response Types:
+
+- finchgo.SandboxIndividualUpdateResponse
+
+Methods:
+
+- client.Sandbox.Individual.Update(ctx context.Context, individualID string, body finchgo.SandboxIndividualUpdateParams) (finchgo.SandboxIndividualUpdateResponse, error)
+
+## Employment
+
+Response Types:
+
+- finchgo.SandboxEmploymentUpdateResponse
+
+Methods:
+
+- client.Sandbox.Employment.Update(ctx context.Context, individualID string, body finchgo.SandboxEmploymentUpdateParams) (finchgo.SandboxEmploymentUpdateResponse, error)
+
+## Payment
+
+Response Types:
+
+- finchgo.SandboxPaymentNewResponse
+
+Methods:
+
+- client.Sandbox.Payment.New(ctx context.Context, body finchgo.SandboxPaymentNewParams) (finchgo.SandboxPaymentNewResponse, error)
+
+## Jobs
+
+### Configuration
+
+Response Types:
+
+- finchgo.SandboxJobConfiguration
+
+Methods:
+
+- client.Sandbox.Jobs.Configuration.Get(ctx context.Context) ([]finchgo.SandboxJobConfiguration, error)
+- client.Sandbox.Jobs.Configuration.Update(ctx context.Context, body finchgo.SandboxJobConfigurationUpdateParams) (finchgo.SandboxJobConfiguration, error)
diff --git a/auth.go b/auth.go
new file mode 100644
index 0000000..98bfb81
--- /dev/null
+++ b/auth.go
@@ -0,0 +1,49 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// AuthService contains methods and other services that help with interacting with
+// the Finch API. Note, unlike clients, this service does not read variables from
+// the environment automatically. You should not instantiate this service directly,
+// and instead use the [NewAuthService] method instead.
+type AuthService struct {
+ Options []option.RequestOption
+}
+
+// NewAuthService generates a new service that applies the given options to each
+// request. These options are applied after the parent client's options (if there
+// is one), and before any request-specific options.
+func NewAuthService(opts ...option.RequestOption) (r *AuthService) {
+ r = &AuthService{}
+ r.Options = opts
+ return
+}
+
+// Exchange the authorization code for an access token
+func (r *AuthService) NewToken(ctx context.Context, body AuthNewTokenParams, opts ...option.RequestOption) (res *CreateAccessTokenResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "auth/token"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+type AuthNewTokenParams struct {
+ ClientID param.Field[string] `json:"client_id,required"`
+ ClientSecret param.Field[string] `json:"client_secret,required"`
+ Code param.Field[string] `json:"code,required"`
+ RedirectUri param.Field[string] `json:"redirect_uri,required"`
+}
+
+func (r AuthNewTokenParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/auth_test.go b/auth_test.go
new file mode 100644
index 0000000..4b57688
--- /dev/null
+++ b/auth_test.go
@@ -0,0 +1,41 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestAuthNewToken(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Auth.NewToken(context.TODO(), finchgo.AuthNewTokenParams{
+ ClientID: finchgo.F(""),
+ ClientSecret: finchgo.F(""),
+ Code: finchgo.F(""),
+ RedirectUri: finchgo.F("https://example.com"),
+ })
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/client.go b/client.go
index c626487..e5a7801 100644
--- a/client.go
+++ b/client.go
@@ -27,6 +27,8 @@ type Client struct {
Webhooks *WebhookService
RequestForwarding *RequestForwardingService
Jobs *JobService
+ Auth *AuthService
+ Sandbox *SandboxService
}
// NewClient generates a new client with the default option read from the
@@ -55,6 +57,8 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
r.Webhooks = NewWebhookService(opts...)
r.RequestForwarding = NewRequestForwardingService(opts...)
r.Jobs = NewJobService(opts...)
+ r.Auth = NewAuthService(opts...)
+ r.Sandbox = NewSandboxService(opts...)
return
}
diff --git a/hris.go b/hris.go
index 35ce412..83bb236 100644
--- a/hris.go
+++ b/hris.go
@@ -4,6 +4,7 @@ package finchgo
import (
"github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
"github.com/Finch-API/finch-api-go/option"
)
@@ -84,6 +85,25 @@ const (
IncomeUnitFixed IncomeUnit = "fixed"
)
+// The employee's income as reported by the provider. This may not always be
+// annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc,
+// depending on what information the provider returns.
+type IncomeParam struct {
+ // The income amount in cents.
+ Amount param.Field[int64] `json:"amount"`
+ // The currency code.
+ Currency param.Field[string] `json:"currency"`
+ // The date the income amount went into effect.
+ EffectiveDate param.Field[string] `json:"effective_date"`
+ // The income unit of payment. Options: `yearly`, `quarterly`, `monthly`,
+ // `semi_monthly`, `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`.
+ Unit param.Field[IncomeUnit] `json:"unit"`
+}
+
+func (r IncomeParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type Location struct {
// City, district, suburb, town, or village.
City string `json:"city,nullable"`
@@ -120,6 +140,27 @@ func (r *Location) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
+type LocationParam struct {
+ // City, district, suburb, town, or village.
+ City param.Field[string] `json:"city"`
+ // The 2-letter ISO 3166 country code.
+ Country param.Field[string] `json:"country"`
+ // Street address or PO box.
+ Line1 param.Field[string] `json:"line1"`
+ // Apartment, suite, unit, or building.
+ Line2 param.Field[string] `json:"line2"`
+ Name param.Field[string] `json:"name"`
+ // The postal code or zip code.
+ PostalCode param.Field[string] `json:"postal_code"`
+ SourceID param.Field[string] `json:"source_id"`
+ // The state code.
+ State param.Field[string] `json:"state"`
+}
+
+func (r LocationParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type Money struct {
// Amount for money object (in cents)
Amount int64 `json:"amount,nullable"`
@@ -138,3 +179,13 @@ type moneyJSON struct {
func (r *Money) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
+
+type MoneyParam struct {
+ // Amount for money object (in cents)
+ Amount param.Field[int64] `json:"amount"`
+ Currency param.Field[string] `json:"currency"`
+}
+
+func (r MoneyParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/hrispaystatement_test.go b/hrispaystatement_test.go
index f9bbbe2..7fd9e89 100644
--- a/hrispaystatement_test.go
+++ b/hrispaystatement_test.go
@@ -27,15 +27,7 @@ func TestHRISPayStatementGetMany(t *testing.T) {
)
_, err := client.HRIS.PayStatements.GetMany(context.TODO(), finchgo.HRISPayStatementGetManyParams{
Requests: finchgo.F([]finchgo.HRISPayStatementGetManyParamsRequest{{
- PaymentID: finchgo.F("e8b90071-0c11-471c-86e8-e303ef2f6782"),
- Limit: finchgo.F(int64(0)),
- Offset: finchgo.F(int64(0)),
- }, {
- PaymentID: finchgo.F("e8b90071-0c11-471c-86e8-e303ef2f6782"),
- Limit: finchgo.F(int64(0)),
- Offset: finchgo.F(int64(0)),
- }, {
- PaymentID: finchgo.F("e8b90071-0c11-471c-86e8-e303ef2f6782"),
+ PaymentID: finchgo.F("string"),
Limit: finchgo.F(int64(0)),
Offset: finchgo.F(int64(0)),
}}),
diff --git a/internal/shared/shared.go b/internal/shared/shared.go
index aca6e00..68ddef2 100644
--- a/internal/shared/shared.go
+++ b/internal/shared/shared.go
@@ -6,6 +6,17 @@ import (
"github.com/Finch-API/finch-api-go/internal/apijson"
)
+type IntrospectResponseConnectionStatus string
+
+const (
+ IntrospectResponseConnectionStatusPending IntrospectResponseConnectionStatus = "pending"
+ IntrospectResponseConnectionStatusProcessing IntrospectResponseConnectionStatus = "processing"
+ IntrospectResponseConnectionStatusConnected IntrospectResponseConnectionStatus = "connected"
+ IntrospectResponseConnectionStatusErrorNoAccountSetup IntrospectResponseConnectionStatus = "error_no_account_setup"
+ IntrospectResponseConnectionStatusErrorPermissions IntrospectResponseConnectionStatus = "error_permissions"
+ IntrospectResponseConnectionStatusReauth IntrospectResponseConnectionStatus = "reauth"
+)
+
// - `supported`: This operation is supported by both the provider and Finch
//
// - `not_supported_by_finch`: This operation is not supported by Finch but
diff --git a/sandbox.go b/sandbox.go
new file mode 100644
index 0000000..4c55c53
--- /dev/null
+++ b/sandbox.go
@@ -0,0 +1,38 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxService contains methods and other services that help with interacting
+// with the Finch API. Note, unlike clients, this service does not read variables
+// from the environment automatically. You should not instantiate this service
+// directly, and instead use the [NewSandboxService] method instead.
+type SandboxService struct {
+ Options []option.RequestOption
+ Connections *SandboxConnectionService
+ Company *SandboxCompanyService
+ Directory *SandboxDirectoryService
+ Individual *SandboxIndividualService
+ Employment *SandboxEmploymentService
+ Payment *SandboxPaymentService
+ Jobs *SandboxJobService
+}
+
+// NewSandboxService generates a new service that applies the given options to each
+// request. These options are applied after the parent client's options (if there
+// is one), and before any request-specific options.
+func NewSandboxService(opts ...option.RequestOption) (r *SandboxService) {
+ r = &SandboxService{}
+ r.Options = opts
+ r.Connections = NewSandboxConnectionService(opts...)
+ r.Company = NewSandboxCompanyService(opts...)
+ r.Directory = NewSandboxDirectoryService(opts...)
+ r.Individual = NewSandboxIndividualService(opts...)
+ r.Employment = NewSandboxEmploymentService(opts...)
+ r.Payment = NewSandboxPaymentService(opts...)
+ r.Jobs = NewSandboxJobService(opts...)
+ return
+}
diff --git a/sandboxcompany.go b/sandboxcompany.go
new file mode 100644
index 0000000..7ac8d2e
--- /dev/null
+++ b/sandboxcompany.go
@@ -0,0 +1,302 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxCompanyService contains methods and other services that help with
+// interacting with the Finch API. Note, unlike clients, this service does not read
+// variables from the environment automatically. You should not instantiate this
+// service directly, and instead use the [NewSandboxCompanyService] method instead.
+type SandboxCompanyService struct {
+ Options []option.RequestOption
+}
+
+// NewSandboxCompanyService generates a new service that applies the given options
+// to each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewSandboxCompanyService(opts ...option.RequestOption) (r *SandboxCompanyService) {
+ r = &SandboxCompanyService{}
+ r.Options = opts
+ return
+}
+
+// Update a sandbox company's data
+func (r *SandboxCompanyService) Update(ctx context.Context, body SandboxCompanyUpdateParams, opts ...option.RequestOption) (res *SandboxCompanyUpdateResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "sandbox/company"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
+ return
+}
+
+type SandboxCompanyUpdateResponse struct {
+ // An array of bank account objects associated with the payroll/HRIS system.
+ Accounts []SandboxCompanyUpdateResponseAccount `json:"accounts,required,nullable"`
+ // The array of company departments.
+ Departments []SandboxCompanyUpdateResponseDepartment `json:"departments,required,nullable"`
+ // The employer identification number.
+ Ein string `json:"ein,required,nullable"`
+ // The entity type object.
+ Entity SandboxCompanyUpdateResponseEntity `json:"entity,required,nullable"`
+ // The legal name of the company.
+ LegalName string `json:"legal_name,required,nullable"`
+ Locations []Location `json:"locations,required,nullable"`
+ // The email of the main administrator on the account.
+ PrimaryEmail string `json:"primary_email,required,nullable"`
+ // The phone number of the main administrator on the account. Format: `XXXXXXXXXX`
+ PrimaryPhoneNumber string `json:"primary_phone_number,required,nullable"`
+ JSON sandboxCompanyUpdateResponseJSON `json:"-"`
+}
+
+// sandboxCompanyUpdateResponseJSON contains the JSON metadata for the struct
+// [SandboxCompanyUpdateResponse]
+type sandboxCompanyUpdateResponseJSON struct {
+ Accounts apijson.Field
+ Departments apijson.Field
+ Ein apijson.Field
+ Entity apijson.Field
+ LegalName apijson.Field
+ Locations apijson.Field
+ PrimaryEmail apijson.Field
+ PrimaryPhoneNumber apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxCompanyUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxCompanyUpdateResponseAccount struct {
+ // The name of the bank associated in the payroll/HRIS system.
+ AccountName string `json:"account_name,nullable"`
+ // 10-12 digit number to specify the bank account
+ AccountNumber string `json:"account_number,nullable"`
+ // The type of bank account.
+ AccountType SandboxCompanyUpdateResponseAccountsAccountType `json:"account_type,nullable"`
+ // Name of the banking institution.
+ InstitutionName string `json:"institution_name,nullable"`
+ // A nine-digit code that's based on the U.S. Bank location where your account was
+ // opened.
+ RoutingNumber string `json:"routing_number,nullable"`
+ JSON sandboxCompanyUpdateResponseAccountJSON `json:"-"`
+}
+
+// sandboxCompanyUpdateResponseAccountJSON contains the JSON metadata for the
+// struct [SandboxCompanyUpdateResponseAccount]
+type sandboxCompanyUpdateResponseAccountJSON struct {
+ AccountName apijson.Field
+ AccountNumber apijson.Field
+ AccountType apijson.Field
+ InstitutionName apijson.Field
+ RoutingNumber apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxCompanyUpdateResponseAccount) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The type of bank account.
+type SandboxCompanyUpdateResponseAccountsAccountType string
+
+const (
+ SandboxCompanyUpdateResponseAccountsAccountTypeChecking SandboxCompanyUpdateResponseAccountsAccountType = "checking"
+ SandboxCompanyUpdateResponseAccountsAccountTypeSavings SandboxCompanyUpdateResponseAccountsAccountType = "savings"
+)
+
+type SandboxCompanyUpdateResponseDepartment struct {
+ // The department name.
+ Name string `json:"name,nullable"`
+ // The parent department, if present.
+ Parent SandboxCompanyUpdateResponseDepartmentsParent `json:"parent,nullable"`
+ JSON sandboxCompanyUpdateResponseDepartmentJSON `json:"-"`
+}
+
+// sandboxCompanyUpdateResponseDepartmentJSON contains the JSON metadata for the
+// struct [SandboxCompanyUpdateResponseDepartment]
+type sandboxCompanyUpdateResponseDepartmentJSON struct {
+ Name apijson.Field
+ Parent apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxCompanyUpdateResponseDepartment) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The parent department, if present.
+type SandboxCompanyUpdateResponseDepartmentsParent struct {
+ // The parent department's name.
+ Name string `json:"name,nullable"`
+ JSON sandboxCompanyUpdateResponseDepartmentsParentJSON `json:"-"`
+}
+
+// sandboxCompanyUpdateResponseDepartmentsParentJSON contains the JSON metadata for
+// the struct [SandboxCompanyUpdateResponseDepartmentsParent]
+type sandboxCompanyUpdateResponseDepartmentsParentJSON struct {
+ Name apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxCompanyUpdateResponseDepartmentsParent) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The entity type object.
+type SandboxCompanyUpdateResponseEntity struct {
+ // The tax payer subtype of the company.
+ Subtype SandboxCompanyUpdateResponseEntitySubtype `json:"subtype,nullable"`
+ // The tax payer type of the company.
+ Type SandboxCompanyUpdateResponseEntityType `json:"type,nullable"`
+ JSON sandboxCompanyUpdateResponseEntityJSON `json:"-"`
+}
+
+// sandboxCompanyUpdateResponseEntityJSON contains the JSON metadata for the struct
+// [SandboxCompanyUpdateResponseEntity]
+type sandboxCompanyUpdateResponseEntityJSON struct {
+ Subtype apijson.Field
+ Type apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxCompanyUpdateResponseEntity) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The tax payer subtype of the company.
+type SandboxCompanyUpdateResponseEntitySubtype string
+
+const (
+ SandboxCompanyUpdateResponseEntitySubtypeSCorporation SandboxCompanyUpdateResponseEntitySubtype = "s_corporation"
+ SandboxCompanyUpdateResponseEntitySubtypeCCorporation SandboxCompanyUpdateResponseEntitySubtype = "c_corporation"
+ SandboxCompanyUpdateResponseEntitySubtypeBCorporation SandboxCompanyUpdateResponseEntitySubtype = "b_corporation"
+)
+
+// The tax payer type of the company.
+type SandboxCompanyUpdateResponseEntityType string
+
+const (
+ SandboxCompanyUpdateResponseEntityTypeLlc SandboxCompanyUpdateResponseEntityType = "llc"
+ SandboxCompanyUpdateResponseEntityTypeLp SandboxCompanyUpdateResponseEntityType = "lp"
+ SandboxCompanyUpdateResponseEntityTypeCorporation SandboxCompanyUpdateResponseEntityType = "corporation"
+ SandboxCompanyUpdateResponseEntityTypeSoleProprietor SandboxCompanyUpdateResponseEntityType = "sole_proprietor"
+ SandboxCompanyUpdateResponseEntityTypeNonProfit SandboxCompanyUpdateResponseEntityType = "non_profit"
+ SandboxCompanyUpdateResponseEntityTypePartnership SandboxCompanyUpdateResponseEntityType = "partnership"
+ SandboxCompanyUpdateResponseEntityTypeCooperative SandboxCompanyUpdateResponseEntityType = "cooperative"
+)
+
+type SandboxCompanyUpdateParams struct {
+ // An array of bank account objects associated with the payroll/HRIS system.
+ Accounts param.Field[[]SandboxCompanyUpdateParamsAccount] `json:"accounts,required"`
+ // The array of company departments.
+ Departments param.Field[[]SandboxCompanyUpdateParamsDepartment] `json:"departments,required"`
+ // The employer identification number.
+ Ein param.Field[string] `json:"ein,required"`
+ // The entity type object.
+ Entity param.Field[SandboxCompanyUpdateParamsEntity] `json:"entity,required"`
+ // The legal name of the company.
+ LegalName param.Field[string] `json:"legal_name,required"`
+ Locations param.Field[[]LocationParam] `json:"locations,required"`
+ // The email of the main administrator on the account.
+ PrimaryEmail param.Field[string] `json:"primary_email,required"`
+ // The phone number of the main administrator on the account. Format: `XXXXXXXXXX`
+ PrimaryPhoneNumber param.Field[string] `json:"primary_phone_number,required"`
+}
+
+func (r SandboxCompanyUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxCompanyUpdateParamsAccount struct {
+ // The name of the bank associated in the payroll/HRIS system.
+ AccountName param.Field[string] `json:"account_name"`
+ // 10-12 digit number to specify the bank account
+ AccountNumber param.Field[string] `json:"account_number"`
+ // The type of bank account.
+ AccountType param.Field[SandboxCompanyUpdateParamsAccountsAccountType] `json:"account_type"`
+ // Name of the banking institution.
+ InstitutionName param.Field[string] `json:"institution_name"`
+ // A nine-digit code that's based on the U.S. Bank location where your account was
+ // opened.
+ RoutingNumber param.Field[string] `json:"routing_number"`
+}
+
+func (r SandboxCompanyUpdateParamsAccount) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The type of bank account.
+type SandboxCompanyUpdateParamsAccountsAccountType string
+
+const (
+ SandboxCompanyUpdateParamsAccountsAccountTypeChecking SandboxCompanyUpdateParamsAccountsAccountType = "checking"
+ SandboxCompanyUpdateParamsAccountsAccountTypeSavings SandboxCompanyUpdateParamsAccountsAccountType = "savings"
+)
+
+type SandboxCompanyUpdateParamsDepartment struct {
+ // The department name.
+ Name param.Field[string] `json:"name"`
+ // The parent department, if present.
+ Parent param.Field[SandboxCompanyUpdateParamsDepartmentsParent] `json:"parent"`
+}
+
+func (r SandboxCompanyUpdateParamsDepartment) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The parent department, if present.
+type SandboxCompanyUpdateParamsDepartmentsParent struct {
+ // The parent department's name.
+ Name param.Field[string] `json:"name"`
+}
+
+func (r SandboxCompanyUpdateParamsDepartmentsParent) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The entity type object.
+type SandboxCompanyUpdateParamsEntity struct {
+ // The tax payer subtype of the company.
+ Subtype param.Field[SandboxCompanyUpdateParamsEntitySubtype] `json:"subtype"`
+ // The tax payer type of the company.
+ Type param.Field[SandboxCompanyUpdateParamsEntityType] `json:"type"`
+}
+
+func (r SandboxCompanyUpdateParamsEntity) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The tax payer subtype of the company.
+type SandboxCompanyUpdateParamsEntitySubtype string
+
+const (
+ SandboxCompanyUpdateParamsEntitySubtypeSCorporation SandboxCompanyUpdateParamsEntitySubtype = "s_corporation"
+ SandboxCompanyUpdateParamsEntitySubtypeCCorporation SandboxCompanyUpdateParamsEntitySubtype = "c_corporation"
+ SandboxCompanyUpdateParamsEntitySubtypeBCorporation SandboxCompanyUpdateParamsEntitySubtype = "b_corporation"
+)
+
+// The tax payer type of the company.
+type SandboxCompanyUpdateParamsEntityType string
+
+const (
+ SandboxCompanyUpdateParamsEntityTypeLlc SandboxCompanyUpdateParamsEntityType = "llc"
+ SandboxCompanyUpdateParamsEntityTypeLp SandboxCompanyUpdateParamsEntityType = "lp"
+ SandboxCompanyUpdateParamsEntityTypeCorporation SandboxCompanyUpdateParamsEntityType = "corporation"
+ SandboxCompanyUpdateParamsEntityTypeSoleProprietor SandboxCompanyUpdateParamsEntityType = "sole_proprietor"
+ SandboxCompanyUpdateParamsEntityTypeNonProfit SandboxCompanyUpdateParamsEntityType = "non_profit"
+ SandboxCompanyUpdateParamsEntityTypePartnership SandboxCompanyUpdateParamsEntityType = "partnership"
+ SandboxCompanyUpdateParamsEntityTypeCooperative SandboxCompanyUpdateParamsEntityType = "cooperative"
+)
diff --git a/sandboxcompany_test.go b/sandboxcompany_test.go
new file mode 100644
index 0000000..509e513
--- /dev/null
+++ b/sandboxcompany_test.go
@@ -0,0 +1,108 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestSandboxCompanyUpdateWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Company.Update(context.TODO(), finchgo.SandboxCompanyUpdateParams{
+ Accounts: finchgo.F([]finchgo.SandboxCompanyUpdateParamsAccount{{
+ RoutingNumber: finchgo.F("string"),
+ AccountName: finchgo.F("string"),
+ InstitutionName: finchgo.F("string"),
+ AccountType: finchgo.F(finchgo.SandboxCompanyUpdateParamsAccountsAccountTypeChecking),
+ AccountNumber: finchgo.F("string"),
+ }, {
+ RoutingNumber: finchgo.F("string"),
+ AccountName: finchgo.F("string"),
+ InstitutionName: finchgo.F("string"),
+ AccountType: finchgo.F(finchgo.SandboxCompanyUpdateParamsAccountsAccountTypeChecking),
+ AccountNumber: finchgo.F("string"),
+ }, {
+ RoutingNumber: finchgo.F("string"),
+ AccountName: finchgo.F("string"),
+ InstitutionName: finchgo.F("string"),
+ AccountType: finchgo.F(finchgo.SandboxCompanyUpdateParamsAccountsAccountTypeChecking),
+ AccountNumber: finchgo.F("string"),
+ }}),
+ Departments: finchgo.F([]finchgo.SandboxCompanyUpdateParamsDepartment{{
+ Name: finchgo.F("string"),
+ Parent: finchgo.F(finchgo.SandboxCompanyUpdateParamsDepartmentsParent{
+ Name: finchgo.F("string"),
+ }),
+ }, {
+ Name: finchgo.F("string"),
+ Parent: finchgo.F(finchgo.SandboxCompanyUpdateParamsDepartmentsParent{
+ Name: finchgo.F("string"),
+ }),
+ }, {
+ Name: finchgo.F("string"),
+ Parent: finchgo.F(finchgo.SandboxCompanyUpdateParamsDepartmentsParent{
+ Name: finchgo.F("string"),
+ }),
+ }}),
+ Ein: finchgo.F("string"),
+ Entity: finchgo.F(finchgo.SandboxCompanyUpdateParamsEntity{
+ Type: finchgo.F(finchgo.SandboxCompanyUpdateParamsEntityTypeLlc),
+ Subtype: finchgo.F(finchgo.SandboxCompanyUpdateParamsEntitySubtypeSCorporation),
+ }),
+ LegalName: finchgo.F("string"),
+ Locations: finchgo.F([]finchgo.LocationParam{{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }, {
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }, {
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }}),
+ PrimaryEmail: finchgo.F("string"),
+ PrimaryPhoneNumber: finchgo.F("string"),
+ })
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/sandboxconnection.go b/sandboxconnection.go
new file mode 100644
index 0000000..acd4a36
--- /dev/null
+++ b/sandboxconnection.go
@@ -0,0 +1,99 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxConnectionService contains methods and other services that help with
+// interacting with the Finch API. Note, unlike clients, this service does not read
+// variables from the environment automatically. You should not instantiate this
+// service directly, and instead use the [NewSandboxConnectionService] method
+// instead.
+type SandboxConnectionService struct {
+ Options []option.RequestOption
+ Accounts *SandboxConnectionAccountService
+}
+
+// NewSandboxConnectionService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewSandboxConnectionService(opts ...option.RequestOption) (r *SandboxConnectionService) {
+ r = &SandboxConnectionService{}
+ r.Options = opts
+ r.Accounts = NewSandboxConnectionAccountService(opts...)
+ return
+}
+
+// Create a new connection (new company/provider pair) with a new account
+func (r *SandboxConnectionService) New(ctx context.Context, body SandboxConnectionNewParams, opts ...option.RequestOption) (res *SandboxConnectionNewResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "sandbox/connections"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+type SandboxConnectionNewResponse struct {
+ AccessToken string `json:"access_token,required" format:"uuid"`
+ AccountID string `json:"account_id,required" format:"uuid"`
+ AuthenticationType SandboxConnectionNewResponseAuthenticationType `json:"authentication_type,required"`
+ CompanyID string `json:"company_id,required" format:"uuid"`
+ Products []string `json:"products,required"`
+ ProviderID string `json:"provider_id,required" format:"uuid"`
+ JSON sandboxConnectionNewResponseJSON `json:"-"`
+}
+
+// sandboxConnectionNewResponseJSON contains the JSON metadata for the struct
+// [SandboxConnectionNewResponse]
+type sandboxConnectionNewResponseJSON struct {
+ AccessToken apijson.Field
+ AccountID apijson.Field
+ AuthenticationType apijson.Field
+ CompanyID apijson.Field
+ Products apijson.Field
+ ProviderID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxConnectionNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxConnectionNewResponseAuthenticationType string
+
+const (
+ SandboxConnectionNewResponseAuthenticationTypeCredentials SandboxConnectionNewResponseAuthenticationType = "credentials"
+ SandboxConnectionNewResponseAuthenticationTypeAPIToken SandboxConnectionNewResponseAuthenticationType = "api_token"
+ SandboxConnectionNewResponseAuthenticationTypeOauth SandboxConnectionNewResponseAuthenticationType = "oauth"
+ SandboxConnectionNewResponseAuthenticationTypeAssisted SandboxConnectionNewResponseAuthenticationType = "assisted"
+)
+
+type SandboxConnectionNewParams struct {
+ ProviderID param.Field[string] `json:"provider_id,required"`
+ AuthenticationType param.Field[SandboxConnectionNewParamsAuthenticationType] `json:"authentication_type"`
+ // Optional: the size of the employer to be created with this connection. Defaults
+ // to 20
+ EmployerSize param.Field[int64] `json:"employer_size"`
+ Products param.Field[[]string] `json:"products"`
+}
+
+func (r SandboxConnectionNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxConnectionNewParamsAuthenticationType string
+
+const (
+ SandboxConnectionNewParamsAuthenticationTypeCredentials SandboxConnectionNewParamsAuthenticationType = "credentials"
+ SandboxConnectionNewParamsAuthenticationTypeAPIToken SandboxConnectionNewParamsAuthenticationType = "api_token"
+ SandboxConnectionNewParamsAuthenticationTypeOauth SandboxConnectionNewParamsAuthenticationType = "oauth"
+ SandboxConnectionNewParamsAuthenticationTypeAssisted SandboxConnectionNewParamsAuthenticationType = "assisted"
+)
diff --git a/sandboxconnection_test.go b/sandboxconnection_test.go
new file mode 100644
index 0000000..5d727ed
--- /dev/null
+++ b/sandboxconnection_test.go
@@ -0,0 +1,41 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestSandboxConnectionNewWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Connections.New(context.TODO(), finchgo.SandboxConnectionNewParams{
+ ProviderID: finchgo.F("string"),
+ AuthenticationType: finchgo.F(finchgo.SandboxConnectionNewParamsAuthenticationTypeCredentials),
+ EmployerSize: finchgo.F(int64(0)),
+ Products: finchgo.F([]string{"string", "string", "string"}),
+ })
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/sandboxconnectionaccount.go b/sandboxconnectionaccount.go
new file mode 100644
index 0000000..d2c1dae
--- /dev/null
+++ b/sandboxconnectionaccount.go
@@ -0,0 +1,149 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/internal/shared"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxConnectionAccountService contains methods and other services that help
+// with interacting with the Finch API. Note, unlike clients, this service does not
+// read variables from the environment automatically. You should not instantiate
+// this service directly, and instead use the [NewSandboxConnectionAccountService]
+// method instead.
+type SandboxConnectionAccountService struct {
+ Options []option.RequestOption
+}
+
+// NewSandboxConnectionAccountService generates a new service that applies the
+// given options to each request. These options are applied after the parent
+// client's options (if there is one), and before any request-specific options.
+func NewSandboxConnectionAccountService(opts ...option.RequestOption) (r *SandboxConnectionAccountService) {
+ r = &SandboxConnectionAccountService{}
+ r.Options = opts
+ return
+}
+
+// Create a new account for an existing connection (company/provider pair)
+func (r *SandboxConnectionAccountService) New(ctx context.Context, body SandboxConnectionAccountNewParams, opts ...option.RequestOption) (res *SandboxConnectionAccountNewResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "sandbox/connections/accounts"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Update an existing sandbox account. Change the connection status to understand
+// how the Finch API responds.
+func (r *SandboxConnectionAccountService) Update(ctx context.Context, body SandboxConnectionAccountUpdateParams, opts ...option.RequestOption) (res *SandboxConnectionAccountUpdateResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "sandbox/connections/accounts"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
+ return
+}
+
+type SandboxConnectionAccountNewResponse struct {
+ AccessToken string `json:"access_token,required" format:"uuid"`
+ AccountID string `json:"account_id,required" format:"uuid"`
+ AuthenticationType SandboxConnectionAccountNewResponseAuthenticationType `json:"authentication_type,required"`
+ CompanyID string `json:"company_id,required" format:"uuid"`
+ Products []string `json:"products,required"`
+ ProviderID string `json:"provider_id,required"`
+ JSON sandboxConnectionAccountNewResponseJSON `json:"-"`
+}
+
+// sandboxConnectionAccountNewResponseJSON contains the JSON metadata for the
+// struct [SandboxConnectionAccountNewResponse]
+type sandboxConnectionAccountNewResponseJSON struct {
+ AccessToken apijson.Field
+ AccountID apijson.Field
+ AuthenticationType apijson.Field
+ CompanyID apijson.Field
+ Products apijson.Field
+ ProviderID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxConnectionAccountNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxConnectionAccountNewResponseAuthenticationType string
+
+const (
+ SandboxConnectionAccountNewResponseAuthenticationTypeCredentials SandboxConnectionAccountNewResponseAuthenticationType = "credentials"
+ SandboxConnectionAccountNewResponseAuthenticationTypeAPIToken SandboxConnectionAccountNewResponseAuthenticationType = "api_token"
+ SandboxConnectionAccountNewResponseAuthenticationTypeOauth SandboxConnectionAccountNewResponseAuthenticationType = "oauth"
+ SandboxConnectionAccountNewResponseAuthenticationTypeAssisted SandboxConnectionAccountNewResponseAuthenticationType = "assisted"
+)
+
+type SandboxConnectionAccountUpdateResponse struct {
+ AccountID string `json:"account_id,required"`
+ AuthenticationType SandboxConnectionAccountUpdateResponseAuthenticationType `json:"authentication_type,required"`
+ CompanyID string `json:"company_id,required" format:"uuid"`
+ Products []string `json:"products,required"`
+ ProviderID string `json:"provider_id,required"`
+ JSON sandboxConnectionAccountUpdateResponseJSON `json:"-"`
+}
+
+// sandboxConnectionAccountUpdateResponseJSON contains the JSON metadata for the
+// struct [SandboxConnectionAccountUpdateResponse]
+type sandboxConnectionAccountUpdateResponseJSON struct {
+ AccountID apijson.Field
+ AuthenticationType apijson.Field
+ CompanyID apijson.Field
+ Products apijson.Field
+ ProviderID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxConnectionAccountUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxConnectionAccountUpdateResponseAuthenticationType string
+
+const (
+ SandboxConnectionAccountUpdateResponseAuthenticationTypeCredentials SandboxConnectionAccountUpdateResponseAuthenticationType = "credentials"
+ SandboxConnectionAccountUpdateResponseAuthenticationTypeAPIToken SandboxConnectionAccountUpdateResponseAuthenticationType = "api_token"
+ SandboxConnectionAccountUpdateResponseAuthenticationTypeOauth SandboxConnectionAccountUpdateResponseAuthenticationType = "oauth"
+ SandboxConnectionAccountUpdateResponseAuthenticationTypeAssisted SandboxConnectionAccountUpdateResponseAuthenticationType = "assisted"
+)
+
+type SandboxConnectionAccountNewParams struct {
+ CompanyID param.Field[string] `json:"company_id,required" format:"uuid"`
+ ProviderID param.Field[string] `json:"provider_id,required"`
+ AuthenticationType param.Field[SandboxConnectionAccountNewParamsAuthenticationType] `json:"authentication_type"`
+ // Optional, defaults to Organization products (`company`, `directory`,
+ // `employment`, `individual`)
+ Products param.Field[[]string] `json:"products"`
+}
+
+func (r SandboxConnectionAccountNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxConnectionAccountNewParamsAuthenticationType string
+
+const (
+ SandboxConnectionAccountNewParamsAuthenticationTypeCredentials SandboxConnectionAccountNewParamsAuthenticationType = "credentials"
+ SandboxConnectionAccountNewParamsAuthenticationTypeAPIToken SandboxConnectionAccountNewParamsAuthenticationType = "api_token"
+ SandboxConnectionAccountNewParamsAuthenticationTypeOauth SandboxConnectionAccountNewParamsAuthenticationType = "oauth"
+ SandboxConnectionAccountNewParamsAuthenticationTypeAssisted SandboxConnectionAccountNewParamsAuthenticationType = "assisted"
+)
+
+type SandboxConnectionAccountUpdateParams struct {
+ ConnectionStatus param.Field[shared.IntrospectResponseConnectionStatus] `json:"connection_status"`
+}
+
+func (r SandboxConnectionAccountUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/sandboxconnectionaccount_test.go b/sandboxconnectionaccount_test.go
new file mode 100644
index 0000000..3b8c45b
--- /dev/null
+++ b/sandboxconnectionaccount_test.go
@@ -0,0 +1,66 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/shared"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestSandboxConnectionAccountNewWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Connections.Accounts.New(context.TODO(), finchgo.SandboxConnectionAccountNewParams{
+ CompanyID: finchgo.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
+ ProviderID: finchgo.F("string"),
+ AuthenticationType: finchgo.F(finchgo.SandboxConnectionAccountNewParamsAuthenticationTypeCredentials),
+ Products: finchgo.F([]string{"string", "string", "string"}),
+ })
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestSandboxConnectionAccountUpdateWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Connections.Accounts.Update(context.TODO(), finchgo.SandboxConnectionAccountUpdateParams{
+ ConnectionStatus: finchgo.F(shared.IntrospectResponseConnectionStatusReauth),
+ })
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/sandboxdirectory.go b/sandboxdirectory.go
new file mode 100644
index 0000000..ab88c53
--- /dev/null
+++ b/sandboxdirectory.go
@@ -0,0 +1,226 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxDirectoryService contains methods and other services that help with
+// interacting with the Finch API. Note, unlike clients, this service does not read
+// variables from the environment automatically. You should not instantiate this
+// service directly, and instead use the [NewSandboxDirectoryService] method
+// instead.
+type SandboxDirectoryService struct {
+ Options []option.RequestOption
+}
+
+// NewSandboxDirectoryService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewSandboxDirectoryService(opts ...option.RequestOption) (r *SandboxDirectoryService) {
+ r = &SandboxDirectoryService{}
+ r.Options = opts
+ return
+}
+
+// Add new individuals to a sandbox company
+func (r *SandboxDirectoryService) New(ctx context.Context, body SandboxDirectoryNewParams, opts ...option.RequestOption) (res *[]SandboxDirectoryNewResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "sandbox/directory"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+type SandboxDirectoryNewResponse = interface{}
+
+type SandboxDirectoryNewParams struct {
+ // Array of individuals to create. Takes all combined fields from `/individual` and
+ // `/employment` endpoints. All fields are optional.
+ Body param.Field[[]SandboxDirectoryNewParamsBody] `json:"body,required"`
+}
+
+func (r SandboxDirectoryNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r.Body)
+}
+
+type SandboxDirectoryNewParamsBody struct {
+ // Worker's compensation classification code for this employee
+ ClassCode param.Field[string] `json:"class_code"`
+ // Custom fields for the individual. These are fields which are defined by the
+ // employer in the system. Custom fields are not currently supported for assisted
+ // connections.
+ CustomFields param.Field[[]SandboxDirectoryNewParamsBodyCustomField] `json:"custom_fields"`
+ // The department object.
+ Department param.Field[SandboxDirectoryNewParamsBodyDepartment] `json:"department"`
+ Dob param.Field[string] `json:"dob"`
+ Emails param.Field[[]SandboxDirectoryNewParamsBodyEmail] `json:"emails"`
+ // The employment object.
+ Employment param.Field[SandboxDirectoryNewParamsBodyEmployment] `json:"employment"`
+ // Social Security Number of the individual in **encrypted** format. This field is
+ // only available with the `ssn` scope enabled and the
+ // `options: { include: ['ssn'] }` param set in the body.
+ EncryptedSsn param.Field[string] `json:"encrypted_ssn"`
+ EndDate param.Field[string] `json:"end_date"`
+ // The EEOC-defined ethnicity of the individual.
+ Ethnicity param.Field[SandboxDirectoryNewParamsBodyEthnicity] `json:"ethnicity"`
+ // The legal first name of the individual.
+ FirstName param.Field[string] `json:"first_name"`
+ // The gender of the individual.
+ Gender param.Field[SandboxDirectoryNewParamsBodyGender] `json:"gender"`
+ // The employee's income as reported by the provider. This may not always be
+ // annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc,
+ // depending on what information the provider returns.
+ Income param.Field[IncomeParam] `json:"income"`
+ // The array of income history.
+ IncomeHistory param.Field[[]IncomeParam] `json:"income_history"`
+ // `true` if the individual an an active employee or contractor at the company.
+ IsActive param.Field[bool] `json:"is_active"`
+ // The legal last name of the individual.
+ LastName param.Field[string] `json:"last_name"`
+ Location param.Field[LocationParam] `json:"location"`
+ // The manager object representing the manager of the individual within the org.
+ Manager param.Field[SandboxDirectoryNewParamsBodyManager] `json:"manager"`
+ // The legal middle name of the individual.
+ MiddleName param.Field[string] `json:"middle_name"`
+ PhoneNumbers param.Field[[]SandboxDirectoryNewParamsBodyPhoneNumber] `json:"phone_numbers"`
+ // The preferred name of the individual.
+ PreferredName param.Field[string] `json:"preferred_name"`
+ Residence param.Field[LocationParam] `json:"residence"`
+ // The source system's unique employment identifier for this individual
+ SourceID param.Field[string] `json:"source_id"`
+ // Social Security Number of the individual. This field is only available with the
+ // `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in the
+ // body.
+ Ssn param.Field[string] `json:"ssn"`
+ StartDate param.Field[string] `json:"start_date"`
+ // The current title of the individual.
+ Title param.Field[string] `json:"title"`
+}
+
+func (r SandboxDirectoryNewParamsBody) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxDirectoryNewParamsBodyCustomField struct {
+ Name param.Field[string] `json:"name"`
+ Value param.Field[interface{}] `json:"value"`
+}
+
+func (r SandboxDirectoryNewParamsBodyCustomField) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The department object.
+type SandboxDirectoryNewParamsBodyDepartment struct {
+ // The name of the department associated with the individual.
+ Name param.Field[string] `json:"name"`
+}
+
+func (r SandboxDirectoryNewParamsBodyDepartment) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxDirectoryNewParamsBodyEmail struct {
+ Data param.Field[string] `json:"data"`
+ Type param.Field[SandboxDirectoryNewParamsBodyEmailsType] `json:"type"`
+}
+
+func (r SandboxDirectoryNewParamsBodyEmail) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxDirectoryNewParamsBodyEmailsType string
+
+const (
+ SandboxDirectoryNewParamsBodyEmailsTypeWork SandboxDirectoryNewParamsBodyEmailsType = "work"
+ SandboxDirectoryNewParamsBodyEmailsTypePersonal SandboxDirectoryNewParamsBodyEmailsType = "personal"
+)
+
+// The employment object.
+type SandboxDirectoryNewParamsBodyEmployment struct {
+ // The secondary employment type of the individual. Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`.
+ Subtype param.Field[SandboxDirectoryNewParamsBodyEmploymentSubtype] `json:"subtype"`
+ // The main employment type of the individual.
+ Type param.Field[SandboxDirectoryNewParamsBodyEmploymentType] `json:"type"`
+}
+
+func (r SandboxDirectoryNewParamsBodyEmployment) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The secondary employment type of the individual. Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`.
+type SandboxDirectoryNewParamsBodyEmploymentSubtype string
+
+const (
+ SandboxDirectoryNewParamsBodyEmploymentSubtypeFullTime SandboxDirectoryNewParamsBodyEmploymentSubtype = "full_time"
+ SandboxDirectoryNewParamsBodyEmploymentSubtypeIntern SandboxDirectoryNewParamsBodyEmploymentSubtype = "intern"
+ SandboxDirectoryNewParamsBodyEmploymentSubtypePartTime SandboxDirectoryNewParamsBodyEmploymentSubtype = "part_time"
+ SandboxDirectoryNewParamsBodyEmploymentSubtypeTemp SandboxDirectoryNewParamsBodyEmploymentSubtype = "temp"
+ SandboxDirectoryNewParamsBodyEmploymentSubtypeSeasonal SandboxDirectoryNewParamsBodyEmploymentSubtype = "seasonal"
+ SandboxDirectoryNewParamsBodyEmploymentSubtypeIndividualContractor SandboxDirectoryNewParamsBodyEmploymentSubtype = "individual_contractor"
+)
+
+// The main employment type of the individual.
+type SandboxDirectoryNewParamsBodyEmploymentType string
+
+const (
+ SandboxDirectoryNewParamsBodyEmploymentTypeEmployee SandboxDirectoryNewParamsBodyEmploymentType = "employee"
+ SandboxDirectoryNewParamsBodyEmploymentTypeContractor SandboxDirectoryNewParamsBodyEmploymentType = "contractor"
+)
+
+// The EEOC-defined ethnicity of the individual.
+type SandboxDirectoryNewParamsBodyEthnicity string
+
+const (
+ SandboxDirectoryNewParamsBodyEthnicityAsian SandboxDirectoryNewParamsBodyEthnicity = "asian"
+ SandboxDirectoryNewParamsBodyEthnicityWhite SandboxDirectoryNewParamsBodyEthnicity = "white"
+ SandboxDirectoryNewParamsBodyEthnicityBlackOrAfricanAmerican SandboxDirectoryNewParamsBodyEthnicity = "black_or_african_american"
+ SandboxDirectoryNewParamsBodyEthnicityNativeHawaiianOrPacificIslander SandboxDirectoryNewParamsBodyEthnicity = "native_hawaiian_or_pacific_islander"
+ SandboxDirectoryNewParamsBodyEthnicityAmericanIndianOrAlaskaNative SandboxDirectoryNewParamsBodyEthnicity = "american_indian_or_alaska_native"
+ SandboxDirectoryNewParamsBodyEthnicityHispanicOrLatino SandboxDirectoryNewParamsBodyEthnicity = "hispanic_or_latino"
+ SandboxDirectoryNewParamsBodyEthnicityTwoOrMoreRaces SandboxDirectoryNewParamsBodyEthnicity = "two_or_more_races"
+ SandboxDirectoryNewParamsBodyEthnicityDeclineToSpecify SandboxDirectoryNewParamsBodyEthnicity = "decline_to_specify"
+)
+
+// The gender of the individual.
+type SandboxDirectoryNewParamsBodyGender string
+
+const (
+ SandboxDirectoryNewParamsBodyGenderFemale SandboxDirectoryNewParamsBodyGender = "female"
+ SandboxDirectoryNewParamsBodyGenderMale SandboxDirectoryNewParamsBodyGender = "male"
+ SandboxDirectoryNewParamsBodyGenderOther SandboxDirectoryNewParamsBodyGender = "other"
+ SandboxDirectoryNewParamsBodyGenderDeclineToSpecify SandboxDirectoryNewParamsBodyGender = "decline_to_specify"
+)
+
+// The manager object representing the manager of the individual within the org.
+type SandboxDirectoryNewParamsBodyManager struct {
+ // A stable Finch `id` (UUID v4) for an individual in the company.
+ ID param.Field[string] `json:"id"`
+}
+
+func (r SandboxDirectoryNewParamsBodyManager) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxDirectoryNewParamsBodyPhoneNumber struct {
+ Data param.Field[string] `json:"data"`
+ Type param.Field[SandboxDirectoryNewParamsBodyPhoneNumbersType] `json:"type"`
+}
+
+func (r SandboxDirectoryNewParamsBodyPhoneNumber) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxDirectoryNewParamsBodyPhoneNumbersType string
+
+const (
+ SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork SandboxDirectoryNewParamsBodyPhoneNumbersType = "work"
+ SandboxDirectoryNewParamsBodyPhoneNumbersTypePersonal SandboxDirectoryNewParamsBodyPhoneNumbersType = "personal"
+)
diff --git a/sandboxdirectory_test.go b/sandboxdirectory_test.go
new file mode 100644
index 0000000..ebf5153
--- /dev/null
+++ b/sandboxdirectory_test.go
@@ -0,0 +1,332 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestSandboxDirectoryNew(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Directory.New(context.TODO(), finchgo.SandboxDirectoryNewParams{
+ Body: finchgo.F([]finchgo.SandboxDirectoryNewParamsBody{{
+ FirstName: finchgo.F("string"),
+ MiddleName: finchgo.F("string"),
+ LastName: finchgo.F("string"),
+ PreferredName: finchgo.F("string"),
+ Emails: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyEmail{{
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }}),
+ PhoneNumbers: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyPhoneNumber{{
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }}),
+ Gender: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyGenderFemale),
+ Ethnicity: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEthnicityAsian),
+ Dob: finchgo.F("string"),
+ Ssn: finchgo.F("string"),
+ EncryptedSsn: finchgo.F("string"),
+ Residence: finchgo.F(finchgo.LocationParam{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }),
+ Title: finchgo.F("string"),
+ Manager: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyManager{
+ ID: finchgo.F("string"),
+ }),
+ Department: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyDepartment{
+ Name: finchgo.F("string"),
+ }),
+ Employment: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmployment{
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmploymentTypeEmployee),
+ Subtype: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmploymentSubtypeFullTime),
+ }),
+ StartDate: finchgo.F("string"),
+ EndDate: finchgo.F("string"),
+ IsActive: finchgo.F(true),
+ ClassCode: finchgo.F("string"),
+ Location: finchgo.F(finchgo.LocationParam{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }),
+ Income: finchgo.F(finchgo.IncomeParam{
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }),
+ IncomeHistory: finchgo.F([]finchgo.IncomeParam{{
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }, {
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }, {
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }}),
+ CustomFields: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyCustomField{{
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }, {
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }, {
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }}),
+ SourceID: finchgo.F("string"),
+ }, {
+ FirstName: finchgo.F("string"),
+ MiddleName: finchgo.F("string"),
+ LastName: finchgo.F("string"),
+ PreferredName: finchgo.F("string"),
+ Emails: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyEmail{{
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }}),
+ PhoneNumbers: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyPhoneNumber{{
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }}),
+ Gender: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyGenderFemale),
+ Ethnicity: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEthnicityAsian),
+ Dob: finchgo.F("string"),
+ Ssn: finchgo.F("string"),
+ EncryptedSsn: finchgo.F("string"),
+ Residence: finchgo.F(finchgo.LocationParam{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }),
+ Title: finchgo.F("string"),
+ Manager: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyManager{
+ ID: finchgo.F("string"),
+ }),
+ Department: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyDepartment{
+ Name: finchgo.F("string"),
+ }),
+ Employment: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmployment{
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmploymentTypeEmployee),
+ Subtype: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmploymentSubtypeFullTime),
+ }),
+ StartDate: finchgo.F("string"),
+ EndDate: finchgo.F("string"),
+ IsActive: finchgo.F(true),
+ ClassCode: finchgo.F("string"),
+ Location: finchgo.F(finchgo.LocationParam{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }),
+ Income: finchgo.F(finchgo.IncomeParam{
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }),
+ IncomeHistory: finchgo.F([]finchgo.IncomeParam{{
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }, {
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }, {
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }}),
+ CustomFields: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyCustomField{{
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }, {
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }, {
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }}),
+ SourceID: finchgo.F("string"),
+ }, {
+ FirstName: finchgo.F("string"),
+ MiddleName: finchgo.F("string"),
+ LastName: finchgo.F("string"),
+ PreferredName: finchgo.F("string"),
+ Emails: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyEmail{{
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmailsTypeWork),
+ }}),
+ PhoneNumbers: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyPhoneNumber{{
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyPhoneNumbersTypeWork),
+ }}),
+ Gender: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyGenderFemale),
+ Ethnicity: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEthnicityAsian),
+ Dob: finchgo.F("string"),
+ Ssn: finchgo.F("string"),
+ EncryptedSsn: finchgo.F("string"),
+ Residence: finchgo.F(finchgo.LocationParam{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }),
+ Title: finchgo.F("string"),
+ Manager: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyManager{
+ ID: finchgo.F("string"),
+ }),
+ Department: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyDepartment{
+ Name: finchgo.F("string"),
+ }),
+ Employment: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmployment{
+ Type: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmploymentTypeEmployee),
+ Subtype: finchgo.F(finchgo.SandboxDirectoryNewParamsBodyEmploymentSubtypeFullTime),
+ }),
+ StartDate: finchgo.F("string"),
+ EndDate: finchgo.F("string"),
+ IsActive: finchgo.F(true),
+ ClassCode: finchgo.F("string"),
+ Location: finchgo.F(finchgo.LocationParam{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }),
+ Income: finchgo.F(finchgo.IncomeParam{
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }),
+ IncomeHistory: finchgo.F([]finchgo.IncomeParam{{
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }, {
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }, {
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }}),
+ CustomFields: finchgo.F([]finchgo.SandboxDirectoryNewParamsBodyCustomField{{
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }, {
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }, {
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }}),
+ SourceID: finchgo.F("string"),
+ }}),
+ })
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/sandboxemployment.go b/sandboxemployment.go
new file mode 100644
index 0000000..a0a4731
--- /dev/null
+++ b/sandboxemployment.go
@@ -0,0 +1,307 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxEmploymentService contains methods and other services that help with
+// interacting with the Finch API. Note, unlike clients, this service does not read
+// variables from the environment automatically. You should not instantiate this
+// service directly, and instead use the [NewSandboxEmploymentService] method
+// instead.
+type SandboxEmploymentService struct {
+ Options []option.RequestOption
+}
+
+// NewSandboxEmploymentService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewSandboxEmploymentService(opts ...option.RequestOption) (r *SandboxEmploymentService) {
+ r = &SandboxEmploymentService{}
+ r.Options = opts
+ return
+}
+
+// Update sandbox employment
+func (r *SandboxEmploymentService) Update(ctx context.Context, individualID string, body SandboxEmploymentUpdateParams, opts ...option.RequestOption) (res *SandboxEmploymentUpdateResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := fmt.Sprintf("sandbox/employment/%s", individualID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
+ return
+}
+
+type SandboxEmploymentUpdateResponse struct {
+ // A stable Finch `id` (UUID v4) for an individual in the company.
+ ID string `json:"id"`
+ // Worker's compensation classification code for this employee
+ ClassCode string `json:"class_code,nullable"`
+ // Custom fields for the individual. These are fields which are defined by the
+ // employer in the system. Custom fields are not currently supported for assisted
+ // connections.
+ CustomFields []SandboxEmploymentUpdateResponseCustomField `json:"custom_fields"`
+ // The department object.
+ Department SandboxEmploymentUpdateResponseDepartment `json:"department,nullable"`
+ // The employment object.
+ Employment SandboxEmploymentUpdateResponseEmployment `json:"employment,nullable"`
+ EndDate string `json:"end_date,nullable"`
+ // The legal first name of the individual.
+ FirstName string `json:"first_name,nullable"`
+ // The employee's income as reported by the provider. This may not always be
+ // annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc,
+ // depending on what information the provider returns.
+ Income Income `json:"income,nullable"`
+ // The array of income history.
+ IncomeHistory []Income `json:"income_history,nullable"`
+ // `true` if the individual an an active employee or contractor at the company.
+ IsActive bool `json:"is_active,nullable"`
+ // The legal last name of the individual.
+ LastName string `json:"last_name,nullable"`
+ Location Location `json:"location,nullable"`
+ // The manager object representing the manager of the individual within the org.
+ Manager SandboxEmploymentUpdateResponseManager `json:"manager,nullable"`
+ // The legal middle name of the individual.
+ MiddleName string `json:"middle_name,nullable"`
+ // The source system's unique employment identifier for this individual
+ SourceID string `json:"source_id"`
+ StartDate string `json:"start_date,nullable"`
+ // The current title of the individual.
+ Title string `json:"title,nullable"`
+ JSON sandboxEmploymentUpdateResponseJSON `json:"-"`
+}
+
+// sandboxEmploymentUpdateResponseJSON contains the JSON metadata for the struct
+// [SandboxEmploymentUpdateResponse]
+type sandboxEmploymentUpdateResponseJSON struct {
+ ID apijson.Field
+ ClassCode apijson.Field
+ CustomFields apijson.Field
+ Department apijson.Field
+ Employment apijson.Field
+ EndDate apijson.Field
+ FirstName apijson.Field
+ Income apijson.Field
+ IncomeHistory apijson.Field
+ IsActive apijson.Field
+ LastName apijson.Field
+ Location apijson.Field
+ Manager apijson.Field
+ MiddleName apijson.Field
+ SourceID apijson.Field
+ StartDate apijson.Field
+ Title apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxEmploymentUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxEmploymentUpdateResponseCustomField struct {
+ Name string `json:"name,nullable"`
+ Value interface{} `json:"value"`
+ JSON sandboxEmploymentUpdateResponseCustomFieldJSON `json:"-"`
+}
+
+// sandboxEmploymentUpdateResponseCustomFieldJSON contains the JSON metadata for
+// the struct [SandboxEmploymentUpdateResponseCustomField]
+type sandboxEmploymentUpdateResponseCustomFieldJSON struct {
+ Name apijson.Field
+ Value apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxEmploymentUpdateResponseCustomField) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The department object.
+type SandboxEmploymentUpdateResponseDepartment struct {
+ // The name of the department associated with the individual.
+ Name string `json:"name,nullable"`
+ JSON sandboxEmploymentUpdateResponseDepartmentJSON `json:"-"`
+}
+
+// sandboxEmploymentUpdateResponseDepartmentJSON contains the JSON metadata for the
+// struct [SandboxEmploymentUpdateResponseDepartment]
+type sandboxEmploymentUpdateResponseDepartmentJSON struct {
+ Name apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxEmploymentUpdateResponseDepartment) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The employment object.
+type SandboxEmploymentUpdateResponseEmployment struct {
+ // The secondary employment type of the individual. Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`.
+ Subtype SandboxEmploymentUpdateResponseEmploymentSubtype `json:"subtype,nullable"`
+ // The main employment type of the individual.
+ Type SandboxEmploymentUpdateResponseEmploymentType `json:"type,nullable"`
+ JSON sandboxEmploymentUpdateResponseEmploymentJSON `json:"-"`
+}
+
+// sandboxEmploymentUpdateResponseEmploymentJSON contains the JSON metadata for the
+// struct [SandboxEmploymentUpdateResponseEmployment]
+type sandboxEmploymentUpdateResponseEmploymentJSON struct {
+ Subtype apijson.Field
+ Type apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxEmploymentUpdateResponseEmployment) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The secondary employment type of the individual. Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`.
+type SandboxEmploymentUpdateResponseEmploymentSubtype string
+
+const (
+ SandboxEmploymentUpdateResponseEmploymentSubtypeFullTime SandboxEmploymentUpdateResponseEmploymentSubtype = "full_time"
+ SandboxEmploymentUpdateResponseEmploymentSubtypeIntern SandboxEmploymentUpdateResponseEmploymentSubtype = "intern"
+ SandboxEmploymentUpdateResponseEmploymentSubtypePartTime SandboxEmploymentUpdateResponseEmploymentSubtype = "part_time"
+ SandboxEmploymentUpdateResponseEmploymentSubtypeTemp SandboxEmploymentUpdateResponseEmploymentSubtype = "temp"
+ SandboxEmploymentUpdateResponseEmploymentSubtypeSeasonal SandboxEmploymentUpdateResponseEmploymentSubtype = "seasonal"
+ SandboxEmploymentUpdateResponseEmploymentSubtypeIndividualContractor SandboxEmploymentUpdateResponseEmploymentSubtype = "individual_contractor"
+)
+
+// The main employment type of the individual.
+type SandboxEmploymentUpdateResponseEmploymentType string
+
+const (
+ SandboxEmploymentUpdateResponseEmploymentTypeEmployee SandboxEmploymentUpdateResponseEmploymentType = "employee"
+ SandboxEmploymentUpdateResponseEmploymentTypeContractor SandboxEmploymentUpdateResponseEmploymentType = "contractor"
+)
+
+// The manager object representing the manager of the individual within the org.
+type SandboxEmploymentUpdateResponseManager struct {
+ // A stable Finch `id` (UUID v4) for an individual in the company.
+ ID string `json:"id"`
+ JSON sandboxEmploymentUpdateResponseManagerJSON `json:"-"`
+}
+
+// sandboxEmploymentUpdateResponseManagerJSON contains the JSON metadata for the
+// struct [SandboxEmploymentUpdateResponseManager]
+type sandboxEmploymentUpdateResponseManagerJSON struct {
+ ID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxEmploymentUpdateResponseManager) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxEmploymentUpdateParams struct {
+ // Worker's compensation classification code for this employee
+ ClassCode param.Field[string] `json:"class_code"`
+ // Custom fields for the individual. These are fields which are defined by the
+ // employer in the system. Custom fields are not currently supported for assisted
+ // connections.
+ CustomFields param.Field[[]SandboxEmploymentUpdateParamsCustomField] `json:"custom_fields"`
+ // The department object.
+ Department param.Field[SandboxEmploymentUpdateParamsDepartment] `json:"department"`
+ // The employment object.
+ Employment param.Field[SandboxEmploymentUpdateParamsEmployment] `json:"employment"`
+ EndDate param.Field[string] `json:"end_date"`
+ // The legal first name of the individual.
+ FirstName param.Field[string] `json:"first_name"`
+ // The employee's income as reported by the provider. This may not always be
+ // annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc,
+ // depending on what information the provider returns.
+ Income param.Field[IncomeParam] `json:"income"`
+ // The array of income history.
+ IncomeHistory param.Field[[]IncomeParam] `json:"income_history"`
+ // `true` if the individual an an active employee or contractor at the company.
+ IsActive param.Field[bool] `json:"is_active"`
+ // The legal last name of the individual.
+ LastName param.Field[string] `json:"last_name"`
+ Location param.Field[LocationParam] `json:"location"`
+ // The manager object representing the manager of the individual within the org.
+ Manager param.Field[SandboxEmploymentUpdateParamsManager] `json:"manager"`
+ // The legal middle name of the individual.
+ MiddleName param.Field[string] `json:"middle_name"`
+ // The source system's unique employment identifier for this individual
+ SourceID param.Field[string] `json:"source_id"`
+ StartDate param.Field[string] `json:"start_date"`
+ // The current title of the individual.
+ Title param.Field[string] `json:"title"`
+}
+
+func (r SandboxEmploymentUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxEmploymentUpdateParamsCustomField struct {
+ Name param.Field[string] `json:"name"`
+ Value param.Field[interface{}] `json:"value"`
+}
+
+func (r SandboxEmploymentUpdateParamsCustomField) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The department object.
+type SandboxEmploymentUpdateParamsDepartment struct {
+ // The name of the department associated with the individual.
+ Name param.Field[string] `json:"name"`
+}
+
+func (r SandboxEmploymentUpdateParamsDepartment) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The employment object.
+type SandboxEmploymentUpdateParamsEmployment struct {
+ // The secondary employment type of the individual. Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`.
+ Subtype param.Field[SandboxEmploymentUpdateParamsEmploymentSubtype] `json:"subtype"`
+ // The main employment type of the individual.
+ Type param.Field[SandboxEmploymentUpdateParamsEmploymentType] `json:"type"`
+}
+
+func (r SandboxEmploymentUpdateParamsEmployment) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The secondary employment type of the individual. Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and `individual_contractor`.
+type SandboxEmploymentUpdateParamsEmploymentSubtype string
+
+const (
+ SandboxEmploymentUpdateParamsEmploymentSubtypeFullTime SandboxEmploymentUpdateParamsEmploymentSubtype = "full_time"
+ SandboxEmploymentUpdateParamsEmploymentSubtypeIntern SandboxEmploymentUpdateParamsEmploymentSubtype = "intern"
+ SandboxEmploymentUpdateParamsEmploymentSubtypePartTime SandboxEmploymentUpdateParamsEmploymentSubtype = "part_time"
+ SandboxEmploymentUpdateParamsEmploymentSubtypeTemp SandboxEmploymentUpdateParamsEmploymentSubtype = "temp"
+ SandboxEmploymentUpdateParamsEmploymentSubtypeSeasonal SandboxEmploymentUpdateParamsEmploymentSubtype = "seasonal"
+ SandboxEmploymentUpdateParamsEmploymentSubtypeIndividualContractor SandboxEmploymentUpdateParamsEmploymentSubtype = "individual_contractor"
+)
+
+// The main employment type of the individual.
+type SandboxEmploymentUpdateParamsEmploymentType string
+
+const (
+ SandboxEmploymentUpdateParamsEmploymentTypeEmployee SandboxEmploymentUpdateParamsEmploymentType = "employee"
+ SandboxEmploymentUpdateParamsEmploymentTypeContractor SandboxEmploymentUpdateParamsEmploymentType = "contractor"
+)
+
+// The manager object representing the manager of the individual within the org.
+type SandboxEmploymentUpdateParamsManager struct {
+ // A stable Finch `id` (UUID v4) for an individual in the company.
+ ID param.Field[string] `json:"id"`
+}
+
+func (r SandboxEmploymentUpdateParamsManager) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
diff --git a/sandboxemployment_test.go b/sandboxemployment_test.go
new file mode 100644
index 0000000..821494a
--- /dev/null
+++ b/sandboxemployment_test.go
@@ -0,0 +1,102 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestSandboxEmploymentUpdateWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Employment.Update(
+ context.TODO(),
+ "string",
+ finchgo.SandboxEmploymentUpdateParams{
+ ClassCode: finchgo.F("string"),
+ CustomFields: finchgo.F([]finchgo.SandboxEmploymentUpdateParamsCustomField{{
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }, {
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }, {
+ Name: finchgo.F("string"),
+ Value: finchgo.F[any](map[string]interface{}{}),
+ }}),
+ Department: finchgo.F(finchgo.SandboxEmploymentUpdateParamsDepartment{
+ Name: finchgo.F("string"),
+ }),
+ Employment: finchgo.F(finchgo.SandboxEmploymentUpdateParamsEmployment{
+ Type: finchgo.F(finchgo.SandboxEmploymentUpdateParamsEmploymentTypeEmployee),
+ Subtype: finchgo.F(finchgo.SandboxEmploymentUpdateParamsEmploymentSubtypeFullTime),
+ }),
+ EndDate: finchgo.F("string"),
+ FirstName: finchgo.F("string"),
+ Income: finchgo.F(finchgo.IncomeParam{
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }),
+ IncomeHistory: finchgo.F([]finchgo.IncomeParam{{
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }, {
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }, {
+ Unit: finchgo.F(finchgo.IncomeUnitYearly),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ EffectiveDate: finchgo.F("string"),
+ }}),
+ IsActive: finchgo.F(true),
+ LastName: finchgo.F("string"),
+ Location: finchgo.F(finchgo.LocationParam{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }),
+ Manager: finchgo.F(finchgo.SandboxEmploymentUpdateParamsManager{
+ ID: finchgo.F("string"),
+ }),
+ MiddleName: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ StartDate: finchgo.F("string"),
+ Title: finchgo.F("string"),
+ },
+ )
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/sandboxindividual.go b/sandboxindividual.go
new file mode 100644
index 0000000..0bb0152
--- /dev/null
+++ b/sandboxindividual.go
@@ -0,0 +1,257 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxIndividualService contains methods and other services that help with
+// interacting with the Finch API. Note, unlike clients, this service does not read
+// variables from the environment automatically. You should not instantiate this
+// service directly, and instead use the [NewSandboxIndividualService] method
+// instead.
+type SandboxIndividualService struct {
+ Options []option.RequestOption
+}
+
+// NewSandboxIndividualService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewSandboxIndividualService(opts ...option.RequestOption) (r *SandboxIndividualService) {
+ r = &SandboxIndividualService{}
+ r.Options = opts
+ return
+}
+
+// Update sandbox individual
+func (r *SandboxIndividualService) Update(ctx context.Context, individualID string, body SandboxIndividualUpdateParams, opts ...option.RequestOption) (res *SandboxIndividualUpdateResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := fmt.Sprintf("sandbox/individual/%s", individualID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
+ return
+}
+
+type SandboxIndividualUpdateResponse struct {
+ // A stable Finch `id` (UUID v4) for an individual in the company.
+ ID string `json:"id"`
+ Dob string `json:"dob,nullable"`
+ Emails []SandboxIndividualUpdateResponseEmail `json:"emails,nullable"`
+ // Social Security Number of the individual in **encrypted** format. This field is
+ // only available with the `ssn` scope enabled and the
+ // `options: { include: ['ssn'] }` param set in the body.
+ EncryptedSsn string `json:"encrypted_ssn,nullable"`
+ // The EEOC-defined ethnicity of the individual.
+ Ethnicity SandboxIndividualUpdateResponseEthnicity `json:"ethnicity,nullable"`
+ // The legal first name of the individual.
+ FirstName string `json:"first_name,nullable"`
+ // The gender of the individual.
+ Gender SandboxIndividualUpdateResponseGender `json:"gender,nullable"`
+ // The legal last name of the individual.
+ LastName string `json:"last_name,nullable"`
+ // The legal middle name of the individual.
+ MiddleName string `json:"middle_name,nullable"`
+ PhoneNumbers []SandboxIndividualUpdateResponsePhoneNumber `json:"phone_numbers,nullable"`
+ // The preferred name of the individual.
+ PreferredName string `json:"preferred_name,nullable"`
+ Residence Location `json:"residence,nullable"`
+ // Social Security Number of the individual. This field is only available with the
+ // `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in the
+ // body.
+ Ssn string `json:"ssn,nullable"`
+ JSON sandboxIndividualUpdateResponseJSON `json:"-"`
+}
+
+// sandboxIndividualUpdateResponseJSON contains the JSON metadata for the struct
+// [SandboxIndividualUpdateResponse]
+type sandboxIndividualUpdateResponseJSON struct {
+ ID apijson.Field
+ Dob apijson.Field
+ Emails apijson.Field
+ EncryptedSsn apijson.Field
+ Ethnicity apijson.Field
+ FirstName apijson.Field
+ Gender apijson.Field
+ LastName apijson.Field
+ MiddleName apijson.Field
+ PhoneNumbers apijson.Field
+ PreferredName apijson.Field
+ Residence apijson.Field
+ Ssn apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxIndividualUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxIndividualUpdateResponseEmail struct {
+ Data string `json:"data"`
+ Type SandboxIndividualUpdateResponseEmailsType `json:"type"`
+ JSON sandboxIndividualUpdateResponseEmailJSON `json:"-"`
+}
+
+// sandboxIndividualUpdateResponseEmailJSON contains the JSON metadata for the
+// struct [SandboxIndividualUpdateResponseEmail]
+type sandboxIndividualUpdateResponseEmailJSON struct {
+ Data apijson.Field
+ Type apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxIndividualUpdateResponseEmail) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxIndividualUpdateResponseEmailsType string
+
+const (
+ SandboxIndividualUpdateResponseEmailsTypeWork SandboxIndividualUpdateResponseEmailsType = "work"
+ SandboxIndividualUpdateResponseEmailsTypePersonal SandboxIndividualUpdateResponseEmailsType = "personal"
+)
+
+// The EEOC-defined ethnicity of the individual.
+type SandboxIndividualUpdateResponseEthnicity string
+
+const (
+ SandboxIndividualUpdateResponseEthnicityAsian SandboxIndividualUpdateResponseEthnicity = "asian"
+ SandboxIndividualUpdateResponseEthnicityWhite SandboxIndividualUpdateResponseEthnicity = "white"
+ SandboxIndividualUpdateResponseEthnicityBlackOrAfricanAmerican SandboxIndividualUpdateResponseEthnicity = "black_or_african_american"
+ SandboxIndividualUpdateResponseEthnicityNativeHawaiianOrPacificIslander SandboxIndividualUpdateResponseEthnicity = "native_hawaiian_or_pacific_islander"
+ SandboxIndividualUpdateResponseEthnicityAmericanIndianOrAlaskaNative SandboxIndividualUpdateResponseEthnicity = "american_indian_or_alaska_native"
+ SandboxIndividualUpdateResponseEthnicityHispanicOrLatino SandboxIndividualUpdateResponseEthnicity = "hispanic_or_latino"
+ SandboxIndividualUpdateResponseEthnicityTwoOrMoreRaces SandboxIndividualUpdateResponseEthnicity = "two_or_more_races"
+ SandboxIndividualUpdateResponseEthnicityDeclineToSpecify SandboxIndividualUpdateResponseEthnicity = "decline_to_specify"
+)
+
+// The gender of the individual.
+type SandboxIndividualUpdateResponseGender string
+
+const (
+ SandboxIndividualUpdateResponseGenderFemale SandboxIndividualUpdateResponseGender = "female"
+ SandboxIndividualUpdateResponseGenderMale SandboxIndividualUpdateResponseGender = "male"
+ SandboxIndividualUpdateResponseGenderOther SandboxIndividualUpdateResponseGender = "other"
+ SandboxIndividualUpdateResponseGenderDeclineToSpecify SandboxIndividualUpdateResponseGender = "decline_to_specify"
+)
+
+type SandboxIndividualUpdateResponsePhoneNumber struct {
+ Data string `json:"data"`
+ Type SandboxIndividualUpdateResponsePhoneNumbersType `json:"type"`
+ JSON sandboxIndividualUpdateResponsePhoneNumberJSON `json:"-"`
+}
+
+// sandboxIndividualUpdateResponsePhoneNumberJSON contains the JSON metadata for
+// the struct [SandboxIndividualUpdateResponsePhoneNumber]
+type sandboxIndividualUpdateResponsePhoneNumberJSON struct {
+ Data apijson.Field
+ Type apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxIndividualUpdateResponsePhoneNumber) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxIndividualUpdateResponsePhoneNumbersType string
+
+const (
+ SandboxIndividualUpdateResponsePhoneNumbersTypeWork SandboxIndividualUpdateResponsePhoneNumbersType = "work"
+ SandboxIndividualUpdateResponsePhoneNumbersTypePersonal SandboxIndividualUpdateResponsePhoneNumbersType = "personal"
+)
+
+type SandboxIndividualUpdateParams struct {
+ Dob param.Field[string] `json:"dob"`
+ Emails param.Field[[]SandboxIndividualUpdateParamsEmail] `json:"emails"`
+ // Social Security Number of the individual in **encrypted** format. This field is
+ // only available with the `ssn` scope enabled and the
+ // `options: { include: ['ssn'] }` param set in the body.
+ EncryptedSsn param.Field[string] `json:"encrypted_ssn"`
+ // The EEOC-defined ethnicity of the individual.
+ Ethnicity param.Field[SandboxIndividualUpdateParamsEthnicity] `json:"ethnicity"`
+ // The legal first name of the individual.
+ FirstName param.Field[string] `json:"first_name"`
+ // The gender of the individual.
+ Gender param.Field[SandboxIndividualUpdateParamsGender] `json:"gender"`
+ // The legal last name of the individual.
+ LastName param.Field[string] `json:"last_name"`
+ // The legal middle name of the individual.
+ MiddleName param.Field[string] `json:"middle_name"`
+ PhoneNumbers param.Field[[]SandboxIndividualUpdateParamsPhoneNumber] `json:"phone_numbers"`
+ // The preferred name of the individual.
+ PreferredName param.Field[string] `json:"preferred_name"`
+ Residence param.Field[LocationParam] `json:"residence"`
+ // Social Security Number of the individual. This field is only available with the
+ // `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in the
+ // body.
+ Ssn param.Field[string] `json:"ssn"`
+}
+
+func (r SandboxIndividualUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxIndividualUpdateParamsEmail struct {
+ Data param.Field[string] `json:"data"`
+ Type param.Field[SandboxIndividualUpdateParamsEmailsType] `json:"type"`
+}
+
+func (r SandboxIndividualUpdateParamsEmail) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxIndividualUpdateParamsEmailsType string
+
+const (
+ SandboxIndividualUpdateParamsEmailsTypeWork SandboxIndividualUpdateParamsEmailsType = "work"
+ SandboxIndividualUpdateParamsEmailsTypePersonal SandboxIndividualUpdateParamsEmailsType = "personal"
+)
+
+// The EEOC-defined ethnicity of the individual.
+type SandboxIndividualUpdateParamsEthnicity string
+
+const (
+ SandboxIndividualUpdateParamsEthnicityAsian SandboxIndividualUpdateParamsEthnicity = "asian"
+ SandboxIndividualUpdateParamsEthnicityWhite SandboxIndividualUpdateParamsEthnicity = "white"
+ SandboxIndividualUpdateParamsEthnicityBlackOrAfricanAmerican SandboxIndividualUpdateParamsEthnicity = "black_or_african_american"
+ SandboxIndividualUpdateParamsEthnicityNativeHawaiianOrPacificIslander SandboxIndividualUpdateParamsEthnicity = "native_hawaiian_or_pacific_islander"
+ SandboxIndividualUpdateParamsEthnicityAmericanIndianOrAlaskaNative SandboxIndividualUpdateParamsEthnicity = "american_indian_or_alaska_native"
+ SandboxIndividualUpdateParamsEthnicityHispanicOrLatino SandboxIndividualUpdateParamsEthnicity = "hispanic_or_latino"
+ SandboxIndividualUpdateParamsEthnicityTwoOrMoreRaces SandboxIndividualUpdateParamsEthnicity = "two_or_more_races"
+ SandboxIndividualUpdateParamsEthnicityDeclineToSpecify SandboxIndividualUpdateParamsEthnicity = "decline_to_specify"
+)
+
+// The gender of the individual.
+type SandboxIndividualUpdateParamsGender string
+
+const (
+ SandboxIndividualUpdateParamsGenderFemale SandboxIndividualUpdateParamsGender = "female"
+ SandboxIndividualUpdateParamsGenderMale SandboxIndividualUpdateParamsGender = "male"
+ SandboxIndividualUpdateParamsGenderOther SandboxIndividualUpdateParamsGender = "other"
+ SandboxIndividualUpdateParamsGenderDeclineToSpecify SandboxIndividualUpdateParamsGender = "decline_to_specify"
+)
+
+type SandboxIndividualUpdateParamsPhoneNumber struct {
+ Data param.Field[string] `json:"data"`
+ Type param.Field[SandboxIndividualUpdateParamsPhoneNumbersType] `json:"type"`
+}
+
+func (r SandboxIndividualUpdateParamsPhoneNumber) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxIndividualUpdateParamsPhoneNumbersType string
+
+const (
+ SandboxIndividualUpdateParamsPhoneNumbersTypeWork SandboxIndividualUpdateParamsPhoneNumbersType = "work"
+ SandboxIndividualUpdateParamsPhoneNumbersTypePersonal SandboxIndividualUpdateParamsPhoneNumbersType = "personal"
+)
diff --git a/sandboxindividual_test.go b/sandboxindividual_test.go
new file mode 100644
index 0000000..b687faf
--- /dev/null
+++ b/sandboxindividual_test.go
@@ -0,0 +1,80 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestSandboxIndividualUpdateWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Individual.Update(
+ context.TODO(),
+ "string",
+ finchgo.SandboxIndividualUpdateParams{
+ Dob: finchgo.F("string"),
+ Emails: finchgo.F([]finchgo.SandboxIndividualUpdateParamsEmail{{
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxIndividualUpdateParamsEmailsTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxIndividualUpdateParamsEmailsTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxIndividualUpdateParamsEmailsTypeWork),
+ }}),
+ EncryptedSsn: finchgo.F("string"),
+ Ethnicity: finchgo.F(finchgo.SandboxIndividualUpdateParamsEthnicityAsian),
+ FirstName: finchgo.F("string"),
+ Gender: finchgo.F(finchgo.SandboxIndividualUpdateParamsGenderFemale),
+ LastName: finchgo.F("string"),
+ MiddleName: finchgo.F("string"),
+ PhoneNumbers: finchgo.F([]finchgo.SandboxIndividualUpdateParamsPhoneNumber{{
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxIndividualUpdateParamsPhoneNumbersTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxIndividualUpdateParamsPhoneNumbersTypeWork),
+ }, {
+ Data: finchgo.F("string"),
+ Type: finchgo.F(finchgo.SandboxIndividualUpdateParamsPhoneNumbersTypeWork),
+ }}),
+ PreferredName: finchgo.F("string"),
+ Residence: finchgo.F(finchgo.LocationParam{
+ Line1: finchgo.F("string"),
+ Line2: finchgo.F("string"),
+ City: finchgo.F("string"),
+ State: finchgo.F("string"),
+ PostalCode: finchgo.F("string"),
+ Country: finchgo.F("string"),
+ Name: finchgo.F("string"),
+ SourceID: finchgo.F("string"),
+ }),
+ Ssn: finchgo.F("string"),
+ },
+ )
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/sandboxjob.go b/sandboxjob.go
new file mode 100644
index 0000000..2fb6dd1
--- /dev/null
+++ b/sandboxjob.go
@@ -0,0 +1,26 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxJobService contains methods and other services that help with interacting
+// with the Finch API. Note, unlike clients, this service does not read variables
+// from the environment automatically. You should not instantiate this service
+// directly, and instead use the [NewSandboxJobService] method instead.
+type SandboxJobService struct {
+ Options []option.RequestOption
+ Configuration *SandboxJobConfigurationService
+}
+
+// NewSandboxJobService generates a new service that applies the given options to
+// each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewSandboxJobService(opts ...option.RequestOption) (r *SandboxJobService) {
+ r = &SandboxJobService{}
+ r.Options = opts
+ r.Configuration = NewSandboxJobConfigurationService(opts...)
+ return
+}
diff --git a/sandboxjobconfiguration.go b/sandboxjobconfiguration.go
new file mode 100644
index 0000000..50eeaf5
--- /dev/null
+++ b/sandboxjobconfiguration.go
@@ -0,0 +1,105 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxJobConfigurationService contains methods and other services that help
+// with interacting with the Finch API. Note, unlike clients, this service does not
+// read variables from the environment automatically. You should not instantiate
+// this service directly, and instead use the [NewSandboxJobConfigurationService]
+// method instead.
+type SandboxJobConfigurationService struct {
+ Options []option.RequestOption
+}
+
+// NewSandboxJobConfigurationService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewSandboxJobConfigurationService(opts ...option.RequestOption) (r *SandboxJobConfigurationService) {
+ r = &SandboxJobConfigurationService{}
+ r.Options = opts
+ return
+}
+
+// Get configurations for sandbox jobs
+func (r *SandboxJobConfigurationService) Get(ctx context.Context, opts ...option.RequestOption) (res *[]SandboxJobConfiguration, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "sandbox/jobs/configuration"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
+}
+
+// Update configurations for sandbox jobs
+func (r *SandboxJobConfigurationService) Update(ctx context.Context, body SandboxJobConfigurationUpdateParams, opts ...option.RequestOption) (res *SandboxJobConfiguration, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "sandbox/jobs/configuration"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
+ return
+}
+
+type SandboxJobConfiguration struct {
+ CompletionStatus SandboxJobConfigurationCompletionStatus `json:"completion_status,required"`
+ Type SandboxJobConfigurationType `json:"type,required"`
+ JSON sandboxJobConfigurationJSON `json:"-"`
+}
+
+// sandboxJobConfigurationJSON contains the JSON metadata for the struct
+// [SandboxJobConfiguration]
+type sandboxJobConfigurationJSON struct {
+ CompletionStatus apijson.Field
+ Type apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxJobConfiguration) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxJobConfigurationCompletionStatus string
+
+const (
+ SandboxJobConfigurationCompletionStatusComplete SandboxJobConfigurationCompletionStatus = "complete"
+ SandboxJobConfigurationCompletionStatusReauthError SandboxJobConfigurationCompletionStatus = "reauth_error"
+ SandboxJobConfigurationCompletionStatusPermissionsError SandboxJobConfigurationCompletionStatus = "permissions_error"
+ SandboxJobConfigurationCompletionStatusError SandboxJobConfigurationCompletionStatus = "error"
+)
+
+type SandboxJobConfigurationType string
+
+const (
+ SandboxJobConfigurationTypeDataSyncAll SandboxJobConfigurationType = "data_sync_all"
+)
+
+type SandboxJobConfigurationUpdateParams struct {
+ CompletionStatus param.Field[SandboxJobConfigurationUpdateParamsCompletionStatus] `json:"completion_status,required"`
+ Type param.Field[SandboxJobConfigurationUpdateParamsType] `json:"type,required"`
+}
+
+func (r SandboxJobConfigurationUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxJobConfigurationUpdateParamsCompletionStatus string
+
+const (
+ SandboxJobConfigurationUpdateParamsCompletionStatusComplete SandboxJobConfigurationUpdateParamsCompletionStatus = "complete"
+ SandboxJobConfigurationUpdateParamsCompletionStatusReauthError SandboxJobConfigurationUpdateParamsCompletionStatus = "reauth_error"
+ SandboxJobConfigurationUpdateParamsCompletionStatusPermissionsError SandboxJobConfigurationUpdateParamsCompletionStatus = "permissions_error"
+ SandboxJobConfigurationUpdateParamsCompletionStatusError SandboxJobConfigurationUpdateParamsCompletionStatus = "error"
+)
+
+type SandboxJobConfigurationUpdateParamsType string
+
+const (
+ SandboxJobConfigurationUpdateParamsTypeDataSyncAll SandboxJobConfigurationUpdateParamsType = "data_sync_all"
+)
diff --git a/sandboxjobconfiguration_test.go b/sandboxjobconfiguration_test.go
new file mode 100644
index 0000000..69a1075
--- /dev/null
+++ b/sandboxjobconfiguration_test.go
@@ -0,0 +1,61 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestSandboxJobConfigurationGet(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Jobs.Configuration.Get(context.TODO())
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestSandboxJobConfigurationUpdate(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Jobs.Configuration.Update(context.TODO(), finchgo.SandboxJobConfigurationUpdateParams{
+ CompletionStatus: finchgo.F(finchgo.SandboxJobConfigurationUpdateParamsCompletionStatusComplete),
+ Type: finchgo.F(finchgo.SandboxJobConfigurationUpdateParamsTypeDataSyncAll),
+ })
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/sandboxpayment.go b/sandboxpayment.go
new file mode 100644
index 0000000..d7d94f6
--- /dev/null
+++ b/sandboxpayment.go
@@ -0,0 +1,206 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/Finch-API/finch-api-go/internal/apijson"
+ "github.com/Finch-API/finch-api-go/internal/param"
+ "github.com/Finch-API/finch-api-go/internal/requestconfig"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+// SandboxPaymentService contains methods and other services that help with
+// interacting with the Finch API. Note, unlike clients, this service does not read
+// variables from the environment automatically. You should not instantiate this
+// service directly, and instead use the [NewSandboxPaymentService] method instead.
+type SandboxPaymentService struct {
+ Options []option.RequestOption
+}
+
+// NewSandboxPaymentService generates a new service that applies the given options
+// to each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewSandboxPaymentService(opts ...option.RequestOption) (r *SandboxPaymentService) {
+ r = &SandboxPaymentService{}
+ r.Options = opts
+ return
+}
+
+// Add a new sandbox payment
+func (r *SandboxPaymentService) New(ctx context.Context, body SandboxPaymentNewParams, opts ...option.RequestOption) (res *SandboxPaymentNewResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "sandbox/payment"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+type SandboxPaymentNewResponse struct {
+ // The date of the payment.
+ PayDate string `json:"pay_date,required"`
+ // The ID of the payment.
+ PaymentID string `json:"payment_id,required"`
+ JSON sandboxPaymentNewResponseJSON `json:"-"`
+}
+
+// sandboxPaymentNewResponseJSON contains the JSON metadata for the struct
+// [SandboxPaymentNewResponse]
+type sandboxPaymentNewResponseJSON struct {
+ PayDate apijson.Field
+ PaymentID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SandboxPaymentNewResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type SandboxPaymentNewParams struct {
+ EndDate param.Field[string] `json:"end_date"`
+ PayStatements param.Field[[]SandboxPaymentNewParamsPayStatement] `json:"pay_statements"`
+ StartDate param.Field[string] `json:"start_date"`
+}
+
+func (r SandboxPaymentNewParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxPaymentNewParamsPayStatement struct {
+ // The array of earnings objects associated with this pay statement
+ Earnings param.Field[[]SandboxPaymentNewParamsPayStatementsEarning] `json:"earnings"`
+ // The array of deductions objects associated with this pay statement.
+ EmployeeDeductions param.Field[[]SandboxPaymentNewParamsPayStatementsEmployeeDeduction] `json:"employee_deductions"`
+ EmployerContributions param.Field[[]SandboxPaymentNewParamsPayStatementsEmployerContribution] `json:"employer_contributions"`
+ GrossPay param.Field[MoneyParam] `json:"gross_pay"`
+ // A stable Finch `id` (UUID v4) for an individual in the company
+ IndividualID param.Field[string] `json:"individual_id"`
+ NetPay param.Field[MoneyParam] `json:"net_pay"`
+ // The payment method.
+ PaymentMethod param.Field[SandboxPaymentNewParamsPayStatementsPaymentMethod] `json:"payment_method"`
+ // The array of taxes objects associated with this pay statement.
+ Taxes param.Field[[]SandboxPaymentNewParamsPayStatementsTax] `json:"taxes"`
+ // The number of hours worked for this pay period
+ TotalHours param.Field[float64] `json:"total_hours"`
+ // The type of the payment associated with the pay statement.
+ Type param.Field[SandboxPaymentNewParamsPayStatementsType] `json:"type"`
+}
+
+func (r SandboxPaymentNewParamsPayStatement) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxPaymentNewParamsPayStatementsEarning struct {
+ // The earnings amount in cents.
+ Amount param.Field[int64] `json:"amount"`
+ // The earnings currency code.
+ Currency param.Field[string] `json:"currency"`
+ // The number of hours associated with this earning. (For salaried employees, this
+ // could be hours per pay period, `0` or `null`, depending on the provider).
+ Hours param.Field[float64] `json:"hours"`
+ // The exact name of the deduction from the pay statement.
+ Name param.Field[string] `json:"name"`
+ // The type of earning.
+ Type param.Field[SandboxPaymentNewParamsPayStatementsEarningsType] `json:"type"`
+}
+
+func (r SandboxPaymentNewParamsPayStatementsEarning) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The type of earning.
+type SandboxPaymentNewParamsPayStatementsEarningsType string
+
+const (
+ SandboxPaymentNewParamsPayStatementsEarningsTypeSalary SandboxPaymentNewParamsPayStatementsEarningsType = "salary"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeWage SandboxPaymentNewParamsPayStatementsEarningsType = "wage"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeReimbursement SandboxPaymentNewParamsPayStatementsEarningsType = "reimbursement"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeOvertime SandboxPaymentNewParamsPayStatementsEarningsType = "overtime"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeSeverance SandboxPaymentNewParamsPayStatementsEarningsType = "severance"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeDoubleOvertime SandboxPaymentNewParamsPayStatementsEarningsType = "double_overtime"
+ SandboxPaymentNewParamsPayStatementsEarningsTypePto SandboxPaymentNewParamsPayStatementsEarningsType = "pto"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeSick SandboxPaymentNewParamsPayStatementsEarningsType = "sick"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeBonus SandboxPaymentNewParamsPayStatementsEarningsType = "bonus"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeCommission SandboxPaymentNewParamsPayStatementsEarningsType = "commission"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeTips SandboxPaymentNewParamsPayStatementsEarningsType = "tips"
+ SandboxPaymentNewParamsPayStatementsEarningsType1099 SandboxPaymentNewParamsPayStatementsEarningsType = "1099"
+ SandboxPaymentNewParamsPayStatementsEarningsTypeOther SandboxPaymentNewParamsPayStatementsEarningsType = "other"
+)
+
+type SandboxPaymentNewParamsPayStatementsEmployeeDeduction struct {
+ // The deduction amount in cents.
+ Amount param.Field[int64] `json:"amount"`
+ // The deduction currency.
+ Currency param.Field[string] `json:"currency"`
+ // The deduction name from the pay statement.
+ Name param.Field[string] `json:"name"`
+ // Boolean indicating if the deduction is pre-tax.
+ PreTax param.Field[bool] `json:"pre_tax"`
+ // Type of benefit.
+ Type param.Field[BenefitType] `json:"type"`
+}
+
+func (r SandboxPaymentNewParamsPayStatementsEmployeeDeduction) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+type SandboxPaymentNewParamsPayStatementsEmployerContribution struct {
+ // The contribution amount in cents.
+ Amount param.Field[int64] `json:"amount"`
+ // The contribution currency.
+ Currency param.Field[string] `json:"currency"`
+ // The contribution name from the pay statement.
+ Name param.Field[string] `json:"name"`
+ // Type of benefit.
+ Type param.Field[BenefitType] `json:"type"`
+}
+
+func (r SandboxPaymentNewParamsPayStatementsEmployerContribution) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The payment method.
+type SandboxPaymentNewParamsPayStatementsPaymentMethod string
+
+const (
+ SandboxPaymentNewParamsPayStatementsPaymentMethodCheck SandboxPaymentNewParamsPayStatementsPaymentMethod = "check"
+ SandboxPaymentNewParamsPayStatementsPaymentMethodDirectDeposit SandboxPaymentNewParamsPayStatementsPaymentMethod = "direct_deposit"
+)
+
+type SandboxPaymentNewParamsPayStatementsTax struct {
+ // The tax amount in cents.
+ Amount param.Field[int64] `json:"amount"`
+ // The currency code.
+ Currency param.Field[string] `json:"currency"`
+ // `true` if the amount is paid by the employers.
+ Employer param.Field[bool] `json:"employer"`
+ // The exact name of tax from the pay statement.
+ Name param.Field[string] `json:"name"`
+ // The type of taxes.
+ Type param.Field[SandboxPaymentNewParamsPayStatementsTaxesType] `json:"type"`
+}
+
+func (r SandboxPaymentNewParamsPayStatementsTax) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The type of taxes.
+type SandboxPaymentNewParamsPayStatementsTaxesType string
+
+const (
+ SandboxPaymentNewParamsPayStatementsTaxesTypeState SandboxPaymentNewParamsPayStatementsTaxesType = "state"
+ SandboxPaymentNewParamsPayStatementsTaxesTypeFederal SandboxPaymentNewParamsPayStatementsTaxesType = "federal"
+ SandboxPaymentNewParamsPayStatementsTaxesTypeLocal SandboxPaymentNewParamsPayStatementsTaxesType = "local"
+ SandboxPaymentNewParamsPayStatementsTaxesTypeFica SandboxPaymentNewParamsPayStatementsTaxesType = "fica"
+)
+
+// The type of the payment associated with the pay statement.
+type SandboxPaymentNewParamsPayStatementsType string
+
+const (
+ SandboxPaymentNewParamsPayStatementsTypeRegularPayroll SandboxPaymentNewParamsPayStatementsType = "regular_payroll"
+ SandboxPaymentNewParamsPayStatementsTypeOffCyclePayroll SandboxPaymentNewParamsPayStatementsType = "off_cycle_payroll"
+ SandboxPaymentNewParamsPayStatementsTypeOneTimePayment SandboxPaymentNewParamsPayStatementsType = "one_time_payment"
+)
diff --git a/sandboxpayment_test.go b/sandboxpayment_test.go
new file mode 100644
index 0000000..ec9b954
--- /dev/null
+++ b/sandboxpayment_test.go
@@ -0,0 +1,114 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package finchgo_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ finchgo "github.com/Finch-API/finch-api-go"
+ "github.com/Finch-API/finch-api-go/internal/testutil"
+ "github.com/Finch-API/finch-api-go/option"
+)
+
+func TestSandboxPaymentNewWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := finchgo.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAccessToken("My Access Token"),
+ )
+ _, err := client.Sandbox.Payment.New(context.TODO(), finchgo.SandboxPaymentNewParams{
+ EndDate: finchgo.F("string"),
+ PayStatements: finchgo.F([]finchgo.SandboxPaymentNewParamsPayStatement{{
+ IndividualID: finchgo.F("b2338cfb-472f-4f72-9faa-e028c083144a"),
+ Type: finchgo.F(finchgo.SandboxPaymentNewParamsPayStatementsTypeRegularPayroll),
+ PaymentMethod: finchgo.F(finchgo.SandboxPaymentNewParamsPayStatementsPaymentMethodCheck),
+ TotalHours: finchgo.F(0.000000),
+ GrossPay: finchgo.F(finchgo.MoneyParam{
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ }),
+ NetPay: finchgo.F(finchgo.MoneyParam{
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ }),
+ Earnings: finchgo.F([]finchgo.SandboxPaymentNewParamsPayStatementsEarning{{
+ Type: finchgo.F(finchgo.SandboxPaymentNewParamsPayStatementsEarningsTypeSalary),
+ Name: finchgo.F("string"),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ Hours: finchgo.F(0.000000),
+ }, {
+ Type: finchgo.F(finchgo.SandboxPaymentNewParamsPayStatementsEarningsTypeSalary),
+ Name: finchgo.F("string"),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ Hours: finchgo.F(0.000000),
+ }, {
+ Type: finchgo.F(finchgo.SandboxPaymentNewParamsPayStatementsEarningsTypeSalary),
+ Name: finchgo.F("string"),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ Hours: finchgo.F(0.000000),
+ }}),
+ Taxes: finchgo.F([]finchgo.SandboxPaymentNewParamsPayStatementsTax{{
+ Type: finchgo.F(finchgo.SandboxPaymentNewParamsPayStatementsTaxesTypeState),
+ Name: finchgo.F("string"),
+ Employer: finchgo.F(true),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ }, {
+ Type: finchgo.F(finchgo.SandboxPaymentNewParamsPayStatementsTaxesTypeState),
+ Name: finchgo.F("string"),
+ Employer: finchgo.F(true),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ }, {
+ Type: finchgo.F(finchgo.SandboxPaymentNewParamsPayStatementsTaxesTypeState),
+ Name: finchgo.F("string"),
+ Employer: finchgo.F(true),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ }}),
+ EmployeeDeductions: finchgo.F([]finchgo.SandboxPaymentNewParamsPayStatementsEmployeeDeduction{{
+ Name: finchgo.F("401k test"),
+ Amount: finchgo.F(int64(2000)),
+ Currency: finchgo.F("usd"),
+ PreTax: finchgo.F(true),
+ Type: finchgo.F(finchgo.BenefitType_401k),
+ }}),
+ EmployerContributions: finchgo.F([]finchgo.SandboxPaymentNewParamsPayStatementsEmployerContribution{{
+ Name: finchgo.F("string"),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ Type: finchgo.F(finchgo.BenefitType_401k),
+ }, {
+ Name: finchgo.F("string"),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ Type: finchgo.F(finchgo.BenefitType_401k),
+ }, {
+ Name: finchgo.F("string"),
+ Amount: finchgo.F(int64(0)),
+ Currency: finchgo.F("string"),
+ Type: finchgo.F(finchgo.BenefitType_401k),
+ }}),
+ }}),
+ StartDate: finchgo.F("string"),
+ })
+ if err != nil {
+ var apierr *finchgo.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}