diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b90a705e..65f558e7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.38.0" + ".": "2.0.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b7a7420d..431aa1d4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 48 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch/finch-7e39b6a20bf3e1f23ad832300b73ae92b6f6ce7c9d86eaa8fcc0710b51455f17.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch/finch-ecd3f6c28edae07dbe9f54d8040a6d7f2af5ac032b20f8df06065542478e4e73.yml openapi_spec_hash: 5e0e04e7274494062ff46ac85d358f5b -config_hash: 8b3c2a32014346513c18d98cbb752d2c +config_hash: 9ae56f40cec7304896138bfad5caf748 diff --git a/CHANGELOG.md b/CHANGELOG.md index f72d0fac..92df5455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.0.0 (2026-06-22) + +Full Changelog: [v1.38.0...v2.0.0](https://github.com/Finch-API/finch-api-go/compare/v1.38.0...v2.0.0) + +### Bug Fixes + +* **payroll:** pay_statement_item is now a direct subresource of hris instead of company ([c563bff](https://github.com/Finch-API/finch-api-go/commit/c563bff01e615514b40745e2d888591d1dbe0035)) + ## 1.38.0 (2026-06-22) Full Changelog: [v1.37.0...v1.38.0](https://github.com/Finch-API/finch-api-go/compare/v1.37.0...v1.38.0) diff --git a/README.md b/README.md index c47b364a..91ac820a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Finch Go API Library -Go Reference +Go Reference The Finch Go library provides convenient access to the [Finch REST API](https://developer.tryfinch.com/) from applications written in Go. @@ -22,7 +22,7 @@ Use the Finch MCP Server to enable AI assistants to interact with this API, allo ```go import ( - "github.com/Finch-API/finch-api-go" // imported as finchgo + "github.com/Finch-API/finch-api-go/v2" // imported as finchgo ) ``` @@ -33,7 +33,7 @@ Or to pin the version: ```sh -go get -u 'github.com/Finch-API/finch-api-go@v1.38.0' +go get -u 'github.com/Finch-API/finch-api-go@v2.0.0' ``` @@ -53,8 +53,8 @@ import ( "context" "fmt" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/option" ) func main() { diff --git a/accesstoken.go b/accesstoken.go index 623daa27..d05919c6 100644 --- a/accesstoken.go +++ b/accesstoken.go @@ -9,10 +9,10 @@ import ( "net/http" "slices" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" "github.com/tidwall/gjson" "github.com/tidwall/sjson" ) diff --git a/accesstoken_test.go b/accesstoken_test.go index 93c2f426..72200336 100644 --- a/accesstoken_test.go +++ b/accesstoken_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestAccessTokenNewWithOptionalParams(t *testing.T) { diff --git a/account.go b/account.go index ac574aef..6a014662 100644 --- a/account.go +++ b/account.go @@ -8,11 +8,11 @@ import ( "reflect" "slices" - "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" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/account_test.go b/account_test.go index c62e5605..c8ef6f51 100644 --- a/account_test.go +++ b/account_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestAccountDisconnect(t *testing.T) { diff --git a/aliases.go b/aliases.go index f8344cb0..210a3e25 100644 --- a/aliases.go +++ b/aliases.go @@ -3,8 +3,8 @@ package finchgo import ( - "github.com/Finch-API/finch-api-go/internal/apierror" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apierror" + "github.com/Finch-API/finch-api-go/v2/shared" ) type Error = apierror.Error diff --git a/api.md b/api.md index bf23d2b9..a7375097 100644 --- a/api.md +++ b/api.md @@ -1,249 +1,249 @@ # Shared Params Types -- shared.ConnectionStatusType -- shared.OperationSupport +- shared.ConnectionStatusType +- shared.OperationSupport # Shared Response Types -- shared.ConnectionStatusType -- shared.OperationSupport -- shared.OperationSupportMatrix -- shared.Paging +- shared.ConnectionStatusType +- shared.OperationSupport +- shared.OperationSupportMatrix +- shared.Paging # finchgo Methods: -- client.GetAuthURL(products string, redirectUri string, sandbox bool, opts ...option.RequestOption) (string, error) -- client.WithAccessToken(accessToken string) (Client, error) +- client.GetAuthURL(products string, redirectUri string, sandbox bool, opts ...option.RequestOption) (string, error) +- client.WithAccessToken(accessToken string) (Client, error) # AccessTokens Response Types: -- finchgo.CreateAccessTokenResponse +- finchgo.CreateAccessTokenResponse Methods: -- client.AccessTokens.New(ctx context.Context, body finchgo.AccessTokenNewParams) (\*finchgo.CreateAccessTokenResponse, error) +- client.AccessTokens.New(ctx context.Context, body finchgo.AccessTokenNewParams) (\*finchgo.CreateAccessTokenResponse, error) # HRIS Params Types: -- finchgo.IncomeParam -- finchgo.LocationParam +- finchgo.IncomeParam +- finchgo.LocationParam Response Types: -- finchgo.Income -- finchgo.Location -- finchgo.Money +- finchgo.Income +- finchgo.Location +- finchgo.Money ## Company Response Types: -- finchgo.Company +- finchgo.Company Methods: -- client.HRIS.Company.Get(ctx context.Context, query finchgo.HRISCompanyGetParams) (\*finchgo.Company, error) +- client.HRIS.Company.Get(ctx context.Context, query finchgo.HRISCompanyGetParams) (\*finchgo.Company, error) -### PayStatementItem +## PayStatementItem Response Types: -- finchgo.HRISCompanyPayStatementItemListResponse +- finchgo.HRISPayStatementItemListResponse Methods: -- client.HRIS.Company.PayStatementItem.List(ctx context.Context, query finchgo.HRISCompanyPayStatementItemListParams) (\*pagination.ResponsesPage[finchgo.HRISCompanyPayStatementItemListResponse], error) +- client.HRIS.PayStatementItem.List(ctx context.Context, query finchgo.HRISPayStatementItemListParams) (\*pagination.ResponsesPage[finchgo.HRISPayStatementItemListResponse], error) -#### Rules +### Rules Response Types: -- finchgo.HRISCompanyPayStatementItemRuleNewResponse -- finchgo.HRISCompanyPayStatementItemRuleUpdateResponse -- finchgo.HRISCompanyPayStatementItemRuleListResponse -- finchgo.HRISCompanyPayStatementItemRuleDeleteResponse +- finchgo.HRISPayStatementItemRuleNewResponse +- finchgo.HRISPayStatementItemRuleUpdateResponse +- finchgo.HRISPayStatementItemRuleListResponse +- finchgo.HRISPayStatementItemRuleDeleteResponse Methods: -- client.HRIS.Company.PayStatementItem.Rules.New(ctx context.Context, params finchgo.HRISCompanyPayStatementItemRuleNewParams) (\*finchgo.HRISCompanyPayStatementItemRuleNewResponse, error) -- client.HRIS.Company.PayStatementItem.Rules.Update(ctx context.Context, ruleID string, params finchgo.HRISCompanyPayStatementItemRuleUpdateParams) (\*finchgo.HRISCompanyPayStatementItemRuleUpdateResponse, error) -- client.HRIS.Company.PayStatementItem.Rules.List(ctx context.Context, query finchgo.HRISCompanyPayStatementItemRuleListParams) (\*pagination.ResponsesPage[finchgo.HRISCompanyPayStatementItemRuleListResponse], error) -- client.HRIS.Company.PayStatementItem.Rules.Delete(ctx context.Context, ruleID string, body finchgo.HRISCompanyPayStatementItemRuleDeleteParams) (\*finchgo.HRISCompanyPayStatementItemRuleDeleteResponse, error) +- client.HRIS.PayStatementItem.Rules.New(ctx context.Context, params finchgo.HRISPayStatementItemRuleNewParams) (\*finchgo.HRISPayStatementItemRuleNewResponse, error) +- client.HRIS.PayStatementItem.Rules.Update(ctx context.Context, ruleID string, params finchgo.HRISPayStatementItemRuleUpdateParams) (\*finchgo.HRISPayStatementItemRuleUpdateResponse, error) +- client.HRIS.PayStatementItem.Rules.List(ctx context.Context, query finchgo.HRISPayStatementItemRuleListParams) (\*pagination.ResponsesPage[finchgo.HRISPayStatementItemRuleListResponse], error) +- client.HRIS.PayStatementItem.Rules.Delete(ctx context.Context, ruleID string, body finchgo.HRISPayStatementItemRuleDeleteParams) (\*finchgo.HRISPayStatementItemRuleDeleteResponse, error) ## Directory Response Types: -- finchgo.IndividualInDirectory +- finchgo.IndividualInDirectory Methods: -- client.HRIS.Directory.List(ctx context.Context, query finchgo.HRISDirectoryListParams) (\*finchgo.IndividualsPage, error) +- client.HRIS.Directory.List(ctx context.Context, query finchgo.HRISDirectoryListParams) (\*finchgo.IndividualsPage, error) ## Individuals Response Types: -- finchgo.Individual -- finchgo.IndividualResponse +- finchgo.Individual +- finchgo.IndividualResponse Methods: -- client.HRIS.Individuals.GetMany(ctx context.Context, params finchgo.HRISIndividualGetManyParams) (\*pagination.ResponsesPage[finchgo.IndividualResponse], error) +- client.HRIS.Individuals.GetMany(ctx context.Context, params finchgo.HRISIndividualGetManyParams) (\*pagination.ResponsesPage[finchgo.IndividualResponse], error) ## Employments Response Types: -- finchgo.EmploymentData -- finchgo.EmploymentDataResponse +- finchgo.EmploymentData +- finchgo.EmploymentDataResponse Methods: -- client.HRIS.Employments.GetMany(ctx context.Context, params finchgo.HRISEmploymentGetManyParams) (\*pagination.ResponsesPage[finchgo.EmploymentDataResponse], error) +- client.HRIS.Employments.GetMany(ctx context.Context, params finchgo.HRISEmploymentGetManyParams) (\*pagination.ResponsesPage[finchgo.EmploymentDataResponse], error) ## Payments Response Types: -- finchgo.Payment +- finchgo.Payment Methods: -- client.HRIS.Payments.List(ctx context.Context, query finchgo.HRISPaymentListParams) (\*pagination.SinglePage[finchgo.Payment], error) +- client.HRIS.Payments.List(ctx context.Context, query finchgo.HRISPaymentListParams) (\*pagination.SinglePage[finchgo.Payment], error) ## PayStatements Response Types: -- finchgo.PayStatement -- finchgo.PayStatementData -- finchgo.PayStatementDataSyncInProgress -- finchgo.PayStatementResponse +- finchgo.PayStatement +- finchgo.PayStatementData +- finchgo.PayStatementDataSyncInProgress +- finchgo.PayStatementResponse Methods: -- client.HRIS.PayStatements.GetMany(ctx context.Context, params finchgo.HRISPayStatementGetManyParams) (\*pagination.ResponsesPage[finchgo.PayStatementResponse], error) +- client.HRIS.PayStatements.GetMany(ctx context.Context, params finchgo.HRISPayStatementGetManyParams) (\*pagination.ResponsesPage[finchgo.PayStatementResponse], error) ## Documents Response Types: -- finchgo.DocumentResponse -- finchgo.W42005 -- finchgo.W42020 -- finchgo.HRISDocumentListResponse -- finchgo.HRISDocumentRetreiveResponse +- finchgo.DocumentResponse +- finchgo.W42005 +- finchgo.W42020 +- finchgo.HRISDocumentListResponse +- finchgo.HRISDocumentRetreiveResponse Methods: -- client.HRIS.Documents.List(ctx context.Context, query finchgo.HRISDocumentListParams) (\*finchgo.HRISDocumentListResponse, error) -- client.HRIS.Documents.Retreive(ctx context.Context, documentID string, query finchgo.HRISDocumentRetreiveParams) (\*finchgo.HRISDocumentRetreiveResponse, error) +- client.HRIS.Documents.List(ctx context.Context, query finchgo.HRISDocumentListParams) (\*finchgo.HRISDocumentListResponse, error) +- client.HRIS.Documents.Retreive(ctx context.Context, documentID string, query finchgo.HRISDocumentRetreiveParams) (\*finchgo.HRISDocumentRetreiveResponse, error) ## Benefits Params Types: -- finchgo.BenefitFrequency -- finchgo.BenefitType +- finchgo.BenefitFrequency +- finchgo.BenefitType Response Types: -- finchgo.BenefitFeaturesAndOperations -- finchgo.BenefitFrequency -- finchgo.BenefitType -- finchgo.BenefitsSupport -- finchgo.CompanyBenefit -- finchgo.CreateCompanyBenefitsResponse -- finchgo.RegisterCompanyBenefitResponse -- finchgo.SupportPerBenefitType -- finchgo.SupportedBenefit -- finchgo.UpdateCompanyBenefitResponse +- finchgo.BenefitFeaturesAndOperations +- finchgo.BenefitFrequency +- finchgo.BenefitType +- finchgo.BenefitsSupport +- finchgo.CompanyBenefit +- finchgo.CreateCompanyBenefitsResponse +- finchgo.RegisterCompanyBenefitResponse +- finchgo.SupportPerBenefitType +- finchgo.SupportedBenefit +- finchgo.UpdateCompanyBenefitResponse Methods: -- client.HRIS.Benefits.New(ctx context.Context, params finchgo.HRISBenefitNewParams) (\*finchgo.CreateCompanyBenefitsResponse, error) -- client.HRIS.Benefits.Get(ctx context.Context, benefitID string, query finchgo.HRISBenefitGetParams) (\*finchgo.CompanyBenefit, error) -- client.HRIS.Benefits.Update(ctx context.Context, benefitID string, params finchgo.HRISBenefitUpdateParams) (\*finchgo.UpdateCompanyBenefitResponse, error) -- client.HRIS.Benefits.List(ctx context.Context, query finchgo.HRISBenefitListParams) (\*pagination.SinglePage[finchgo.CompanyBenefit], error) -- client.HRIS.Benefits.ListSupportedBenefits(ctx context.Context, query finchgo.HRISBenefitListSupportedBenefitsParams) (\*pagination.SinglePage[finchgo.SupportedBenefit], error) -- client.HRIS.Benefits.Register(ctx context.Context, params finchgo.HRISBenefitRegisterParams) (\*finchgo.RegisterCompanyBenefitResponse, error) +- client.HRIS.Benefits.New(ctx context.Context, params finchgo.HRISBenefitNewParams) (\*finchgo.CreateCompanyBenefitsResponse, error) +- client.HRIS.Benefits.Get(ctx context.Context, benefitID string, query finchgo.HRISBenefitGetParams) (\*finchgo.CompanyBenefit, error) +- client.HRIS.Benefits.Update(ctx context.Context, benefitID string, params finchgo.HRISBenefitUpdateParams) (\*finchgo.UpdateCompanyBenefitResponse, error) +- client.HRIS.Benefits.List(ctx context.Context, query finchgo.HRISBenefitListParams) (\*pagination.SinglePage[finchgo.CompanyBenefit], error) +- client.HRIS.Benefits.ListSupportedBenefits(ctx context.Context, query finchgo.HRISBenefitListSupportedBenefitsParams) (\*pagination.SinglePage[finchgo.SupportedBenefit], error) +- client.HRIS.Benefits.Register(ctx context.Context, params finchgo.HRISBenefitRegisterParams) (\*finchgo.RegisterCompanyBenefitResponse, error) ### Individuals Response Types: -- finchgo.EnrolledIndividualBenefitResponse -- finchgo.IndividualBenefit -- finchgo.UnenrolledIndividualBenefitResponse -- finchgo.HRISBenefitIndividualEnrolledIDsResponse +- finchgo.EnrolledIndividualBenefitResponse +- finchgo.IndividualBenefit +- finchgo.UnenrolledIndividualBenefitResponse +- finchgo.HRISBenefitIndividualEnrolledIDsResponse Methods: -- client.HRIS.Benefits.Individuals.EnrollMany(ctx context.Context, benefitID string, params finchgo.HRISBenefitIndividualEnrollManyParams) (\*finchgo.EnrolledIndividualBenefitResponse, error) -- client.HRIS.Benefits.Individuals.EnrolledIDs(ctx context.Context, benefitID string, query finchgo.HRISBenefitIndividualEnrolledIDsParams) (\*finchgo.HRISBenefitIndividualEnrolledIDsResponse, error) -- client.HRIS.Benefits.Individuals.GetManyBenefits(ctx context.Context, benefitID string, query finchgo.HRISBenefitIndividualGetManyBenefitsParams) (\*pagination.SinglePage[finchgo.IndividualBenefit], error) -- client.HRIS.Benefits.Individuals.UnenrollMany(ctx context.Context, benefitID string, params finchgo.HRISBenefitIndividualUnenrollManyParams) (\*finchgo.UnenrolledIndividualBenefitResponse, error) +- client.HRIS.Benefits.Individuals.EnrollMany(ctx context.Context, benefitID string, params finchgo.HRISBenefitIndividualEnrollManyParams) (\*finchgo.EnrolledIndividualBenefitResponse, error) +- client.HRIS.Benefits.Individuals.EnrolledIDs(ctx context.Context, benefitID string, query finchgo.HRISBenefitIndividualEnrolledIDsParams) (\*finchgo.HRISBenefitIndividualEnrolledIDsResponse, error) +- client.HRIS.Benefits.Individuals.GetManyBenefits(ctx context.Context, benefitID string, query finchgo.HRISBenefitIndividualGetManyBenefitsParams) (\*pagination.SinglePage[finchgo.IndividualBenefit], error) +- client.HRIS.Benefits.Individuals.UnenrollMany(ctx context.Context, benefitID string, params finchgo.HRISBenefitIndividualUnenrollManyParams) (\*finchgo.UnenrolledIndividualBenefitResponse, error) # Providers Response Types: -- finchgo.ProviderListResponse +- finchgo.ProviderListResponse Methods: -- client.Providers.List(ctx context.Context) (\*pagination.SinglePage[finchgo.ProviderListResponse], error) +- client.Providers.List(ctx context.Context) (\*pagination.SinglePage[finchgo.ProviderListResponse], error) # Account Response Types: -- finchgo.DisconnectEntityResponse -- finchgo.DisconnectResponse -- finchgo.Introspection +- finchgo.DisconnectEntityResponse +- finchgo.DisconnectResponse +- finchgo.Introspection Methods: -- client.Account.Disconnect(ctx context.Context) (\*finchgo.DisconnectResponse, error) -- client.Account.DisconnectEntity(ctx context.Context, body finchgo.AccountDisconnectEntityParams) (\*finchgo.DisconnectEntityResponse, error) -- client.Account.Introspect(ctx context.Context) (\*finchgo.Introspection, error) +- client.Account.Disconnect(ctx context.Context) (\*finchgo.DisconnectResponse, error) +- client.Account.DisconnectEntity(ctx context.Context, body finchgo.AccountDisconnectEntityParams) (\*finchgo.DisconnectEntityResponse, error) +- client.Account.Introspect(ctx context.Context) (\*finchgo.Introspection, error) # Webhooks Response Types: -- finchgo.AccountUpdateEvent -- finchgo.BaseWebhookEvent -- finchgo.CompanyEvent -- finchgo.DirectoryEvent -- finchgo.EmploymentEvent -- finchgo.IndividualEvent -- finchgo.JobCompletionEvent -- finchgo.PayStatementEvent -- finchgo.PaymentEvent -- finchgo.WebhookEventUnion +- finchgo.AccountUpdateEvent +- finchgo.BaseWebhookEvent +- finchgo.CompanyEvent +- finchgo.DirectoryEvent +- finchgo.EmploymentEvent +- finchgo.IndividualEvent +- finchgo.JobCompletionEvent +- finchgo.PayStatementEvent +- finchgo.PaymentEvent +- finchgo.WebhookEventUnion Methods: -- client.Webhooks.Unwrap(payload []byte, headers http.Header, secret string, now time.Time) (WebhookEvent, error) -- client.Webhooks.VerifySignature(payload []byte, headers http.Header, secret string, now time.Time) error +- client.Webhooks.Unwrap(payload []byte, headers http.Header, secret string, now time.Time) (WebhookEvent, error) +- client.Webhooks.VerifySignature(payload []byte, headers http.Header, secret string, now time.Time) error # RequestForwarding Response Types: -- finchgo.RequestForwardingForwardResponse +- finchgo.RequestForwardingForwardResponse Methods: -- client.RequestForwarding.Forward(ctx context.Context, body finchgo.RequestForwardingForwardParams) (\*finchgo.RequestForwardingForwardResponse, error) +- client.RequestForwarding.Forward(ctx context.Context, body finchgo.RequestForwardingForwardParams) (\*finchgo.RequestForwardingForwardResponse, error) # Jobs @@ -251,25 +251,25 @@ Methods: Response Types: -- finchgo.AutomatedAsyncJob -- finchgo.JobAutomatedNewResponse -- finchgo.JobAutomatedListResponse +- finchgo.AutomatedAsyncJob +- finchgo.JobAutomatedNewResponse +- finchgo.JobAutomatedListResponse Methods: -- client.Jobs.Automated.New(ctx context.Context, body finchgo.JobAutomatedNewParams) (\*finchgo.JobAutomatedNewResponse, error) -- client.Jobs.Automated.Get(ctx context.Context, jobID string) (\*finchgo.AutomatedAsyncJob, error) -- client.Jobs.Automated.List(ctx context.Context, query finchgo.JobAutomatedListParams) (\*finchgo.JobAutomatedListResponse, error) +- client.Jobs.Automated.New(ctx context.Context, body finchgo.JobAutomatedNewParams) (\*finchgo.JobAutomatedNewResponse, error) +- client.Jobs.Automated.Get(ctx context.Context, jobID string) (\*finchgo.AutomatedAsyncJob, error) +- client.Jobs.Automated.List(ctx context.Context, query finchgo.JobAutomatedListParams) (\*finchgo.JobAutomatedListResponse, error) ## Manual Response Types: -- finchgo.ManualAsyncJob +- finchgo.ManualAsyncJob Methods: -- client.Jobs.Manual.Get(ctx context.Context, jobID string) (\*finchgo.ManualAsyncJob, error) +- client.Jobs.Manual.Get(ctx context.Context, jobID string) (\*finchgo.ManualAsyncJob, error) # Sandbox @@ -277,94 +277,94 @@ Methods: Response Types: -- finchgo.SandboxConnectionNewResponse +- finchgo.SandboxConnectionNewResponse Methods: -- client.Sandbox.Connections.New(ctx context.Context, body finchgo.SandboxConnectionNewParams) (\*finchgo.SandboxConnectionNewResponse, error) +- client.Sandbox.Connections.New(ctx context.Context, body finchgo.SandboxConnectionNewParams) (\*finchgo.SandboxConnectionNewResponse, error) ### Accounts Response Types: -- finchgo.SandboxConnectionAccountNewResponse -- finchgo.SandboxConnectionAccountUpdateResponse +- 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) +- 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 +- finchgo.SandboxCompanyUpdateResponse Methods: -- client.Sandbox.Company.Update(ctx context.Context, body finchgo.SandboxCompanyUpdateParams) (\*finchgo.SandboxCompanyUpdateResponse, error) +- client.Sandbox.Company.Update(ctx context.Context, body finchgo.SandboxCompanyUpdateParams) (\*finchgo.SandboxCompanyUpdateResponse, error) ## Directory Response Types: -- finchgo.SandboxDirectoryNewResponse +- finchgo.SandboxDirectoryNewResponse Methods: -- client.Sandbox.Directory.New(ctx context.Context, body finchgo.SandboxDirectoryNewParams) (\*[]finchgo.SandboxDirectoryNewResponse, error) +- client.Sandbox.Directory.New(ctx context.Context, body finchgo.SandboxDirectoryNewParams) (\*[]finchgo.SandboxDirectoryNewResponse, error) ## Individual Response Types: -- finchgo.SandboxIndividualUpdateResponse +- finchgo.SandboxIndividualUpdateResponse Methods: -- client.Sandbox.Individual.Update(ctx context.Context, individualID string, body finchgo.SandboxIndividualUpdateParams) (\*finchgo.SandboxIndividualUpdateResponse, error) +- client.Sandbox.Individual.Update(ctx context.Context, individualID string, body finchgo.SandboxIndividualUpdateParams) (\*finchgo.SandboxIndividualUpdateResponse, error) ## Employment Response Types: -- finchgo.SandboxEmploymentUpdateResponse +- finchgo.SandboxEmploymentUpdateResponse Methods: -- client.Sandbox.Employment.Update(ctx context.Context, individualID string, body finchgo.SandboxEmploymentUpdateParams) (\*finchgo.SandboxEmploymentUpdateResponse, error) +- client.Sandbox.Employment.Update(ctx context.Context, individualID string, body finchgo.SandboxEmploymentUpdateParams) (\*finchgo.SandboxEmploymentUpdateResponse, error) ## Payment Response Types: -- finchgo.SandboxPaymentNewResponse +- finchgo.SandboxPaymentNewResponse Methods: -- client.Sandbox.Payment.New(ctx context.Context, body finchgo.SandboxPaymentNewParams) (\*finchgo.SandboxPaymentNewResponse, error) +- client.Sandbox.Payment.New(ctx context.Context, body finchgo.SandboxPaymentNewParams) (\*finchgo.SandboxPaymentNewResponse, error) ## Jobs Response Types: -- finchgo.SandboxJobNewResponse +- finchgo.SandboxJobNewResponse Methods: -- client.Sandbox.Jobs.New(ctx context.Context, body finchgo.SandboxJobNewParams) (\*finchgo.SandboxJobNewResponse, error) +- client.Sandbox.Jobs.New(ctx context.Context, body finchgo.SandboxJobNewParams) (\*finchgo.SandboxJobNewResponse, error) ### Configuration Response Types: -- finchgo.SandboxJobConfiguration +- 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) +- 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) # Payroll @@ -372,13 +372,13 @@ Methods: Response Types: -- finchgo.PayrollPayGroupGetResponse -- finchgo.PayrollPayGroupListResponse +- finchgo.PayrollPayGroupGetResponse +- finchgo.PayrollPayGroupListResponse Methods: -- client.Payroll.PayGroups.Get(ctx context.Context, payGroupID string, query finchgo.PayrollPayGroupGetParams) (\*finchgo.PayrollPayGroupGetResponse, error) -- client.Payroll.PayGroups.List(ctx context.Context, query finchgo.PayrollPayGroupListParams) (\*pagination.SinglePage[finchgo.PayrollPayGroupListResponse], error) +- client.Payroll.PayGroups.Get(ctx context.Context, payGroupID string, query finchgo.PayrollPayGroupGetParams) (\*finchgo.PayrollPayGroupGetResponse, error) +- client.Payroll.PayGroups.List(ctx context.Context, query finchgo.PayrollPayGroupListParams) (\*pagination.SinglePage[finchgo.PayrollPayGroupListResponse], error) # Connect @@ -386,10 +386,10 @@ Methods: Response Types: -- finchgo.ConnectSessionNewResponse -- finchgo.ConnectSessionReauthenticateResponse +- finchgo.ConnectSessionNewResponse +- finchgo.ConnectSessionReauthenticateResponse Methods: -- client.Connect.Sessions.New(ctx context.Context, body finchgo.ConnectSessionNewParams) (\*finchgo.ConnectSessionNewResponse, error) -- client.Connect.Sessions.Reauthenticate(ctx context.Context, body finchgo.ConnectSessionReauthenticateParams) (\*finchgo.ConnectSessionReauthenticateResponse, error) +- client.Connect.Sessions.New(ctx context.Context, body finchgo.ConnectSessionNewParams) (\*finchgo.ConnectSessionNewResponse, error) +- client.Connect.Sessions.Reauthenticate(ctx context.Context, body finchgo.ConnectSessionReauthenticateParams) (\*finchgo.ConnectSessionReauthenticateResponse, error) diff --git a/client.go b/client.go index ec122a86..a4e0943d 100644 --- a/client.go +++ b/client.go @@ -14,8 +14,8 @@ import ( "slices" "strings" - "github.com/Finch-API/finch-api-go/internal/requestconfig" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // Client creates a struct with services and top level methods that help with diff --git a/client_test.go b/client_test.go index dd4a8bcd..1f3a4041 100644 --- a/client_test.go +++ b/client_test.go @@ -10,9 +10,9 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal" + "github.com/Finch-API/finch-api-go/v2/option" ) type closureTransport struct { diff --git a/connect.go b/connect.go index 3c123f85..0fea824f 100644 --- a/connect.go +++ b/connect.go @@ -3,7 +3,7 @@ package finchgo import ( - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2/option" ) // ConnectService contains methods and other services that help with interacting diff --git a/connectsession.go b/connectsession.go index a8bbbbdb..079dbd93 100644 --- a/connectsession.go +++ b/connectsession.go @@ -7,10 +7,10 @@ import ( "net/http" "slices" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // ConnectSessionService contains methods and other services that help with diff --git a/connectsession_test.go b/connectsession_test.go index 699e4298..0994a4f4 100644 --- a/connectsession_test.go +++ b/connectsession_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestConnectSessionNewWithOptionalParams(t *testing.T) { diff --git a/examples/auth/main.go b/examples/auth/main.go index 4fcc730c..ee4a5cf0 100644 --- a/examples/auth/main.go +++ b/examples/auth/main.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - finch "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/option" + finch "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/option" ) func main() { diff --git a/field.go b/field.go index 90ed17eb..5fd8378f 100644 --- a/field.go +++ b/field.go @@ -1,7 +1,7 @@ package finchgo import ( - "github.com/Finch-API/finch-api-go/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/param" "io" ) diff --git a/go.mod b/go.mod index 0b0f6924..6abce90e 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/Finch-API/finch-api-go +module github.com/Finch-API/finch-api-go/v2 go 1.22 diff --git a/hris.go b/hris.go index c373f835..2ed3caac 100644 --- a/hris.go +++ b/hris.go @@ -5,9 +5,9 @@ package finchgo import ( "time" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/option" ) // HRISService contains methods and other services that help with interacting with @@ -17,15 +17,16 @@ import ( // automatically. You should not instantiate this service directly, and instead use // the [NewHRISService] method instead. type HRISService struct { - Options []option.RequestOption - Company *HRISCompanyService - Directory *HRISDirectoryService - Individuals *HRISIndividualService - Employments *HRISEmploymentService - Payments *HRISPaymentService - PayStatements *HRISPayStatementService - Documents *HRISDocumentService - Benefits *HRISBenefitService + Options []option.RequestOption + Company *HRISCompanyService + PayStatementItem *HRISPayStatementItemService + Directory *HRISDirectoryService + Individuals *HRISIndividualService + Employments *HRISEmploymentService + Payments *HRISPaymentService + PayStatements *HRISPayStatementService + Documents *HRISDocumentService + Benefits *HRISBenefitService } // NewHRISService generates a new service that applies the given options to each @@ -35,6 +36,7 @@ func NewHRISService(opts ...option.RequestOption) (r *HRISService) { r = &HRISService{} r.Options = opts r.Company = NewHRISCompanyService(opts...) + r.PayStatementItem = NewHRISPayStatementItemService(opts...) r.Directory = NewHRISDirectoryService(opts...) r.Individuals = NewHRISIndividualService(opts...) r.Employments = NewHRISEmploymentService(opts...) diff --git a/hrisbenefit.go b/hrisbenefit.go index e42cfc20..098bab7a 100644 --- a/hrisbenefit.go +++ b/hrisbenefit.go @@ -10,13 +10,13 @@ import ( "net/url" "slices" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" + "github.com/Finch-API/finch-api-go/v2/shared" ) // HRISBenefitService contains methods and other services that help with diff --git a/hrisbenefit_test.go b/hrisbenefit_test.go index d29326a4..c2500a27 100644 --- a/hrisbenefit_test.go +++ b/hrisbenefit_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISBenefitNewWithOptionalParams(t *testing.T) { diff --git a/hrisbenefitindividual.go b/hrisbenefitindividual.go index 35417a4a..b73d09e0 100644 --- a/hrisbenefitindividual.go +++ b/hrisbenefitindividual.go @@ -12,12 +12,12 @@ import ( "slices" "time" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" "github.com/tidwall/gjson" ) diff --git a/hrisbenefitindividual_test.go b/hrisbenefitindividual_test.go index df4e4b21..cd4ea54e 100644 --- a/hrisbenefitindividual_test.go +++ b/hrisbenefitindividual_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISBenefitIndividualEnrollManyWithOptionalParams(t *testing.T) { diff --git a/hriscompany.go b/hriscompany.go index cfdbffa7..573820c0 100644 --- a/hriscompany.go +++ b/hriscompany.go @@ -8,11 +8,11 @@ import ( "net/url" "slices" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // HRISCompanyService contains methods and other services that help with @@ -22,8 +22,7 @@ import ( // automatically. You should not instantiate this service directly, and instead use // the [NewHRISCompanyService] method instead. type HRISCompanyService struct { - Options []option.RequestOption - PayStatementItem *HRISCompanyPayStatementItemService + Options []option.RequestOption } // NewHRISCompanyService generates a new service that applies the given options to @@ -32,7 +31,6 @@ type HRISCompanyService struct { func NewHRISCompanyService(opts ...option.RequestOption) (r *HRISCompanyService) { r = &HRISCompanyService{} r.Options = opts - r.PayStatementItem = NewHRISCompanyPayStatementItemService(opts...) return } diff --git a/hriscompany_test.go b/hriscompany_test.go index c9af8ec1..a85e6f4f 100644 --- a/hriscompany_test.go +++ b/hriscompany_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISCompanyGetWithOptionalParams(t *testing.T) { diff --git a/hriscompanypaystatementitem.go b/hriscompanypaystatementitem.go deleted file mode 100644 index ae061876..00000000 --- a/hriscompanypaystatementitem.go +++ /dev/null @@ -1,190 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package finchgo - -import ( - "context" - "net/http" - "net/url" - "slices" - "time" - - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" -) - -// HRISCompanyPayStatementItemService 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 [NewHRISCompanyPayStatementItemService] method instead. -type HRISCompanyPayStatementItemService struct { - Options []option.RequestOption - Rules *HRISCompanyPayStatementItemRuleService -} - -// NewHRISCompanyPayStatementItemService 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 NewHRISCompanyPayStatementItemService(opts ...option.RequestOption) (r *HRISCompanyPayStatementItemService) { - r = &HRISCompanyPayStatementItemService{} - r.Options = opts - r.Rules = NewHRISCompanyPayStatementItemRuleService(opts...) - return -} - -// Retrieve a list of detailed pay statement items for the access token's -// connection account. -func (r *HRISCompanyPayStatementItemService) List(ctx context.Context, query HRISCompanyPayStatementItemListParams, opts ...option.RequestOption) (res *pagination.ResponsesPage[HRISCompanyPayStatementItemListResponse], err error) { - var raw *http.Response - var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} - opts = slices.Concat(preClientOpts, r.Options, opts) - opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := "employer/pay-statement-item" - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) - if err != nil { - return nil, err - } - err = cfg.Execute() - if err != nil { - return nil, err - } - res.SetPageConfig(cfg, raw) - return res, nil -} - -// Retrieve a list of detailed pay statement items for the access token's -// connection account. -func (r *HRISCompanyPayStatementItemService) ListAutoPaging(ctx context.Context, query HRISCompanyPayStatementItemListParams, opts ...option.RequestOption) *pagination.ResponsesPageAutoPager[HRISCompanyPayStatementItemListResponse] { - return pagination.NewResponsesPageAutoPager(r.List(ctx, query, opts...)) -} - -type HRISCompanyPayStatementItemListResponse struct { - // The attributes of the pay statement item. - Attributes HRISCompanyPayStatementItemListResponseAttributes `json:"attributes" api:"required"` - // The category of the pay statement item. - Category HRISCompanyPayStatementItemListResponseCategory `json:"category" api:"required"` - // The name of the pay statement item. - Name string `json:"name" api:"required"` - JSON hrisCompanyPayStatementItemListResponseJSON `json:"-"` -} - -// hrisCompanyPayStatementItemListResponseJSON contains the JSON metadata for the -// struct [HRISCompanyPayStatementItemListResponse] -type hrisCompanyPayStatementItemListResponseJSON struct { - Attributes apijson.Field - Category apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemListResponseJSON) RawJSON() string { - return r.raw -} - -// The attributes of the pay statement item. -type HRISCompanyPayStatementItemListResponseAttributes struct { - // The metadata of the pay statement item derived by the rules engine if available. - // Each attribute will be a key-value pair defined by a rule. - Metadata map[string]interface{} `json:"metadata" api:"required,nullable"` - // `true` if the amount is paid by the employers. This field is only available for - // taxes. - Employer bool `json:"employer" api:"nullable"` - // `true` if the pay statement item is pre-tax. This field is only available for - // employee deductions. - PreTax bool `json:"pre_tax" api:"nullable"` - // The type of the pay statement item. - Type string `json:"type" api:"nullable"` - JSON hrisCompanyPayStatementItemListResponseAttributesJSON `json:"-"` -} - -// hrisCompanyPayStatementItemListResponseAttributesJSON contains the JSON metadata -// for the struct [HRISCompanyPayStatementItemListResponseAttributes] -type hrisCompanyPayStatementItemListResponseAttributesJSON struct { - Metadata apijson.Field - Employer apijson.Field - PreTax apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemListResponseAttributes) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemListResponseAttributesJSON) RawJSON() string { - return r.raw -} - -// The category of the pay statement item. -type HRISCompanyPayStatementItemListResponseCategory string - -const ( - HRISCompanyPayStatementItemListResponseCategoryEarnings HRISCompanyPayStatementItemListResponseCategory = "earnings" - HRISCompanyPayStatementItemListResponseCategoryTaxes HRISCompanyPayStatementItemListResponseCategory = "taxes" - HRISCompanyPayStatementItemListResponseCategoryEmployeeDeductions HRISCompanyPayStatementItemListResponseCategory = "employee_deductions" - HRISCompanyPayStatementItemListResponseCategoryEmployerContributions HRISCompanyPayStatementItemListResponseCategory = "employer_contributions" -) - -func (r HRISCompanyPayStatementItemListResponseCategory) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemListResponseCategoryEarnings, HRISCompanyPayStatementItemListResponseCategoryTaxes, HRISCompanyPayStatementItemListResponseCategoryEmployeeDeductions, HRISCompanyPayStatementItemListResponseCategoryEmployerContributions: - return true - } - return false -} - -type HRISCompanyPayStatementItemListParams struct { - // Comma-delimited list of pay statement item categories to filter on. If empty, - // defaults to all categories. - Categories param.Field[[]HRISCompanyPayStatementItemListParamsCategory] `query:"categories"` - // The end date to retrieve pay statement items by via their last seen pay date in - // `YYYY-MM-DD` format. - EndDate param.Field[time.Time] `query:"end_date" format:"date"` - // The entity IDs to specify which entities' data to access. - EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` - // Case-insensitive partial match search by pay statement item name. - Name param.Field[string] `query:"name"` - // The start date to retrieve pay statement items by via their last seen pay date - // (inclusive) in `YYYY-MM-DD` format. - StartDate param.Field[time.Time] `query:"start_date" format:"date"` - // String search by pay statement item type. - Type param.Field[string] `query:"type"` -} - -// URLQuery serializes [HRISCompanyPayStatementItemListParams]'s query parameters -// as `url.Values`. -func (r HRISCompanyPayStatementItemListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatBrackets, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type HRISCompanyPayStatementItemListParamsCategory string - -const ( - HRISCompanyPayStatementItemListParamsCategoryEarnings HRISCompanyPayStatementItemListParamsCategory = "earnings" - HRISCompanyPayStatementItemListParamsCategoryTaxes HRISCompanyPayStatementItemListParamsCategory = "taxes" - HRISCompanyPayStatementItemListParamsCategoryEmployeeDeductions HRISCompanyPayStatementItemListParamsCategory = "employee_deductions" - HRISCompanyPayStatementItemListParamsCategoryEmployerContributions HRISCompanyPayStatementItemListParamsCategory = "employer_contributions" -) - -func (r HRISCompanyPayStatementItemListParamsCategory) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemListParamsCategoryEarnings, HRISCompanyPayStatementItemListParamsCategoryTaxes, HRISCompanyPayStatementItemListParamsCategoryEmployeeDeductions, HRISCompanyPayStatementItemListParamsCategoryEmployerContributions: - return true - } - return false -} diff --git a/hriscompanypaystatementitemrule.go b/hriscompanypaystatementitemrule.go deleted file mode 100644 index 3e4dc00c..00000000 --- a/hriscompanypaystatementitemrule.go +++ /dev/null @@ -1,742 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package finchgo - -import ( - "context" - "errors" - "fmt" - "net/http" - "net/url" - "slices" - "time" - - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" -) - -// HRISCompanyPayStatementItemRuleService 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 [NewHRISCompanyPayStatementItemRuleService] method instead. -type HRISCompanyPayStatementItemRuleService struct { - Options []option.RequestOption -} - -// NewHRISCompanyPayStatementItemRuleService 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 NewHRISCompanyPayStatementItemRuleService(opts ...option.RequestOption) (r *HRISCompanyPayStatementItemRuleService) { - r = &HRISCompanyPayStatementItemRuleService{} - r.Options = opts - return -} - -// Custom rules can be created to associate specific attributes to pay statement -// items depending on the use case. For example, pay statement items that meet -// certain conditions can be labeled as a pre-tax 401k. This metadata can be -// retrieved where pay statement item information is available. -func (r *HRISCompanyPayStatementItemRuleService) New(ctx context.Context, params HRISCompanyPayStatementItemRuleNewParams, opts ...option.RequestOption) (res *HRISCompanyPayStatementItemRuleNewResponse, err error) { - var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} - opts = slices.Concat(preClientOpts, r.Options, opts) - path := "employer/pay-statement-item/rule" - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...) - return res, err -} - -// Update a rule for a pay statement item. -func (r *HRISCompanyPayStatementItemRuleService) Update(ctx context.Context, ruleID string, params HRISCompanyPayStatementItemRuleUpdateParams, opts ...option.RequestOption) (res *HRISCompanyPayStatementItemRuleUpdateResponse, err error) { - var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} - opts = slices.Concat(preClientOpts, r.Options, opts) - if ruleID == "" { - err = errors.New("missing required rule_id parameter") - return nil, err - } - path := fmt.Sprintf("employer/pay-statement-item/rule/%s", ruleID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...) - return res, err -} - -// List all rules of a connection account. -func (r *HRISCompanyPayStatementItemRuleService) List(ctx context.Context, query HRISCompanyPayStatementItemRuleListParams, opts ...option.RequestOption) (res *pagination.ResponsesPage[HRISCompanyPayStatementItemRuleListResponse], err error) { - var raw *http.Response - var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} - opts = slices.Concat(preClientOpts, r.Options, opts) - opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := "employer/pay-statement-item/rule" - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) - if err != nil { - return nil, err - } - err = cfg.Execute() - if err != nil { - return nil, err - } - res.SetPageConfig(cfg, raw) - return res, nil -} - -// List all rules of a connection account. -func (r *HRISCompanyPayStatementItemRuleService) ListAutoPaging(ctx context.Context, query HRISCompanyPayStatementItemRuleListParams, opts ...option.RequestOption) *pagination.ResponsesPageAutoPager[HRISCompanyPayStatementItemRuleListResponse] { - return pagination.NewResponsesPageAutoPager(r.List(ctx, query, opts...)) -} - -// Delete a rule for a pay statement item. -func (r *HRISCompanyPayStatementItemRuleService) Delete(ctx context.Context, ruleID string, body HRISCompanyPayStatementItemRuleDeleteParams, opts ...option.RequestOption) (res *HRISCompanyPayStatementItemRuleDeleteResponse, err error) { - var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} - opts = slices.Concat(preClientOpts, r.Options, opts) - if ruleID == "" { - err = errors.New("missing required rule_id parameter") - return nil, err - } - path := fmt.Sprintf("employer/pay-statement-item/rule/%s", ruleID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) - return res, err -} - -type HRISCompanyPayStatementItemRuleNewResponse struct { - // Finch id (uuidv4) for the rule. - ID string `json:"id"` - // Specifies the fields to be applied when the condition is met. - Attributes HRISCompanyPayStatementItemRuleNewResponseAttributes `json:"attributes"` - Conditions []HRISCompanyPayStatementItemRuleNewResponseCondition `json:"conditions"` - // The datetime when the rule was created. - CreatedAt time.Time `json:"created_at" format:"date-time"` - // Specifies when the rules should stop applying rules based on the date. - EffectiveEndDate string `json:"effective_end_date" api:"nullable"` - // Specifies when the rule should begin applying based on the date. - EffectiveStartDate string `json:"effective_start_date" api:"nullable"` - // The entity type to which the rule is applied. - EntityType HRISCompanyPayStatementItemRuleNewResponseEntityType `json:"entity_type"` - // The priority of the rule. - Priority int64 `json:"priority"` - // The datetime when the rule was last updated. - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - JSON hrisCompanyPayStatementItemRuleNewResponseJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleNewResponseJSON contains the JSON metadata for -// the struct [HRISCompanyPayStatementItemRuleNewResponse] -type hrisCompanyPayStatementItemRuleNewResponseJSON struct { - ID apijson.Field - Attributes apijson.Field - Conditions apijson.Field - CreatedAt apijson.Field - EffectiveEndDate apijson.Field - EffectiveStartDate apijson.Field - EntityType apijson.Field - Priority apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleNewResponseJSON) RawJSON() string { - return r.raw -} - -// Specifies the fields to be applied when the condition is met. -type HRISCompanyPayStatementItemRuleNewResponseAttributes struct { - // The metadata to be attached in the entity. It is a key-value pairs where the - // values can be of any type (string, number, boolean, object, array, etc.). - Metadata map[string]interface{} `json:"metadata"` - JSON hrisCompanyPayStatementItemRuleNewResponseAttributesJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleNewResponseAttributesJSON contains the JSON -// metadata for the struct [HRISCompanyPayStatementItemRuleNewResponseAttributes] -type hrisCompanyPayStatementItemRuleNewResponseAttributesJSON struct { - Metadata apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleNewResponseAttributes) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleNewResponseAttributesJSON) RawJSON() string { - return r.raw -} - -type HRISCompanyPayStatementItemRuleNewResponseCondition struct { - // The field to be checked in the rule. - Field string `json:"field"` - // The operator to be used in the rule. - Operator HRISCompanyPayStatementItemRuleNewResponseConditionsOperator `json:"operator"` - // The value of the field to be checked in the rule. - Value string `json:"value"` - JSON hrisCompanyPayStatementItemRuleNewResponseConditionJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleNewResponseConditionJSON contains the JSON -// metadata for the struct [HRISCompanyPayStatementItemRuleNewResponseCondition] -type hrisCompanyPayStatementItemRuleNewResponseConditionJSON struct { - Field apijson.Field - Operator apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleNewResponseCondition) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleNewResponseConditionJSON) RawJSON() string { - return r.raw -} - -// The operator to be used in the rule. -type HRISCompanyPayStatementItemRuleNewResponseConditionsOperator string - -const ( - HRISCompanyPayStatementItemRuleNewResponseConditionsOperatorEquals HRISCompanyPayStatementItemRuleNewResponseConditionsOperator = "equals" -) - -func (r HRISCompanyPayStatementItemRuleNewResponseConditionsOperator) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleNewResponseConditionsOperatorEquals: - return true - } - return false -} - -// The entity type to which the rule is applied. -type HRISCompanyPayStatementItemRuleNewResponseEntityType string - -const ( - HRISCompanyPayStatementItemRuleNewResponseEntityTypePayStatementItem HRISCompanyPayStatementItemRuleNewResponseEntityType = "pay_statement_item" -) - -func (r HRISCompanyPayStatementItemRuleNewResponseEntityType) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleNewResponseEntityTypePayStatementItem: - return true - } - return false -} - -type HRISCompanyPayStatementItemRuleUpdateResponse struct { - // Finch id (uuidv4) for the rule. - ID string `json:"id" format:"uuid"` - // Specifies the fields to be applied when the condition is met. - Attributes HRISCompanyPayStatementItemRuleUpdateResponseAttributes `json:"attributes"` - Conditions []HRISCompanyPayStatementItemRuleUpdateResponseCondition `json:"conditions"` - // The datetime when the rule was created. - CreatedAt time.Time `json:"created_at" format:"date-time"` - // Specifies when the rules should stop applying rules based on the date. - EffectiveEndDate string `json:"effective_end_date" api:"nullable"` - // Specifies when the rule should begin applying based on the date. - EffectiveStartDate string `json:"effective_start_date" api:"nullable"` - // The entity type to which the rule is applied. - EntityType HRISCompanyPayStatementItemRuleUpdateResponseEntityType `json:"entity_type"` - // The priority of the rule. - Priority int64 `json:"priority"` - // The datetime when the rule was last updated. - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - JSON hrisCompanyPayStatementItemRuleUpdateResponseJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleUpdateResponseJSON contains the JSON metadata for -// the struct [HRISCompanyPayStatementItemRuleUpdateResponse] -type hrisCompanyPayStatementItemRuleUpdateResponseJSON struct { - ID apijson.Field - Attributes apijson.Field - Conditions apijson.Field - CreatedAt apijson.Field - EffectiveEndDate apijson.Field - EffectiveStartDate apijson.Field - EntityType apijson.Field - Priority apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleUpdateResponseJSON) RawJSON() string { - return r.raw -} - -// Specifies the fields to be applied when the condition is met. -type HRISCompanyPayStatementItemRuleUpdateResponseAttributes struct { - // The metadata to be attached in the entity. It is a key-value pairs where the - // values can be of any type (string, number, boolean, object, array, etc.). - Metadata map[string]interface{} `json:"metadata"` - JSON hrisCompanyPayStatementItemRuleUpdateResponseAttributesJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleUpdateResponseAttributesJSON contains the JSON -// metadata for the struct -// [HRISCompanyPayStatementItemRuleUpdateResponseAttributes] -type hrisCompanyPayStatementItemRuleUpdateResponseAttributesJSON struct { - Metadata apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleUpdateResponseAttributes) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleUpdateResponseAttributesJSON) RawJSON() string { - return r.raw -} - -type HRISCompanyPayStatementItemRuleUpdateResponseCondition struct { - // The field to be checked in the rule. - Field string `json:"field"` - // The operator to be used in the rule. - Operator HRISCompanyPayStatementItemRuleUpdateResponseConditionsOperator `json:"operator"` - // The value of the field to be checked in the rule. - Value string `json:"value"` - JSON hrisCompanyPayStatementItemRuleUpdateResponseConditionJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleUpdateResponseConditionJSON contains the JSON -// metadata for the struct [HRISCompanyPayStatementItemRuleUpdateResponseCondition] -type hrisCompanyPayStatementItemRuleUpdateResponseConditionJSON struct { - Field apijson.Field - Operator apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleUpdateResponseCondition) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleUpdateResponseConditionJSON) RawJSON() string { - return r.raw -} - -// The operator to be used in the rule. -type HRISCompanyPayStatementItemRuleUpdateResponseConditionsOperator string - -const ( - HRISCompanyPayStatementItemRuleUpdateResponseConditionsOperatorEquals HRISCompanyPayStatementItemRuleUpdateResponseConditionsOperator = "equals" -) - -func (r HRISCompanyPayStatementItemRuleUpdateResponseConditionsOperator) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleUpdateResponseConditionsOperatorEquals: - return true - } - return false -} - -// The entity type to which the rule is applied. -type HRISCompanyPayStatementItemRuleUpdateResponseEntityType string - -const ( - HRISCompanyPayStatementItemRuleUpdateResponseEntityTypePayStatementItem HRISCompanyPayStatementItemRuleUpdateResponseEntityType = "pay_statement_item" -) - -func (r HRISCompanyPayStatementItemRuleUpdateResponseEntityType) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleUpdateResponseEntityTypePayStatementItem: - return true - } - return false -} - -type HRISCompanyPayStatementItemRuleListResponse struct { - // Finch id (uuidv4) for the rule. - ID string `json:"id"` - // Specifies the fields to be applied when the condition is met. - Attributes HRISCompanyPayStatementItemRuleListResponseAttributes `json:"attributes"` - Conditions []HRISCompanyPayStatementItemRuleListResponseCondition `json:"conditions"` - // The datetime when the rule was created. - CreatedAt time.Time `json:"created_at" format:"date-time"` - // Specifies when the rules should stop applying rules based on the date. - EffectiveEndDate string `json:"effective_end_date" api:"nullable"` - // Specifies when the rule should begin applying based on the date. - EffectiveStartDate string `json:"effective_start_date" api:"nullable"` - // The entity type to which the rule is applied. - EntityType HRISCompanyPayStatementItemRuleListResponseEntityType `json:"entity_type"` - // The priority of the rule. - Priority int64 `json:"priority"` - // The datetime when the rule was last updated. - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - JSON hrisCompanyPayStatementItemRuleListResponseJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleListResponseJSON contains the JSON metadata for -// the struct [HRISCompanyPayStatementItemRuleListResponse] -type hrisCompanyPayStatementItemRuleListResponseJSON struct { - ID apijson.Field - Attributes apijson.Field - Conditions apijson.Field - CreatedAt apijson.Field - EffectiveEndDate apijson.Field - EffectiveStartDate apijson.Field - EntityType apijson.Field - Priority apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleListResponseJSON) RawJSON() string { - return r.raw -} - -// Specifies the fields to be applied when the condition is met. -type HRISCompanyPayStatementItemRuleListResponseAttributes struct { - // The metadata to be attached in the entity. It is a key-value pairs where the - // values can be of any type (string, number, boolean, object, array, etc.). - Metadata map[string]interface{} `json:"metadata"` - JSON hrisCompanyPayStatementItemRuleListResponseAttributesJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleListResponseAttributesJSON contains the JSON -// metadata for the struct [HRISCompanyPayStatementItemRuleListResponseAttributes] -type hrisCompanyPayStatementItemRuleListResponseAttributesJSON struct { - Metadata apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleListResponseAttributes) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleListResponseAttributesJSON) RawJSON() string { - return r.raw -} - -type HRISCompanyPayStatementItemRuleListResponseCondition struct { - // The field to be checked in the rule. - Field string `json:"field"` - // The operator to be used in the rule. - Operator HRISCompanyPayStatementItemRuleListResponseConditionsOperator `json:"operator"` - // The value of the field to be checked in the rule. - Value string `json:"value"` - JSON hrisCompanyPayStatementItemRuleListResponseConditionJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleListResponseConditionJSON contains the JSON -// metadata for the struct [HRISCompanyPayStatementItemRuleListResponseCondition] -type hrisCompanyPayStatementItemRuleListResponseConditionJSON struct { - Field apijson.Field - Operator apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleListResponseCondition) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleListResponseConditionJSON) RawJSON() string { - return r.raw -} - -// The operator to be used in the rule. -type HRISCompanyPayStatementItemRuleListResponseConditionsOperator string - -const ( - HRISCompanyPayStatementItemRuleListResponseConditionsOperatorEquals HRISCompanyPayStatementItemRuleListResponseConditionsOperator = "equals" -) - -func (r HRISCompanyPayStatementItemRuleListResponseConditionsOperator) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleListResponseConditionsOperatorEquals: - return true - } - return false -} - -// The entity type to which the rule is applied. -type HRISCompanyPayStatementItemRuleListResponseEntityType string - -const ( - HRISCompanyPayStatementItemRuleListResponseEntityTypePayStatementItem HRISCompanyPayStatementItemRuleListResponseEntityType = "pay_statement_item" -) - -func (r HRISCompanyPayStatementItemRuleListResponseEntityType) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleListResponseEntityTypePayStatementItem: - return true - } - return false -} - -type HRISCompanyPayStatementItemRuleDeleteResponse struct { - // Finch id (uuidv4) for the rule. - ID string `json:"id" format:"uuid"` - // Specifies the fields to be applied when the condition is met. - Attributes HRISCompanyPayStatementItemRuleDeleteResponseAttributes `json:"attributes"` - Conditions []HRISCompanyPayStatementItemRuleDeleteResponseCondition `json:"conditions"` - // The datetime when the rule was created. - CreatedAt time.Time `json:"created_at" format:"date-time"` - // The datetime when the rule was deleted. - DeletedAt time.Time `json:"deleted_at" format:"date-time"` - // Specifies when the rules should stop applying rules based on the date. - EffectiveEndDate string `json:"effective_end_date" api:"nullable"` - // Specifies when the rule should begin applying based on the date. - EffectiveStartDate string `json:"effective_start_date" api:"nullable"` - // The entity type to which the rule is applied. - EntityType HRISCompanyPayStatementItemRuleDeleteResponseEntityType `json:"entity_type"` - // The priority of the rule. - Priority int64 `json:"priority"` - // The datetime when the rule was last updated. - UpdatedAt time.Time `json:"updated_at" format:"date-time"` - JSON hrisCompanyPayStatementItemRuleDeleteResponseJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleDeleteResponseJSON contains the JSON metadata for -// the struct [HRISCompanyPayStatementItemRuleDeleteResponse] -type hrisCompanyPayStatementItemRuleDeleteResponseJSON struct { - ID apijson.Field - Attributes apijson.Field - Conditions apijson.Field - CreatedAt apijson.Field - DeletedAt apijson.Field - EffectiveEndDate apijson.Field - EffectiveStartDate apijson.Field - EntityType apijson.Field - Priority apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleDeleteResponseJSON) RawJSON() string { - return r.raw -} - -// Specifies the fields to be applied when the condition is met. -type HRISCompanyPayStatementItemRuleDeleteResponseAttributes struct { - // The metadata to be attached in the entity. It is a key-value pairs where the - // values can be of any type (string, number, boolean, object, array, etc.). - Metadata map[string]interface{} `json:"metadata"` - JSON hrisCompanyPayStatementItemRuleDeleteResponseAttributesJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleDeleteResponseAttributesJSON contains the JSON -// metadata for the struct -// [HRISCompanyPayStatementItemRuleDeleteResponseAttributes] -type hrisCompanyPayStatementItemRuleDeleteResponseAttributesJSON struct { - Metadata apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleDeleteResponseAttributes) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleDeleteResponseAttributesJSON) RawJSON() string { - return r.raw -} - -type HRISCompanyPayStatementItemRuleDeleteResponseCondition struct { - // The field to be checked in the rule. - Field string `json:"field"` - // The operator to be used in the rule. - Operator HRISCompanyPayStatementItemRuleDeleteResponseConditionsOperator `json:"operator"` - // The value of the field to be checked in the rule. - Value string `json:"value"` - JSON hrisCompanyPayStatementItemRuleDeleteResponseConditionJSON `json:"-"` -} - -// hrisCompanyPayStatementItemRuleDeleteResponseConditionJSON contains the JSON -// metadata for the struct [HRISCompanyPayStatementItemRuleDeleteResponseCondition] -type hrisCompanyPayStatementItemRuleDeleteResponseConditionJSON struct { - Field apijson.Field - Operator apijson.Field - Value apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *HRISCompanyPayStatementItemRuleDeleteResponseCondition) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r hrisCompanyPayStatementItemRuleDeleteResponseConditionJSON) RawJSON() string { - return r.raw -} - -// The operator to be used in the rule. -type HRISCompanyPayStatementItemRuleDeleteResponseConditionsOperator string - -const ( - HRISCompanyPayStatementItemRuleDeleteResponseConditionsOperatorEquals HRISCompanyPayStatementItemRuleDeleteResponseConditionsOperator = "equals" -) - -func (r HRISCompanyPayStatementItemRuleDeleteResponseConditionsOperator) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleDeleteResponseConditionsOperatorEquals: - return true - } - return false -} - -// The entity type to which the rule is applied. -type HRISCompanyPayStatementItemRuleDeleteResponseEntityType string - -const ( - HRISCompanyPayStatementItemRuleDeleteResponseEntityTypePayStatementItem HRISCompanyPayStatementItemRuleDeleteResponseEntityType = "pay_statement_item" -) - -func (r HRISCompanyPayStatementItemRuleDeleteResponseEntityType) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleDeleteResponseEntityTypePayStatementItem: - return true - } - return false -} - -type HRISCompanyPayStatementItemRuleNewParams struct { - // The entity IDs to create the rule for. - EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` - // Specifies the fields to be applied when the condition is met. - Attributes param.Field[HRISCompanyPayStatementItemRuleNewParamsAttributes] `json:"attributes"` - Conditions param.Field[[]HRISCompanyPayStatementItemRuleNewParamsCondition] `json:"conditions"` - // Specifies when the rules should stop applying rules based on the date. - EffectiveEndDate param.Field[string] `json:"effective_end_date"` - // Specifies when the rule should begin applying based on the date. - EffectiveStartDate param.Field[string] `json:"effective_start_date"` - // The entity type to which the rule is applied. - EntityType param.Field[HRISCompanyPayStatementItemRuleNewParamsEntityType] `json:"entity_type"` -} - -func (r HRISCompanyPayStatementItemRuleNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// URLQuery serializes [HRISCompanyPayStatementItemRuleNewParams]'s query -// parameters as `url.Values`. -func (r HRISCompanyPayStatementItemRuleNewParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatBrackets, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// Specifies the fields to be applied when the condition is met. -type HRISCompanyPayStatementItemRuleNewParamsAttributes struct { - // The metadata to be attached in the entity. It is a key-value pairs where the - // values can be of any type (string, number, boolean, object, array, etc.). - Metadata param.Field[map[string]interface{}] `json:"metadata"` -} - -func (r HRISCompanyPayStatementItemRuleNewParamsAttributes) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type HRISCompanyPayStatementItemRuleNewParamsCondition struct { - // The field to be checked in the rule. - Field param.Field[string] `json:"field"` - // The operator to be used in the rule. - Operator param.Field[HRISCompanyPayStatementItemRuleNewParamsConditionsOperator] `json:"operator"` - // The value of the field to be checked in the rule. - Value param.Field[string] `json:"value"` -} - -func (r HRISCompanyPayStatementItemRuleNewParamsCondition) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// The operator to be used in the rule. -type HRISCompanyPayStatementItemRuleNewParamsConditionsOperator string - -const ( - HRISCompanyPayStatementItemRuleNewParamsConditionsOperatorEquals HRISCompanyPayStatementItemRuleNewParamsConditionsOperator = "equals" -) - -func (r HRISCompanyPayStatementItemRuleNewParamsConditionsOperator) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleNewParamsConditionsOperatorEquals: - return true - } - return false -} - -// The entity type to which the rule is applied. -type HRISCompanyPayStatementItemRuleNewParamsEntityType string - -const ( - HRISCompanyPayStatementItemRuleNewParamsEntityTypePayStatementItem HRISCompanyPayStatementItemRuleNewParamsEntityType = "pay_statement_item" -) - -func (r HRISCompanyPayStatementItemRuleNewParamsEntityType) IsKnown() bool { - switch r { - case HRISCompanyPayStatementItemRuleNewParamsEntityTypePayStatementItem: - return true - } - return false -} - -type HRISCompanyPayStatementItemRuleUpdateParams struct { - // The entity IDs to update the rule for. - EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` - OptionalProperty param.Field[interface{}] `json:"optionalProperty"` -} - -func (r HRISCompanyPayStatementItemRuleUpdateParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// URLQuery serializes [HRISCompanyPayStatementItemRuleUpdateParams]'s query -// parameters as `url.Values`. -func (r HRISCompanyPayStatementItemRuleUpdateParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatBrackets, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type HRISCompanyPayStatementItemRuleListParams struct { - // The entity IDs to retrieve rules for. - EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` -} - -// URLQuery serializes [HRISCompanyPayStatementItemRuleListParams]'s query -// parameters as `url.Values`. -func (r HRISCompanyPayStatementItemRuleListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatBrackets, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -type HRISCompanyPayStatementItemRuleDeleteParams struct { - // The entity IDs to delete the rule for. - EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` -} - -// URLQuery serializes [HRISCompanyPayStatementItemRuleDeleteParams]'s query -// parameters as `url.Values`. -func (r HRISCompanyPayStatementItemRuleDeleteParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatBrackets, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} diff --git a/hrisdirectory.go b/hrisdirectory.go index f80fb4f3..9ebdf7d0 100644 --- a/hrisdirectory.go +++ b/hrisdirectory.go @@ -9,12 +9,12 @@ import ( "slices" "strconv" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" ) // HRISDirectoryService contains methods and other services that help with diff --git a/hrisdirectory_test.go b/hrisdirectory_test.go index 70d90d5b..bf659de8 100644 --- a/hrisdirectory_test.go +++ b/hrisdirectory_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISDirectoryListWithOptionalParams(t *testing.T) { diff --git a/hrisdocument.go b/hrisdocument.go index d04d412e..04fec7ae 100644 --- a/hrisdocument.go +++ b/hrisdocument.go @@ -11,12 +11,12 @@ import ( "reflect" "slices" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/hrisdocument_test.go b/hrisdocument_test.go index 9b1257cc..e1c6cbfe 100644 --- a/hrisdocument_test.go +++ b/hrisdocument_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISDocumentListWithOptionalParams(t *testing.T) { diff --git a/hrisemployment.go b/hrisemployment.go index 244d6d1f..9f969946 100644 --- a/hrisemployment.go +++ b/hrisemployment.go @@ -9,13 +9,13 @@ import ( "reflect" "slices" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" + "github.com/Finch-API/finch-api-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/hrisemployment_test.go b/hrisemployment_test.go index e3d618e7..1851537a 100644 --- a/hrisemployment_test.go +++ b/hrisemployment_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISEmploymentGetManyWithOptionalParams(t *testing.T) { diff --git a/hrisindividual.go b/hrisindividual.go index 7cfa92e2..dde8e87e 100644 --- a/hrisindividual.go +++ b/hrisindividual.go @@ -9,12 +9,12 @@ import ( "reflect" "slices" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" "github.com/tidwall/gjson" ) diff --git a/hrisindividual_test.go b/hrisindividual_test.go index 52b4b245..6185afed 100644 --- a/hrisindividual_test.go +++ b/hrisindividual_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISIndividualGetManyWithOptionalParams(t *testing.T) { diff --git a/hrispayment.go b/hrispayment.go index 288d7d63..01f7fce2 100644 --- a/hrispayment.go +++ b/hrispayment.go @@ -9,12 +9,12 @@ import ( "slices" "time" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" ) // HRISPaymentService contains methods and other services that help with diff --git a/hrispayment_test.go b/hrispayment_test.go index 89244d4d..f362afe4 100644 --- a/hrispayment_test.go +++ b/hrispayment_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISPaymentListWithOptionalParams(t *testing.T) { diff --git a/hrispaystatement.go b/hrispaystatement.go index c55d3995..1348dc3f 100644 --- a/hrispaystatement.go +++ b/hrispaystatement.go @@ -9,12 +9,12 @@ import ( "reflect" "slices" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" "github.com/tidwall/gjson" ) diff --git a/hrispaystatement_test.go b/hrispaystatement_test.go index 455ffa4f..48b37479 100644 --- a/hrispaystatement_test.go +++ b/hrispaystatement_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestHRISPayStatementGetManyWithOptionalParams(t *testing.T) { diff --git a/hrispaystatementitem.go b/hrispaystatementitem.go new file mode 100644 index 00000000..b6a9c8a5 --- /dev/null +++ b/hrispaystatementitem.go @@ -0,0 +1,190 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package finchgo + +import ( + "context" + "net/http" + "net/url" + "slices" + "time" + + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" +) + +// HRISPayStatementItemService 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 [NewHRISPayStatementItemService] method instead. +type HRISPayStatementItemService struct { + Options []option.RequestOption + Rules *HRISPayStatementItemRuleService +} + +// NewHRISPayStatementItemService 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 NewHRISPayStatementItemService(opts ...option.RequestOption) (r *HRISPayStatementItemService) { + r = &HRISPayStatementItemService{} + r.Options = opts + r.Rules = NewHRISPayStatementItemRuleService(opts...) + return +} + +// Retrieve a list of detailed pay statement items for the access token's +// connection account. +func (r *HRISPayStatementItemService) List(ctx context.Context, query HRISPayStatementItemListParams, opts ...option.RequestOption) (res *pagination.ResponsesPage[HRISPayStatementItemListResponse], err error) { + var raw *http.Response + var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} + opts = slices.Concat(preClientOpts, r.Options, opts) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "employer/pay-statement-item" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// Retrieve a list of detailed pay statement items for the access token's +// connection account. +func (r *HRISPayStatementItemService) ListAutoPaging(ctx context.Context, query HRISPayStatementItemListParams, opts ...option.RequestOption) *pagination.ResponsesPageAutoPager[HRISPayStatementItemListResponse] { + return pagination.NewResponsesPageAutoPager(r.List(ctx, query, opts...)) +} + +type HRISPayStatementItemListResponse struct { + // The attributes of the pay statement item. + Attributes HRISPayStatementItemListResponseAttributes `json:"attributes" api:"required"` + // The category of the pay statement item. + Category HRISPayStatementItemListResponseCategory `json:"category" api:"required"` + // The name of the pay statement item. + Name string `json:"name" api:"required"` + JSON hrisPayStatementItemListResponseJSON `json:"-"` +} + +// hrisPayStatementItemListResponseJSON contains the JSON metadata for the struct +// [HRISPayStatementItemListResponse] +type hrisPayStatementItemListResponseJSON struct { + Attributes apijson.Field + Category apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemListResponseJSON) RawJSON() string { + return r.raw +} + +// The attributes of the pay statement item. +type HRISPayStatementItemListResponseAttributes struct { + // The metadata of the pay statement item derived by the rules engine if available. + // Each attribute will be a key-value pair defined by a rule. + Metadata map[string]interface{} `json:"metadata" api:"required,nullable"` + // `true` if the amount is paid by the employers. This field is only available for + // taxes. + Employer bool `json:"employer" api:"nullable"` + // `true` if the pay statement item is pre-tax. This field is only available for + // employee deductions. + PreTax bool `json:"pre_tax" api:"nullable"` + // The type of the pay statement item. + Type string `json:"type" api:"nullable"` + JSON hrisPayStatementItemListResponseAttributesJSON `json:"-"` +} + +// hrisPayStatementItemListResponseAttributesJSON contains the JSON metadata for +// the struct [HRISPayStatementItemListResponseAttributes] +type hrisPayStatementItemListResponseAttributesJSON struct { + Metadata apijson.Field + Employer apijson.Field + PreTax apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemListResponseAttributes) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemListResponseAttributesJSON) RawJSON() string { + return r.raw +} + +// The category of the pay statement item. +type HRISPayStatementItemListResponseCategory string + +const ( + HRISPayStatementItemListResponseCategoryEarnings HRISPayStatementItemListResponseCategory = "earnings" + HRISPayStatementItemListResponseCategoryTaxes HRISPayStatementItemListResponseCategory = "taxes" + HRISPayStatementItemListResponseCategoryEmployeeDeductions HRISPayStatementItemListResponseCategory = "employee_deductions" + HRISPayStatementItemListResponseCategoryEmployerContributions HRISPayStatementItemListResponseCategory = "employer_contributions" +) + +func (r HRISPayStatementItemListResponseCategory) IsKnown() bool { + switch r { + case HRISPayStatementItemListResponseCategoryEarnings, HRISPayStatementItemListResponseCategoryTaxes, HRISPayStatementItemListResponseCategoryEmployeeDeductions, HRISPayStatementItemListResponseCategoryEmployerContributions: + return true + } + return false +} + +type HRISPayStatementItemListParams struct { + // Comma-delimited list of pay statement item categories to filter on. If empty, + // defaults to all categories. + Categories param.Field[[]HRISPayStatementItemListParamsCategory] `query:"categories"` + // The end date to retrieve pay statement items by via their last seen pay date in + // `YYYY-MM-DD` format. + EndDate param.Field[time.Time] `query:"end_date" format:"date"` + // The entity IDs to specify which entities' data to access. + EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` + // Case-insensitive partial match search by pay statement item name. + Name param.Field[string] `query:"name"` + // The start date to retrieve pay statement items by via their last seen pay date + // (inclusive) in `YYYY-MM-DD` format. + StartDate param.Field[time.Time] `query:"start_date" format:"date"` + // String search by pay statement item type. + Type param.Field[string] `query:"type"` +} + +// URLQuery serializes [HRISPayStatementItemListParams]'s query parameters as +// `url.Values`. +func (r HRISPayStatementItemListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatBrackets, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type HRISPayStatementItemListParamsCategory string + +const ( + HRISPayStatementItemListParamsCategoryEarnings HRISPayStatementItemListParamsCategory = "earnings" + HRISPayStatementItemListParamsCategoryTaxes HRISPayStatementItemListParamsCategory = "taxes" + HRISPayStatementItemListParamsCategoryEmployeeDeductions HRISPayStatementItemListParamsCategory = "employee_deductions" + HRISPayStatementItemListParamsCategoryEmployerContributions HRISPayStatementItemListParamsCategory = "employer_contributions" +) + +func (r HRISPayStatementItemListParamsCategory) IsKnown() bool { + switch r { + case HRISPayStatementItemListParamsCategoryEarnings, HRISPayStatementItemListParamsCategoryTaxes, HRISPayStatementItemListParamsCategoryEmployeeDeductions, HRISPayStatementItemListParamsCategoryEmployerContributions: + return true + } + return false +} diff --git a/hriscompanypaystatementitem_test.go b/hrispaystatementitem_test.go similarity index 67% rename from hriscompanypaystatementitem_test.go rename to hrispaystatementitem_test.go index 0685b08c..d400ddcc 100644 --- a/hriscompanypaystatementitem_test.go +++ b/hrispaystatementitem_test.go @@ -9,12 +9,12 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) -func TestHRISCompanyPayStatementItemListWithOptionalParams(t *testing.T) { +func TestHRISPayStatementItemListWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -28,8 +28,8 @@ func TestHRISCompanyPayStatementItemListWithOptionalParams(t *testing.T) { option.WithClientID("4ab15e51-11ad-49f4-acae-f343b7794375"), option.WithClientSecret("My Client Secret"), ) - _, err := client.HRIS.Company.PayStatementItem.List(context.TODO(), finchgo.HRISCompanyPayStatementItemListParams{ - Categories: finchgo.F([]finchgo.HRISCompanyPayStatementItemListParamsCategory{finchgo.HRISCompanyPayStatementItemListParamsCategoryEarnings}), + _, err := client.HRIS.PayStatementItem.List(context.TODO(), finchgo.HRISPayStatementItemListParams{ + Categories: finchgo.F([]finchgo.HRISPayStatementItemListParamsCategory{finchgo.HRISPayStatementItemListParamsCategoryEarnings}), EndDate: finchgo.F(time.Now()), EntityIDs: finchgo.F([]string{"550e8400-e29b-41d4-a716-446655440000"}), Name: finchgo.F("name"), diff --git a/hrispaystatementitemrule.go b/hrispaystatementitemrule.go new file mode 100644 index 00000000..faabbb66 --- /dev/null +++ b/hrispaystatementitemrule.go @@ -0,0 +1,740 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package finchgo + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "slices" + "time" + + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" +) + +// HRISPayStatementItemRuleService 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 [NewHRISPayStatementItemRuleService] method instead. +type HRISPayStatementItemRuleService struct { + Options []option.RequestOption +} + +// NewHRISPayStatementItemRuleService 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 NewHRISPayStatementItemRuleService(opts ...option.RequestOption) (r *HRISPayStatementItemRuleService) { + r = &HRISPayStatementItemRuleService{} + r.Options = opts + return +} + +// Custom rules can be created to associate specific attributes to pay statement +// items depending on the use case. For example, pay statement items that meet +// certain conditions can be labeled as a pre-tax 401k. This metadata can be +// retrieved where pay statement item information is available. +func (r *HRISPayStatementItemRuleService) New(ctx context.Context, params HRISPayStatementItemRuleNewParams, opts ...option.RequestOption) (res *HRISPayStatementItemRuleNewResponse, err error) { + var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} + opts = slices.Concat(preClientOpts, r.Options, opts) + path := "employer/pay-statement-item/rule" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...) + return res, err +} + +// Update a rule for a pay statement item. +func (r *HRISPayStatementItemRuleService) Update(ctx context.Context, ruleID string, params HRISPayStatementItemRuleUpdateParams, opts ...option.RequestOption) (res *HRISPayStatementItemRuleUpdateResponse, err error) { + var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} + opts = slices.Concat(preClientOpts, r.Options, opts) + if ruleID == "" { + err = errors.New("missing required rule_id parameter") + return nil, err + } + path := fmt.Sprintf("employer/pay-statement-item/rule/%s", ruleID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...) + return res, err +} + +// List all rules of a connection account. +func (r *HRISPayStatementItemRuleService) List(ctx context.Context, query HRISPayStatementItemRuleListParams, opts ...option.RequestOption) (res *pagination.ResponsesPage[HRISPayStatementItemRuleListResponse], err error) { + var raw *http.Response + var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} + opts = slices.Concat(preClientOpts, r.Options, opts) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := "employer/pay-statement-item/rule" + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// List all rules of a connection account. +func (r *HRISPayStatementItemRuleService) ListAutoPaging(ctx context.Context, query HRISPayStatementItemRuleListParams, opts ...option.RequestOption) *pagination.ResponsesPageAutoPager[HRISPayStatementItemRuleListResponse] { + return pagination.NewResponsesPageAutoPager(r.List(ctx, query, opts...)) +} + +// Delete a rule for a pay statement item. +func (r *HRISPayStatementItemRuleService) Delete(ctx context.Context, ruleID string, body HRISPayStatementItemRuleDeleteParams, opts ...option.RequestOption) (res *HRISPayStatementItemRuleDeleteResponse, err error) { + var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()} + opts = slices.Concat(preClientOpts, r.Options, opts) + if ruleID == "" { + err = errors.New("missing required rule_id parameter") + return nil, err + } + path := fmt.Sprintf("employer/pay-statement-item/rule/%s", ruleID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...) + return res, err +} + +type HRISPayStatementItemRuleNewResponse struct { + // Finch id (uuidv4) for the rule. + ID string `json:"id"` + // Specifies the fields to be applied when the condition is met. + Attributes HRISPayStatementItemRuleNewResponseAttributes `json:"attributes"` + Conditions []HRISPayStatementItemRuleNewResponseCondition `json:"conditions"` + // The datetime when the rule was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Specifies when the rules should stop applying rules based on the date. + EffectiveEndDate string `json:"effective_end_date" api:"nullable"` + // Specifies when the rule should begin applying based on the date. + EffectiveStartDate string `json:"effective_start_date" api:"nullable"` + // The entity type to which the rule is applied. + EntityType HRISPayStatementItemRuleNewResponseEntityType `json:"entity_type"` + // The priority of the rule. + Priority int64 `json:"priority"` + // The datetime when the rule was last updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON hrisPayStatementItemRuleNewResponseJSON `json:"-"` +} + +// hrisPayStatementItemRuleNewResponseJSON contains the JSON metadata for the +// struct [HRISPayStatementItemRuleNewResponse] +type hrisPayStatementItemRuleNewResponseJSON struct { + ID apijson.Field + Attributes apijson.Field + Conditions apijson.Field + CreatedAt apijson.Field + EffectiveEndDate apijson.Field + EffectiveStartDate apijson.Field + EntityType apijson.Field + Priority apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleNewResponseJSON) RawJSON() string { + return r.raw +} + +// Specifies the fields to be applied when the condition is met. +type HRISPayStatementItemRuleNewResponseAttributes struct { + // The metadata to be attached in the entity. It is a key-value pairs where the + // values can be of any type (string, number, boolean, object, array, etc.). + Metadata map[string]interface{} `json:"metadata"` + JSON hrisPayStatementItemRuleNewResponseAttributesJSON `json:"-"` +} + +// hrisPayStatementItemRuleNewResponseAttributesJSON contains the JSON metadata for +// the struct [HRISPayStatementItemRuleNewResponseAttributes] +type hrisPayStatementItemRuleNewResponseAttributesJSON struct { + Metadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleNewResponseAttributes) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleNewResponseAttributesJSON) RawJSON() string { + return r.raw +} + +type HRISPayStatementItemRuleNewResponseCondition struct { + // The field to be checked in the rule. + Field string `json:"field"` + // The operator to be used in the rule. + Operator HRISPayStatementItemRuleNewResponseConditionsOperator `json:"operator"` + // The value of the field to be checked in the rule. + Value string `json:"value"` + JSON hrisPayStatementItemRuleNewResponseConditionJSON `json:"-"` +} + +// hrisPayStatementItemRuleNewResponseConditionJSON contains the JSON metadata for +// the struct [HRISPayStatementItemRuleNewResponseCondition] +type hrisPayStatementItemRuleNewResponseConditionJSON struct { + Field apijson.Field + Operator apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleNewResponseCondition) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleNewResponseConditionJSON) RawJSON() string { + return r.raw +} + +// The operator to be used in the rule. +type HRISPayStatementItemRuleNewResponseConditionsOperator string + +const ( + HRISPayStatementItemRuleNewResponseConditionsOperatorEquals HRISPayStatementItemRuleNewResponseConditionsOperator = "equals" +) + +func (r HRISPayStatementItemRuleNewResponseConditionsOperator) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleNewResponseConditionsOperatorEquals: + return true + } + return false +} + +// The entity type to which the rule is applied. +type HRISPayStatementItemRuleNewResponseEntityType string + +const ( + HRISPayStatementItemRuleNewResponseEntityTypePayStatementItem HRISPayStatementItemRuleNewResponseEntityType = "pay_statement_item" +) + +func (r HRISPayStatementItemRuleNewResponseEntityType) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleNewResponseEntityTypePayStatementItem: + return true + } + return false +} + +type HRISPayStatementItemRuleUpdateResponse struct { + // Finch id (uuidv4) for the rule. + ID string `json:"id" format:"uuid"` + // Specifies the fields to be applied when the condition is met. + Attributes HRISPayStatementItemRuleUpdateResponseAttributes `json:"attributes"` + Conditions []HRISPayStatementItemRuleUpdateResponseCondition `json:"conditions"` + // The datetime when the rule was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Specifies when the rules should stop applying rules based on the date. + EffectiveEndDate string `json:"effective_end_date" api:"nullable"` + // Specifies when the rule should begin applying based on the date. + EffectiveStartDate string `json:"effective_start_date" api:"nullable"` + // The entity type to which the rule is applied. + EntityType HRISPayStatementItemRuleUpdateResponseEntityType `json:"entity_type"` + // The priority of the rule. + Priority int64 `json:"priority"` + // The datetime when the rule was last updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON hrisPayStatementItemRuleUpdateResponseJSON `json:"-"` +} + +// hrisPayStatementItemRuleUpdateResponseJSON contains the JSON metadata for the +// struct [HRISPayStatementItemRuleUpdateResponse] +type hrisPayStatementItemRuleUpdateResponseJSON struct { + ID apijson.Field + Attributes apijson.Field + Conditions apijson.Field + CreatedAt apijson.Field + EffectiveEndDate apijson.Field + EffectiveStartDate apijson.Field + EntityType apijson.Field + Priority apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleUpdateResponseJSON) RawJSON() string { + return r.raw +} + +// Specifies the fields to be applied when the condition is met. +type HRISPayStatementItemRuleUpdateResponseAttributes struct { + // The metadata to be attached in the entity. It is a key-value pairs where the + // values can be of any type (string, number, boolean, object, array, etc.). + Metadata map[string]interface{} `json:"metadata"` + JSON hrisPayStatementItemRuleUpdateResponseAttributesJSON `json:"-"` +} + +// hrisPayStatementItemRuleUpdateResponseAttributesJSON contains the JSON metadata +// for the struct [HRISPayStatementItemRuleUpdateResponseAttributes] +type hrisPayStatementItemRuleUpdateResponseAttributesJSON struct { + Metadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleUpdateResponseAttributes) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleUpdateResponseAttributesJSON) RawJSON() string { + return r.raw +} + +type HRISPayStatementItemRuleUpdateResponseCondition struct { + // The field to be checked in the rule. + Field string `json:"field"` + // The operator to be used in the rule. + Operator HRISPayStatementItemRuleUpdateResponseConditionsOperator `json:"operator"` + // The value of the field to be checked in the rule. + Value string `json:"value"` + JSON hrisPayStatementItemRuleUpdateResponseConditionJSON `json:"-"` +} + +// hrisPayStatementItemRuleUpdateResponseConditionJSON contains the JSON metadata +// for the struct [HRISPayStatementItemRuleUpdateResponseCondition] +type hrisPayStatementItemRuleUpdateResponseConditionJSON struct { + Field apijson.Field + Operator apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleUpdateResponseCondition) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleUpdateResponseConditionJSON) RawJSON() string { + return r.raw +} + +// The operator to be used in the rule. +type HRISPayStatementItemRuleUpdateResponseConditionsOperator string + +const ( + HRISPayStatementItemRuleUpdateResponseConditionsOperatorEquals HRISPayStatementItemRuleUpdateResponseConditionsOperator = "equals" +) + +func (r HRISPayStatementItemRuleUpdateResponseConditionsOperator) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleUpdateResponseConditionsOperatorEquals: + return true + } + return false +} + +// The entity type to which the rule is applied. +type HRISPayStatementItemRuleUpdateResponseEntityType string + +const ( + HRISPayStatementItemRuleUpdateResponseEntityTypePayStatementItem HRISPayStatementItemRuleUpdateResponseEntityType = "pay_statement_item" +) + +func (r HRISPayStatementItemRuleUpdateResponseEntityType) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleUpdateResponseEntityTypePayStatementItem: + return true + } + return false +} + +type HRISPayStatementItemRuleListResponse struct { + // Finch id (uuidv4) for the rule. + ID string `json:"id"` + // Specifies the fields to be applied when the condition is met. + Attributes HRISPayStatementItemRuleListResponseAttributes `json:"attributes"` + Conditions []HRISPayStatementItemRuleListResponseCondition `json:"conditions"` + // The datetime when the rule was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Specifies when the rules should stop applying rules based on the date. + EffectiveEndDate string `json:"effective_end_date" api:"nullable"` + // Specifies when the rule should begin applying based on the date. + EffectiveStartDate string `json:"effective_start_date" api:"nullable"` + // The entity type to which the rule is applied. + EntityType HRISPayStatementItemRuleListResponseEntityType `json:"entity_type"` + // The priority of the rule. + Priority int64 `json:"priority"` + // The datetime when the rule was last updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON hrisPayStatementItemRuleListResponseJSON `json:"-"` +} + +// hrisPayStatementItemRuleListResponseJSON contains the JSON metadata for the +// struct [HRISPayStatementItemRuleListResponse] +type hrisPayStatementItemRuleListResponseJSON struct { + ID apijson.Field + Attributes apijson.Field + Conditions apijson.Field + CreatedAt apijson.Field + EffectiveEndDate apijson.Field + EffectiveStartDate apijson.Field + EntityType apijson.Field + Priority apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleListResponseJSON) RawJSON() string { + return r.raw +} + +// Specifies the fields to be applied when the condition is met. +type HRISPayStatementItemRuleListResponseAttributes struct { + // The metadata to be attached in the entity. It is a key-value pairs where the + // values can be of any type (string, number, boolean, object, array, etc.). + Metadata map[string]interface{} `json:"metadata"` + JSON hrisPayStatementItemRuleListResponseAttributesJSON `json:"-"` +} + +// hrisPayStatementItemRuleListResponseAttributesJSON contains the JSON metadata +// for the struct [HRISPayStatementItemRuleListResponseAttributes] +type hrisPayStatementItemRuleListResponseAttributesJSON struct { + Metadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleListResponseAttributes) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleListResponseAttributesJSON) RawJSON() string { + return r.raw +} + +type HRISPayStatementItemRuleListResponseCondition struct { + // The field to be checked in the rule. + Field string `json:"field"` + // The operator to be used in the rule. + Operator HRISPayStatementItemRuleListResponseConditionsOperator `json:"operator"` + // The value of the field to be checked in the rule. + Value string `json:"value"` + JSON hrisPayStatementItemRuleListResponseConditionJSON `json:"-"` +} + +// hrisPayStatementItemRuleListResponseConditionJSON contains the JSON metadata for +// the struct [HRISPayStatementItemRuleListResponseCondition] +type hrisPayStatementItemRuleListResponseConditionJSON struct { + Field apijson.Field + Operator apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleListResponseCondition) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleListResponseConditionJSON) RawJSON() string { + return r.raw +} + +// The operator to be used in the rule. +type HRISPayStatementItemRuleListResponseConditionsOperator string + +const ( + HRISPayStatementItemRuleListResponseConditionsOperatorEquals HRISPayStatementItemRuleListResponseConditionsOperator = "equals" +) + +func (r HRISPayStatementItemRuleListResponseConditionsOperator) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleListResponseConditionsOperatorEquals: + return true + } + return false +} + +// The entity type to which the rule is applied. +type HRISPayStatementItemRuleListResponseEntityType string + +const ( + HRISPayStatementItemRuleListResponseEntityTypePayStatementItem HRISPayStatementItemRuleListResponseEntityType = "pay_statement_item" +) + +func (r HRISPayStatementItemRuleListResponseEntityType) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleListResponseEntityTypePayStatementItem: + return true + } + return false +} + +type HRISPayStatementItemRuleDeleteResponse struct { + // Finch id (uuidv4) for the rule. + ID string `json:"id" format:"uuid"` + // Specifies the fields to be applied when the condition is met. + Attributes HRISPayStatementItemRuleDeleteResponseAttributes `json:"attributes"` + Conditions []HRISPayStatementItemRuleDeleteResponseCondition `json:"conditions"` + // The datetime when the rule was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // The datetime when the rule was deleted. + DeletedAt time.Time `json:"deleted_at" format:"date-time"` + // Specifies when the rules should stop applying rules based on the date. + EffectiveEndDate string `json:"effective_end_date" api:"nullable"` + // Specifies when the rule should begin applying based on the date. + EffectiveStartDate string `json:"effective_start_date" api:"nullable"` + // The entity type to which the rule is applied. + EntityType HRISPayStatementItemRuleDeleteResponseEntityType `json:"entity_type"` + // The priority of the rule. + Priority int64 `json:"priority"` + // The datetime when the rule was last updated. + UpdatedAt time.Time `json:"updated_at" format:"date-time"` + JSON hrisPayStatementItemRuleDeleteResponseJSON `json:"-"` +} + +// hrisPayStatementItemRuleDeleteResponseJSON contains the JSON metadata for the +// struct [HRISPayStatementItemRuleDeleteResponse] +type hrisPayStatementItemRuleDeleteResponseJSON struct { + ID apijson.Field + Attributes apijson.Field + Conditions apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + EffectiveEndDate apijson.Field + EffectiveStartDate apijson.Field + EntityType apijson.Field + Priority apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleDeleteResponseJSON) RawJSON() string { + return r.raw +} + +// Specifies the fields to be applied when the condition is met. +type HRISPayStatementItemRuleDeleteResponseAttributes struct { + // The metadata to be attached in the entity. It is a key-value pairs where the + // values can be of any type (string, number, boolean, object, array, etc.). + Metadata map[string]interface{} `json:"metadata"` + JSON hrisPayStatementItemRuleDeleteResponseAttributesJSON `json:"-"` +} + +// hrisPayStatementItemRuleDeleteResponseAttributesJSON contains the JSON metadata +// for the struct [HRISPayStatementItemRuleDeleteResponseAttributes] +type hrisPayStatementItemRuleDeleteResponseAttributesJSON struct { + Metadata apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleDeleteResponseAttributes) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleDeleteResponseAttributesJSON) RawJSON() string { + return r.raw +} + +type HRISPayStatementItemRuleDeleteResponseCondition struct { + // The field to be checked in the rule. + Field string `json:"field"` + // The operator to be used in the rule. + Operator HRISPayStatementItemRuleDeleteResponseConditionsOperator `json:"operator"` + // The value of the field to be checked in the rule. + Value string `json:"value"` + JSON hrisPayStatementItemRuleDeleteResponseConditionJSON `json:"-"` +} + +// hrisPayStatementItemRuleDeleteResponseConditionJSON contains the JSON metadata +// for the struct [HRISPayStatementItemRuleDeleteResponseCondition] +type hrisPayStatementItemRuleDeleteResponseConditionJSON struct { + Field apijson.Field + Operator apijson.Field + Value apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HRISPayStatementItemRuleDeleteResponseCondition) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r hrisPayStatementItemRuleDeleteResponseConditionJSON) RawJSON() string { + return r.raw +} + +// The operator to be used in the rule. +type HRISPayStatementItemRuleDeleteResponseConditionsOperator string + +const ( + HRISPayStatementItemRuleDeleteResponseConditionsOperatorEquals HRISPayStatementItemRuleDeleteResponseConditionsOperator = "equals" +) + +func (r HRISPayStatementItemRuleDeleteResponseConditionsOperator) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleDeleteResponseConditionsOperatorEquals: + return true + } + return false +} + +// The entity type to which the rule is applied. +type HRISPayStatementItemRuleDeleteResponseEntityType string + +const ( + HRISPayStatementItemRuleDeleteResponseEntityTypePayStatementItem HRISPayStatementItemRuleDeleteResponseEntityType = "pay_statement_item" +) + +func (r HRISPayStatementItemRuleDeleteResponseEntityType) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleDeleteResponseEntityTypePayStatementItem: + return true + } + return false +} + +type HRISPayStatementItemRuleNewParams struct { + // The entity IDs to create the rule for. + EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` + // Specifies the fields to be applied when the condition is met. + Attributes param.Field[HRISPayStatementItemRuleNewParamsAttributes] `json:"attributes"` + Conditions param.Field[[]HRISPayStatementItemRuleNewParamsCondition] `json:"conditions"` + // Specifies when the rules should stop applying rules based on the date. + EffectiveEndDate param.Field[string] `json:"effective_end_date"` + // Specifies when the rule should begin applying based on the date. + EffectiveStartDate param.Field[string] `json:"effective_start_date"` + // The entity type to which the rule is applied. + EntityType param.Field[HRISPayStatementItemRuleNewParamsEntityType] `json:"entity_type"` +} + +func (r HRISPayStatementItemRuleNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// URLQuery serializes [HRISPayStatementItemRuleNewParams]'s query parameters as +// `url.Values`. +func (r HRISPayStatementItemRuleNewParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatBrackets, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// Specifies the fields to be applied when the condition is met. +type HRISPayStatementItemRuleNewParamsAttributes struct { + // The metadata to be attached in the entity. It is a key-value pairs where the + // values can be of any type (string, number, boolean, object, array, etc.). + Metadata param.Field[map[string]interface{}] `json:"metadata"` +} + +func (r HRISPayStatementItemRuleNewParamsAttributes) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type HRISPayStatementItemRuleNewParamsCondition struct { + // The field to be checked in the rule. + Field param.Field[string] `json:"field"` + // The operator to be used in the rule. + Operator param.Field[HRISPayStatementItemRuleNewParamsConditionsOperator] `json:"operator"` + // The value of the field to be checked in the rule. + Value param.Field[string] `json:"value"` +} + +func (r HRISPayStatementItemRuleNewParamsCondition) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// The operator to be used in the rule. +type HRISPayStatementItemRuleNewParamsConditionsOperator string + +const ( + HRISPayStatementItemRuleNewParamsConditionsOperatorEquals HRISPayStatementItemRuleNewParamsConditionsOperator = "equals" +) + +func (r HRISPayStatementItemRuleNewParamsConditionsOperator) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleNewParamsConditionsOperatorEquals: + return true + } + return false +} + +// The entity type to which the rule is applied. +type HRISPayStatementItemRuleNewParamsEntityType string + +const ( + HRISPayStatementItemRuleNewParamsEntityTypePayStatementItem HRISPayStatementItemRuleNewParamsEntityType = "pay_statement_item" +) + +func (r HRISPayStatementItemRuleNewParamsEntityType) IsKnown() bool { + switch r { + case HRISPayStatementItemRuleNewParamsEntityTypePayStatementItem: + return true + } + return false +} + +type HRISPayStatementItemRuleUpdateParams struct { + // The entity IDs to update the rule for. + EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` + OptionalProperty param.Field[interface{}] `json:"optionalProperty"` +} + +func (r HRISPayStatementItemRuleUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// URLQuery serializes [HRISPayStatementItemRuleUpdateParams]'s query parameters as +// `url.Values`. +func (r HRISPayStatementItemRuleUpdateParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatBrackets, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type HRISPayStatementItemRuleListParams struct { + // The entity IDs to retrieve rules for. + EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` +} + +// URLQuery serializes [HRISPayStatementItemRuleListParams]'s query parameters as +// `url.Values`. +func (r HRISPayStatementItemRuleListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatBrackets, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type HRISPayStatementItemRuleDeleteParams struct { + // The entity IDs to delete the rule for. + EntityIDs param.Field[[]string] `query:"entity_ids" format:"uuid"` +} + +// URLQuery serializes [HRISPayStatementItemRuleDeleteParams]'s query parameters as +// `url.Values`. +func (r HRISPayStatementItemRuleDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatBrackets, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} diff --git a/hriscompanypaystatementitemrule_test.go b/hrispaystatementitemrule_test.go similarity index 70% rename from hriscompanypaystatementitemrule_test.go rename to hrispaystatementitemrule_test.go index 7d61be57..d99c032b 100644 --- a/hriscompanypaystatementitemrule_test.go +++ b/hrispaystatementitemrule_test.go @@ -8,12 +8,12 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) -func TestHRISCompanyPayStatementItemRuleNewWithOptionalParams(t *testing.T) { +func TestHRISPayStatementItemRuleNewWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -27,21 +27,21 @@ func TestHRISCompanyPayStatementItemRuleNewWithOptionalParams(t *testing.T) { option.WithClientID("4ab15e51-11ad-49f4-acae-f343b7794375"), option.WithClientSecret("My Client Secret"), ) - _, err := client.HRIS.Company.PayStatementItem.Rules.New(context.TODO(), finchgo.HRISCompanyPayStatementItemRuleNewParams{ + _, err := client.HRIS.PayStatementItem.Rules.New(context.TODO(), finchgo.HRISPayStatementItemRuleNewParams{ EntityIDs: finchgo.F([]string{"550e8400-e29b-41d4-a716-446655440000"}), - Attributes: finchgo.F(finchgo.HRISCompanyPayStatementItemRuleNewParamsAttributes{ + Attributes: finchgo.F(finchgo.HRISPayStatementItemRuleNewParamsAttributes{ Metadata: finchgo.F(map[string]interface{}{ "foo": "bar", }), }), - Conditions: finchgo.F([]finchgo.HRISCompanyPayStatementItemRuleNewParamsCondition{{ + Conditions: finchgo.F([]finchgo.HRISPayStatementItemRuleNewParamsCondition{{ Field: finchgo.F("field"), - Operator: finchgo.F(finchgo.HRISCompanyPayStatementItemRuleNewParamsConditionsOperatorEquals), + Operator: finchgo.F(finchgo.HRISPayStatementItemRuleNewParamsConditionsOperatorEquals), Value: finchgo.F("value"), }}), EffectiveEndDate: finchgo.F("effective_end_date"), EffectiveStartDate: finchgo.F("effective_start_date"), - EntityType: finchgo.F(finchgo.HRISCompanyPayStatementItemRuleNewParamsEntityTypePayStatementItem), + EntityType: finchgo.F(finchgo.HRISPayStatementItemRuleNewParamsEntityTypePayStatementItem), }) if err != nil { var apierr *finchgo.Error @@ -52,7 +52,7 @@ func TestHRISCompanyPayStatementItemRuleNewWithOptionalParams(t *testing.T) { } } -func TestHRISCompanyPayStatementItemRuleUpdateWithOptionalParams(t *testing.T) { +func TestHRISPayStatementItemRuleUpdateWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -66,10 +66,10 @@ func TestHRISCompanyPayStatementItemRuleUpdateWithOptionalParams(t *testing.T) { option.WithClientID("4ab15e51-11ad-49f4-acae-f343b7794375"), option.WithClientSecret("My Client Secret"), ) - _, err := client.HRIS.Company.PayStatementItem.Rules.Update( + _, err := client.HRIS.PayStatementItem.Rules.Update( context.TODO(), "rule_id", - finchgo.HRISCompanyPayStatementItemRuleUpdateParams{ + finchgo.HRISPayStatementItemRuleUpdateParams{ EntityIDs: finchgo.F([]string{"550e8400-e29b-41d4-a716-446655440000"}), OptionalProperty: finchgo.F[any](map[string]interface{}{}), }, @@ -83,7 +83,7 @@ func TestHRISCompanyPayStatementItemRuleUpdateWithOptionalParams(t *testing.T) { } } -func TestHRISCompanyPayStatementItemRuleListWithOptionalParams(t *testing.T) { +func TestHRISPayStatementItemRuleListWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -97,7 +97,7 @@ func TestHRISCompanyPayStatementItemRuleListWithOptionalParams(t *testing.T) { option.WithClientID("4ab15e51-11ad-49f4-acae-f343b7794375"), option.WithClientSecret("My Client Secret"), ) - _, err := client.HRIS.Company.PayStatementItem.Rules.List(context.TODO(), finchgo.HRISCompanyPayStatementItemRuleListParams{ + _, err := client.HRIS.PayStatementItem.Rules.List(context.TODO(), finchgo.HRISPayStatementItemRuleListParams{ EntityIDs: finchgo.F([]string{"550e8400-e29b-41d4-a716-446655440000"}), }) if err != nil { @@ -109,7 +109,7 @@ func TestHRISCompanyPayStatementItemRuleListWithOptionalParams(t *testing.T) { } } -func TestHRISCompanyPayStatementItemRuleDeleteWithOptionalParams(t *testing.T) { +func TestHRISPayStatementItemRuleDeleteWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -123,10 +123,10 @@ func TestHRISCompanyPayStatementItemRuleDeleteWithOptionalParams(t *testing.T) { option.WithClientID("4ab15e51-11ad-49f4-acae-f343b7794375"), option.WithClientSecret("My Client Secret"), ) - _, err := client.HRIS.Company.PayStatementItem.Rules.Delete( + _, err := client.HRIS.PayStatementItem.Rules.Delete( context.TODO(), "rule_id", - finchgo.HRISCompanyPayStatementItemRuleDeleteParams{ + finchgo.HRISPayStatementItemRuleDeleteParams{ EntityIDs: finchgo.F([]string{"550e8400-e29b-41d4-a716-446655440000"}), }, ) diff --git a/internal/apierror/apierror.go b/internal/apierror/apierror.go index 3e17985d..4936e128 100644 --- a/internal/apierror/apierror.go +++ b/internal/apierror/apierror.go @@ -7,7 +7,7 @@ import ( "net/http" "net/http/httputil" - "github.com/Finch-API/finch-api-go/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" ) // Error represents an error that originates from the API, i.e. when a request is diff --git a/internal/apiform/encoder.go b/internal/apiform/encoder.go index 2a551205..4d5464c3 100644 --- a/internal/apiform/encoder.go +++ b/internal/apiform/encoder.go @@ -13,7 +13,7 @@ import ( "sync" "time" - "github.com/Finch-API/finch-api-go/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/param" ) var encoders sync.Map // map[encoderEntry]encoderFunc diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go index e7a4a558..5490a51d 100644 --- a/internal/apijson/encoder.go +++ b/internal/apijson/encoder.go @@ -13,7 +13,7 @@ import ( "github.com/tidwall/sjson" - "github.com/Finch-API/finch-api-go/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/param" ) var encoders sync.Map // map[encoderEntry]encoderFunc diff --git a/internal/apijson/field_test.go b/internal/apijson/field_test.go index a9247591..b4633d80 100644 --- a/internal/apijson/field_test.go +++ b/internal/apijson/field_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/param" ) type Struct struct { diff --git a/internal/apiquery/encoder.go b/internal/apiquery/encoder.go index 9f2a9285..7eb5a8e9 100644 --- a/internal/apiquery/encoder.go +++ b/internal/apiquery/encoder.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/Finch-API/finch-api-go/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/param" ) var encoders sync.Map // map[reflect.Type]encoderFunc diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index 3ec2a788..0c86535a 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -19,11 +19,11 @@ import ( "strings" "time" - "github.com/Finch-API/finch-api-go/internal" - "github.com/Finch-API/finch-api-go/internal/apierror" - "github.com/Finch-API/finch-api-go/internal/apiform" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "github.com/Finch-API/finch-api-go/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal" + "github.com/Finch-API/finch-api-go/v2/internal/apierror" + "github.com/Finch-API/finch-api-go/v2/internal/apiform" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" ) func getDefaultHeaders() map[string]string { diff --git a/internal/version.go b/internal/version.go index be0140ea..fef66226 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "1.38.0" // x-release-please-version +const PackageVersion = "2.0.0" // x-release-please-version diff --git a/job.go b/job.go index 837c62be..7c7fa856 100644 --- a/job.go +++ b/job.go @@ -3,7 +3,7 @@ package finchgo import ( - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2/option" ) // JobService contains methods and other services that help with interacting with diff --git a/jobautomated.go b/jobautomated.go index 61165a83..97d2b4f4 100644 --- a/jobautomated.go +++ b/jobautomated.go @@ -11,11 +11,11 @@ import ( "slices" "time" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // JobAutomatedService contains methods and other services that help with diff --git a/jobautomated_test.go b/jobautomated_test.go index a4363544..a003a856 100644 --- a/jobautomated_test.go +++ b/jobautomated_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestJobAutomatedNew(t *testing.T) { diff --git a/jobmanual.go b/jobmanual.go index 254b365e..8d8cd602 100644 --- a/jobmanual.go +++ b/jobmanual.go @@ -9,9 +9,9 @@ import ( "net/http" "slices" - "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/option" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // JobManualService contains methods and other services that help with interacting diff --git a/jobmanual_test.go b/jobmanual_test.go index c707e08d..81fc4a2e 100644 --- a/jobmanual_test.go +++ b/jobmanual_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestJobManualGet(t *testing.T) { diff --git a/option/requestoption.go b/option/requestoption.go index 94f59fac..7bddc40d 100644 --- a/option/requestoption.go +++ b/option/requestoption.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "github.com/Finch-API/finch-api-go/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" "github.com/tidwall/sjson" ) diff --git a/packages/pagination/pagination.go b/packages/pagination/pagination.go index 5c5ba04d..5c7fa055 100644 --- a/packages/pagination/pagination.go +++ b/packages/pagination/pagination.go @@ -6,10 +6,10 @@ import ( "net/http" "strconv" - "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/option" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" ) type SinglePage[T any] struct { diff --git a/paginationauto_test.go b/paginationauto_test.go index 6471d4ce..e014713f 100644 --- a/paginationauto_test.go +++ b/paginationauto_test.go @@ -7,9 +7,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestAutoPagination(t *testing.T) { diff --git a/paginationmanual_test.go b/paginationmanual_test.go index 713a65c1..e3922991 100644 --- a/paginationmanual_test.go +++ b/paginationmanual_test.go @@ -7,9 +7,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestManualPagination(t *testing.T) { diff --git a/payroll.go b/payroll.go index aa9838dd..b5d073e0 100644 --- a/payroll.go +++ b/payroll.go @@ -3,7 +3,7 @@ package finchgo import ( - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2/option" ) // PayrollService contains methods and other services that help with interacting diff --git a/payrollpaygroup.go b/payrollpaygroup.go index bf22fdef..47acc451 100644 --- a/payrollpaygroup.go +++ b/payrollpaygroup.go @@ -10,12 +10,12 @@ import ( "net/url" "slices" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/internal/apiquery" - "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" - "github.com/Finch-API/finch-api-go/packages/pagination" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apiquery" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" ) // PayrollPayGroupService contains methods and other services that help with diff --git a/payrollpaygroup_test.go b/payrollpaygroup_test.go index 306c2324..896551d4 100644 --- a/payrollpaygroup_test.go +++ b/payrollpaygroup_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestPayrollPayGroupGetWithOptionalParams(t *testing.T) { diff --git a/provider.go b/provider.go index 54119f1f..1f5c3493 100644 --- a/provider.go +++ b/provider.go @@ -7,10 +7,10 @@ import ( "net/http" "slices" - "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/option" - "github.com/Finch-API/finch-api-go/packages/pagination" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/packages/pagination" ) // ProviderService contains methods and other services that help with interacting diff --git a/provider_test.go b/provider_test.go index cd7374e7..ca5636a5 100644 --- a/provider_test.go +++ b/provider_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestProviderList(t *testing.T) { diff --git a/requestforwarding.go b/requestforwarding.go index 493be20a..9a90593e 100644 --- a/requestforwarding.go +++ b/requestforwarding.go @@ -8,11 +8,11 @@ import ( "reflect" "slices" - "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" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/requestforwarding_test.go b/requestforwarding_test.go index 6af3ffcb..43c5fd43 100644 --- a/requestforwarding_test.go +++ b/requestforwarding_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestRequestForwardingForwardWithOptionalParams(t *testing.T) { diff --git a/sandbox.go b/sandbox.go index 23fbab2d..4e27a64f 100644 --- a/sandbox.go +++ b/sandbox.go @@ -3,7 +3,7 @@ package finchgo import ( - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2/option" ) // SandboxService contains methods and other services that help with interacting diff --git a/sandboxcompany.go b/sandboxcompany.go index 798e6b46..6f7cc9af 100644 --- a/sandboxcompany.go +++ b/sandboxcompany.go @@ -7,10 +7,10 @@ import ( "net/http" "slices" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // SandboxCompanyService contains methods and other services that help with diff --git a/sandboxcompany_test.go b/sandboxcompany_test.go index f3516f58..891e920c 100644 --- a/sandboxcompany_test.go +++ b/sandboxcompany_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestSandboxCompanyUpdateWithOptionalParams(t *testing.T) { diff --git a/sandboxconnection.go b/sandboxconnection.go index e70c20ca..621f9533 100644 --- a/sandboxconnection.go +++ b/sandboxconnection.go @@ -7,10 +7,10 @@ import ( "net/http" "slices" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // SandboxConnectionService contains methods and other services that help with diff --git a/sandboxconnection_test.go b/sandboxconnection_test.go index f262883d..eed8c42a 100644 --- a/sandboxconnection_test.go +++ b/sandboxconnection_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestSandboxConnectionNewWithOptionalParams(t *testing.T) { diff --git a/sandboxconnectionaccount.go b/sandboxconnectionaccount.go index 63e2eea7..e0ced7d2 100644 --- a/sandboxconnectionaccount.go +++ b/sandboxconnectionaccount.go @@ -7,11 +7,11 @@ import ( "net/http" "slices" - "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" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" ) // SandboxConnectionAccountService contains methods and other services that help diff --git a/sandboxconnectionaccount_test.go b/sandboxconnectionaccount_test.go index 98ac8324..a4d4a0bc 100644 --- a/sandboxconnectionaccount_test.go +++ b/sandboxconnectionaccount_test.go @@ -8,10 +8,10 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" ) func TestSandboxConnectionAccountNewWithOptionalParams(t *testing.T) { diff --git a/sandboxdirectory.go b/sandboxdirectory.go index 6049762f..35b3dece 100644 --- a/sandboxdirectory.go +++ b/sandboxdirectory.go @@ -7,10 +7,10 @@ import ( "net/http" "slices" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // SandboxDirectoryService contains methods and other services that help with diff --git a/sandboxdirectory_test.go b/sandboxdirectory_test.go index b000a272..d768c280 100644 --- a/sandboxdirectory_test.go +++ b/sandboxdirectory_test.go @@ -9,10 +9,10 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" ) func TestSandboxDirectoryNewWithOptionalParams(t *testing.T) { diff --git a/sandboxemployment.go b/sandboxemployment.go index 0b58faaf..651d5e01 100644 --- a/sandboxemployment.go +++ b/sandboxemployment.go @@ -10,11 +10,11 @@ import ( "reflect" "slices" - "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" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/sandboxemployment_test.go b/sandboxemployment_test.go index 2881a3df..793c37d1 100644 --- a/sandboxemployment_test.go +++ b/sandboxemployment_test.go @@ -9,10 +9,10 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" ) func TestSandboxEmploymentUpdateWithOptionalParams(t *testing.T) { diff --git a/sandboxindividual.go b/sandboxindividual.go index 341bb691..5b5b436b 100644 --- a/sandboxindividual.go +++ b/sandboxindividual.go @@ -9,10 +9,10 @@ import ( "net/http" "slices" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // SandboxIndividualService contains methods and other services that help with diff --git a/sandboxindividual_test.go b/sandboxindividual_test.go index d777e9de..0f45bf05 100644 --- a/sandboxindividual_test.go +++ b/sandboxindividual_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestSandboxIndividualUpdateWithOptionalParams(t *testing.T) { diff --git a/sandboxjob.go b/sandboxjob.go index d095a82e..19c2002c 100644 --- a/sandboxjob.go +++ b/sandboxjob.go @@ -7,10 +7,10 @@ import ( "net/http" "slices" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // SandboxJobService contains methods and other services that help with interacting diff --git a/sandboxjob_test.go b/sandboxjob_test.go index 0944d7ea..7dbf7fab 100644 --- a/sandboxjob_test.go +++ b/sandboxjob_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestSandboxJobNew(t *testing.T) { diff --git a/sandboxjobconfiguration.go b/sandboxjobconfiguration.go index 5692135f..4dc58b27 100644 --- a/sandboxjobconfiguration.go +++ b/sandboxjobconfiguration.go @@ -7,10 +7,10 @@ import ( "net/http" "slices" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // SandboxJobConfigurationService contains methods and other services that help diff --git a/sandboxjobconfiguration_test.go b/sandboxjobconfiguration_test.go index 09ccbab5..fe6022c9 100644 --- a/sandboxjobconfiguration_test.go +++ b/sandboxjobconfiguration_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestSandboxJobConfigurationGet(t *testing.T) { diff --git a/sandboxpayment.go b/sandboxpayment.go index a037ebab..94666b53 100644 --- a/sandboxpayment.go +++ b/sandboxpayment.go @@ -8,10 +8,10 @@ import ( "slices" "time" - "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" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/param" + "github.com/Finch-API/finch-api-go/v2/internal/requestconfig" + "github.com/Finch-API/finch-api-go/v2/option" ) // SandboxPaymentService contains methods and other services that help with diff --git a/sandboxpayment_test.go b/sandboxpayment_test.go index ca67b00e..117c0bb5 100644 --- a/sandboxpayment_test.go +++ b/sandboxpayment_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestSandboxPaymentNewWithOptionalParams(t *testing.T) { diff --git a/shared/shared.go b/shared/shared.go index 133383c8..04ff9730 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -3,7 +3,7 @@ package shared import ( - "github.com/Finch-API/finch-api-go/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" ) type ConnectionStatusType string diff --git a/usage_test.go b/usage_test.go index 3cebfb2e..952a2433 100644 --- a/usage_test.go +++ b/usage_test.go @@ -7,9 +7,9 @@ import ( "os" "testing" - "github.com/Finch-API/finch-api-go" - "github.com/Finch-API/finch-api-go/internal/testutil" - "github.com/Finch-API/finch-api-go/option" + "github.com/Finch-API/finch-api-go/v2" + "github.com/Finch-API/finch-api-go/v2/internal/testutil" + "github.com/Finch-API/finch-api-go/v2/option" ) func TestUsage(t *testing.T) { diff --git a/webhook.go b/webhook.go index c4b08a9e..d788f203 100644 --- a/webhook.go +++ b/webhook.go @@ -14,9 +14,9 @@ import ( "strings" "time" - "github.com/Finch-API/finch-api-go/internal/apijson" - "github.com/Finch-API/finch-api-go/option" - "github.com/Finch-API/finch-api-go/shared" + "github.com/Finch-API/finch-api-go/v2/internal/apijson" + "github.com/Finch-API/finch-api-go/v2/option" + "github.com/Finch-API/finch-api-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/webhook_test.go b/webhook_test.go index ced3c2e7..5aec346c 100644 --- a/webhook_test.go +++ b/webhook_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/Finch-API/finch-api-go" + "github.com/Finch-API/finch-api-go/v2" ) func TestVerifySignature(t *testing.T) {