diff --git a/acs/credentials.go b/acs/credentials.go index 314e9b4..5b4eaf5 100644 --- a/acs/credentials.go +++ b/acs/credentials.go @@ -15,16 +15,14 @@ type CredentialsAssignRequest struct { } type CredentialsCreateRequest struct { - AcsUserId string `json:"acs_user_id"` - AccessMethod CredentialsCreateRequestAccessMethod `json:"access_method,omitempty"` - Code *string `json:"code,omitempty"` - IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` - AssaAbloyCredentialServiceMobileEndpointId *string `json:"assa_abloy_credential_service_mobile_endpoint_id,omitempty"` - ExternalType *CredentialsCreateRequestExternalType `json:"external_type,omitempty"` - CardFormat *CredentialsCreateRequestCardFormat `json:"card_format,omitempty"` - IsOverrideKey *bool `json:"is_override_key,omitempty"` - StartsAt *time.Time `json:"starts_at,omitempty"` - EndsAt *time.Time `json:"ends_at,omitempty"` + AcsUserId string `json:"acs_user_id"` + AccessMethod CredentialsCreateRequestAccessMethod `json:"access_method,omitempty"` + Code *string `json:"code,omitempty"` + IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` + ExternalType *CredentialsCreateRequestExternalType `json:"external_type,omitempty"` + VisionlineMetadata *CredentialsCreateRequestVisionlineMetadata `json:"visionline_metadata,omitempty"` + StartsAt *time.Time `json:"starts_at,omitempty"` + EndsAt *time.Time `json:"ends_at,omitempty"` } type CredentialsDeleteRequest struct { @@ -90,28 +88,6 @@ func (c CredentialsCreateRequestAccessMethod) Ptr() *CredentialsCreateRequestAcc return &c } -type CredentialsCreateRequestCardFormat string - -const ( - CredentialsCreateRequestCardFormatTlCode CredentialsCreateRequestCardFormat = "TLCode" - CredentialsCreateRequestCardFormatRfid48 CredentialsCreateRequestCardFormat = "rfid48" -) - -func NewCredentialsCreateRequestCardFormatFromString(s string) (CredentialsCreateRequestCardFormat, error) { - switch s { - case "TLCode": - return CredentialsCreateRequestCardFormatTlCode, nil - case "rfid48": - return CredentialsCreateRequestCardFormatRfid48, nil - } - var t CredentialsCreateRequestCardFormat - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (c CredentialsCreateRequestCardFormat) Ptr() *CredentialsCreateRequestCardFormat { - return &c -} - type CredentialsCreateRequestExternalType string const ( @@ -140,6 +116,37 @@ func (c CredentialsCreateRequestExternalType) Ptr() *CredentialsCreateRequestExt return &c } +type CredentialsCreateRequestVisionlineMetadata struct { + AssaAbloyCredentialServiceMobileEndpointId *string `json:"assa_abloy_credential_service_mobile_endpoint_id,omitempty"` + CardFormat *CredentialsCreateRequestVisionlineMetadataCardFormat `json:"card_format,omitempty"` + IsOverrideKey *bool `json:"is_override_key,omitempty"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsCreateRequestVisionlineMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsCreateRequestVisionlineMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsCreateRequestVisionlineMetadata(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsCreateRequestVisionlineMetadata) String() string { + if len(c._rawJSON) > 0 { + if value, err := core.StringifyJSON(c._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + type CredentialsCreateResponse struct { AcsCredential *CredentialsCreateResponseAcsCredential `json:"acs_credential,omitempty"` Ok bool `json:"ok"` diff --git a/acs/types.go b/acs/types.go index be9c684..6985ea0 100644 --- a/acs/types.go +++ b/acs/types.go @@ -189,6 +189,28 @@ func (c CredentialsAssignResponseAcsCredentialExternalType) Ptr() *CredentialsAs return &c } +type CredentialsCreateRequestVisionlineMetadataCardFormat string + +const ( + CredentialsCreateRequestVisionlineMetadataCardFormatTlCode CredentialsCreateRequestVisionlineMetadataCardFormat = "TLCode" + CredentialsCreateRequestVisionlineMetadataCardFormatRfid48 CredentialsCreateRequestVisionlineMetadataCardFormat = "rfid48" +) + +func NewCredentialsCreateRequestVisionlineMetadataCardFormatFromString(s string) (CredentialsCreateRequestVisionlineMetadataCardFormat, error) { + switch s { + case "TLCode": + return CredentialsCreateRequestVisionlineMetadataCardFormatTlCode, nil + case "rfid48": + return CredentialsCreateRequestVisionlineMetadataCardFormatRfid48, nil + } + var t CredentialsCreateRequestVisionlineMetadataCardFormat + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsCreateRequestVisionlineMetadataCardFormat) Ptr() *CredentialsCreateRequestVisionlineMetadataCardFormat { + return &c +} + type CredentialsCreateResponseAcsCredential struct { AcsCredentialId string `json:"acs_credential_id"` AcsUserId *string `json:"acs_user_id,omitempty"` diff --git a/client/options.go b/client/options.go index 49a702f..e468d90 100644 --- a/client/options.go +++ b/client/options.go @@ -31,20 +31,13 @@ func WithHTTPHeader(httpHeader http.Header) core.ClientOption { } } -// WithApiKey sets the 'Authorization: Bearer ' header on every request. +// WithApiKey sets the apiKey auth header on every request. func WithApiKey(apiKey string) core.ClientOption { return func(opts *core.ClientOptions) { opts.ApiKey = apiKey } } -// WithSeamWorkspace sets the seamWorkspace header on every request. -func WithSeamWorkspace(seamWorkspace string) core.ClientOption { - return func(opts *core.ClientOptions) { - opts.SeamWorkspace = seamWorkspace - } -} - // WithSeamClientSessionToken sets the seamClientSessionToken header on every request. func WithSeamClientSessionToken(seamClientSessionToken string) core.ClientOption { return func(opts *core.ClientOptions) { diff --git a/core/client_option.go b/core/client_option.go index faa4b9e..343129e 100644 --- a/core/client_option.go +++ b/core/client_option.go @@ -18,7 +18,6 @@ type ClientOptions struct { HTTPClient HTTPClient HTTPHeader http.Header ApiKey string - SeamWorkspace string SeamClientSessionToken string ClientSessionToken string } @@ -37,10 +36,7 @@ func NewClientOptions() *ClientOptions { // on every request. func (c *ClientOptions) ToHeader() http.Header { header := c.cloneHeader() - if c.ApiKey != "" { - header.Set("Authorization", "Bearer "+c.ApiKey) - } - header.Set("seam-workspace", fmt.Sprintf("%v", c.SeamWorkspace)) + header.Set("seam-workspace", fmt.Sprintf("%v", c.ApiKey)) header.Set("seam-client-session-token", fmt.Sprintf("%v", c.SeamClientSessionToken)) header.Set("client-session-token", fmt.Sprintf("%v", c.ClientSessionToken)) return header @@ -50,6 +46,6 @@ func (c *ClientOptions) cloneHeader() http.Header { headers := c.HTTPHeader.Clone() headers.Set("X-Fern-Language", "Go") headers.Set("X-Fern-SDK-Name", "github.com/seamapi/go") - headers.Set("X-Fern-SDK-Version", "v0.2.4") + headers.Set("X-Fern-SDK-Version", "v0.2.5") return headers } diff --git a/noisesensors/noisethresholds/client.go b/noisesensors/noisethresholds/client.go index cde4298..f05fb71 100644 --- a/noisesensors/noisethresholds/client.go +++ b/noisesensors/noisethresholds/client.go @@ -32,7 +32,7 @@ func NewClient(opts ...core.ClientOption) *Client { } } -func (c *Client) Create(ctx context.Context, request *noisesensors.NoiseThresholdsCreateRequest) (*seamapigo.ActionAttempt, error) { +func (c *Client) Create(ctx context.Context, request *noisesensors.NoiseThresholdsCreateRequest) (*seamapigo.NoiseThreshold, error) { baseURL := "https://connect.getseam.com" if c.baseURL != "" { baseURL = c.baseURL @@ -79,7 +79,7 @@ func (c *Client) Create(ctx context.Context, request *noisesensors.NoiseThreshol ); err != nil { return nil, err } - return response.ActionAttempt, nil + return response.NoiseThreshold, nil } func (c *Client) Delete(ctx context.Context, request *noisesensors.NoiseThresholdsDeleteRequest) (*seamapigo.ActionAttempt, error) {