diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d0ab664..2a8f4ff 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.0" + ".": "1.3.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c259114..4c778ef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-60f88b9ae0cedc03dd888b63ca8dec25658c87e6cc3493170114144ca9e070c9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-82f59232f8a0981c05494d0697c69182e5f36f2d355953c6098c1d4baf52341b.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index de5d92d..c18edfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.3.0 (2024-08-30) + +Full Changelog: [v1.2.0...v1.3.0](https://github.com/Finch-API/finch-api-go/compare/v1.2.0...v1.3.0) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#239](https://github.com/Finch-API/finch-api-go/issues/239)) ([031be0d](https://github.com/Finch-API/finch-api-go/commit/031be0d2f37ac96f6d3129e1521af21fc9ea761a)) + ## 1.2.0 (2024-08-28) Full Changelog: [v1.1.0...v1.2.0](https://github.com/Finch-API/finch-api-go/compare/v1.1.0...v1.2.0) diff --git a/README.md b/README.md index 194445f..3223a19 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/Finch-API/finch-api-go@v1.2.0' +go get -u 'github.com/Finch-API/finch-api-go@v1.3.0' ``` diff --git a/accesstoken.go b/accesstoken.go index cf811f2..87f967f 100644 --- a/accesstoken.go +++ b/accesstoken.go @@ -77,13 +77,18 @@ func (r *AccessTokenService) New(ctx context.Context, body AccessTokenNewParams, } type CreateAccessTokenResponse struct { + // The access token for the connection. AccessToken string `json:"access_token,required"` - // The Finch uuid of the account used to connect this company. + // [DEPRECATED] Use `connection_id` to identify the connection instead of this + // account ID. AccountID string `json:"account_id,required"` // The type of application associated with a token. ClientType CreateAccessTokenResponseClientType `json:"client_type,required"` - // The Finch uuid of the company associated with the `access_token`. + // [DEPRECATED] Use `connection_id` to identify the connection instead of this + // company ID. CompanyID string `json:"company_id,required"` + // The Finch UUID of the connection associated with the `access_token`. + ConnectionID string `json:"connection_id,required"` // The type of the connection associated with the token. // // - `provider` - connection to an external provider @@ -91,7 +96,7 @@ type CreateAccessTokenResponse struct { ConnectionType CreateAccessTokenResponseConnectionType `json:"connection_type,required"` // An array of the authorized products associated with the `access_token`. Products []string `json:"products,required"` - // The payroll provider associated with the `access_token`. + // The ID of the provider associated with the `access_token`. ProviderID string `json:"provider_id,required"` JSON createAccessTokenResponseJSON `json:"-"` } @@ -103,6 +108,7 @@ type createAccessTokenResponseJSON struct { AccountID apijson.Field ClientType apijson.Field CompanyID apijson.Field + ConnectionID apijson.Field ConnectionType apijson.Field Products apijson.Field ProviderID apijson.Field diff --git a/account.go b/account.go index 47eee84..971b969 100644 --- a/account.go +++ b/account.go @@ -70,15 +70,20 @@ func (r disconnectResponseJSON) RawJSON() string { } type Introspection struct { - // The Finch uuid of the account used to connect this company. + // [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + // instead of this account ID. AccountID string `json:"account_id,required"` AuthenticationMethods []IntrospectionAuthenticationMethod `json:"authentication_methods,required"` - // The client id of the application associated with the `access_token`. + // The client ID of the application associated with the `access_token`. ClientID string `json:"client_id,required"` // The type of application associated with a token. ClientType IntrospectionClientType `json:"client_type,required"` - // The Finch uuid of the company associated with the `access_token`. + // [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + // instead of this company ID. CompanyID string `json:"company_id,required"` + // The Finch UUID of the connection associated with the `access_token`. + ConnectionID string `json:"connection_id,required"` + ConnectionStatus IntrospectionConnectionStatus `json:"connection_status,required"` // The type of the connection associated with the token. // // - `provider` - connection to an external provider @@ -88,10 +93,13 @@ type Introspection struct { // Connect Flow. (`true` if using Assisted Connect, `false` if connection is // automated) Manual bool `json:"manual,required"` - // The payroll provider associated with the `access_token`. + // [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll + // provider ID. PayrollProviderID string `json:"payroll_provider_id,required"` // An array of the authorized products associated with the `access_token`. Products []string `json:"products,required"` + // The ID of the provider associated with the `access_token`. + ProviderID string `json:"provider_id,required"` // The account username used for login associated with the `access_token`. Username string `json:"username,required"` JSON introspectionJSON `json:"-"` @@ -104,10 +112,13 @@ type introspectionJSON struct { ClientID apijson.Field ClientType apijson.Field CompanyID apijson.Field + ConnectionID apijson.Field + ConnectionStatus apijson.Field ConnectionType apijson.Field Manual apijson.Field PayrollProviderID apijson.Field Products apijson.Field + ProviderID apijson.Field Username apijson.Field raw string ExtraFields map[string]apijson.Field @@ -123,6 +134,8 @@ func (r introspectionJSON) RawJSON() string { type IntrospectionAuthenticationMethod struct { ConnectionStatus IntrospectionAuthenticationMethodsConnectionStatus `json:"connection_status"` + // An array of the authorized products associated with the `access_token`. + Products []string `json:"products"` // The type of authentication method. Type IntrospectionAuthenticationMethodsType `json:"type"` JSON introspectionAuthenticationMethodJSON `json:"-"` @@ -132,6 +145,7 @@ type IntrospectionAuthenticationMethod struct { // [IntrospectionAuthenticationMethod] type introspectionAuthenticationMethodJSON struct { ConnectionStatus apijson.Field + Products apijson.Field Type apijson.Field raw string ExtraFields map[string]apijson.Field @@ -204,6 +218,29 @@ func (r IntrospectionClientType) IsKnown() bool { return false } +type IntrospectionConnectionStatus struct { + Message string `json:"message"` + Status shared.ConnectionStatusType `json:"status"` + JSON introspectionConnectionStatusJSON `json:"-"` +} + +// introspectionConnectionStatusJSON contains the JSON metadata for the struct +// [IntrospectionConnectionStatus] +type introspectionConnectionStatusJSON struct { + Message apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IntrospectionConnectionStatus) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r introspectionConnectionStatusJSON) RawJSON() string { + return r.raw +} + // The type of the connection associated with the token. // // - `provider` - connection to an external provider diff --git a/internal/version.go b/internal/version.go index 497a1a0..83c436e 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "1.2.0" // x-release-please-version +const PackageVersion = "1.3.0" // x-release-please-version diff --git a/sandboxconnection.go b/sandboxconnection.go index 7074e94..d92d0a3 100644 --- a/sandboxconnection.go +++ b/sandboxconnection.go @@ -42,13 +42,18 @@ func (r *SandboxConnectionService) New(ctx context.Context, body SandboxConnecti } type SandboxConnectionNewResponse struct { - AccessToken string `json:"access_token,required" format:"uuid"` + AccessToken string `json:"access_token,required" format:"uuid"` + // [DEPRECATED] Use `connection_id` to associate a connection with an access token AccountID string `json:"account_id,required" format:"uuid"` AuthenticationType SandboxConnectionNewResponseAuthenticationType `json:"authentication_type,required"` - CompanyID string `json:"company_id,required" format:"uuid"` - Products []string `json:"products,required"` - ProviderID string `json:"provider_id,required" format:"uuid"` - JSON sandboxConnectionNewResponseJSON `json:"-"` + // [DEPRECATED] Use `connection_id` to associate a connection with an access token + CompanyID string `json:"company_id,required" format:"uuid"` + // The ID of the new connection + ConnectionID string `json:"connection_id,required" format:"uuid"` + Products []string `json:"products,required"` + // The ID of the provider associated with the `access_token`. + ProviderID string `json:"provider_id,required" format:"uuid"` + JSON sandboxConnectionNewResponseJSON `json:"-"` } // sandboxConnectionNewResponseJSON contains the JSON metadata for the struct @@ -58,6 +63,7 @@ type sandboxConnectionNewResponseJSON struct { AccountID apijson.Field AuthenticationType apijson.Field CompanyID apijson.Field + ConnectionID apijson.Field Products apijson.Field ProviderID apijson.Field raw string @@ -90,6 +96,7 @@ func (r SandboxConnectionNewResponseAuthenticationType) IsKnown() bool { } type SandboxConnectionNewParams struct { + // The provider associated with the connection ProviderID param.Field[string] `json:"provider_id,required"` AuthenticationType param.Field[SandboxConnectionNewParamsAuthenticationType] `json:"authentication_type"` // Optional: the size of the employer to be created with this connection. Defaults diff --git a/sandboxconnectionaccount.go b/sandboxconnectionaccount.go index 9ef7ee6..6ee548e 100644 --- a/sandboxconnectionaccount.go +++ b/sandboxconnectionaccount.go @@ -50,13 +50,18 @@ func (r *SandboxConnectionAccountService) Update(ctx context.Context, body Sandb } type SandboxConnectionAccountNewResponse struct { - AccessToken string `json:"access_token,required" format:"uuid"` + AccessToken string `json:"access_token,required" format:"uuid"` + // [DEPRECATED] Use `connection_id` to associate a connection with an access token AccountID string `json:"account_id,required" format:"uuid"` AuthenticationType SandboxConnectionAccountNewResponseAuthenticationType `json:"authentication_type,required"` - CompanyID string `json:"company_id,required" format:"uuid"` - Products []string `json:"products,required"` - ProviderID string `json:"provider_id,required"` - JSON sandboxConnectionAccountNewResponseJSON `json:"-"` + // [DEPRECATED] Use `connection_id` to associate a connection with an access token + CompanyID string `json:"company_id,required" format:"uuid"` + // The ID of the new connection + ConnectionID string `json:"connection_id,required" format:"uuid"` + Products []string `json:"products,required"` + // The ID of the provider associated with the `access_token` + ProviderID string `json:"provider_id,required"` + JSON sandboxConnectionAccountNewResponseJSON `json:"-"` } // sandboxConnectionAccountNewResponseJSON contains the JSON metadata for the @@ -66,6 +71,7 @@ type sandboxConnectionAccountNewResponseJSON struct { AccountID apijson.Field AuthenticationType apijson.Field CompanyID apijson.Field + ConnectionID apijson.Field Products apijson.Field ProviderID apijson.Field raw string @@ -98,12 +104,17 @@ func (r SandboxConnectionAccountNewResponseAuthenticationType) IsKnown() bool { } type SandboxConnectionAccountUpdateResponse struct { - AccountID string `json:"account_id,required"` + // [DEPRECATED] Use `connection_id` to associate a connection with an access token + AccountID string `json:"account_id,required" format:"uuid"` AuthenticationType SandboxConnectionAccountUpdateResponseAuthenticationType `json:"authentication_type,required"` - CompanyID string `json:"company_id,required" format:"uuid"` - Products []string `json:"products,required"` - ProviderID string `json:"provider_id,required"` - JSON sandboxConnectionAccountUpdateResponseJSON `json:"-"` + // [DEPRECATED] Use `connection_id` to associate a connection with an access token + CompanyID string `json:"company_id,required" format:"uuid"` + Products []string `json:"products,required"` + // The ID of the provider associated with the `access_token` + ProviderID string `json:"provider_id,required"` + // The ID of the new connection + ConnectionID string `json:"connection_id" format:"uuid"` + JSON sandboxConnectionAccountUpdateResponseJSON `json:"-"` } // sandboxConnectionAccountUpdateResponseJSON contains the JSON metadata for the @@ -114,6 +125,7 @@ type sandboxConnectionAccountUpdateResponseJSON struct { CompanyID apijson.Field Products apijson.Field ProviderID apijson.Field + ConnectionID apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -144,7 +156,8 @@ func (r SandboxConnectionAccountUpdateResponseAuthenticationType) IsKnown() bool } type SandboxConnectionAccountNewParams struct { - CompanyID param.Field[string] `json:"company_id,required" format:"uuid"` + CompanyID param.Field[string] `json:"company_id,required" format:"uuid"` + // The provider associated with the `access_token` ProviderID param.Field[string] `json:"provider_id,required"` AuthenticationType param.Field[SandboxConnectionAccountNewParamsAuthenticationType] `json:"authentication_type"` // Optional, defaults to Organization products (`company`, `directory`, diff --git a/webhook.go b/webhook.go index f39f750..2ff654e 100644 --- a/webhook.go +++ b/webhook.go @@ -1139,20 +1139,26 @@ func (r AccountUpdateEventEventType) IsKnown() bool { } type BaseWebhookEvent struct { - // Unique Finch id of the employer account that was used to make this connection. + // [DEPRECATED] Unique Finch ID of the employer account used to make this + // connection. Use `connection_id` instead to identify the connection associated + // with this event. AccountID string `json:"account_id,required"` - // Unique Finch id of the company for which data has been updated. - CompanyID string `json:"company_id,required"` - JSON baseWebhookEventJSON `json:"-"` + // [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + // `connection_id` instead to identify the connection associated with this event. + CompanyID string `json:"company_id,required"` + // Unique Finch ID of the connection associated with the webhook event. + ConnectionID string `json:"connection_id"` + JSON baseWebhookEventJSON `json:"-"` } // baseWebhookEventJSON contains the JSON metadata for the struct // [BaseWebhookEvent] type baseWebhookEventJSON struct { - AccountID apijson.Field - CompanyID apijson.Field - raw string - ExtraFields map[string]apijson.Field + AccountID apijson.Field + CompanyID apijson.Field + ConnectionID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *BaseWebhookEvent) UnmarshalJSON(data []byte) (err error) {