Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 2, 2024
1 parent be88b45 commit 820cedc
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 48 deletions.
71 changes: 39 additions & 32 deletions acs/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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"`
Expand Down
22 changes: 22 additions & 0 deletions acs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
9 changes: 1 addition & 8 deletions client/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,13 @@ func WithHTTPHeader(httpHeader http.Header) core.ClientOption {
}
}

// WithApiKey sets the 'Authorization: Bearer <apiKey>' 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) {
Expand Down
8 changes: 2 additions & 6 deletions core/client_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ type ClientOptions struct {
HTTPClient HTTPClient
HTTPHeader http.Header
ApiKey string
SeamWorkspace string
SeamClientSessionToken string
ClientSessionToken string
}
Expand All @@ -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
Expand All @@ -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
}
4 changes: 2 additions & 2 deletions noisesensors/noisethresholds/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 820cedc

Please sign in to comment.