Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Aug 30, 2024
1 parent 3d51738 commit 16fccae
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 9 additions & 3 deletions accesstoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,26 @@ 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
// - `finch` - finch-generated data.
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:"-"`
}
Expand All @@ -66,6 +71,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
Expand Down
45 changes: 41 additions & 4 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:"-"`
Expand All @@ -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
Expand All @@ -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:"-"`
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions sandboxconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
35 changes: 24 additions & 11 deletions sandboxconnectionaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand Down Expand Up @@ -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`,
Expand Down
22 changes: 14 additions & 8 deletions webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -1053,20 +1053,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) {
Expand Down

0 comments on commit 16fccae

Please sign in to comment.