diff --git a/acs/access_groups.go b/acs/access_groups.go new file mode 100644 index 0000000..010a252 --- /dev/null +++ b/acs/access_groups.go @@ -0,0 +1,181 @@ +// This file was auto-generated by Fern from our API Definition. + +package acs + +import ( + json "encoding/json" + fmt "fmt" + seamapigo "github.com/seamapi/go" + core "github.com/seamapi/go/core" +) + +type AccessGroupsAddUserRequest struct { + AcsAccessGroupId string `json:"acs_access_group_id"` + AcsUserId string `json:"acs_user_id"` +} + +type AccessGroupsGetRequest struct { + AcsAccessGroupId string `json:"acs_access_group_id"` +} + +type AccessGroupsListRequest struct { + AcsSystemId *string `json:"acs_system_id,omitempty"` + AcsUserId *string `json:"acs_user_id,omitempty"` +} + +type AccessGroupsListUsersRequest struct { + AcsAccessGroupId string `json:"acs_access_group_id"` +} + +type AccessGroupsRemoveUserRequest struct { + AcsAccessGroupId string `json:"acs_access_group_id"` + AcsUserId string `json:"acs_user_id"` +} + +type AccessGroupsAddUserResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (a *AccessGroupsAddUserResponse) UnmarshalJSON(data []byte) error { + type unmarshaler AccessGroupsAddUserResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AccessGroupsAddUserResponse(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AccessGroupsAddUserResponse) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type AccessGroupsGetResponse struct { + AcsAccessGroup *seamapigo.AcsAccessGroup `json:"acs_access_group,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (a *AccessGroupsGetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler AccessGroupsGetResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AccessGroupsGetResponse(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AccessGroupsGetResponse) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type AccessGroupsListResponse struct { + AcsAccessGroups []*seamapigo.AcsAccessGroup `json:"acs_access_groups,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (a *AccessGroupsListResponse) UnmarshalJSON(data []byte) error { + type unmarshaler AccessGroupsListResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AccessGroupsListResponse(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AccessGroupsListResponse) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type AccessGroupsListUsersResponse struct { + AcsUsers []*seamapigo.AcsUser `json:"acs_users,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (a *AccessGroupsListUsersResponse) UnmarshalJSON(data []byte) error { + type unmarshaler AccessGroupsListUsersResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AccessGroupsListUsersResponse(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AccessGroupsListUsersResponse) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type AccessGroupsRemoveUserResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (a *AccessGroupsRemoveUserResponse) UnmarshalJSON(data []byte) error { + type unmarshaler AccessGroupsRemoveUserResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AccessGroupsRemoveUserResponse(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AccessGroupsRemoveUserResponse) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} diff --git a/acs/accessgroups/client.go b/acs/accessgroups/client.go new file mode 100644 index 0000000..ad8b5e5 --- /dev/null +++ b/acs/accessgroups/client.go @@ -0,0 +1,283 @@ +// This file was auto-generated by Fern from our API Definition. + +package accessgroups + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + acs "github.com/seamapi/go/acs" + core "github.com/seamapi/go/core" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +func (c *Client) AddUser(ctx context.Context, request *acs.AccessGroupsAddUserRequest) (*acs.AccessGroupsAddUserResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/access_groups/add_user" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.AccessGroupsAddUserResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Get(ctx context.Context, request *acs.AccessGroupsGetRequest) (*acs.AccessGroupsGetResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/access_groups/get" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.AccessGroupsGetResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) List(ctx context.Context, request *acs.AccessGroupsListRequest) (*acs.AccessGroupsListResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/access_groups/list" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.AccessGroupsListResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) ListUsers(ctx context.Context, request *acs.AccessGroupsListUsersRequest) (*acs.AccessGroupsListUsersResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/access_groups/list_users" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.AccessGroupsListUsersResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) RemoveUser(ctx context.Context, request *acs.AccessGroupsRemoveUserRequest) (*acs.AccessGroupsRemoveUserResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/access_groups/remove_user" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.AccessGroupsRemoveUserResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/acs/client/client.go b/acs/client/client.go new file mode 100644 index 0000000..bff55de --- /dev/null +++ b/acs/client/client.go @@ -0,0 +1,48 @@ +// This file was auto-generated by Fern from our API Definition. + +package client + +import ( + accessgroups "github.com/seamapi/go/acs/accessgroups" + credentialpools "github.com/seamapi/go/acs/credentialpools" + credentialprovisioningautomations "github.com/seamapi/go/acs/credentialprovisioningautomations" + credentials "github.com/seamapi/go/acs/credentials" + entrances "github.com/seamapi/go/acs/entrances" + systems "github.com/seamapi/go/acs/systems" + users "github.com/seamapi/go/acs/users" + core "github.com/seamapi/go/core" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header + + AccessGroups *accessgroups.Client + CredentialPools *credentialpools.Client + CredentialProvisioningAutomations *credentialprovisioningautomations.Client + Credentials *credentials.Client + Entrances *entrances.Client + Systems *systems.Client + Users *users.Client +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + AccessGroups: accessgroups.NewClient(opts...), + CredentialPools: credentialpools.NewClient(opts...), + CredentialProvisioningAutomations: credentialprovisioningautomations.NewClient(opts...), + Credentials: credentials.NewClient(opts...), + Entrances: entrances.NewClient(opts...), + Systems: systems.NewClient(opts...), + Users: users.NewClient(opts...), + } +} diff --git a/acs/credential_pools.go b/acs/credential_pools.go new file mode 100644 index 0000000..559a8a8 --- /dev/null +++ b/acs/credential_pools.go @@ -0,0 +1,43 @@ +// This file was auto-generated by Fern from our API Definition. + +package acs + +import ( + json "encoding/json" + fmt "fmt" + core "github.com/seamapi/go/core" +) + +type CredentialPoolsListRequest struct { + AcsSystemId string `json:"acs_system_id"` +} + +type CredentialPoolsListResponse struct { + AcsCredentialPools []*CredentialPoolsListResponseAcsCredentialPoolsItem `json:"acs_credential_pools,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialPoolsListResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialPoolsListResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialPoolsListResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialPoolsListResponse) 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) +} diff --git a/acs/credential_provisioning_automations.go b/acs/credential_provisioning_automations.go new file mode 100644 index 0000000..1caadeb --- /dev/null +++ b/acs/credential_provisioning_automations.go @@ -0,0 +1,47 @@ +// This file was auto-generated by Fern from our API Definition. + +package acs + +import ( + json "encoding/json" + fmt "fmt" + core "github.com/seamapi/go/core" +) + +type CredentialProvisioningAutomationsLaunchRequest struct { + UserIdentityId string `json:"user_identity_id"` + CredentialManagerAcsSystemId string `json:"credential_manager_acs_system_id"` + AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` + CreateCredentialManagerUser *bool `json:"create_credential_manager_user,omitempty"` + CredentialManagerAcsUserId *string `json:"credential_manager_acs_user_id,omitempty"` +} + +type CredentialProvisioningAutomationsLaunchResponse struct { + AcsCredentialProvisioningAutomation *CredentialProvisioningAutomationsLaunchResponseAcsCredentialProvisioningAutomation `json:"acs_credential_provisioning_automation,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialProvisioningAutomationsLaunchResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialProvisioningAutomationsLaunchResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialProvisioningAutomationsLaunchResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialProvisioningAutomationsLaunchResponse) 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) +} diff --git a/acs/credentialpools/client.go b/acs/credentialpools/client.go new file mode 100644 index 0000000..3f1f9d7 --- /dev/null +++ b/acs/credentialpools/client.go @@ -0,0 +1,83 @@ +// This file was auto-generated by Fern from our API Definition. + +package credentialpools + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + acs "github.com/seamapi/go/acs" + core "github.com/seamapi/go/core" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +func (c *Client) List(ctx context.Context, request *acs.CredentialPoolsListRequest) (*acs.CredentialPoolsListResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credential_pools/list" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialPoolsListResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/acs/credentialprovisioningautomations/client.go b/acs/credentialprovisioningautomations/client.go new file mode 100644 index 0000000..403ab50 --- /dev/null +++ b/acs/credentialprovisioningautomations/client.go @@ -0,0 +1,83 @@ +// This file was auto-generated by Fern from our API Definition. + +package credentialprovisioningautomations + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + acs "github.com/seamapi/go/acs" + core "github.com/seamapi/go/core" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +func (c *Client) Launch(ctx context.Context, request *acs.CredentialProvisioningAutomationsLaunchRequest) (*acs.CredentialProvisioningAutomationsLaunchResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credential_provisioning_automations/launch" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialProvisioningAutomationsLaunchResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/acs/credentials.go b/acs/credentials.go new file mode 100644 index 0000000..591275e --- /dev/null +++ b/acs/credentials.go @@ -0,0 +1,400 @@ +// This file was auto-generated by Fern from our API Definition. + +package acs + +import ( + json "encoding/json" + fmt "fmt" + core "github.com/seamapi/go/core" +) + +type CredentialsAssignRequest struct { + AcsUserId string `json:"acs_user_id"` + AcsCredentialId string `json:"acs_credential_id"` +} + +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"` +} + +type CredentialsDeleteRequest struct { + AcsCredentialId string `json:"acs_credential_id"` +} + +type CredentialsGetRequest struct { + AcsCredentialId string `json:"acs_credential_id"` +} + +type CredentialsAssignResponse struct { + AcsCredential *CredentialsAssignResponseAcsCredential `json:"acs_credential,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsAssignResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsAssignResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsAssignResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsAssignResponse) 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 CredentialsCreateRequestAccessMethod string + +const ( + CredentialsCreateRequestAccessMethodCode CredentialsCreateRequestAccessMethod = "code" + CredentialsCreateRequestAccessMethodCard CredentialsCreateRequestAccessMethod = "card" + CredentialsCreateRequestAccessMethodMobileKey CredentialsCreateRequestAccessMethod = "mobile_key" +) + +func NewCredentialsCreateRequestAccessMethodFromString(s string) (CredentialsCreateRequestAccessMethod, error) { + switch s { + case "code": + return CredentialsCreateRequestAccessMethodCode, nil + case "card": + return CredentialsCreateRequestAccessMethodCard, nil + case "mobile_key": + return CredentialsCreateRequestAccessMethodMobileKey, nil + } + var t CredentialsCreateRequestAccessMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsCreateRequestAccessMethod) Ptr() *CredentialsCreateRequestAccessMethod { + 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 ( + CredentialsCreateRequestExternalTypePtiCard CredentialsCreateRequestExternalType = "pti_card" + CredentialsCreateRequestExternalTypeBrivoCredential CredentialsCreateRequestExternalType = "brivo_credential" + CredentialsCreateRequestExternalTypeHidCredential CredentialsCreateRequestExternalType = "hid_credential" + CredentialsCreateRequestExternalTypeVisionlineCard CredentialsCreateRequestExternalType = "visionline_card" +) + +func NewCredentialsCreateRequestExternalTypeFromString(s string) (CredentialsCreateRequestExternalType, error) { + switch s { + case "pti_card": + return CredentialsCreateRequestExternalTypePtiCard, nil + case "brivo_credential": + return CredentialsCreateRequestExternalTypeBrivoCredential, nil + case "hid_credential": + return CredentialsCreateRequestExternalTypeHidCredential, nil + case "visionline_card": + return CredentialsCreateRequestExternalTypeVisionlineCard, nil + } + var t CredentialsCreateRequestExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsCreateRequestExternalType) Ptr() *CredentialsCreateRequestExternalType { + return &c +} + +type CredentialsCreateResponse struct { + AcsCredential *CredentialsCreateResponseAcsCredential `json:"acs_credential,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsCreateResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsCreateResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsCreateResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsCreateResponse) 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 CredentialsDeleteResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsDeleteResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsDeleteResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsDeleteResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsDeleteResponse) 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 CredentialsGetResponse struct { + AcsCredential *CredentialsGetResponseAcsCredential `json:"acs_credential,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsGetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsGetResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsGetResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsGetResponse) 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 CredentialsListRequest struct { + typeName string + CredentialsListRequestZero *CredentialsListRequestZero + CredentialsListRequestOne *CredentialsListRequestOne + CredentialsListRequestTwo *CredentialsListRequestTwo +} + +func NewCredentialsListRequestFromCredentialsListRequestZero(value *CredentialsListRequestZero) *CredentialsListRequest { + return &CredentialsListRequest{typeName: "credentialsListRequestZero", CredentialsListRequestZero: value} +} + +func NewCredentialsListRequestFromCredentialsListRequestOne(value *CredentialsListRequestOne) *CredentialsListRequest { + return &CredentialsListRequest{typeName: "credentialsListRequestOne", CredentialsListRequestOne: value} +} + +func NewCredentialsListRequestFromCredentialsListRequestTwo(value *CredentialsListRequestTwo) *CredentialsListRequest { + return &CredentialsListRequest{typeName: "credentialsListRequestTwo", CredentialsListRequestTwo: value} +} + +func (c *CredentialsListRequest) UnmarshalJSON(data []byte) error { + valueCredentialsListRequestZero := new(CredentialsListRequestZero) + if err := json.Unmarshal(data, &valueCredentialsListRequestZero); err == nil { + c.typeName = "credentialsListRequestZero" + c.CredentialsListRequestZero = valueCredentialsListRequestZero + return nil + } + valueCredentialsListRequestOne := new(CredentialsListRequestOne) + if err := json.Unmarshal(data, &valueCredentialsListRequestOne); err == nil { + c.typeName = "credentialsListRequestOne" + c.CredentialsListRequestOne = valueCredentialsListRequestOne + return nil + } + valueCredentialsListRequestTwo := new(CredentialsListRequestTwo) + if err := json.Unmarshal(data, &valueCredentialsListRequestTwo); err == nil { + c.typeName = "credentialsListRequestTwo" + c.CredentialsListRequestTwo = valueCredentialsListRequestTwo + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CredentialsListRequest) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "credentialsListRequestZero": + return json.Marshal(c.CredentialsListRequestZero) + case "credentialsListRequestOne": + return json.Marshal(c.CredentialsListRequestOne) + case "credentialsListRequestTwo": + return json.Marshal(c.CredentialsListRequestTwo) + } +} + +type CredentialsListRequestVisitor interface { + VisitCredentialsListRequestZero(*CredentialsListRequestZero) error + VisitCredentialsListRequestOne(*CredentialsListRequestOne) error + VisitCredentialsListRequestTwo(*CredentialsListRequestTwo) error +} + +func (c *CredentialsListRequest) Accept(visitor CredentialsListRequestVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "credentialsListRequestZero": + return visitor.VisitCredentialsListRequestZero(c.CredentialsListRequestZero) + case "credentialsListRequestOne": + return visitor.VisitCredentialsListRequestOne(c.CredentialsListRequestOne) + case "credentialsListRequestTwo": + return visitor.VisitCredentialsListRequestTwo(c.CredentialsListRequestTwo) + } +} + +type CredentialsListResponse struct { + AcsCredentials []*CredentialsListResponseAcsCredentialsItem `json:"acs_credentials,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsListResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsListResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsListResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsListResponse) 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 CredentialsUnassignResponse struct { + AcsCredential *CredentialsUnassignResponseAcsCredential `json:"acs_credential,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsUnassignResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsUnassignResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsUnassignResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsUnassignResponse) 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 CredentialsUpdateResponse struct { + AcsCredential *CredentialsUpdateResponseAcsCredential `json:"acs_credential,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsUpdateResponse) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsUpdateResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsUpdateResponse(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsUpdateResponse) 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 CredentialsUnassignRequest struct { + AcsUserId string `json:"acs_user_id"` + AcsCredentialId string `json:"acs_credential_id"` +} + +type CredentialsUpdateRequest struct { + AcsCredentialId string `json:"acs_credential_id"` + Code string `json:"code"` +} diff --git a/acs/credentials/client.go b/acs/credentials/client.go new file mode 100644 index 0000000..0fb5d47 --- /dev/null +++ b/acs/credentials/client.go @@ -0,0 +1,383 @@ +// This file was auto-generated by Fern from our API Definition. + +package credentials + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + acs "github.com/seamapi/go/acs" + core "github.com/seamapi/go/core" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +func (c *Client) Assign(ctx context.Context, request *acs.CredentialsAssignRequest) (*acs.CredentialsAssignResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credentials/assign" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialsAssignResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Create(ctx context.Context, request *acs.CredentialsCreateRequest) (*acs.CredentialsCreateResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credentials/create" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialsCreateResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Delete(ctx context.Context, request *acs.CredentialsDeleteRequest) (*acs.CredentialsDeleteResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credentials/delete" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialsDeleteResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Get(ctx context.Context, request *acs.CredentialsGetRequest) (*acs.CredentialsGetResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credentials/get" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialsGetResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) List(ctx context.Context, request *acs.CredentialsListRequest) (*acs.CredentialsListResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credentials/list" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialsListResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Unassign(ctx context.Context, request *acs.CredentialsUnassignRequest) (*acs.CredentialsUnassignResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credentials/unassign" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialsUnassignResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Update(ctx context.Context, request *acs.CredentialsUpdateRequest) (*acs.CredentialsUpdateResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/credentials/update" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.CredentialsUpdateResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/acs/entrances.go b/acs/entrances.go new file mode 100644 index 0000000..c7c0a60 --- /dev/null +++ b/acs/entrances.go @@ -0,0 +1,111 @@ +// This file was auto-generated by Fern from our API Definition. + +package acs + +import ( + json "encoding/json" + fmt "fmt" + core "github.com/seamapi/go/core" +) + +type EntrancesGetRequest struct { + AcsEntranceId string `json:"acs_entrance_id"` +} + +type EntrancesGrantAccessRequest struct { + AcsEntranceId string `json:"acs_entrance_id"` + AcsUserId string `json:"acs_user_id"` +} + +type EntrancesListRequest struct { + AcsSystemId *string `json:"acs_system_id,omitempty"` +} + +type EntrancesGetResponse struct { + AcsEntrance *EntrancesGetResponseAcsEntrance `json:"acs_entrance,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesGetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesGetResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesGetResponse(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesGetResponse) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type EntrancesGrantAccessResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesGrantAccessResponse) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesGrantAccessResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesGrantAccessResponse(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesGrantAccessResponse) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type EntrancesListResponse struct { + AcsEntrances []*EntrancesListResponseAcsEntrancesItem `json:"acs_entrances,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesListResponse) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesListResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesListResponse(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesListResponse) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} diff --git a/acs/entrances/client.go b/acs/entrances/client.go new file mode 100644 index 0000000..b37a235 --- /dev/null +++ b/acs/entrances/client.go @@ -0,0 +1,183 @@ +// This file was auto-generated by Fern from our API Definition. + +package entrances + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + acs "github.com/seamapi/go/acs" + core "github.com/seamapi/go/core" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +func (c *Client) Get(ctx context.Context, request *acs.EntrancesGetRequest) (*acs.EntrancesGetResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/entrances/get" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.EntrancesGetResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) GrantAccess(ctx context.Context, request *acs.EntrancesGrantAccessRequest) (*acs.EntrancesGrantAccessResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/entrances/grant_access" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.EntrancesGrantAccessResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) List(ctx context.Context, request *acs.EntrancesListRequest) (*acs.EntrancesListResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/entrances/list" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.EntrancesListResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/acs/systems.go b/acs/systems.go new file mode 100644 index 0000000..459dff6 --- /dev/null +++ b/acs/systems.go @@ -0,0 +1,78 @@ +// This file was auto-generated by Fern from our API Definition. + +package acs + +import ( + json "encoding/json" + fmt "fmt" + seamapigo "github.com/seamapi/go" + core "github.com/seamapi/go/core" +) + +type SystemsGetRequest struct { + AcsSystemId string `json:"acs_system_id"` +} + +type SystemsListRequest struct { + ConnectedAccountId *string `json:"connected_account_id,omitempty"` +} + +type SystemsGetResponse struct { + AcsSystem *seamapigo.AcsSystem `json:"acs_system,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (s *SystemsGetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SystemsGetResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SystemsGetResponse(value) + s._rawJSON = json.RawMessage(data) + return nil +} + +func (s *SystemsGetResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SystemsListResponse struct { + AcsSystems []*seamapigo.AcsSystem `json:"acs_systems,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (s *SystemsListResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SystemsListResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SystemsListResponse(value) + s._rawJSON = json.RawMessage(data) + return nil +} + +func (s *SystemsListResponse) String() string { + if len(s._rawJSON) > 0 { + if value, err := core.StringifyJSON(s._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} diff --git a/acs/systems/client.go b/acs/systems/client.go new file mode 100644 index 0000000..f7d5b16 --- /dev/null +++ b/acs/systems/client.go @@ -0,0 +1,133 @@ +// This file was auto-generated by Fern from our API Definition. + +package systems + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + acs "github.com/seamapi/go/acs" + core "github.com/seamapi/go/core" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +func (c *Client) Get(ctx context.Context, request *acs.SystemsGetRequest) (*acs.SystemsGetResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/systems/get" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.SystemsGetResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) List(ctx context.Context, request *acs.SystemsListRequest) (*acs.SystemsListResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/systems/list" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.SystemsListResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/acs/types.go b/acs/types.go new file mode 100644 index 0000000..01fce68 --- /dev/null +++ b/acs/types.go @@ -0,0 +1,799 @@ +// This file was auto-generated by Fern from our API Definition. + +package acs + +import ( + json "encoding/json" + fmt "fmt" + core "github.com/seamapi/go/core" + time "time" +) + +type CredentialPoolsListResponseAcsCredentialPoolsItem struct { + AcsCredentialPoolId string `json:"acs_credential_pool_id"` + AcsSystemId string `json:"acs_system_id"` + DisplayName string `json:"display_name"` + ExternalTypeDisplayName string `json:"external_type_display_name"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + externalType string + + _rawJSON json.RawMessage +} + +func (c *CredentialPoolsListResponseAcsCredentialPoolsItem) ExternalType() string { + return c.externalType +} + +func (c *CredentialPoolsListResponseAcsCredentialPoolsItem) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialPoolsListResponseAcsCredentialPoolsItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialPoolsListResponseAcsCredentialPoolsItem(value) + c.externalType = "hid_part_number" + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialPoolsListResponseAcsCredentialPoolsItem) MarshalJSON() ([]byte, error) { + type embed CredentialPoolsListResponseAcsCredentialPoolsItem + var marshaler = struct { + embed + ExternalType string `json:"external_type"` + }{ + embed: embed(*c), + ExternalType: "hid_part_number", + } + return json.Marshal(marshaler) +} + +func (c *CredentialPoolsListResponseAcsCredentialPoolsItem) 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 CredentialProvisioningAutomationsLaunchResponseAcsCredentialProvisioningAutomation struct { + AcsCredentialProvisioningAutomationId string `json:"acs_credential_provisioning_automation_id"` + CredentialManagerAcsSystemId string `json:"credential_manager_acs_system_id"` + UserIdentityId string `json:"user_identity_id"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialProvisioningAutomationsLaunchResponseAcsCredentialProvisioningAutomation) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialProvisioningAutomationsLaunchResponseAcsCredentialProvisioningAutomation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialProvisioningAutomationsLaunchResponseAcsCredentialProvisioningAutomation(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialProvisioningAutomationsLaunchResponseAcsCredentialProvisioningAutomation) 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 CredentialsAssignResponseAcsCredential struct { + AcsCredentialId string `json:"acs_credential_id"` + AcsUserId *string `json:"acs_user_id,omitempty"` + AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` + AcsSystemId string `json:"acs_system_id"` + DisplayName string `json:"display_name"` + Code *string `json:"code,omitempty"` + AccessMethod CredentialsAssignResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` + ExternalType *CredentialsAssignResponseAcsCredentialExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName *string `json:"external_type_display_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsAssignResponseAcsCredential) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsAssignResponseAcsCredential + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsAssignResponseAcsCredential(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsAssignResponseAcsCredential) 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 CredentialsAssignResponseAcsCredentialAccessMethod string + +const ( + CredentialsAssignResponseAcsCredentialAccessMethodCode CredentialsAssignResponseAcsCredentialAccessMethod = "code" + CredentialsAssignResponseAcsCredentialAccessMethodCard CredentialsAssignResponseAcsCredentialAccessMethod = "card" + CredentialsAssignResponseAcsCredentialAccessMethodMobileKey CredentialsAssignResponseAcsCredentialAccessMethod = "mobile_key" +) + +func NewCredentialsAssignResponseAcsCredentialAccessMethodFromString(s string) (CredentialsAssignResponseAcsCredentialAccessMethod, error) { + switch s { + case "code": + return CredentialsAssignResponseAcsCredentialAccessMethodCode, nil + case "card": + return CredentialsAssignResponseAcsCredentialAccessMethodCard, nil + case "mobile_key": + return CredentialsAssignResponseAcsCredentialAccessMethodMobileKey, nil + } + var t CredentialsAssignResponseAcsCredentialAccessMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsAssignResponseAcsCredentialAccessMethod) Ptr() *CredentialsAssignResponseAcsCredentialAccessMethod { + return &c +} + +type CredentialsAssignResponseAcsCredentialExternalType string + +const ( + CredentialsAssignResponseAcsCredentialExternalTypePtiCard CredentialsAssignResponseAcsCredentialExternalType = "pti_card" + CredentialsAssignResponseAcsCredentialExternalTypeBrivoCredential CredentialsAssignResponseAcsCredentialExternalType = "brivo_credential" + CredentialsAssignResponseAcsCredentialExternalTypeHidCredential CredentialsAssignResponseAcsCredentialExternalType = "hid_credential" + CredentialsAssignResponseAcsCredentialExternalTypeVisionlineCard CredentialsAssignResponseAcsCredentialExternalType = "visionline_card" +) + +func NewCredentialsAssignResponseAcsCredentialExternalTypeFromString(s string) (CredentialsAssignResponseAcsCredentialExternalType, error) { + switch s { + case "pti_card": + return CredentialsAssignResponseAcsCredentialExternalTypePtiCard, nil + case "brivo_credential": + return CredentialsAssignResponseAcsCredentialExternalTypeBrivoCredential, nil + case "hid_credential": + return CredentialsAssignResponseAcsCredentialExternalTypeHidCredential, nil + case "visionline_card": + return CredentialsAssignResponseAcsCredentialExternalTypeVisionlineCard, nil + } + var t CredentialsAssignResponseAcsCredentialExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsAssignResponseAcsCredentialExternalType) Ptr() *CredentialsAssignResponseAcsCredentialExternalType { + return &c +} + +type CredentialsCreateResponseAcsCredential struct { + AcsCredentialId string `json:"acs_credential_id"` + AcsUserId *string `json:"acs_user_id,omitempty"` + AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` + AcsSystemId string `json:"acs_system_id"` + DisplayName string `json:"display_name"` + Code *string `json:"code,omitempty"` + AccessMethod CredentialsCreateResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` + ExternalType *CredentialsCreateResponseAcsCredentialExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName *string `json:"external_type_display_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsCreateResponseAcsCredential) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsCreateResponseAcsCredential + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsCreateResponseAcsCredential(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsCreateResponseAcsCredential) 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 CredentialsCreateResponseAcsCredentialAccessMethod string + +const ( + CredentialsCreateResponseAcsCredentialAccessMethodCode CredentialsCreateResponseAcsCredentialAccessMethod = "code" + CredentialsCreateResponseAcsCredentialAccessMethodCard CredentialsCreateResponseAcsCredentialAccessMethod = "card" + CredentialsCreateResponseAcsCredentialAccessMethodMobileKey CredentialsCreateResponseAcsCredentialAccessMethod = "mobile_key" +) + +func NewCredentialsCreateResponseAcsCredentialAccessMethodFromString(s string) (CredentialsCreateResponseAcsCredentialAccessMethod, error) { + switch s { + case "code": + return CredentialsCreateResponseAcsCredentialAccessMethodCode, nil + case "card": + return CredentialsCreateResponseAcsCredentialAccessMethodCard, nil + case "mobile_key": + return CredentialsCreateResponseAcsCredentialAccessMethodMobileKey, nil + } + var t CredentialsCreateResponseAcsCredentialAccessMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsCreateResponseAcsCredentialAccessMethod) Ptr() *CredentialsCreateResponseAcsCredentialAccessMethod { + return &c +} + +type CredentialsCreateResponseAcsCredentialExternalType string + +const ( + CredentialsCreateResponseAcsCredentialExternalTypePtiCard CredentialsCreateResponseAcsCredentialExternalType = "pti_card" + CredentialsCreateResponseAcsCredentialExternalTypeBrivoCredential CredentialsCreateResponseAcsCredentialExternalType = "brivo_credential" + CredentialsCreateResponseAcsCredentialExternalTypeHidCredential CredentialsCreateResponseAcsCredentialExternalType = "hid_credential" + CredentialsCreateResponseAcsCredentialExternalTypeVisionlineCard CredentialsCreateResponseAcsCredentialExternalType = "visionline_card" +) + +func NewCredentialsCreateResponseAcsCredentialExternalTypeFromString(s string) (CredentialsCreateResponseAcsCredentialExternalType, error) { + switch s { + case "pti_card": + return CredentialsCreateResponseAcsCredentialExternalTypePtiCard, nil + case "brivo_credential": + return CredentialsCreateResponseAcsCredentialExternalTypeBrivoCredential, nil + case "hid_credential": + return CredentialsCreateResponseAcsCredentialExternalTypeHidCredential, nil + case "visionline_card": + return CredentialsCreateResponseAcsCredentialExternalTypeVisionlineCard, nil + } + var t CredentialsCreateResponseAcsCredentialExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsCreateResponseAcsCredentialExternalType) Ptr() *CredentialsCreateResponseAcsCredentialExternalType { + return &c +} + +type CredentialsGetResponseAcsCredential struct { + AcsCredentialId string `json:"acs_credential_id"` + AcsUserId *string `json:"acs_user_id,omitempty"` + AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` + AcsSystemId string `json:"acs_system_id"` + DisplayName string `json:"display_name"` + Code *string `json:"code,omitempty"` + AccessMethod CredentialsGetResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` + ExternalType *CredentialsGetResponseAcsCredentialExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName *string `json:"external_type_display_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsGetResponseAcsCredential) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsGetResponseAcsCredential + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsGetResponseAcsCredential(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsGetResponseAcsCredential) 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 CredentialsGetResponseAcsCredentialAccessMethod string + +const ( + CredentialsGetResponseAcsCredentialAccessMethodCode CredentialsGetResponseAcsCredentialAccessMethod = "code" + CredentialsGetResponseAcsCredentialAccessMethodCard CredentialsGetResponseAcsCredentialAccessMethod = "card" + CredentialsGetResponseAcsCredentialAccessMethodMobileKey CredentialsGetResponseAcsCredentialAccessMethod = "mobile_key" +) + +func NewCredentialsGetResponseAcsCredentialAccessMethodFromString(s string) (CredentialsGetResponseAcsCredentialAccessMethod, error) { + switch s { + case "code": + return CredentialsGetResponseAcsCredentialAccessMethodCode, nil + case "card": + return CredentialsGetResponseAcsCredentialAccessMethodCard, nil + case "mobile_key": + return CredentialsGetResponseAcsCredentialAccessMethodMobileKey, nil + } + var t CredentialsGetResponseAcsCredentialAccessMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsGetResponseAcsCredentialAccessMethod) Ptr() *CredentialsGetResponseAcsCredentialAccessMethod { + return &c +} + +type CredentialsGetResponseAcsCredentialExternalType string + +const ( + CredentialsGetResponseAcsCredentialExternalTypePtiCard CredentialsGetResponseAcsCredentialExternalType = "pti_card" + CredentialsGetResponseAcsCredentialExternalTypeBrivoCredential CredentialsGetResponseAcsCredentialExternalType = "brivo_credential" + CredentialsGetResponseAcsCredentialExternalTypeHidCredential CredentialsGetResponseAcsCredentialExternalType = "hid_credential" + CredentialsGetResponseAcsCredentialExternalTypeVisionlineCard CredentialsGetResponseAcsCredentialExternalType = "visionline_card" +) + +func NewCredentialsGetResponseAcsCredentialExternalTypeFromString(s string) (CredentialsGetResponseAcsCredentialExternalType, error) { + switch s { + case "pti_card": + return CredentialsGetResponseAcsCredentialExternalTypePtiCard, nil + case "brivo_credential": + return CredentialsGetResponseAcsCredentialExternalTypeBrivoCredential, nil + case "hid_credential": + return CredentialsGetResponseAcsCredentialExternalTypeHidCredential, nil + case "visionline_card": + return CredentialsGetResponseAcsCredentialExternalTypeVisionlineCard, nil + } + var t CredentialsGetResponseAcsCredentialExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsGetResponseAcsCredentialExternalType) Ptr() *CredentialsGetResponseAcsCredentialExternalType { + return &c +} + +type CredentialsListRequestOne struct { + AcsSystemId string `json:"acs_system_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsListRequestOne) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsListRequestOne + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsListRequestOne(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsListRequestOne) 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 CredentialsListRequestTwo struct { + AcsUserId string `json:"acs_user_id"` + AcsSystemId string `json:"acs_system_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsListRequestTwo) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsListRequestTwo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsListRequestTwo(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsListRequestTwo) 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 CredentialsListRequestZero struct { + AcsUserId string `json:"acs_user_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsListRequestZero) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsListRequestZero + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsListRequestZero(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsListRequestZero) 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 CredentialsListResponseAcsCredentialsItem struct { + AcsCredentialId string `json:"acs_credential_id"` + AcsUserId *string `json:"acs_user_id,omitempty"` + AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` + AcsSystemId string `json:"acs_system_id"` + DisplayName string `json:"display_name"` + Code *string `json:"code,omitempty"` + AccessMethod CredentialsListResponseAcsCredentialsItemAccessMethod `json:"access_method,omitempty"` + ExternalType *CredentialsListResponseAcsCredentialsItemExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName *string `json:"external_type_display_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsListResponseAcsCredentialsItem) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsListResponseAcsCredentialsItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsListResponseAcsCredentialsItem(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsListResponseAcsCredentialsItem) 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 CredentialsListResponseAcsCredentialsItemAccessMethod string + +const ( + CredentialsListResponseAcsCredentialsItemAccessMethodCode CredentialsListResponseAcsCredentialsItemAccessMethod = "code" + CredentialsListResponseAcsCredentialsItemAccessMethodCard CredentialsListResponseAcsCredentialsItemAccessMethod = "card" + CredentialsListResponseAcsCredentialsItemAccessMethodMobileKey CredentialsListResponseAcsCredentialsItemAccessMethod = "mobile_key" +) + +func NewCredentialsListResponseAcsCredentialsItemAccessMethodFromString(s string) (CredentialsListResponseAcsCredentialsItemAccessMethod, error) { + switch s { + case "code": + return CredentialsListResponseAcsCredentialsItemAccessMethodCode, nil + case "card": + return CredentialsListResponseAcsCredentialsItemAccessMethodCard, nil + case "mobile_key": + return CredentialsListResponseAcsCredentialsItemAccessMethodMobileKey, nil + } + var t CredentialsListResponseAcsCredentialsItemAccessMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsListResponseAcsCredentialsItemAccessMethod) Ptr() *CredentialsListResponseAcsCredentialsItemAccessMethod { + return &c +} + +type CredentialsListResponseAcsCredentialsItemExternalType string + +const ( + CredentialsListResponseAcsCredentialsItemExternalTypePtiCard CredentialsListResponseAcsCredentialsItemExternalType = "pti_card" + CredentialsListResponseAcsCredentialsItemExternalTypeBrivoCredential CredentialsListResponseAcsCredentialsItemExternalType = "brivo_credential" + CredentialsListResponseAcsCredentialsItemExternalTypeHidCredential CredentialsListResponseAcsCredentialsItemExternalType = "hid_credential" + CredentialsListResponseAcsCredentialsItemExternalTypeVisionlineCard CredentialsListResponseAcsCredentialsItemExternalType = "visionline_card" +) + +func NewCredentialsListResponseAcsCredentialsItemExternalTypeFromString(s string) (CredentialsListResponseAcsCredentialsItemExternalType, error) { + switch s { + case "pti_card": + return CredentialsListResponseAcsCredentialsItemExternalTypePtiCard, nil + case "brivo_credential": + return CredentialsListResponseAcsCredentialsItemExternalTypeBrivoCredential, nil + case "hid_credential": + return CredentialsListResponseAcsCredentialsItemExternalTypeHidCredential, nil + case "visionline_card": + return CredentialsListResponseAcsCredentialsItemExternalTypeVisionlineCard, nil + } + var t CredentialsListResponseAcsCredentialsItemExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsListResponseAcsCredentialsItemExternalType) Ptr() *CredentialsListResponseAcsCredentialsItemExternalType { + return &c +} + +type CredentialsUnassignResponseAcsCredential struct { + AcsCredentialId string `json:"acs_credential_id"` + AcsUserId *string `json:"acs_user_id,omitempty"` + AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` + AcsSystemId string `json:"acs_system_id"` + DisplayName string `json:"display_name"` + Code *string `json:"code,omitempty"` + AccessMethod CredentialsUnassignResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` + ExternalType *CredentialsUnassignResponseAcsCredentialExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName *string `json:"external_type_display_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsUnassignResponseAcsCredential) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsUnassignResponseAcsCredential + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsUnassignResponseAcsCredential(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsUnassignResponseAcsCredential) 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 CredentialsUnassignResponseAcsCredentialAccessMethod string + +const ( + CredentialsUnassignResponseAcsCredentialAccessMethodCode CredentialsUnassignResponseAcsCredentialAccessMethod = "code" + CredentialsUnassignResponseAcsCredentialAccessMethodCard CredentialsUnassignResponseAcsCredentialAccessMethod = "card" + CredentialsUnassignResponseAcsCredentialAccessMethodMobileKey CredentialsUnassignResponseAcsCredentialAccessMethod = "mobile_key" +) + +func NewCredentialsUnassignResponseAcsCredentialAccessMethodFromString(s string) (CredentialsUnassignResponseAcsCredentialAccessMethod, error) { + switch s { + case "code": + return CredentialsUnassignResponseAcsCredentialAccessMethodCode, nil + case "card": + return CredentialsUnassignResponseAcsCredentialAccessMethodCard, nil + case "mobile_key": + return CredentialsUnassignResponseAcsCredentialAccessMethodMobileKey, nil + } + var t CredentialsUnassignResponseAcsCredentialAccessMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsUnassignResponseAcsCredentialAccessMethod) Ptr() *CredentialsUnassignResponseAcsCredentialAccessMethod { + return &c +} + +type CredentialsUnassignResponseAcsCredentialExternalType string + +const ( + CredentialsUnassignResponseAcsCredentialExternalTypePtiCard CredentialsUnassignResponseAcsCredentialExternalType = "pti_card" + CredentialsUnassignResponseAcsCredentialExternalTypeBrivoCredential CredentialsUnassignResponseAcsCredentialExternalType = "brivo_credential" + CredentialsUnassignResponseAcsCredentialExternalTypeHidCredential CredentialsUnassignResponseAcsCredentialExternalType = "hid_credential" + CredentialsUnassignResponseAcsCredentialExternalTypeVisionlineCard CredentialsUnassignResponseAcsCredentialExternalType = "visionline_card" +) + +func NewCredentialsUnassignResponseAcsCredentialExternalTypeFromString(s string) (CredentialsUnassignResponseAcsCredentialExternalType, error) { + switch s { + case "pti_card": + return CredentialsUnassignResponseAcsCredentialExternalTypePtiCard, nil + case "brivo_credential": + return CredentialsUnassignResponseAcsCredentialExternalTypeBrivoCredential, nil + case "hid_credential": + return CredentialsUnassignResponseAcsCredentialExternalTypeHidCredential, nil + case "visionline_card": + return CredentialsUnassignResponseAcsCredentialExternalTypeVisionlineCard, nil + } + var t CredentialsUnassignResponseAcsCredentialExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsUnassignResponseAcsCredentialExternalType) Ptr() *CredentialsUnassignResponseAcsCredentialExternalType { + return &c +} + +type CredentialsUpdateResponseAcsCredential struct { + AcsCredentialId string `json:"acs_credential_id"` + AcsUserId *string `json:"acs_user_id,omitempty"` + AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` + AcsSystemId string `json:"acs_system_id"` + DisplayName string `json:"display_name"` + Code *string `json:"code,omitempty"` + AccessMethod CredentialsUpdateResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` + ExternalType *CredentialsUpdateResponseAcsCredentialExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName *string `json:"external_type_display_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (c *CredentialsUpdateResponseAcsCredential) UnmarshalJSON(data []byte) error { + type unmarshaler CredentialsUpdateResponseAcsCredential + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CredentialsUpdateResponseAcsCredential(value) + c._rawJSON = json.RawMessage(data) + return nil +} + +func (c *CredentialsUpdateResponseAcsCredential) 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 CredentialsUpdateResponseAcsCredentialAccessMethod string + +const ( + CredentialsUpdateResponseAcsCredentialAccessMethodCode CredentialsUpdateResponseAcsCredentialAccessMethod = "code" + CredentialsUpdateResponseAcsCredentialAccessMethodCard CredentialsUpdateResponseAcsCredentialAccessMethod = "card" + CredentialsUpdateResponseAcsCredentialAccessMethodMobileKey CredentialsUpdateResponseAcsCredentialAccessMethod = "mobile_key" +) + +func NewCredentialsUpdateResponseAcsCredentialAccessMethodFromString(s string) (CredentialsUpdateResponseAcsCredentialAccessMethod, error) { + switch s { + case "code": + return CredentialsUpdateResponseAcsCredentialAccessMethodCode, nil + case "card": + return CredentialsUpdateResponseAcsCredentialAccessMethodCard, nil + case "mobile_key": + return CredentialsUpdateResponseAcsCredentialAccessMethodMobileKey, nil + } + var t CredentialsUpdateResponseAcsCredentialAccessMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsUpdateResponseAcsCredentialAccessMethod) Ptr() *CredentialsUpdateResponseAcsCredentialAccessMethod { + return &c +} + +type CredentialsUpdateResponseAcsCredentialExternalType string + +const ( + CredentialsUpdateResponseAcsCredentialExternalTypePtiCard CredentialsUpdateResponseAcsCredentialExternalType = "pti_card" + CredentialsUpdateResponseAcsCredentialExternalTypeBrivoCredential CredentialsUpdateResponseAcsCredentialExternalType = "brivo_credential" + CredentialsUpdateResponseAcsCredentialExternalTypeHidCredential CredentialsUpdateResponseAcsCredentialExternalType = "hid_credential" + CredentialsUpdateResponseAcsCredentialExternalTypeVisionlineCard CredentialsUpdateResponseAcsCredentialExternalType = "visionline_card" +) + +func NewCredentialsUpdateResponseAcsCredentialExternalTypeFromString(s string) (CredentialsUpdateResponseAcsCredentialExternalType, error) { + switch s { + case "pti_card": + return CredentialsUpdateResponseAcsCredentialExternalTypePtiCard, nil + case "brivo_credential": + return CredentialsUpdateResponseAcsCredentialExternalTypeBrivoCredential, nil + case "hid_credential": + return CredentialsUpdateResponseAcsCredentialExternalTypeHidCredential, nil + case "visionline_card": + return CredentialsUpdateResponseAcsCredentialExternalTypeVisionlineCard, nil + } + var t CredentialsUpdateResponseAcsCredentialExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CredentialsUpdateResponseAcsCredentialExternalType) Ptr() *CredentialsUpdateResponseAcsCredentialExternalType { + return &c +} + +type EntrancesGetResponseAcsEntrance struct { + AcsEntranceId string `json:"acs_entrance_id"` + DisplayName string `json:"display_name"` + AcsSystemId string `json:"acs_system_id"` + CreatedAt time.Time `json:"created_at"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesGetResponseAcsEntrance) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesGetResponseAcsEntrance + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesGetResponseAcsEntrance(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesGetResponseAcsEntrance) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type EntrancesListResponseAcsEntrancesItem struct { + AcsEntranceId string `json:"acs_entrance_id"` + DisplayName string `json:"display_name"` + AcsSystemId string `json:"acs_system_id"` + CreatedAt time.Time `json:"created_at"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesListResponseAcsEntrancesItem) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesListResponseAcsEntrancesItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesListResponseAcsEntrancesItem(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesListResponseAcsEntrancesItem) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} diff --git a/acs/users.go b/acs/users.go new file mode 100644 index 0000000..aa6d3f5 --- /dev/null +++ b/acs/users.go @@ -0,0 +1,299 @@ +// This file was auto-generated by Fern from our API Definition. + +package acs + +import ( + json "encoding/json" + fmt "fmt" + seamapigo "github.com/seamapi/go" + core "github.com/seamapi/go/core" + time "time" +) + +type UsersAddToAccessGroupRequest struct { + AcsUserId string `json:"acs_user_id"` + AcsAccessGroupId string `json:"acs_access_group_id"` +} + +type UsersCreateRequest struct { + AcsSystemId string `json:"acs_system_id"` + AcsAccessGroupIds []string `json:"acs_access_group_ids,omitempty"` + UserIdentityId *string `json:"user_identity_id,omitempty"` + AccessSchedule *UsersCreateRequestAccessSchedule `json:"access_schedule,omitempty"` + FullName *string `json:"full_name,omitempty"` + // Deprecated: use email_address. + Email *string `json:"email,omitempty"` + PhoneNumber *string `json:"phone_number,omitempty"` + EmailAddress *string `json:"email_address,omitempty"` +} + +type UsersDeleteRequest struct { + AcsUserId string `json:"acs_user_id"` +} + +type UsersGetRequest struct { + AcsUserId string `json:"acs_user_id"` +} + +type UsersListRequest struct { + AcsSystemId string `json:"acs_system_id"` +} + +type UsersRemoveFromAccessGroupRequest struct { + AcsUserId string `json:"acs_user_id"` + AcsAccessGroupId string `json:"acs_access_group_id"` +} + +type UsersSuspendRequest struct { + AcsUserId string `json:"acs_user_id"` +} + +type UsersCreateRequestAccessSchedule struct { + StartsAt time.Time `json:"starts_at"` + EndsAt time.Time `json:"ends_at"` + + _rawJSON json.RawMessage +} + +func (u *UsersCreateRequestAccessSchedule) UnmarshalJSON(data []byte) error { + type unmarshaler UsersCreateRequestAccessSchedule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersCreateRequestAccessSchedule(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersCreateRequestAccessSchedule) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UsersCreateResponse struct { + AcsUser *seamapigo.AcsUser `json:"acs_user,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UsersCreateResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UsersCreateResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersCreateResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersCreateResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UsersDeleteResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UsersDeleteResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UsersDeleteResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersDeleteResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersDeleteResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UsersGetResponse struct { + AcsUser *seamapigo.AcsUser `json:"acs_user,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UsersGetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UsersGetResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersGetResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersGetResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UsersListResponse struct { + AcsUsers []*seamapigo.AcsUser `json:"acs_users,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UsersListResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UsersListResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersListResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersListResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UsersSuspendResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UsersSuspendResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UsersSuspendResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersSuspendResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersSuspendResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UsersUnsuspendResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UsersUnsuspendResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UsersUnsuspendResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersUnsuspendResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersUnsuspendResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UsersUpdateResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UsersUpdateResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UsersUpdateResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersUpdateResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersUpdateResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UsersUnsuspendRequest struct { + AcsUserId string `json:"acs_user_id"` +} + +type UsersUpdateRequest struct { + AcsUserId string `json:"acs_user_id"` + FullName *string `json:"full_name,omitempty"` + // Deprecated: use email_address. + Email *string `json:"email,omitempty"` + PhoneNumber *string `json:"phone_number,omitempty"` + EmailAddress *string `json:"email_address,omitempty"` + HidAcsSystemId *string `json:"hid_acs_system_id,omitempty"` +} diff --git a/acs/users/client.go b/acs/users/client.go new file mode 100644 index 0000000..ea9c280 --- /dev/null +++ b/acs/users/client.go @@ -0,0 +1,479 @@ +// This file was auto-generated by Fern from our API Definition. + +package users + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + acs "github.com/seamapi/go/acs" + core "github.com/seamapi/go/core" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +func (c *Client) AddToAccessGroup(ctx context.Context, request *acs.UsersAddToAccessGroupRequest) error { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/add_to_access_group" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return err + } + return nil +} + +func (c *Client) Create(ctx context.Context, request *acs.UsersCreateRequest) (*acs.UsersCreateResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/create" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.UsersCreateResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Delete(ctx context.Context, request *acs.UsersDeleteRequest) (*acs.UsersDeleteResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/delete" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.UsersDeleteResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Get(ctx context.Context, request *acs.UsersGetRequest) (*acs.UsersGetResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/get" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.UsersGetResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) List(ctx context.Context, request *acs.UsersListRequest) (*acs.UsersListResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/list" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.UsersListResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) RemoveFromAccessGroup(ctx context.Context, request *acs.UsersRemoveFromAccessGroupRequest) error { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/remove_from_access_group" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return err + } + return nil +} + +func (c *Client) Suspend(ctx context.Context, request *acs.UsersSuspendRequest) (*acs.UsersSuspendResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/suspend" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.UsersSuspendResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Unsuspend(ctx context.Context, request *acs.UsersUnsuspendRequest) (*acs.UsersUnsuspendResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/unsuspend" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.UsersUnsuspendResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Update(ctx context.Context, request *acs.UsersUpdateRequest) (*acs.UsersUpdateResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/update" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *acs.UsersUpdateResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/client/client.go b/client/client.go index 48a39b8..c6d99bf 100644 --- a/client/client.go +++ b/client/client.go @@ -4,6 +4,7 @@ package client import ( accesscodesclient "github.com/seamapi/go/accesscodes/client" + acsclient "github.com/seamapi/go/acs/client" actionattempts "github.com/seamapi/go/actionattempts" clientsessions "github.com/seamapi/go/clientsessions" connectedaccounts "github.com/seamapi/go/connectedaccounts" @@ -15,6 +16,7 @@ import ( locks "github.com/seamapi/go/locks" noisesensorsclient "github.com/seamapi/go/noisesensors/client" thermostatsclient "github.com/seamapi/go/thermostats/client" + useridentitiesclient "github.com/seamapi/go/useridentities/client" webhooks "github.com/seamapi/go/webhooks" workspaces "github.com/seamapi/go/workspaces" http "net/http" @@ -25,7 +27,9 @@ type Client struct { caller *core.Caller header http.Header + UserIdentities *useridentitiesclient.Client AccessCodes *accesscodesclient.Client + Acs *acsclient.Client ActionAttempts *actionattempts.Client ClientSessions *clientsessions.Client ConnectedAccounts *connectedaccounts.Client @@ -49,7 +53,9 @@ func NewClient(opts ...core.ClientOption) *Client { baseURL: options.BaseURL, caller: core.NewCaller(options.HTTPClient), header: options.ToHeader(), + UserIdentities: useridentitiesclient.NewClient(opts...), AccessCodes: accesscodesclient.NewClient(opts...), + Acs: acsclient.NewClient(opts...), ActionAttempts: actionattempts.NewClient(opts...), ClientSessions: clientsessions.NewClient(opts...), ConnectedAccounts: connectedaccounts.NewClient(opts...), diff --git a/core/client_option.go b/core/client_option.go index 7795c71..22fc87f 100644 --- a/core/client_option.go +++ b/core/client_option.go @@ -48,6 +48,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.1.5") + headers.Set("X-Fern-SDK-Version", "v0.2.0") return headers } diff --git a/types.go b/types.go index 29ec5e2..845d5f2 100644 --- a/types.go +++ b/types.go @@ -108,6 +108,317 @@ func (a AccessCodeType) Ptr() *AccessCodeType { return &a } +type AcsAccessGroup struct { + AcsAccessGroupId string `json:"acs_access_group_id"` + AcsSystemId string `json:"acs_system_id"` + WorkspaceId string `json:"workspace_id"` + Name string `json:"name"` + // deprecated: use external_type + AccessGroupType AcsAccessGroupAccessGroupType `json:"access_group_type,omitempty"` + // deprecated: use external_type_display_name + AccessGroupTypeDisplayName string `json:"access_group_type_display_name"` + ExternalType AcsAccessGroupExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName string `json:"external_type_display_name"` + CreatedAt time.Time `json:"created_at"` + + _rawJSON json.RawMessage +} + +func (a *AcsAccessGroup) UnmarshalJSON(data []byte) error { + type unmarshaler AcsAccessGroup + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AcsAccessGroup(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AcsAccessGroup) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +// deprecated: use external_type +type AcsAccessGroupAccessGroupType string + +const ( + AcsAccessGroupAccessGroupTypePtiUnit AcsAccessGroupAccessGroupType = "pti_unit" + AcsAccessGroupAccessGroupTypePtiAccessLevel AcsAccessGroupAccessGroupType = "pti_access_level" + AcsAccessGroupAccessGroupTypeSaltoAccessGroup AcsAccessGroupAccessGroupType = "salto_access_group" + AcsAccessGroupAccessGroupTypeBrivoGroup AcsAccessGroupAccessGroupType = "brivo_group" +) + +func NewAcsAccessGroupAccessGroupTypeFromString(s string) (AcsAccessGroupAccessGroupType, error) { + switch s { + case "pti_unit": + return AcsAccessGroupAccessGroupTypePtiUnit, nil + case "pti_access_level": + return AcsAccessGroupAccessGroupTypePtiAccessLevel, nil + case "salto_access_group": + return AcsAccessGroupAccessGroupTypeSaltoAccessGroup, nil + case "brivo_group": + return AcsAccessGroupAccessGroupTypeBrivoGroup, nil + } + var t AcsAccessGroupAccessGroupType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (a AcsAccessGroupAccessGroupType) Ptr() *AcsAccessGroupAccessGroupType { + return &a +} + +type AcsAccessGroupExternalType string + +const ( + AcsAccessGroupExternalTypePtiUnit AcsAccessGroupExternalType = "pti_unit" + AcsAccessGroupExternalTypePtiAccessLevel AcsAccessGroupExternalType = "pti_access_level" + AcsAccessGroupExternalTypeSaltoAccessGroup AcsAccessGroupExternalType = "salto_access_group" + AcsAccessGroupExternalTypeBrivoGroup AcsAccessGroupExternalType = "brivo_group" +) + +func NewAcsAccessGroupExternalTypeFromString(s string) (AcsAccessGroupExternalType, error) { + switch s { + case "pti_unit": + return AcsAccessGroupExternalTypePtiUnit, nil + case "pti_access_level": + return AcsAccessGroupExternalTypePtiAccessLevel, nil + case "salto_access_group": + return AcsAccessGroupExternalTypeSaltoAccessGroup, nil + case "brivo_group": + return AcsAccessGroupExternalTypeBrivoGroup, nil + } + var t AcsAccessGroupExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (a AcsAccessGroupExternalType) Ptr() *AcsAccessGroupExternalType { + return &a +} + +type AcsSystem struct { + AcsSystemId string `json:"acs_system_id"` + ExternalType AcsSystemExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName string `json:"external_type_display_name"` + // deprecated: use external_type + SystemType AcsSystemSystemType `json:"system_type,omitempty"` + // deprecated: use external_type_display_name + SystemTypeDisplayName string `json:"system_type_display_name"` + Name string `json:"name"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` + + _rawJSON json.RawMessage +} + +func (a *AcsSystem) UnmarshalJSON(data []byte) error { + type unmarshaler AcsSystem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AcsSystem(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AcsSystem) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type AcsSystemExternalType string + +const ( + AcsSystemExternalTypePtiSite AcsSystemExternalType = "pti_site" + AcsSystemExternalTypeAltaOrg AcsSystemExternalType = "alta_org" + AcsSystemExternalTypeSaltoSite AcsSystemExternalType = "salto_site" + AcsSystemExternalTypeBrivoAccount AcsSystemExternalType = "brivo_account" + AcsSystemExternalTypeHidCredentialManagerOrganization AcsSystemExternalType = "hid_credential_manager_organization" + AcsSystemExternalTypeVisionlineSystem AcsSystemExternalType = "visionline_system" + AcsSystemExternalTypeAssaAbloyCredentialServiceUser AcsSystemExternalType = "assa_abloy_credential_service_user" +) + +func NewAcsSystemExternalTypeFromString(s string) (AcsSystemExternalType, error) { + switch s { + case "pti_site": + return AcsSystemExternalTypePtiSite, nil + case "alta_org": + return AcsSystemExternalTypeAltaOrg, nil + case "salto_site": + return AcsSystemExternalTypeSaltoSite, nil + case "brivo_account": + return AcsSystemExternalTypeBrivoAccount, nil + case "hid_credential_manager_organization": + return AcsSystemExternalTypeHidCredentialManagerOrganization, nil + case "visionline_system": + return AcsSystemExternalTypeVisionlineSystem, nil + case "assa_abloy_credential_service_user": + return AcsSystemExternalTypeAssaAbloyCredentialServiceUser, nil + } + var t AcsSystemExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (a AcsSystemExternalType) Ptr() *AcsSystemExternalType { + return &a +} + +// deprecated: use external_type +type AcsSystemSystemType string + +const ( + AcsSystemSystemTypePtiSite AcsSystemSystemType = "pti_site" + AcsSystemSystemTypeAltaOrg AcsSystemSystemType = "alta_org" + AcsSystemSystemTypeSaltoSite AcsSystemSystemType = "salto_site" + AcsSystemSystemTypeBrivoAccount AcsSystemSystemType = "brivo_account" + AcsSystemSystemTypeHidCredentialManagerOrganization AcsSystemSystemType = "hid_credential_manager_organization" + AcsSystemSystemTypeVisionlineSystem AcsSystemSystemType = "visionline_system" + AcsSystemSystemTypeAssaAbloyCredentialServiceUser AcsSystemSystemType = "assa_abloy_credential_service_user" +) + +func NewAcsSystemSystemTypeFromString(s string) (AcsSystemSystemType, error) { + switch s { + case "pti_site": + return AcsSystemSystemTypePtiSite, nil + case "alta_org": + return AcsSystemSystemTypeAltaOrg, nil + case "salto_site": + return AcsSystemSystemTypeSaltoSite, nil + case "brivo_account": + return AcsSystemSystemTypeBrivoAccount, nil + case "hid_credential_manager_organization": + return AcsSystemSystemTypeHidCredentialManagerOrganization, nil + case "visionline_system": + return AcsSystemSystemTypeVisionlineSystem, nil + case "assa_abloy_credential_service_user": + return AcsSystemSystemTypeAssaAbloyCredentialServiceUser, nil + } + var t AcsSystemSystemType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (a AcsSystemSystemType) Ptr() *AcsSystemSystemType { + return &a +} + +type AcsUser struct { + AcsUserId string `json:"acs_user_id"` + AcsSystemId string `json:"acs_system_id"` + HidAcsSystemId *string `json:"hid_acs_system_id,omitempty"` + WorkspaceId string `json:"workspace_id"` + CreatedAt time.Time `json:"created_at"` + DisplayName string `json:"display_name"` + ExternalType *AcsUserExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName *string `json:"external_type_display_name,omitempty"` + IsSuspended bool `json:"is_suspended"` + AccessSchedule *AcsUserAccessSchedule `json:"access_schedule,omitempty"` + FullName *string `json:"full_name,omitempty"` + // Deprecated: use email_address. + Email *string `json:"email,omitempty"` + EmailAddress *string `json:"email_address,omitempty"` + PhoneNumber *string `json:"phone_number,omitempty"` + + _rawJSON json.RawMessage +} + +func (a *AcsUser) UnmarshalJSON(data []byte) error { + type unmarshaler AcsUser + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AcsUser(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AcsUser) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type AcsUserAccessSchedule struct { + StartsAt time.Time `json:"starts_at"` + EndsAt time.Time `json:"ends_at"` + + _rawJSON json.RawMessage +} + +func (a *AcsUserAccessSchedule) UnmarshalJSON(data []byte) error { + type unmarshaler AcsUserAccessSchedule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AcsUserAccessSchedule(value) + a._rawJSON = json.RawMessage(data) + return nil +} + +func (a *AcsUserAccessSchedule) String() string { + if len(a._rawJSON) > 0 { + if value, err := core.StringifyJSON(a._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(a); err == nil { + return value + } + return fmt.Sprintf("%#v", a) +} + +type AcsUserExternalType string + +const ( + AcsUserExternalTypePtiUser AcsUserExternalType = "pti_user" + AcsUserExternalTypeBrivoUser AcsUserExternalType = "brivo_user" + AcsUserExternalTypeHidCmUser AcsUserExternalType = "hid_cm_user" + AcsUserExternalTypeSaltoSiteUser AcsUserExternalType = "salto_site_user" +) + +func NewAcsUserExternalTypeFromString(s string) (AcsUserExternalType, error) { + switch s { + case "pti_user": + return AcsUserExternalTypePtiUser, nil + case "brivo_user": + return AcsUserExternalTypeBrivoUser, nil + case "hid_cm_user": + return AcsUserExternalTypeHidCmUser, nil + case "salto_site_user": + return AcsUserExternalTypeSaltoSiteUser, nil + } + var t AcsUserExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (a AcsUserExternalType) Ptr() *AcsUserExternalType { + return &a +} + type ActionAttempt struct { Status string Success *ActionAttemptSuccess diff --git a/useridentities/client/client.go b/useridentities/client/client.go new file mode 100644 index 0000000..f001624 --- /dev/null +++ b/useridentities/client/client.go @@ -0,0 +1,486 @@ +// This file was auto-generated by Fern from our API Definition. + +package client + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + core "github.com/seamapi/go/core" + useridentities "github.com/seamapi/go/useridentities" + enrollmentautomations "github.com/seamapi/go/useridentities/enrollmentautomations" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header + + EnrollmentAutomations *enrollmentautomations.Client +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + EnrollmentAutomations: enrollmentautomations.NewClient(opts...), + } +} + +func (c *Client) AddAcsUser(ctx context.Context, request *useridentities.UserIdentitiesAddAcsUserRequest) (*useridentities.UserIdentitiesAddAcsUserResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/add_acs_user" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesAddAcsUserResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) Create(ctx context.Context, request *useridentities.UserIdentitiesCreateRequest) (*useridentities.UserIdentitiesCreateResponseUserIdentity, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/create" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesCreateResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response.UserIdentity, nil +} + +func (c *Client) Get(ctx context.Context, request *useridentities.UserIdentitiesGetRequest) (*useridentities.UserIdentitiesGetResponseUserIdentity, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/get" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesGetResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response.UserIdentity, nil +} + +func (c *Client) GrantAccessToDevice(ctx context.Context, request *useridentities.UserIdentitiesGrantAccessToDeviceRequest) (*useridentities.UserIdentitiesGrantAccessToDeviceResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/grant_access_to_device" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesGrantAccessToDeviceResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) List(ctx context.Context) ([]*useridentities.UserIdentitiesListResponseUserIdentitiesItem, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/list" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesListResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response.UserIdentities, nil +} + +func (c *Client) ListAccessibleDevices(ctx context.Context, request *useridentities.UserIdentitiesListAccessibleDevicesRequest) (*useridentities.UserIdentitiesListAccessibleDevicesResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/list_accessible_devices" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesListAccessibleDevicesResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) ListAcsUsers(ctx context.Context, request *useridentities.UserIdentitiesListAcsUsersRequest) (*useridentities.UserIdentitiesListAcsUsersResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/list_acs_users" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesListAcsUsersResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) RemoveAcsUser(ctx context.Context, request *useridentities.UserIdentitiesRemoveAcsUserRequest) (*useridentities.UserIdentitiesRemoveAcsUserResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/remove_acs_user" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesRemoveAcsUserResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} + +func (c *Client) RevokeAccessToDevice(ctx context.Context, request *useridentities.UserIdentitiesRevokeAccessToDeviceRequest) (*useridentities.UserIdentitiesRevokeAccessToDeviceResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/revoke_access_to_device" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.UserIdentitiesRevokeAccessToDeviceResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/useridentities/enrollment_automations.go b/useridentities/enrollment_automations.go new file mode 100644 index 0000000..db8f061 --- /dev/null +++ b/useridentities/enrollment_automations.go @@ -0,0 +1,47 @@ +// This file was auto-generated by Fern from our API Definition. + +package useridentities + +import ( + json "encoding/json" + fmt "fmt" + core "github.com/seamapi/go/core" +) + +type EnrollmentAutomationsLaunchRequest struct { + UserIdentityId string `json:"user_identity_id"` + CredentialManagerAcsSystemId string `json:"credential_manager_acs_system_id"` + AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` + CreateCredentialManagerUser *bool `json:"create_credential_manager_user,omitempty"` + CredentialManagerAcsUserId *string `json:"credential_manager_acs_user_id,omitempty"` +} + +type EnrollmentAutomationsLaunchResponse struct { + EnrollmentAutomation *EnrollmentAutomationsLaunchResponseEnrollmentAutomation `json:"enrollment_automation,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (e *EnrollmentAutomationsLaunchResponse) UnmarshalJSON(data []byte) error { + type unmarshaler EnrollmentAutomationsLaunchResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EnrollmentAutomationsLaunchResponse(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EnrollmentAutomationsLaunchResponse) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} diff --git a/useridentities/enrollmentautomations/client.go b/useridentities/enrollmentautomations/client.go new file mode 100644 index 0000000..319f63a --- /dev/null +++ b/useridentities/enrollmentautomations/client.go @@ -0,0 +1,83 @@ +// This file was auto-generated by Fern from our API Definition. + +package enrollmentautomations + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + seamapigo "github.com/seamapi/go" + core "github.com/seamapi/go/core" + useridentities "github.com/seamapi/go/useridentities" + io "io" + http "net/http" +) + +type Client struct { + baseURL string + caller *core.Caller + header http.Header +} + +func NewClient(opts ...core.ClientOption) *Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &Client{ + baseURL: options.BaseURL, + caller: core.NewCaller(options.HTTPClient), + header: options.ToHeader(), + } +} + +func (c *Client) Launch(ctx context.Context, request *useridentities.EnrollmentAutomationsLaunchRequest) (*useridentities.EnrollmentAutomationsLaunchResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/enrollment_automations/launch" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *useridentities.EnrollmentAutomationsLaunchResponse + if err := c.caller.Call( + ctx, + &core.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: c.header, + Request: request, + Response: &response, + ErrorDecoder: errorDecoder, + }, + ); err != nil { + return nil, err + } + return response, nil +} diff --git a/useridentities/types.go b/useridentities/types.go new file mode 100644 index 0000000..25683e0 --- /dev/null +++ b/useridentities/types.go @@ -0,0 +1,242 @@ +// This file was auto-generated by Fern from our API Definition. + +package useridentities + +import ( + json "encoding/json" + fmt "fmt" + core "github.com/seamapi/go/core" + time "time" +) + +type UserIdentitiesAddAcsUserRequest struct { + UserIdentityId string `json:"user_identity_id"` + AcsUserId string `json:"acs_user_id"` +} + +type UserIdentitiesCreateRequest struct { + UserIdentityKey *string `json:"user_identity_key,omitempty"` + EmailAddress *string `json:"email_address,omitempty"` + FirstName *string `json:"first_name,omitempty"` + LastName *string `json:"last_name,omitempty"` +} + +type UserIdentitiesGrantAccessToDeviceRequest struct { + UserIdentityId string `json:"user_identity_id"` + DeviceId string `json:"device_id"` +} + +type UserIdentitiesListAccessibleDevicesRequest struct { + UserIdentityId string `json:"user_identity_id"` +} + +type UserIdentitiesListAcsUsersRequest struct { + UserIdentityId string `json:"user_identity_id"` +} + +type UserIdentitiesRemoveAcsUserRequest struct { + UserIdentityId string `json:"user_identity_id"` + AcsUserId string `json:"acs_user_id"` +} + +type UserIdentitiesRevokeAccessToDeviceRequest struct { + UserIdentityId string `json:"user_identity_id"` + DeviceId string `json:"device_id"` +} + +type EnrollmentAutomationsLaunchResponseEnrollmentAutomation struct { + AcsCredentialProvisioningAutomationId string `json:"acs_credential_provisioning_automation_id"` + CredentialManagerAcsSystemId string `json:"credential_manager_acs_system_id"` + UserIdentityId string `json:"user_identity_id"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + EnrollmentAutomationId string `json:"enrollment_automation_id"` + + _rawJSON json.RawMessage +} + +func (e *EnrollmentAutomationsLaunchResponseEnrollmentAutomation) UnmarshalJSON(data []byte) error { + type unmarshaler EnrollmentAutomationsLaunchResponseEnrollmentAutomation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EnrollmentAutomationsLaunchResponseEnrollmentAutomation(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EnrollmentAutomationsLaunchResponseEnrollmentAutomation) String() string { + if len(e._rawJSON) > 0 { + if value, err := core.StringifyJSON(e._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type UserIdentitiesCreateResponseUserIdentity struct { + UserIdentityId string `json:"user_identity_id"` + UserIdentityKey *string `json:"user_identity_key,omitempty"` + EmailAddress *string `json:"email_address,omitempty"` + FirstName *string `json:"first_name,omitempty"` + LastName *string `json:"last_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesCreateResponseUserIdentity) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesCreateResponseUserIdentity + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesCreateResponseUserIdentity(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesCreateResponseUserIdentity) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesGetRequestUserIdentityId struct { + UserIdentityId string `json:"user_identity_id"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesGetRequestUserIdentityId) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesGetRequestUserIdentityId + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesGetRequestUserIdentityId(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesGetRequestUserIdentityId) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesGetRequestUserIdentityKey struct { + UserIdentityKey string `json:"user_identity_key"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesGetRequestUserIdentityKey) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesGetRequestUserIdentityKey + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesGetRequestUserIdentityKey(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesGetRequestUserIdentityKey) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesGetResponseUserIdentity struct { + UserIdentityId string `json:"user_identity_id"` + UserIdentityKey *string `json:"user_identity_key,omitempty"` + EmailAddress *string `json:"email_address,omitempty"` + FirstName *string `json:"first_name,omitempty"` + LastName *string `json:"last_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesGetResponseUserIdentity) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesGetResponseUserIdentity + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesGetResponseUserIdentity(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesGetResponseUserIdentity) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesListResponseUserIdentitiesItem struct { + UserIdentityId string `json:"user_identity_id"` + UserIdentityKey *string `json:"user_identity_key,omitempty"` + EmailAddress *string `json:"email_address,omitempty"` + FirstName *string `json:"first_name,omitempty"` + LastName *string `json:"last_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesListResponseUserIdentitiesItem) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesListResponseUserIdentitiesItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesListResponseUserIdentitiesItem(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesListResponseUserIdentitiesItem) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} diff --git a/useridentities/user_identities.go b/useridentities/user_identities.go new file mode 100644 index 0000000..4a25ac2 --- /dev/null +++ b/useridentities/user_identities.go @@ -0,0 +1,333 @@ +// This file was auto-generated by Fern from our API Definition. + +package useridentities + +import ( + json "encoding/json" + fmt "fmt" + seamapigo "github.com/seamapi/go" + core "github.com/seamapi/go/core" +) + +type UserIdentitiesAddAcsUserResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesAddAcsUserResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesAddAcsUserResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesAddAcsUserResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesAddAcsUserResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesCreateResponse struct { + UserIdentity *UserIdentitiesCreateResponseUserIdentity `json:"user_identity,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesCreateResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesCreateResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesCreateResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesCreateResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesGetRequest struct { + typeName string + UserIdentitiesGetRequestUserIdentityId *UserIdentitiesGetRequestUserIdentityId + UserIdentitiesGetRequestUserIdentityKey *UserIdentitiesGetRequestUserIdentityKey +} + +func NewUserIdentitiesGetRequestFromUserIdentitiesGetRequestUserIdentityId(value *UserIdentitiesGetRequestUserIdentityId) *UserIdentitiesGetRequest { + return &UserIdentitiesGetRequest{typeName: "userIdentitiesGetRequestUserIdentityId", UserIdentitiesGetRequestUserIdentityId: value} +} + +func NewUserIdentitiesGetRequestFromUserIdentitiesGetRequestUserIdentityKey(value *UserIdentitiesGetRequestUserIdentityKey) *UserIdentitiesGetRequest { + return &UserIdentitiesGetRequest{typeName: "userIdentitiesGetRequestUserIdentityKey", UserIdentitiesGetRequestUserIdentityKey: value} +} + +func (u *UserIdentitiesGetRequest) UnmarshalJSON(data []byte) error { + valueUserIdentitiesGetRequestUserIdentityId := new(UserIdentitiesGetRequestUserIdentityId) + if err := json.Unmarshal(data, &valueUserIdentitiesGetRequestUserIdentityId); err == nil { + u.typeName = "userIdentitiesGetRequestUserIdentityId" + u.UserIdentitiesGetRequestUserIdentityId = valueUserIdentitiesGetRequestUserIdentityId + return nil + } + valueUserIdentitiesGetRequestUserIdentityKey := new(UserIdentitiesGetRequestUserIdentityKey) + if err := json.Unmarshal(data, &valueUserIdentitiesGetRequestUserIdentityKey); err == nil { + u.typeName = "userIdentitiesGetRequestUserIdentityKey" + u.UserIdentitiesGetRequestUserIdentityKey = valueUserIdentitiesGetRequestUserIdentityKey + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UserIdentitiesGetRequest) MarshalJSON() ([]byte, error) { + switch u.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "userIdentitiesGetRequestUserIdentityId": + return json.Marshal(u.UserIdentitiesGetRequestUserIdentityId) + case "userIdentitiesGetRequestUserIdentityKey": + return json.Marshal(u.UserIdentitiesGetRequestUserIdentityKey) + } +} + +type UserIdentitiesGetRequestVisitor interface { + VisitUserIdentitiesGetRequestUserIdentityId(*UserIdentitiesGetRequestUserIdentityId) error + VisitUserIdentitiesGetRequestUserIdentityKey(*UserIdentitiesGetRequestUserIdentityKey) error +} + +func (u *UserIdentitiesGetRequest) Accept(visitor UserIdentitiesGetRequestVisitor) error { + switch u.typeName { + default: + return fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "userIdentitiesGetRequestUserIdentityId": + return visitor.VisitUserIdentitiesGetRequestUserIdentityId(u.UserIdentitiesGetRequestUserIdentityId) + case "userIdentitiesGetRequestUserIdentityKey": + return visitor.VisitUserIdentitiesGetRequestUserIdentityKey(u.UserIdentitiesGetRequestUserIdentityKey) + } +} + +type UserIdentitiesGetResponse struct { + UserIdentity *UserIdentitiesGetResponseUserIdentity `json:"user_identity,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesGetResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesGetResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesGetResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesGetResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesGrantAccessToDeviceResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesGrantAccessToDeviceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesGrantAccessToDeviceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesGrantAccessToDeviceResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesGrantAccessToDeviceResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesListAccessibleDevicesResponse struct { + AccessibleDevices []*seamapigo.Device `json:"accessible_devices,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesListAccessibleDevicesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesListAccessibleDevicesResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesListAccessibleDevicesResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesListAccessibleDevicesResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesListAcsUsersResponse struct { + AcsUsers []*seamapigo.AcsUser `json:"acs_users,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesListAcsUsersResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesListAcsUsersResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesListAcsUsersResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesListAcsUsersResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesListResponse struct { + UserIdentities []*UserIdentitiesListResponseUserIdentitiesItem `json:"user_identities,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesListResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesListResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesListResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesListResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesRemoveAcsUserResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesRemoveAcsUserResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesRemoveAcsUserResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesRemoveAcsUserResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesRemoveAcsUserResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UserIdentitiesRevokeAccessToDeviceResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesRevokeAccessToDeviceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesRevokeAccessToDeviceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesRevokeAccessToDeviceResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesRevokeAccessToDeviceResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +}