diff --git a/acs/entrances.go b/acs/entrances.go index 903fc61..b3a1f4f 100644 --- a/acs/entrances.go +++ b/acs/entrances.go @@ -22,6 +22,12 @@ type EntrancesListRequest struct { AcsCredentialId *string `json:"acs_credential_id,omitempty"` } +type EntrancesListCredentialsWithAccessRequest struct { + AcsEntranceId *string `json:"acs_entrance_id,omitempty"` + AcsEntranceIds []string `json:"acs_entrance_ids,omitempty"` + IncludeIf []string `json:"include_if,omitempty"` +} + type EntrancesGetResponse struct { AcsEntrance *EntrancesGetResponseAcsEntrance `json:"acs_entrance,omitempty"` Ok bool `json:"ok"` @@ -81,6 +87,36 @@ func (e *EntrancesGrantAccessResponse) String() string { return fmt.Sprintf("%#v", e) } +type EntrancesListCredentialsWithAccessResponse struct { + AcsCredentials []*EntrancesListCredentialsWithAccessResponseAcsCredentialsItem `json:"acs_credentials,omitempty"` + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesListCredentialsWithAccessResponse) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesListCredentialsWithAccessResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesListCredentialsWithAccessResponse(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesListCredentialsWithAccessResponse) 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"` diff --git a/acs/entrances/client.go b/acs/entrances/client.go index b37a235..ea34707 100644 --- a/acs/entrances/client.go +++ b/acs/entrances/client.go @@ -181,3 +181,53 @@ func (c *Client) List(ctx context.Context, request *acs.EntrancesListRequest) (* } return response, nil } + +func (c *Client) ListCredentialsWithAccess(ctx context.Context, request *acs.EntrancesListCredentialsWithAccessRequest) (*acs.EntrancesListCredentialsWithAccessResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/entrances/list_credentials_with_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.EntrancesListCredentialsWithAccessResponse + 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 index 255eaf1..be9c684 100644 --- a/acs/types.go +++ b/acs/types.go @@ -95,19 +95,20 @@ func (c *CredentialProvisioningAutomationsLaunchResponseAcsCredentialProvisionin } 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"` - StartsAt *string `json:"starts_at,omitempty"` - EndsAt *string `json:"ends_at,omitempty"` + 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"` + StartsAt *string `json:"starts_at,omitempty"` + EndsAt *string `json:"ends_at,omitempty"` + IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` _rawJSON json.RawMessage } @@ -189,19 +190,20 @@ func (c CredentialsAssignResponseAcsCredentialExternalType) Ptr() *CredentialsAs } 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"` - StartsAt *string `json:"starts_at,omitempty"` - EndsAt *string `json:"ends_at,omitempty"` + 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"` + StartsAt *string `json:"starts_at,omitempty"` + EndsAt *string `json:"ends_at,omitempty"` + IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` _rawJSON json.RawMessage } @@ -283,19 +285,20 @@ func (c CredentialsCreateResponseAcsCredentialExternalType) Ptr() *CredentialsCr } 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"` - StartsAt *string `json:"starts_at,omitempty"` - EndsAt *string `json:"ends_at,omitempty"` + 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"` + StartsAt *string `json:"starts_at,omitempty"` + EndsAt *string `json:"ends_at,omitempty"` + IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` _rawJSON json.RawMessage } @@ -494,19 +497,20 @@ func (c *CredentialsListRequestZero) String() string { } 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"` - StartsAt *string `json:"starts_at,omitempty"` - EndsAt *string `json:"ends_at,omitempty"` + 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"` + StartsAt *string `json:"starts_at,omitempty"` + EndsAt *string `json:"ends_at,omitempty"` + IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` _rawJSON json.RawMessage } @@ -588,19 +592,20 @@ func (c CredentialsListResponseAcsCredentialsItemExternalType) Ptr() *Credential } 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"` - StartsAt *string `json:"starts_at,omitempty"` - EndsAt *string `json:"ends_at,omitempty"` + 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"` + StartsAt *string `json:"starts_at,omitempty"` + EndsAt *string `json:"ends_at,omitempty"` + IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` _rawJSON json.RawMessage } @@ -682,19 +687,20 @@ func (c CredentialsUnassignResponseAcsCredentialExternalType) Ptr() *Credentials } 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"` - StartsAt *string `json:"starts_at,omitempty"` - EndsAt *string `json:"ends_at,omitempty"` + 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"` + StartsAt *string `json:"starts_at,omitempty"` + EndsAt *string `json:"ends_at,omitempty"` + IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` _rawJSON json.RawMessage } @@ -776,10 +782,11 @@ func (c CredentialsUpdateResponseAcsCredentialExternalType) Ptr() *CredentialsUp } 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"` + AcsEntranceId string `json:"acs_entrance_id"` + DisplayName string `json:"display_name"` + AcsSystemId string `json:"acs_system_id"` + CreatedAt time.Time `json:"created_at"` + VisionlineMetadata *EntrancesGetResponseAcsEntranceVisionlineMetadata `json:"visionline_metadata,omitempty"` _rawJSON json.RawMessage } @@ -807,11 +814,192 @@ func (e *EntrancesGetResponseAcsEntrance) String() string { return fmt.Sprintf("%#v", e) } +type EntrancesGetResponseAcsEntranceVisionlineMetadata struct { + DoorName string `json:"door_name"` + Profiles []*EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItem `json:"profiles,omitempty"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesGetResponseAcsEntranceVisionlineMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesGetResponseAcsEntranceVisionlineMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesGetResponseAcsEntranceVisionlineMetadata(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesGetResponseAcsEntranceVisionlineMetadata) 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 EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItem struct { + VisionlineDoorProfileId string `json:"visionline_door_profile_id"` + VisionlineDoorProfileType EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType `json:"visionline_door_profile_type,omitempty"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItem) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItem(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItem) 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 EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType string + +const ( + EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileTypeBle EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType = "BLE" + EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileTypeCommonDoor EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType = "commonDoor" + EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileTypeTouch EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType = "touch" +) + +func NewEntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileTypeFromString(s string) (EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType, error) { + switch s { + case "BLE": + return EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileTypeBle, nil + case "commonDoor": + return EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileTypeCommonDoor, nil + case "touch": + return EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileTypeTouch, nil + } + var t EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType) Ptr() *EntrancesGetResponseAcsEntranceVisionlineMetadataProfilesItemVisionlineDoorProfileType { + return &e +} + +type EntrancesListCredentialsWithAccessResponseAcsCredentialsItem 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 EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod `json:"access_method,omitempty"` + ExternalType *EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType `json:"external_type,omitempty"` + ExternalTypeDisplayName *string `json:"external_type_display_name,omitempty"` + CreatedAt time.Time `json:"created_at"` + WorkspaceId string `json:"workspace_id"` + StartsAt *string `json:"starts_at,omitempty"` + EndsAt *string `json:"ends_at,omitempty"` + IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesListCredentialsWithAccessResponseAcsCredentialsItem) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesListCredentialsWithAccessResponseAcsCredentialsItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesListCredentialsWithAccessResponseAcsCredentialsItem(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesListCredentialsWithAccessResponseAcsCredentialsItem) 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 EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod string + +const ( + EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethodCode EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod = "code" + EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethodCard EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod = "card" + EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethodMobileKey EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod = "mobile_key" +) + +func NewEntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethodFromString(s string) (EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod, error) { + switch s { + case "code": + return EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethodCode, nil + case "card": + return EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethodCard, nil + case "mobile_key": + return EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethodMobileKey, nil + } + var t EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod) Ptr() *EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod { + return &e +} + +type EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType string + +const ( + EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypePtiCard EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType = "pti_card" + EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypeBrivoCredential EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType = "brivo_credential" + EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypeHidCredential EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType = "hid_credential" + EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypeVisionlineCard EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType = "visionline_card" +) + +func NewEntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypeFromString(s string) (EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType, error) { + switch s { + case "pti_card": + return EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypePtiCard, nil + case "brivo_credential": + return EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypeBrivoCredential, nil + case "hid_credential": + return EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypeHidCredential, nil + case "visionline_card": + return EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalTypeVisionlineCard, nil + } + var t EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType) Ptr() *EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType { + return &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"` + AcsEntranceId string `json:"acs_entrance_id"` + DisplayName string `json:"display_name"` + AcsSystemId string `json:"acs_system_id"` + CreatedAt time.Time `json:"created_at"` + VisionlineMetadata *EntrancesListResponseAcsEntrancesItemVisionlineMetadata `json:"visionline_metadata,omitempty"` _rawJSON json.RawMessage } @@ -839,11 +1027,97 @@ func (e *EntrancesListResponseAcsEntrancesItem) String() string { return fmt.Sprintf("%#v", e) } +type EntrancesListResponseAcsEntrancesItemVisionlineMetadata struct { + DoorName string `json:"door_name"` + Profiles []*EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItem `json:"profiles,omitempty"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesListResponseAcsEntrancesItemVisionlineMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesListResponseAcsEntrancesItemVisionlineMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesListResponseAcsEntrancesItemVisionlineMetadata(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesListResponseAcsEntrancesItemVisionlineMetadata) 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 EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItem struct { + VisionlineDoorProfileId string `json:"visionline_door_profile_id"` + VisionlineDoorProfileType EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType `json:"visionline_door_profile_type,omitempty"` + + _rawJSON json.RawMessage +} + +func (e *EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItem) UnmarshalJSON(data []byte) error { + type unmarshaler EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItem(value) + e._rawJSON = json.RawMessage(data) + return nil +} + +func (e *EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItem) 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 EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType string + +const ( + EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeBle EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType = "BLE" + EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeCommonDoor EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType = "commonDoor" + EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeTouch EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType = "touch" +) + +func NewEntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeFromString(s string) (EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType, error) { + switch s { + case "BLE": + return EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeBle, nil + case "commonDoor": + return EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeCommonDoor, nil + case "touch": + return EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeTouch, nil + } + var t EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType) Ptr() *EntrancesListResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType { + return &e +} + type UsersListAccessibleEntrancesResponseAcsEntrancesItem struct { - AcsEntranceId string `json:"acs_entrance_id"` - DisplayName string `json:"display_name"` - AcsSystemId string `json:"acs_system_id"` - CreatedAt time.Time `json:"created_at"` + AcsEntranceId string `json:"acs_entrance_id"` + DisplayName string `json:"display_name"` + AcsSystemId string `json:"acs_system_id"` + CreatedAt time.Time `json:"created_at"` + VisionlineMetadata *UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadata `json:"visionline_metadata,omitempty"` _rawJSON json.RawMessage } @@ -870,3 +1144,88 @@ func (u *UsersListAccessibleEntrancesResponseAcsEntrancesItem) String() string { } return fmt.Sprintf("%#v", u) } + +type UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadata struct { + DoorName string `json:"door_name"` + Profiles []*UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItem `json:"profiles,omitempty"` + + _rawJSON json.RawMessage +} + +func (u *UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadata(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadata) 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 UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItem struct { + VisionlineDoorProfileId string `json:"visionline_door_profile_id"` + VisionlineDoorProfileType UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType `json:"visionline_door_profile_type,omitempty"` + + _rawJSON json.RawMessage +} + +func (u *UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItem) UnmarshalJSON(data []byte) error { + type unmarshaler UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItem + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItem(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItem) 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 UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType string + +const ( + UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeBle UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType = "BLE" + UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeCommonDoor UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType = "commonDoor" + UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeTouch UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType = "touch" +) + +func NewUsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeFromString(s string) (UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType, error) { + switch s { + case "BLE": + return UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeBle, nil + case "commonDoor": + return UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeCommonDoor, nil + case "touch": + return UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileTypeTouch, nil + } + var t UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (u UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType) Ptr() *UsersListAccessibleEntrancesResponseAcsEntrancesItemVisionlineMetadataProfilesItemVisionlineDoorProfileType { + return &u +} diff --git a/connect_webviews.go b/connect_webviews.go index 86bdbab..e7b8d1f 100644 --- a/connect_webviews.go +++ b/connect_webviews.go @@ -29,6 +29,8 @@ type ConnectWebviewsGetRequest struct { type ConnectWebviewsListRequest struct { UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + // Returns devices where the webview's custom_metadata contains all of the provided key/value pairs. + CustomMetadataHas map[string]*ConnectWebviewsListRequestCustomMetadataHasValue `json:"custom_metadata_has,omitempty"` } type AcceptedProvider string @@ -70,6 +72,7 @@ const ( AcceptedProviderSeamBridge AcceptedProvider = "seam_bridge" AcceptedProviderYaleAccess AcceptedProvider = "yale_access" AcceptedProviderHidCm AcceptedProvider = "hid_cm" + AcceptedProviderGoogleNest AcceptedProvider = "google_nest" ) func NewAcceptedProviderFromString(s string) (AcceptedProvider, error) { @@ -146,6 +149,8 @@ func NewAcceptedProviderFromString(s string) (AcceptedProvider, error) { return AcceptedProviderYaleAccess, nil case "hid_cm": return AcceptedProviderHidCm, nil + case "google_nest": + return AcceptedProviderGoogleNest, nil } var t AcceptedProvider return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -156,9 +161,10 @@ func (a AcceptedProvider) Ptr() *AcceptedProvider { } type ConnectWebviewsCreateRequestCustomMetadataValue struct { - typeName string - String string - Boolean bool + typeName string + String string + Boolean bool + StringOptional *string } func NewConnectWebviewsCreateRequestCustomMetadataValueFromString(value string) *ConnectWebviewsCreateRequestCustomMetadataValue { @@ -169,6 +175,10 @@ func NewConnectWebviewsCreateRequestCustomMetadataValueFromBoolean(value bool) * return &ConnectWebviewsCreateRequestCustomMetadataValue{typeName: "boolean", Boolean: value} } +func NewConnectWebviewsCreateRequestCustomMetadataValueFromStringOptional(value *string) *ConnectWebviewsCreateRequestCustomMetadataValue { + return &ConnectWebviewsCreateRequestCustomMetadataValue{typeName: "stringOptional", StringOptional: value} +} + func (c *ConnectWebviewsCreateRequestCustomMetadataValue) UnmarshalJSON(data []byte) error { var valueString string if err := json.Unmarshal(data, &valueString); err == nil { @@ -182,6 +192,12 @@ func (c *ConnectWebviewsCreateRequestCustomMetadataValue) UnmarshalJSON(data []b c.Boolean = valueBoolean return nil } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + c.typeName = "stringOptional" + c.StringOptional = valueStringOptional + return nil + } return fmt.Errorf("%s cannot be deserialized as a %T", data, c) } @@ -193,12 +209,15 @@ func (c ConnectWebviewsCreateRequestCustomMetadataValue) MarshalJSON() ([]byte, return json.Marshal(c.String) case "boolean": return json.Marshal(c.Boolean) + case "stringOptional": + return json.Marshal(c.StringOptional) } } type ConnectWebviewsCreateRequestCustomMetadataValueVisitor interface { VisitString(string) error VisitBoolean(bool) error + VisitStringOptional(*string) error } func (c *ConnectWebviewsCreateRequestCustomMetadataValue) Accept(visitor ConnectWebviewsCreateRequestCustomMetadataValueVisitor) error { @@ -209,6 +228,8 @@ func (c *ConnectWebviewsCreateRequestCustomMetadataValue) Accept(visitor Connect return visitor.VisitString(c.String) case "boolean": return visitor.VisitBoolean(c.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(c.StringOptional) } } @@ -301,6 +322,79 @@ func (c *ConnectWebviewsGetResponse) String() string { return fmt.Sprintf("%#v", c) } +type ConnectWebviewsListRequestCustomMetadataHasValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewConnectWebviewsListRequestCustomMetadataHasValueFromString(value string) *ConnectWebviewsListRequestCustomMetadataHasValue { + return &ConnectWebviewsListRequestCustomMetadataHasValue{typeName: "string", String: value} +} + +func NewConnectWebviewsListRequestCustomMetadataHasValueFromBoolean(value bool) *ConnectWebviewsListRequestCustomMetadataHasValue { + return &ConnectWebviewsListRequestCustomMetadataHasValue{typeName: "boolean", Boolean: value} +} + +func NewConnectWebviewsListRequestCustomMetadataHasValueFromStringOptional(value *string) *ConnectWebviewsListRequestCustomMetadataHasValue { + return &ConnectWebviewsListRequestCustomMetadataHasValue{typeName: "stringOptional", StringOptional: value} +} + +func (c *ConnectWebviewsListRequestCustomMetadataHasValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + c.typeName = "boolean" + c.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + c.typeName = "stringOptional" + c.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c ConnectWebviewsListRequestCustomMetadataHasValue) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "boolean": + return json.Marshal(c.Boolean) + case "stringOptional": + return json.Marshal(c.StringOptional) + } +} + +type ConnectWebviewsListRequestCustomMetadataHasValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (c *ConnectWebviewsListRequestCustomMetadataHasValue) Accept(visitor ConnectWebviewsListRequestCustomMetadataHasValueVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "boolean": + return visitor.VisitBoolean(c.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(c.StringOptional) + } +} + type ConnectWebviewsListResponse struct { ConnectWebviews []*ConnectWebview `json:"connect_webviews,omitempty"` Ok bool `json:"ok"` diff --git a/connected_accounts.go b/connected_accounts.go index ace0c1b..8179f08 100644 --- a/connected_accounts.go +++ b/connected_accounts.go @@ -13,6 +13,11 @@ type ConnectedAccountsDeleteRequest struct { Sync *bool `json:"sync,omitempty"` } +type ConnectedAccountsListRequest struct { + // Returns devices where the account's custom_metadata contains all of the provided key/value pairs. + CustomMetadataHas map[string]*ConnectedAccountsListRequestCustomMetadataHasValue `json:"custom_metadata_has,omitempty"` +} + type ConnectedAccountsDeleteResponse struct { Ok bool `json:"ok"` @@ -129,6 +134,79 @@ func (c *ConnectedAccountsGetResponse) String() string { return fmt.Sprintf("%#v", c) } +type ConnectedAccountsListRequestCustomMetadataHasValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewConnectedAccountsListRequestCustomMetadataHasValueFromString(value string) *ConnectedAccountsListRequestCustomMetadataHasValue { + return &ConnectedAccountsListRequestCustomMetadataHasValue{typeName: "string", String: value} +} + +func NewConnectedAccountsListRequestCustomMetadataHasValueFromBoolean(value bool) *ConnectedAccountsListRequestCustomMetadataHasValue { + return &ConnectedAccountsListRequestCustomMetadataHasValue{typeName: "boolean", Boolean: value} +} + +func NewConnectedAccountsListRequestCustomMetadataHasValueFromStringOptional(value *string) *ConnectedAccountsListRequestCustomMetadataHasValue { + return &ConnectedAccountsListRequestCustomMetadataHasValue{typeName: "stringOptional", StringOptional: value} +} + +func (c *ConnectedAccountsListRequestCustomMetadataHasValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + c.typeName = "boolean" + c.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + c.typeName = "stringOptional" + c.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c ConnectedAccountsListRequestCustomMetadataHasValue) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "boolean": + return json.Marshal(c.Boolean) + case "stringOptional": + return json.Marshal(c.StringOptional) + } +} + +type ConnectedAccountsListRequestCustomMetadataHasValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (c *ConnectedAccountsListRequestCustomMetadataHasValue) Accept(visitor ConnectedAccountsListRequestCustomMetadataHasValueVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "boolean": + return visitor.VisitBoolean(c.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(c.StringOptional) + } +} + type ConnectedAccountsListResponse struct { ConnectedAccounts []*ConnectedAccount `json:"connected_accounts,omitempty"` Ok bool `json:"ok"` @@ -159,6 +237,79 @@ func (c *ConnectedAccountsListResponse) String() string { return fmt.Sprintf("%#v", c) } +type ConnectedAccountsUpdateRequestCustomMetadataValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewConnectedAccountsUpdateRequestCustomMetadataValueFromString(value string) *ConnectedAccountsUpdateRequestCustomMetadataValue { + return &ConnectedAccountsUpdateRequestCustomMetadataValue{typeName: "string", String: value} +} + +func NewConnectedAccountsUpdateRequestCustomMetadataValueFromBoolean(value bool) *ConnectedAccountsUpdateRequestCustomMetadataValue { + return &ConnectedAccountsUpdateRequestCustomMetadataValue{typeName: "boolean", Boolean: value} +} + +func NewConnectedAccountsUpdateRequestCustomMetadataValueFromStringOptional(value *string) *ConnectedAccountsUpdateRequestCustomMetadataValue { + return &ConnectedAccountsUpdateRequestCustomMetadataValue{typeName: "stringOptional", StringOptional: value} +} + +func (c *ConnectedAccountsUpdateRequestCustomMetadataValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + c.typeName = "boolean" + c.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + c.typeName = "stringOptional" + c.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c ConnectedAccountsUpdateRequestCustomMetadataValue) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "boolean": + return json.Marshal(c.Boolean) + case "stringOptional": + return json.Marshal(c.StringOptional) + } +} + +type ConnectedAccountsUpdateRequestCustomMetadataValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (c *ConnectedAccountsUpdateRequestCustomMetadataValue) Accept(visitor ConnectedAccountsUpdateRequestCustomMetadataValueVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "boolean": + return visitor.VisitBoolean(c.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(c.StringOptional) + } +} + type ConnectedAccountsUpdateResponse struct { ConnectedAccount *ConnectedAccount `json:"connected_account,omitempty"` Ok bool `json:"ok"` @@ -190,6 +341,7 @@ func (c *ConnectedAccountsUpdateResponse) String() string { } type ConnectedAccountsUpdateRequest struct { - ConnectedAccountId string `json:"connected_account_id"` - AutomaticallyManageNewDevices *bool `json:"automatically_manage_new_devices,omitempty"` + ConnectedAccountId string `json:"connected_account_id"` + AutomaticallyManageNewDevices *bool `json:"automatically_manage_new_devices,omitempty"` + CustomMetadata map[string]*ConnectedAccountsUpdateRequestCustomMetadataValue `json:"custom_metadata,omitempty"` } diff --git a/connectedaccounts/client.go b/connectedaccounts/client.go index 9be0ed7..e8f1f84 100644 --- a/connectedaccounts/client.go +++ b/connectedaccounts/client.go @@ -131,7 +131,7 @@ func (c *Client) Get(ctx context.Context, request *seamapigo.ConnectedAccountsGe return response.ConnectedAccount, nil } -func (c *Client) List(ctx context.Context) ([]*seamapigo.ConnectedAccount, error) { +func (c *Client) List(ctx context.Context, request *seamapigo.ConnectedAccountsListRequest) ([]*seamapigo.ConnectedAccount, error) { baseURL := "https://connect.getseam.com" if c.baseURL != "" { baseURL = c.baseURL @@ -171,6 +171,7 @@ func (c *Client) List(ctx context.Context) ([]*seamapigo.ConnectedAccount, error URL: endpointURL, Method: http.MethodPost, Headers: c.header, + Request: request, Response: &response, ErrorDecoder: errorDecoder, }, diff --git a/core/client_option.go b/core/client_option.go index 816836f..faa4b9e 100644 --- a/core/client_option.go +++ b/core/client_option.go @@ -50,6 +50,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.3.0") + headers.Set("X-Fern-SDK-Version", "v0.2.4") return headers } diff --git a/devices.go b/devices.go index 403531f..37aa7ff 100644 --- a/devices.go +++ b/devices.go @@ -20,16 +20,17 @@ type DevicesGetRequest struct { type DevicesListRequest struct { // List all devices owned by this connected account - ConnectedAccountId *string `json:"connected_account_id,omitempty"` - ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` - ConnectWebviewId *string `json:"connect_webview_id,omitempty"` - DeviceType *DeviceType `json:"device_type,omitempty"` - DeviceTypes []DeviceType `json:"device_types,omitempty"` - Manufacturer *Manufacturer `json:"manufacturer,omitempty"` - DeviceIds []string `json:"device_ids,omitempty"` - Limit *float64 `json:"limit,omitempty"` - CreatedBefore *time.Time `json:"created_before,omitempty"` - UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + ConnectedAccountId *string `json:"connected_account_id,omitempty"` + ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` + ConnectWebviewId *string `json:"connect_webview_id,omitempty"` + DeviceType *DeviceType `json:"device_type,omitempty"` + DeviceTypes []DeviceType `json:"device_types,omitempty"` + Manufacturer *Manufacturer `json:"manufacturer,omitempty"` + DeviceIds []string `json:"device_ids,omitempty"` + Limit *float64 `json:"limit,omitempty"` + CreatedBefore *time.Time `json:"created_before,omitempty"` + UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + CustomMetadataHas map[string]*DevicesListRequestCustomMetadataHasValue `json:"custom_metadata_has,omitempty"` } type DevicesListDeviceProvidersRequest struct { @@ -125,6 +126,79 @@ func (d *DevicesListDeviceProvidersResponse) String() string { return fmt.Sprintf("%#v", d) } +type DevicesListRequestCustomMetadataHasValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewDevicesListRequestCustomMetadataHasValueFromString(value string) *DevicesListRequestCustomMetadataHasValue { + return &DevicesListRequestCustomMetadataHasValue{typeName: "string", String: value} +} + +func NewDevicesListRequestCustomMetadataHasValueFromBoolean(value bool) *DevicesListRequestCustomMetadataHasValue { + return &DevicesListRequestCustomMetadataHasValue{typeName: "boolean", Boolean: value} +} + +func NewDevicesListRequestCustomMetadataHasValueFromStringOptional(value *string) *DevicesListRequestCustomMetadataHasValue { + return &DevicesListRequestCustomMetadataHasValue{typeName: "stringOptional", StringOptional: value} +} + +func (d *DevicesListRequestCustomMetadataHasValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + d.typeName = "string" + d.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + d.typeName = "boolean" + d.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + d.typeName = "stringOptional" + d.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, d) +} + +func (d DevicesListRequestCustomMetadataHasValue) MarshalJSON() ([]byte, error) { + switch d.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", d.typeName, d) + case "string": + return json.Marshal(d.String) + case "boolean": + return json.Marshal(d.Boolean) + case "stringOptional": + return json.Marshal(d.StringOptional) + } +} + +type DevicesListRequestCustomMetadataHasValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (d *DevicesListRequestCustomMetadataHasValue) Accept(visitor DevicesListRequestCustomMetadataHasValueVisitor) error { + switch d.typeName { + default: + return fmt.Errorf("invalid type %s in %T", d.typeName, d) + case "string": + return visitor.VisitString(d.String) + case "boolean": + return visitor.VisitBoolean(d.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(d.StringOptional) + } +} + type DevicesListResponse struct { Devices []*Device `json:"devices,omitempty"` Ok bool `json:"ok"` @@ -155,6 +229,79 @@ func (d *DevicesListResponse) String() string { return fmt.Sprintf("%#v", d) } +type DevicesUpdateRequestCustomMetadataValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewDevicesUpdateRequestCustomMetadataValueFromString(value string) *DevicesUpdateRequestCustomMetadataValue { + return &DevicesUpdateRequestCustomMetadataValue{typeName: "string", String: value} +} + +func NewDevicesUpdateRequestCustomMetadataValueFromBoolean(value bool) *DevicesUpdateRequestCustomMetadataValue { + return &DevicesUpdateRequestCustomMetadataValue{typeName: "boolean", Boolean: value} +} + +func NewDevicesUpdateRequestCustomMetadataValueFromStringOptional(value *string) *DevicesUpdateRequestCustomMetadataValue { + return &DevicesUpdateRequestCustomMetadataValue{typeName: "stringOptional", StringOptional: value} +} + +func (d *DevicesUpdateRequestCustomMetadataValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + d.typeName = "string" + d.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + d.typeName = "boolean" + d.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + d.typeName = "stringOptional" + d.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, d) +} + +func (d DevicesUpdateRequestCustomMetadataValue) MarshalJSON() ([]byte, error) { + switch d.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", d.typeName, d) + case "string": + return json.Marshal(d.String) + case "boolean": + return json.Marshal(d.Boolean) + case "stringOptional": + return json.Marshal(d.StringOptional) + } +} + +type DevicesUpdateRequestCustomMetadataValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (d *DevicesUpdateRequestCustomMetadataValue) Accept(visitor DevicesUpdateRequestCustomMetadataValueVisitor) error { + switch d.typeName { + default: + return fmt.Errorf("invalid type %s in %T", d.typeName, d) + case "string": + return visitor.VisitString(d.String) + case "boolean": + return visitor.VisitBoolean(d.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(d.StringOptional) + } +} + type DevicesUpdateRequestProperties struct { Name *string `json:"name,omitempty"` @@ -214,8 +361,9 @@ func (d *DevicesUpdateResponse) String() string { } type DevicesUpdateRequest struct { - DeviceId string `json:"device_id"` - Properties *DevicesUpdateRequestProperties `json:"properties,omitempty"` - Name *string `json:"name,omitempty"` - IsManaged *bool `json:"is_managed,omitempty"` + DeviceId string `json:"device_id"` + Properties *DevicesUpdateRequestProperties `json:"properties,omitempty"` + Name *string `json:"name,omitempty"` + IsManaged *bool `json:"is_managed,omitempty"` + CustomMetadata map[string]*DevicesUpdateRequestCustomMetadataValue `json:"custom_metadata,omitempty"` } diff --git a/devices/unmanaged.go b/devices/unmanaged.go index 5503bc2..ba4bd7e 100644 --- a/devices/unmanaged.go +++ b/devices/unmanaged.go @@ -17,16 +17,17 @@ type UnmanagedGetRequest struct { type UnmanagedListRequest struct { // List all devices owned by this connected account - ConnectedAccountId *string `json:"connected_account_id,omitempty"` - ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` - ConnectWebviewId *string `json:"connect_webview_id,omitempty"` - DeviceType *seamapigo.DeviceType `json:"device_type,omitempty"` - DeviceTypes []seamapigo.DeviceType `json:"device_types,omitempty"` - Manufacturer *seamapigo.Manufacturer `json:"manufacturer,omitempty"` - DeviceIds []string `json:"device_ids,omitempty"` - Limit *float64 `json:"limit,omitempty"` - CreatedBefore *time.Time `json:"created_before,omitempty"` - UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + ConnectedAccountId *string `json:"connected_account_id,omitempty"` + ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` + ConnectWebviewId *string `json:"connect_webview_id,omitempty"` + DeviceType *seamapigo.DeviceType `json:"device_type,omitempty"` + DeviceTypes []seamapigo.DeviceType `json:"device_types,omitempty"` + Manufacturer *seamapigo.Manufacturer `json:"manufacturer,omitempty"` + DeviceIds []string `json:"device_ids,omitempty"` + Limit *float64 `json:"limit,omitempty"` + CreatedBefore *time.Time `json:"created_before,omitempty"` + UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + CustomMetadataHas map[string]*UnmanagedListRequestCustomMetadataHasValue `json:"custom_metadata_has,omitempty"` } type UnmanagedGetResponse struct { @@ -59,6 +60,79 @@ func (u *UnmanagedGetResponse) String() string { return fmt.Sprintf("%#v", u) } +type UnmanagedListRequestCustomMetadataHasValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewUnmanagedListRequestCustomMetadataHasValueFromString(value string) *UnmanagedListRequestCustomMetadataHasValue { + return &UnmanagedListRequestCustomMetadataHasValue{typeName: "string", String: value} +} + +func NewUnmanagedListRequestCustomMetadataHasValueFromBoolean(value bool) *UnmanagedListRequestCustomMetadataHasValue { + return &UnmanagedListRequestCustomMetadataHasValue{typeName: "boolean", Boolean: value} +} + +func NewUnmanagedListRequestCustomMetadataHasValueFromStringOptional(value *string) *UnmanagedListRequestCustomMetadataHasValue { + return &UnmanagedListRequestCustomMetadataHasValue{typeName: "stringOptional", StringOptional: value} +} + +func (u *UnmanagedListRequestCustomMetadataHasValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + u.typeName = "string" + u.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + u.typeName = "boolean" + u.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + u.typeName = "stringOptional" + u.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UnmanagedListRequestCustomMetadataHasValue) MarshalJSON() ([]byte, error) { + switch u.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "string": + return json.Marshal(u.String) + case "boolean": + return json.Marshal(u.Boolean) + case "stringOptional": + return json.Marshal(u.StringOptional) + } +} + +type UnmanagedListRequestCustomMetadataHasValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (u *UnmanagedListRequestCustomMetadataHasValue) Accept(visitor UnmanagedListRequestCustomMetadataHasValueVisitor) error { + switch u.typeName { + default: + return fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "string": + return visitor.VisitString(u.String) + case "boolean": + return visitor.VisitBoolean(u.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(u.StringOptional) + } +} + type UnmanagedListResponse struct { Devices []*seamapigo.UnmanagedDevice `json:"devices,omitempty"` Ok bool `json:"ok"` diff --git a/health/client/client.go b/health/client/client.go index 40d2003..56514e8 100644 --- a/health/client/client.go +++ b/health/client/client.go @@ -73,7 +73,7 @@ func (c *Client) GetHealth(ctx context.Context) (*seamapigo.HealthGetHealthRespo ctx, &core.CallParams{ URL: endpointURL, - Method: http.MethodGet, + Method: http.MethodPost, Headers: c.header, Response: &response, ErrorDecoder: errorDecoder, diff --git a/locks.go b/locks.go index 7ef096a..3e84c04 100644 --- a/locks.go +++ b/locks.go @@ -16,16 +16,17 @@ type LocksGetRequest struct { type LocksListRequest struct { // List all devices owned by this connected account - ConnectedAccountId *string `json:"connected_account_id,omitempty"` - ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` - ConnectWebviewId *string `json:"connect_webview_id,omitempty"` - DeviceType *DeviceType `json:"device_type,omitempty"` - DeviceTypes []DeviceType `json:"device_types,omitempty"` - Manufacturer *Manufacturer `json:"manufacturer,omitempty"` - DeviceIds []string `json:"device_ids,omitempty"` - Limit *float64 `json:"limit,omitempty"` - CreatedBefore *time.Time `json:"created_before,omitempty"` - UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + ConnectedAccountId *string `json:"connected_account_id,omitempty"` + ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` + ConnectWebviewId *string `json:"connect_webview_id,omitempty"` + DeviceType *DeviceType `json:"device_type,omitempty"` + DeviceTypes []DeviceType `json:"device_types,omitempty"` + Manufacturer *Manufacturer `json:"manufacturer,omitempty"` + DeviceIds []string `json:"device_ids,omitempty"` + Limit *float64 `json:"limit,omitempty"` + CreatedBefore *time.Time `json:"created_before,omitempty"` + UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + CustomMetadataHas map[string]*LocksListRequestCustomMetadataHasValue `json:"custom_metadata_has,omitempty"` } type LocksLockDoorRequest struct { @@ -64,6 +65,79 @@ func (l *LocksGetResponse) String() string { return fmt.Sprintf("%#v", l) } +type LocksListRequestCustomMetadataHasValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewLocksListRequestCustomMetadataHasValueFromString(value string) *LocksListRequestCustomMetadataHasValue { + return &LocksListRequestCustomMetadataHasValue{typeName: "string", String: value} +} + +func NewLocksListRequestCustomMetadataHasValueFromBoolean(value bool) *LocksListRequestCustomMetadataHasValue { + return &LocksListRequestCustomMetadataHasValue{typeName: "boolean", Boolean: value} +} + +func NewLocksListRequestCustomMetadataHasValueFromStringOptional(value *string) *LocksListRequestCustomMetadataHasValue { + return &LocksListRequestCustomMetadataHasValue{typeName: "stringOptional", StringOptional: value} +} + +func (l *LocksListRequestCustomMetadataHasValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + l.typeName = "string" + l.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + l.typeName = "boolean" + l.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + l.typeName = "stringOptional" + l.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, l) +} + +func (l LocksListRequestCustomMetadataHasValue) MarshalJSON() ([]byte, error) { + switch l.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", l.typeName, l) + case "string": + return json.Marshal(l.String) + case "boolean": + return json.Marshal(l.Boolean) + case "stringOptional": + return json.Marshal(l.StringOptional) + } +} + +type LocksListRequestCustomMetadataHasValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (l *LocksListRequestCustomMetadataHasValue) Accept(visitor LocksListRequestCustomMetadataHasValueVisitor) error { + switch l.typeName { + default: + return fmt.Errorf("invalid type %s in %T", l.typeName, l) + case "string": + return visitor.VisitString(l.String) + case "boolean": + return visitor.VisitBoolean(l.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(l.StringOptional) + } +} + type LocksListResponse struct { Locks []*Device `json:"locks,omitempty"` Devices []*Device `json:"devices,omitempty"` diff --git a/test/integration/connected_accounts_test.go b/test/integration/connected_accounts_test.go index 2c905f8..9411fc1 100644 --- a/test/integration/connected_accounts_test.go +++ b/test/integration/connected_accounts_test.go @@ -46,7 +46,7 @@ func TestConnectedAccounts(t *testing.T) { // require.NoError(t, err) // assert.Equal(t, connectedAccountID, emailAccount.ConnectedAccountId) - connectedAccounts, err := seam.ConnectedAccounts.List(ctx) + connectedAccounts, err := seam.ConnectedAccounts.List(ctx, &seamgo.ConnectedAccountsListRequest{}) require.NoError(t, err) assert.Len(t, connectedAccounts, 2) @@ -58,13 +58,13 @@ func TestConnectedAccounts(t *testing.T) { ) require.NoError(t, err) - connectedAccounts, err = seam.ConnectedAccounts.List(ctx) + connectedAccounts, err = seam.ConnectedAccounts.List(ctx, &seamgo.ConnectedAccountsListRequest{}) require.NoError(t, err) assert.Len(t, connectedAccounts, 1) } func getTestConnectedAccount(t *testing.T, seam *seamclient.Client) *seamgo.ConnectedAccount { - connectedAccounts, err := seam.ConnectedAccounts.List(context.Background()) + connectedAccounts, err := seam.ConnectedAccounts.List(context.Background(), &seamgo.ConnectedAccountsListRequest{}) require.NoError(t, err) require.GreaterOrEqual(t, len(connectedAccounts), 1) return connectedAccounts[0] diff --git a/thermostats.go b/thermostats.go index fedd5d8..8f3df00 100644 --- a/thermostats.go +++ b/thermostats.go @@ -39,16 +39,17 @@ type ThermostatsHeatCoolRequest struct { type ThermostatsListRequest struct { // List all devices owned by this connected account - ConnectedAccountId *string `json:"connected_account_id,omitempty"` - ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` - ConnectWebviewId *string `json:"connect_webview_id,omitempty"` - DeviceType *DeviceType `json:"device_type,omitempty"` - DeviceTypes []DeviceType `json:"device_types,omitempty"` - Manufacturer *Manufacturer `json:"manufacturer,omitempty"` - DeviceIds []string `json:"device_ids,omitempty"` - Limit *float64 `json:"limit,omitempty"` - CreatedBefore *time.Time `json:"created_before,omitempty"` - UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + ConnectedAccountId *string `json:"connected_account_id,omitempty"` + ConnectedAccountIds []string `json:"connected_account_ids,omitempty"` + ConnectWebviewId *string `json:"connect_webview_id,omitempty"` + DeviceType *DeviceType `json:"device_type,omitempty"` + DeviceTypes []DeviceType `json:"device_types,omitempty"` + Manufacturer *Manufacturer `json:"manufacturer,omitempty"` + DeviceIds []string `json:"device_ids,omitempty"` + Limit *float64 `json:"limit,omitempty"` + CreatedBefore *time.Time `json:"created_before,omitempty"` + UserIdentifierKey *string `json:"user_identifier_key,omitempty"` + CustomMetadataHas map[string]*ThermostatsListRequestCustomMetadataHasValue `json:"custom_metadata_has,omitempty"` } type ThermostatsOffRequest struct { @@ -180,6 +181,79 @@ func (t *ThermostatsHeatResponse) String() string { return fmt.Sprintf("%#v", t) } +type ThermostatsListRequestCustomMetadataHasValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewThermostatsListRequestCustomMetadataHasValueFromString(value string) *ThermostatsListRequestCustomMetadataHasValue { + return &ThermostatsListRequestCustomMetadataHasValue{typeName: "string", String: value} +} + +func NewThermostatsListRequestCustomMetadataHasValueFromBoolean(value bool) *ThermostatsListRequestCustomMetadataHasValue { + return &ThermostatsListRequestCustomMetadataHasValue{typeName: "boolean", Boolean: value} +} + +func NewThermostatsListRequestCustomMetadataHasValueFromStringOptional(value *string) *ThermostatsListRequestCustomMetadataHasValue { + return &ThermostatsListRequestCustomMetadataHasValue{typeName: "stringOptional", StringOptional: value} +} + +func (t *ThermostatsListRequestCustomMetadataHasValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + t.typeName = "string" + t.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + t.typeName = "boolean" + t.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + t.typeName = "stringOptional" + t.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t ThermostatsListRequestCustomMetadataHasValue) MarshalJSON() ([]byte, error) { + switch t.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "string": + return json.Marshal(t.String) + case "boolean": + return json.Marshal(t.Boolean) + case "stringOptional": + return json.Marshal(t.StringOptional) + } +} + +type ThermostatsListRequestCustomMetadataHasValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (t *ThermostatsListRequestCustomMetadataHasValue) Accept(visitor ThermostatsListRequestCustomMetadataHasValueVisitor) error { + switch t.typeName { + default: + return fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "string": + return visitor.VisitString(t.String) + case "boolean": + return visitor.VisitBoolean(t.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(t.StringOptional) + } +} + type ThermostatsListResponse struct { Thermostats []*Device `json:"thermostats,omitempty"` Ok bool `json:"ok"` @@ -291,14 +365,14 @@ func (t *ThermostatsSetFanModeResponse) String() string { } type ThermostatsUpdateRequestDefaultClimateSetting struct { - AutomaticHeatingEnabled *bool `json:"automatic_heating_enabled,omitempty"` - AutomaticCoolingEnabled *bool `json:"automatic_cooling_enabled,omitempty"` - HvacModeSetting *HvacModeSetting `json:"hvac_mode_setting,omitempty"` - CoolingSetPointCelsius *float64 `json:"cooling_set_point_celsius,omitempty"` - HeatingSetPointCelsius *float64 `json:"heating_set_point_celsius,omitempty"` - CoolingSetPointFahrenheit *float64 `json:"cooling_set_point_fahrenheit,omitempty"` - HeatingSetPointFahrenheit *float64 `json:"heating_set_point_fahrenheit,omitempty"` - ManualOverrideAllowed *bool `json:"manual_override_allowed,omitempty"` + AutomaticHeatingEnabled *bool `json:"automatic_heating_enabled,omitempty"` + AutomaticCoolingEnabled *bool `json:"automatic_cooling_enabled,omitempty"` + HvacModeSetting *ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting `json:"hvac_mode_setting,omitempty"` + CoolingSetPointCelsius *float64 `json:"cooling_set_point_celsius,omitempty"` + HeatingSetPointCelsius *float64 `json:"heating_set_point_celsius,omitempty"` + CoolingSetPointFahrenheit *float64 `json:"cooling_set_point_fahrenheit,omitempty"` + HeatingSetPointFahrenheit *float64 `json:"heating_set_point_fahrenheit,omitempty"` + ManualOverrideAllowed *bool `json:"manual_override_allowed,omitempty"` _rawJSON json.RawMessage } diff --git a/thermostats/climate_setting_schedules.go b/thermostats/climate_setting_schedules.go index 17c5736..c78809d 100644 --- a/thermostats/climate_setting_schedules.go +++ b/thermostats/climate_setting_schedules.go @@ -10,19 +10,19 @@ import ( ) type ClimateSettingSchedulesCreateRequest struct { - ScheduleType *string `json:"schedule_type,omitempty"` - DeviceId string `json:"device_id"` - Name *string `json:"name,omitempty"` - ScheduleStartsAt string `json:"schedule_starts_at"` - ScheduleEndsAt string `json:"schedule_ends_at"` - AutomaticHeatingEnabled *bool `json:"automatic_heating_enabled,omitempty"` - AutomaticCoolingEnabled *bool `json:"automatic_cooling_enabled,omitempty"` - HvacModeSetting *seamapigo.HvacModeSetting `json:"hvac_mode_setting,omitempty"` - CoolingSetPointCelsius *float64 `json:"cooling_set_point_celsius,omitempty"` - HeatingSetPointCelsius *float64 `json:"heating_set_point_celsius,omitempty"` - CoolingSetPointFahrenheit *float64 `json:"cooling_set_point_fahrenheit,omitempty"` - HeatingSetPointFahrenheit *float64 `json:"heating_set_point_fahrenheit,omitempty"` - ManualOverrideAllowed *bool `json:"manual_override_allowed,omitempty"` + ScheduleType *string `json:"schedule_type,omitempty"` + DeviceId string `json:"device_id"` + Name *string `json:"name,omitempty"` + ScheduleStartsAt string `json:"schedule_starts_at"` + ScheduleEndsAt string `json:"schedule_ends_at"` + AutomaticHeatingEnabled *bool `json:"automatic_heating_enabled,omitempty"` + AutomaticCoolingEnabled *bool `json:"automatic_cooling_enabled,omitempty"` + HvacModeSetting *ClimateSettingSchedulesCreateRequestHvacModeSetting `json:"hvac_mode_setting,omitempty"` + CoolingSetPointCelsius *float64 `json:"cooling_set_point_celsius,omitempty"` + HeatingSetPointCelsius *float64 `json:"heating_set_point_celsius,omitempty"` + CoolingSetPointFahrenheit *float64 `json:"cooling_set_point_fahrenheit,omitempty"` + HeatingSetPointFahrenheit *float64 `json:"heating_set_point_fahrenheit,omitempty"` + ManualOverrideAllowed *bool `json:"manual_override_allowed,omitempty"` } type ClimateSettingSchedulesDeleteRequest struct { @@ -39,6 +39,34 @@ type ClimateSettingSchedulesListRequest struct { UserIdentifierKey *string `json:"user_identifier_key,omitempty"` } +type ClimateSettingSchedulesCreateRequestHvacModeSetting string + +const ( + ClimateSettingSchedulesCreateRequestHvacModeSettingOff ClimateSettingSchedulesCreateRequestHvacModeSetting = "off" + ClimateSettingSchedulesCreateRequestHvacModeSettingHeat ClimateSettingSchedulesCreateRequestHvacModeSetting = "heat" + ClimateSettingSchedulesCreateRequestHvacModeSettingCool ClimateSettingSchedulesCreateRequestHvacModeSetting = "cool" + ClimateSettingSchedulesCreateRequestHvacModeSettingHeatCool ClimateSettingSchedulesCreateRequestHvacModeSetting = "heat_cool" +) + +func NewClimateSettingSchedulesCreateRequestHvacModeSettingFromString(s string) (ClimateSettingSchedulesCreateRequestHvacModeSetting, error) { + switch s { + case "off": + return ClimateSettingSchedulesCreateRequestHvacModeSettingOff, nil + case "heat": + return ClimateSettingSchedulesCreateRequestHvacModeSettingHeat, nil + case "cool": + return ClimateSettingSchedulesCreateRequestHvacModeSettingCool, nil + case "heat_cool": + return ClimateSettingSchedulesCreateRequestHvacModeSettingHeatCool, nil + } + var t ClimateSettingSchedulesCreateRequestHvacModeSetting + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ClimateSettingSchedulesCreateRequestHvacModeSetting) Ptr() *ClimateSettingSchedulesCreateRequestHvacModeSetting { + return &c +} + type ClimateSettingSchedulesCreateResponse struct { ClimateSettingSchedule *seamapigo.ClimateSettingSchedule `json:"climate_setting_schedule,omitempty"` Ok bool `json:"ok"` @@ -158,6 +186,34 @@ func (c *ClimateSettingSchedulesListResponse) String() string { return fmt.Sprintf("%#v", c) } +type ClimateSettingSchedulesUpdateRequestHvacModeSetting string + +const ( + ClimateSettingSchedulesUpdateRequestHvacModeSettingOff ClimateSettingSchedulesUpdateRequestHvacModeSetting = "off" + ClimateSettingSchedulesUpdateRequestHvacModeSettingHeat ClimateSettingSchedulesUpdateRequestHvacModeSetting = "heat" + ClimateSettingSchedulesUpdateRequestHvacModeSettingCool ClimateSettingSchedulesUpdateRequestHvacModeSetting = "cool" + ClimateSettingSchedulesUpdateRequestHvacModeSettingHeatCool ClimateSettingSchedulesUpdateRequestHvacModeSetting = "heat_cool" +) + +func NewClimateSettingSchedulesUpdateRequestHvacModeSettingFromString(s string) (ClimateSettingSchedulesUpdateRequestHvacModeSetting, error) { + switch s { + case "off": + return ClimateSettingSchedulesUpdateRequestHvacModeSettingOff, nil + case "heat": + return ClimateSettingSchedulesUpdateRequestHvacModeSettingHeat, nil + case "cool": + return ClimateSettingSchedulesUpdateRequestHvacModeSettingCool, nil + case "heat_cool": + return ClimateSettingSchedulesUpdateRequestHvacModeSettingHeatCool, nil + } + var t ClimateSettingSchedulesUpdateRequestHvacModeSetting + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ClimateSettingSchedulesUpdateRequestHvacModeSetting) Ptr() *ClimateSettingSchedulesUpdateRequestHvacModeSetting { + return &c +} + type ClimateSettingSchedulesUpdateResponse struct { ClimateSettingSchedule *seamapigo.ClimateSettingSchedule `json:"climate_setting_schedule,omitempty"` Ok bool `json:"ok"` @@ -189,17 +245,17 @@ func (c *ClimateSettingSchedulesUpdateResponse) String() string { } type ClimateSettingSchedulesUpdateRequest struct { - ClimateSettingScheduleId string `json:"climate_setting_schedule_id"` - ScheduleType *string `json:"schedule_type,omitempty"` - Name *string `json:"name,omitempty"` - ScheduleStartsAt *string `json:"schedule_starts_at,omitempty"` - ScheduleEndsAt *string `json:"schedule_ends_at,omitempty"` - AutomaticHeatingEnabled *bool `json:"automatic_heating_enabled,omitempty"` - AutomaticCoolingEnabled *bool `json:"automatic_cooling_enabled,omitempty"` - HvacModeSetting *seamapigo.HvacModeSetting `json:"hvac_mode_setting,omitempty"` - CoolingSetPointCelsius *float64 `json:"cooling_set_point_celsius,omitempty"` - HeatingSetPointCelsius *float64 `json:"heating_set_point_celsius,omitempty"` - CoolingSetPointFahrenheit *float64 `json:"cooling_set_point_fahrenheit,omitempty"` - HeatingSetPointFahrenheit *float64 `json:"heating_set_point_fahrenheit,omitempty"` - ManualOverrideAllowed *bool `json:"manual_override_allowed,omitempty"` + ClimateSettingScheduleId string `json:"climate_setting_schedule_id"` + ScheduleType *string `json:"schedule_type,omitempty"` + Name *string `json:"name,omitempty"` + ScheduleStartsAt *string `json:"schedule_starts_at,omitempty"` + ScheduleEndsAt *string `json:"schedule_ends_at,omitempty"` + AutomaticHeatingEnabled *bool `json:"automatic_heating_enabled,omitempty"` + AutomaticCoolingEnabled *bool `json:"automatic_cooling_enabled,omitempty"` + HvacModeSetting *ClimateSettingSchedulesUpdateRequestHvacModeSetting `json:"hvac_mode_setting,omitempty"` + CoolingSetPointCelsius *float64 `json:"cooling_set_point_celsius,omitempty"` + HeatingSetPointCelsius *float64 `json:"heating_set_point_celsius,omitempty"` + CoolingSetPointFahrenheit *float64 `json:"cooling_set_point_fahrenheit,omitempty"` + HeatingSetPointFahrenheit *float64 `json:"heating_set_point_fahrenheit,omitempty"` + ManualOverrideAllowed *bool `json:"manual_override_allowed,omitempty"` } diff --git a/types.go b/types.go index 7ab48d6..cb7e09f 100644 --- a/types.go +++ b/types.go @@ -713,21 +713,21 @@ func (c *ClientSession) String() string { } type ClimateSettingSchedule struct { - ClimateSettingScheduleId string `json:"climate_setting_schedule_id"` - DeviceId string `json:"device_id"` - Name *string `json:"name,omitempty"` - ScheduleStartsAt string `json:"schedule_starts_at"` - ScheduleEndsAt string `json:"schedule_ends_at"` - CreatedAt time.Time `json:"created_at"` - Errors interface{} `json:"errors,omitempty"` - AutomaticHeatingEnabled *bool `json:"automatic_heating_enabled,omitempty"` - AutomaticCoolingEnabled *bool `json:"automatic_cooling_enabled,omitempty"` - HvacModeSetting *HvacModeSetting `json:"hvac_mode_setting,omitempty"` - CoolingSetPointCelsius *float64 `json:"cooling_set_point_celsius,omitempty"` - HeatingSetPointCelsius *float64 `json:"heating_set_point_celsius,omitempty"` - CoolingSetPointFahrenheit *float64 `json:"cooling_set_point_fahrenheit,omitempty"` - HeatingSetPointFahrenheit *float64 `json:"heating_set_point_fahrenheit,omitempty"` - ManualOverrideAllowed *bool `json:"manual_override_allowed,omitempty"` + ClimateSettingScheduleId string `json:"climate_setting_schedule_id"` + DeviceId string `json:"device_id"` + Name *string `json:"name,omitempty"` + ScheduleStartsAt string `json:"schedule_starts_at"` + ScheduleEndsAt string `json:"schedule_ends_at"` + CreatedAt time.Time `json:"created_at"` + Errors interface{} `json:"errors,omitempty"` + AutomaticHeatingEnabled *bool `json:"automatic_heating_enabled,omitempty"` + AutomaticCoolingEnabled *bool `json:"automatic_cooling_enabled,omitempty"` + HvacModeSetting *ClimateSettingScheduleHvacModeSetting `json:"hvac_mode_setting,omitempty"` + CoolingSetPointCelsius *float64 `json:"cooling_set_point_celsius,omitempty"` + HeatingSetPointCelsius *float64 `json:"heating_set_point_celsius,omitempty"` + CoolingSetPointFahrenheit *float64 `json:"cooling_set_point_fahrenheit,omitempty"` + HeatingSetPointFahrenheit *float64 `json:"heating_set_point_fahrenheit,omitempty"` + ManualOverrideAllowed *bool `json:"manual_override_allowed,omitempty"` scheduleType string _rawJSON json.RawMessage @@ -773,6 +773,34 @@ func (c *ClimateSettingSchedule) String() string { return fmt.Sprintf("%#v", c) } +type ClimateSettingScheduleHvacModeSetting string + +const ( + ClimateSettingScheduleHvacModeSettingOff ClimateSettingScheduleHvacModeSetting = "off" + ClimateSettingScheduleHvacModeSettingHeat ClimateSettingScheduleHvacModeSetting = "heat" + ClimateSettingScheduleHvacModeSettingCool ClimateSettingScheduleHvacModeSetting = "cool" + ClimateSettingScheduleHvacModeSettingHeatCool ClimateSettingScheduleHvacModeSetting = "heat_cool" +) + +func NewClimateSettingScheduleHvacModeSettingFromString(s string) (ClimateSettingScheduleHvacModeSetting, error) { + switch s { + case "off": + return ClimateSettingScheduleHvacModeSettingOff, nil + case "heat": + return ClimateSettingScheduleHvacModeSettingHeat, nil + case "cool": + return ClimateSettingScheduleHvacModeSettingCool, nil + case "heat_cool": + return ClimateSettingScheduleHvacModeSettingHeatCool, nil + } + var t ClimateSettingScheduleHvacModeSetting + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c ClimateSettingScheduleHvacModeSetting) Ptr() *ClimateSettingScheduleHvacModeSetting { + return &c +} + type ConnectWebview struct { ConnectWebviewId string `json:"connect_webview_id"` ConnectedAccountId *string `json:"connected_account_id,omitempty"` @@ -821,9 +849,10 @@ func (c *ConnectWebview) String() string { } type ConnectWebviewCustomMetadataValue struct { - typeName string - String string - Boolean bool + typeName string + String string + Boolean bool + StringOptional *string } func NewConnectWebviewCustomMetadataValueFromString(value string) *ConnectWebviewCustomMetadataValue { @@ -834,6 +863,10 @@ func NewConnectWebviewCustomMetadataValueFromBoolean(value bool) *ConnectWebview return &ConnectWebviewCustomMetadataValue{typeName: "boolean", Boolean: value} } +func NewConnectWebviewCustomMetadataValueFromStringOptional(value *string) *ConnectWebviewCustomMetadataValue { + return &ConnectWebviewCustomMetadataValue{typeName: "stringOptional", StringOptional: value} +} + func (c *ConnectWebviewCustomMetadataValue) UnmarshalJSON(data []byte) error { var valueString string if err := json.Unmarshal(data, &valueString); err == nil { @@ -847,6 +880,12 @@ func (c *ConnectWebviewCustomMetadataValue) UnmarshalJSON(data []byte) error { c.Boolean = valueBoolean return nil } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + c.typeName = "stringOptional" + c.StringOptional = valueStringOptional + return nil + } return fmt.Errorf("%s cannot be deserialized as a %T", data, c) } @@ -858,12 +897,15 @@ func (c ConnectWebviewCustomMetadataValue) MarshalJSON() ([]byte, error) { return json.Marshal(c.String) case "boolean": return json.Marshal(c.Boolean) + case "stringOptional": + return json.Marshal(c.StringOptional) } } type ConnectWebviewCustomMetadataValueVisitor interface { VisitString(string) error VisitBoolean(bool) error + VisitStringOptional(*string) error } func (c *ConnectWebviewCustomMetadataValue) Accept(visitor ConnectWebviewCustomMetadataValueVisitor) error { @@ -874,6 +916,8 @@ func (c *ConnectWebviewCustomMetadataValue) Accept(visitor ConnectWebviewCustomM return visitor.VisitString(c.String) case "boolean": return visitor.VisitBoolean(c.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(c.StringOptional) } } @@ -940,9 +984,10 @@ func (c *ConnectedAccount) String() string { } type ConnectedAccountCustomMetadataValue struct { - typeName string - String string - Boolean bool + typeName string + String string + Boolean bool + StringOptional *string } func NewConnectedAccountCustomMetadataValueFromString(value string) *ConnectedAccountCustomMetadataValue { @@ -953,6 +998,10 @@ func NewConnectedAccountCustomMetadataValueFromBoolean(value bool) *ConnectedAcc return &ConnectedAccountCustomMetadataValue{typeName: "boolean", Boolean: value} } +func NewConnectedAccountCustomMetadataValueFromStringOptional(value *string) *ConnectedAccountCustomMetadataValue { + return &ConnectedAccountCustomMetadataValue{typeName: "stringOptional", StringOptional: value} +} + func (c *ConnectedAccountCustomMetadataValue) UnmarshalJSON(data []byte) error { var valueString string if err := json.Unmarshal(data, &valueString); err == nil { @@ -966,6 +1015,12 @@ func (c *ConnectedAccountCustomMetadataValue) UnmarshalJSON(data []byte) error { c.Boolean = valueBoolean return nil } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + c.typeName = "stringOptional" + c.StringOptional = valueStringOptional + return nil + } return fmt.Errorf("%s cannot be deserialized as a %T", data, c) } @@ -977,12 +1032,15 @@ func (c ConnectedAccountCustomMetadataValue) MarshalJSON() ([]byte, error) { return json.Marshal(c.String) case "boolean": return json.Marshal(c.Boolean) + case "stringOptional": + return json.Marshal(c.StringOptional) } } type ConnectedAccountCustomMetadataValueVisitor interface { VisitString(string) error VisitBoolean(bool) error + VisitStringOptional(*string) error } func (c *ConnectedAccountCustomMetadataValue) Accept(visitor ConnectedAccountCustomMetadataValueVisitor) error { @@ -993,6 +1051,8 @@ func (c *ConnectedAccountCustomMetadataValue) Accept(visitor ConnectedAccountCus return visitor.VisitString(c.String) case "boolean": return visitor.VisitBoolean(c.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(c.StringOptional) } } @@ -1051,7 +1111,8 @@ type Device struct { // Date and time at which the device object was created. CreatedAt time.Time `json:"created_at"` // Indicates whether Seam manages the device. - IsManaged bool `json:"is_managed"` + IsManaged bool `json:"is_managed"` + CustomMetadata map[string]*DeviceCustomMetadataValue `json:"custom_metadata,omitempty"` _rawJSON json.RawMessage } @@ -1113,6 +1174,79 @@ func (d DeviceCapabilitiesSupportedItem) Ptr() *DeviceCapabilitiesSupportedItem return &d } +type DeviceCustomMetadataValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewDeviceCustomMetadataValueFromString(value string) *DeviceCustomMetadataValue { + return &DeviceCustomMetadataValue{typeName: "string", String: value} +} + +func NewDeviceCustomMetadataValueFromBoolean(value bool) *DeviceCustomMetadataValue { + return &DeviceCustomMetadataValue{typeName: "boolean", Boolean: value} +} + +func NewDeviceCustomMetadataValueFromStringOptional(value *string) *DeviceCustomMetadataValue { + return &DeviceCustomMetadataValue{typeName: "stringOptional", StringOptional: value} +} + +func (d *DeviceCustomMetadataValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + d.typeName = "string" + d.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + d.typeName = "boolean" + d.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + d.typeName = "stringOptional" + d.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, d) +} + +func (d DeviceCustomMetadataValue) MarshalJSON() ([]byte, error) { + switch d.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", d.typeName, d) + case "string": + return json.Marshal(d.String) + case "boolean": + return json.Marshal(d.Boolean) + case "stringOptional": + return json.Marshal(d.StringOptional) + } +} + +type DeviceCustomMetadataValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (d *DeviceCustomMetadataValue) Accept(visitor DeviceCustomMetadataValueVisitor) error { + switch d.typeName { + default: + return fmt.Errorf("invalid type %s in %T", d.typeName, d) + case "string": + return visitor.VisitString(d.String) + case "boolean": + return visitor.VisitBoolean(d.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(d.StringOptional) + } +} + type DeviceErrorsItem struct { ErrorCode string `json:"error_code"` Message string `json:"message"` @@ -1204,40 +1338,41 @@ type DeviceProperties struct { // Deprecated. Use model.accessory_keypad_supported. SupportsAccessoryKeypad *bool `json:"supports_accessory_keypad,omitempty"` // Deprecated. Use offline_access_codes_enabled. - SupportsOfflineAccessCodes *bool `json:"supports_offline_access_codes,omitempty"` - AugustMetadata *DevicePropertiesAugustMetadata `json:"august_metadata,omitempty"` - AvigilonAltaMetadata *DevicePropertiesAvigilonAltaMetadata `json:"avigilon_alta_metadata,omitempty"` - SchlageMetadata *DevicePropertiesSchlageMetadata `json:"schlage_metadata,omitempty"` - SmartthingsMetadata *DevicePropertiesSmartthingsMetadata `json:"smartthings_metadata,omitempty"` - LocklyMetadata *DevicePropertiesLocklyMetadata `json:"lockly_metadata,omitempty"` - NukiMetadata *DevicePropertiesNukiMetadata `json:"nuki_metadata,omitempty"` - KwiksetMetadata *DevicePropertiesKwiksetMetadata `json:"kwikset_metadata,omitempty"` - SaltoMetadata *DevicePropertiesSaltoMetadata `json:"salto_metadata,omitempty"` - GenieMetadata *DevicePropertiesGenieMetadata `json:"genie_metadata,omitempty"` - BrivoMetadata *DevicePropertiesBrivoMetadata `json:"brivo_metadata,omitempty"` - IglooMetadata *DevicePropertiesIglooMetadata `json:"igloo_metadata,omitempty"` - NoiseawareMetadata *DevicePropertiesNoiseawareMetadata `json:"noiseaware_metadata,omitempty"` - MinutMetadata *DevicePropertiesMinutMetadata `json:"minut_metadata,omitempty"` - FourSuitesMetadata *DevicePropertiesFourSuitesMetadata `json:"four_suites_metadata,omitempty"` - TwoNMetadata *DevicePropertiesTwoNMetadata `json:"two_n_metadata,omitempty"` - ControlbywebMetadata *DevicePropertiesControlbywebMetadata `json:"controlbyweb_metadata,omitempty"` - TtlockMetadata *DevicePropertiesTtlockMetadata `json:"ttlock_metadata,omitempty"` - SeamBridgeMetadata *DevicePropertiesSeamBridgeMetadata `json:"seam_bridge_metadata,omitempty"` - IgloohomeMetadata *DevicePropertiesIgloohomeMetadata `json:"igloohome_metadata,omitempty"` - NestMetadata *DevicePropertiesNestMetadata `json:"nest_metadata,omitempty"` - EcobeeMetadata *DevicePropertiesEcobeeMetadata `json:"ecobee_metadata,omitempty"` - HubitatMetadata *DevicePropertiesHubitatMetadata `json:"hubitat_metadata,omitempty"` - DormakabaOracodeMetadata *DevicePropertiesDormakabaOracodeMetadata `json:"dormakaba_oracode_metadata,omitempty"` - WyzeMetadata *DevicePropertiesWyzeMetadata `json:"wyze_metadata,omitempty"` - CodeConstraints []*DevicePropertiesCodeConstraintsItem `json:"code_constraints,omitempty"` - SupportedCodeLengths []float64 `json:"supported_code_lengths,omitempty"` - MaxActiveCodesSupported *float64 `json:"max_active_codes_supported,omitempty"` - SupportsBackupAccessCodePool *bool `json:"supports_backup_access_code_pool,omitempty"` - HasNativeEntryEvents *bool `json:"has_native_entry_events,omitempty"` - Locked *bool `json:"locked,omitempty"` - KeypadBattery *DevicePropertiesKeypadBattery `json:"keypad_battery,omitempty"` - DoorOpen *bool `json:"door_open,omitempty"` - AssaAbloyCredentialServiceMetadata *DevicePropertiesAssaAbloyCredentialServiceMetadata `json:"assa_abloy_credential_service_metadata,omitempty"` + SupportsOfflineAccessCodes *bool `json:"supports_offline_access_codes,omitempty"` + AssaAbloyCredentialServiceMetadata *DevicePropertiesAssaAbloyCredentialServiceMetadata `json:"assa_abloy_credential_service_metadata,omitempty"` + AugustMetadata *DevicePropertiesAugustMetadata `json:"august_metadata,omitempty"` + AvigilonAltaMetadata *DevicePropertiesAvigilonAltaMetadata `json:"avigilon_alta_metadata,omitempty"` + SchlageMetadata *DevicePropertiesSchlageMetadata `json:"schlage_metadata,omitempty"` + SmartthingsMetadata *DevicePropertiesSmartthingsMetadata `json:"smartthings_metadata,omitempty"` + LocklyMetadata *DevicePropertiesLocklyMetadata `json:"lockly_metadata,omitempty"` + NukiMetadata *DevicePropertiesNukiMetadata `json:"nuki_metadata,omitempty"` + KwiksetMetadata *DevicePropertiesKwiksetMetadata `json:"kwikset_metadata,omitempty"` + SaltoMetadata *DevicePropertiesSaltoMetadata `json:"salto_metadata,omitempty"` + GenieMetadata *DevicePropertiesGenieMetadata `json:"genie_metadata,omitempty"` + BrivoMetadata *DevicePropertiesBrivoMetadata `json:"brivo_metadata,omitempty"` + IglooMetadata *DevicePropertiesIglooMetadata `json:"igloo_metadata,omitempty"` + NoiseawareMetadata *DevicePropertiesNoiseawareMetadata `json:"noiseaware_metadata,omitempty"` + MinutMetadata *DevicePropertiesMinutMetadata `json:"minut_metadata,omitempty"` + FourSuitesMetadata *DevicePropertiesFourSuitesMetadata `json:"four_suites_metadata,omitempty"` + TwoNMetadata *DevicePropertiesTwoNMetadata `json:"two_n_metadata,omitempty"` + ControlbywebMetadata *DevicePropertiesControlbywebMetadata `json:"controlbyweb_metadata,omitempty"` + TtlockMetadata *DevicePropertiesTtlockMetadata `json:"ttlock_metadata,omitempty"` + SeamBridgeMetadata *DevicePropertiesSeamBridgeMetadata `json:"seam_bridge_metadata,omitempty"` + IgloohomeMetadata *DevicePropertiesIgloohomeMetadata `json:"igloohome_metadata,omitempty"` + NestMetadata *DevicePropertiesNestMetadata `json:"nest_metadata,omitempty"` + EcobeeMetadata *DevicePropertiesEcobeeMetadata `json:"ecobee_metadata,omitempty"` + HubitatMetadata *DevicePropertiesHubitatMetadata `json:"hubitat_metadata,omitempty"` + DormakabaOracodeMetadata *DevicePropertiesDormakabaOracodeMetadata `json:"dormakaba_oracode_metadata,omitempty"` + WyzeMetadata *DevicePropertiesWyzeMetadata `json:"wyze_metadata,omitempty"` + ExperimentalSupportedCodeFromAccessCodesLengths []float64 `json:"_experimental_supported_code_from_access_codes_lengths,omitempty"` + CodeConstraints []*DevicePropertiesCodeConstraintsItem `json:"code_constraints,omitempty"` + SupportedCodeLengths []float64 `json:"supported_code_lengths,omitempty"` + MaxActiveCodesSupported *float64 `json:"max_active_codes_supported,omitempty"` + SupportsBackupAccessCodePool *bool `json:"supports_backup_access_code_pool,omitempty"` + HasNativeEntryEvents *bool `json:"has_native_entry_events,omitempty"` + Locked *bool `json:"locked,omitempty"` + KeypadBattery *DevicePropertiesKeypadBattery `json:"keypad_battery,omitempty"` + DoorOpen *bool `json:"door_open,omitempty"` _rawJSON json.RawMessage } @@ -3305,8 +3440,7 @@ type Phone struct { DeviceType PhoneDeviceType `json:"device_type,omitempty"` // Collection of capabilities that the device supports when connected to Seam. Values are "access_code," which indicates that the device can manage and utilize digital PIN codes for secure access; "lock," which indicates that the device controls a door locking mechanism, enabling the remote opening and closing of doors and other entry points; "noise_detection," which indicates that the device supports monitoring and responding to ambient noise levels; "thermostat," which indicates that the device can regulate and adjust indoor temperatures; and "battery," which indicates that the device can manage battery life and health. CapabilitiesSupported []PhoneCapabilitiesSupportedItem `json:"capabilities_supported,omitempty"` - // Properties of the device. - Properties *PhoneProperties `json:"properties,omitempty"` + Properties *PhoneProperties `json:"properties,omitempty"` // Location information for the device. Location *PhoneLocation `json:"location,omitempty"` // Unique identifier for the Seam workspace associated with the device. @@ -3318,8 +3452,8 @@ type Phone struct { // Date and time at which the device object was created. CreatedAt time.Time `json:"created_at"` // Indicates whether Seam manages the device. - IsManaged bool `json:"is_managed"` - AssaAbloyCredentialServiceMetadata *PhoneAssaAbloyCredentialServiceMetadata `json:"assa_abloy_credential_service_metadata,omitempty"` + IsManaged bool `json:"is_managed"` + CustomMetadata map[string]*PhoneCustomMetadataValue `json:"custom_metadata,omitempty"` _rawJSON json.RawMessage } @@ -3347,66 +3481,6 @@ func (p *Phone) String() string { return fmt.Sprintf("%#v", p) } -type PhoneAssaAbloyCredentialServiceMetadata struct { - HasActiveEndpoint bool `json:"has_active_endpoint"` - Endpoints []*PhoneAssaAbloyCredentialServiceMetadataEndpointsItem `json:"endpoints,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhoneAssaAbloyCredentialServiceMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhoneAssaAbloyCredentialServiceMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhoneAssaAbloyCredentialServiceMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhoneAssaAbloyCredentialServiceMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhoneAssaAbloyCredentialServiceMetadataEndpointsItem struct { - EndpointId string `json:"endpoint_id"` - IsActive bool `json:"is_active"` - - _rawJSON json.RawMessage -} - -func (p *PhoneAssaAbloyCredentialServiceMetadataEndpointsItem) UnmarshalJSON(data []byte) error { - type unmarshaler PhoneAssaAbloyCredentialServiceMetadataEndpointsItem - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhoneAssaAbloyCredentialServiceMetadataEndpointsItem(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhoneAssaAbloyCredentialServiceMetadataEndpointsItem) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - type PhoneCapabilitiesSupportedItem string const ( @@ -3441,6 +3515,79 @@ func (p PhoneCapabilitiesSupportedItem) Ptr() *PhoneCapabilitiesSupportedItem { return &p } +type PhoneCustomMetadataValue struct { + typeName string + String string + Boolean bool + StringOptional *string +} + +func NewPhoneCustomMetadataValueFromString(value string) *PhoneCustomMetadataValue { + return &PhoneCustomMetadataValue{typeName: "string", String: value} +} + +func NewPhoneCustomMetadataValueFromBoolean(value bool) *PhoneCustomMetadataValue { + return &PhoneCustomMetadataValue{typeName: "boolean", Boolean: value} +} + +func NewPhoneCustomMetadataValueFromStringOptional(value *string) *PhoneCustomMetadataValue { + return &PhoneCustomMetadataValue{typeName: "stringOptional", StringOptional: value} +} + +func (p *PhoneCustomMetadataValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + p.typeName = "string" + p.String = valueString + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + p.typeName = "boolean" + p.Boolean = valueBoolean + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + p.typeName = "stringOptional" + p.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, p) +} + +func (p PhoneCustomMetadataValue) MarshalJSON() ([]byte, error) { + switch p.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", p.typeName, p) + case "string": + return json.Marshal(p.String) + case "boolean": + return json.Marshal(p.Boolean) + case "stringOptional": + return json.Marshal(p.StringOptional) + } +} + +type PhoneCustomMetadataValueVisitor interface { + VisitString(string) error + VisitBoolean(bool) error + VisitStringOptional(*string) error +} + +func (p *PhoneCustomMetadataValue) Accept(visitor PhoneCustomMetadataValueVisitor) error { + switch p.typeName { + default: + return fmt.Errorf("invalid type %s in %T", p.typeName, p) + case "string": + return visitor.VisitString(p.String) + case "boolean": + return visitor.VisitBoolean(p.Boolean) + case "stringOptional": + return visitor.VisitStringOptional(p.StringOptional) + } +} + type PhoneDeviceType string const ( @@ -3548,67 +3695,7 @@ func (p PhoneOperatingSystem) Ptr() *PhoneOperatingSystem { return &p } -// Properties of the device. type PhoneProperties struct { - // Indicates whether the device is online. - Online bool `json:"online"` - // Name of the device. Enables administrators and users to identify the device easily, especially when there are numerous devices. - Name string `json:"name"` - Model *PhonePropertiesModel `json:"model,omitempty"` - // Indicates whether the device has direct power. - HasDirectPower *bool `json:"has_direct_power,omitempty"` - // Indicates the battery level of the device as a decimal value between 0 and 1, inclusive. - BatteryLevel *float64 `json:"battery_level,omitempty"` - // Represents the current status of the battery charge level. Values are "critical," which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; "low," which signifies that the battery is under the preferred threshold and should be charged soon; "good," which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and "full," which represents a battery that is fully charged, providing the maximum duration of usage. - Battery *PhonePropertiesBattery `json:"battery,omitempty"` - // Manufacturer of the device. - Manufacturer *string `json:"manufacturer,omitempty"` - // Image URL for the device. - ImageUrl *string `json:"image_url,omitempty"` - // Alt text for the device image. - ImageAltText *string `json:"image_alt_text,omitempty"` - // Serial number of the device. - SerialNumber *string `json:"serial_number,omitempty"` - // Indicates whether it is currently possible to use online access codes for the device. - OnlineAccessCodesEnabled *bool `json:"online_access_codes_enabled,omitempty"` - // Indicates whether it is currently possible to use offline access codes for the device. - OfflineAccessCodesEnabled *bool `json:"offline_access_codes_enabled,omitempty"` - // Deprecated. Use model.accessory_keypad_supported. - SupportsAccessoryKeypad *bool `json:"supports_accessory_keypad,omitempty"` - // Deprecated. Use offline_access_codes_enabled. - SupportsOfflineAccessCodes *bool `json:"supports_offline_access_codes,omitempty"` - AugustMetadata *PhonePropertiesAugustMetadata `json:"august_metadata,omitempty"` - AvigilonAltaMetadata *PhonePropertiesAvigilonAltaMetadata `json:"avigilon_alta_metadata,omitempty"` - SchlageMetadata *PhonePropertiesSchlageMetadata `json:"schlage_metadata,omitempty"` - SmartthingsMetadata *PhonePropertiesSmartthingsMetadata `json:"smartthings_metadata,omitempty"` - LocklyMetadata *PhonePropertiesLocklyMetadata `json:"lockly_metadata,omitempty"` - NukiMetadata *PhonePropertiesNukiMetadata `json:"nuki_metadata,omitempty"` - KwiksetMetadata *PhonePropertiesKwiksetMetadata `json:"kwikset_metadata,omitempty"` - SaltoMetadata *PhonePropertiesSaltoMetadata `json:"salto_metadata,omitempty"` - GenieMetadata *PhonePropertiesGenieMetadata `json:"genie_metadata,omitempty"` - BrivoMetadata *PhonePropertiesBrivoMetadata `json:"brivo_metadata,omitempty"` - IglooMetadata *PhonePropertiesIglooMetadata `json:"igloo_metadata,omitempty"` - NoiseawareMetadata *PhonePropertiesNoiseawareMetadata `json:"noiseaware_metadata,omitempty"` - MinutMetadata *PhonePropertiesMinutMetadata `json:"minut_metadata,omitempty"` - FourSuitesMetadata *PhonePropertiesFourSuitesMetadata `json:"four_suites_metadata,omitempty"` - TwoNMetadata *PhonePropertiesTwoNMetadata `json:"two_n_metadata,omitempty"` - ControlbywebMetadata *PhonePropertiesControlbywebMetadata `json:"controlbyweb_metadata,omitempty"` - TtlockMetadata *PhonePropertiesTtlockMetadata `json:"ttlock_metadata,omitempty"` - SeamBridgeMetadata *PhonePropertiesSeamBridgeMetadata `json:"seam_bridge_metadata,omitempty"` - IgloohomeMetadata *PhonePropertiesIgloohomeMetadata `json:"igloohome_metadata,omitempty"` - NestMetadata *PhonePropertiesNestMetadata `json:"nest_metadata,omitempty"` - EcobeeMetadata *PhonePropertiesEcobeeMetadata `json:"ecobee_metadata,omitempty"` - HubitatMetadata *PhonePropertiesHubitatMetadata `json:"hubitat_metadata,omitempty"` - DormakabaOracodeMetadata *PhonePropertiesDormakabaOracodeMetadata `json:"dormakaba_oracode_metadata,omitempty"` - WyzeMetadata *PhonePropertiesWyzeMetadata `json:"wyze_metadata,omitempty"` - CodeConstraints []*PhonePropertiesCodeConstraintsItem `json:"code_constraints,omitempty"` - SupportedCodeLengths []float64 `json:"supported_code_lengths,omitempty"` - MaxActiveCodesSupported *float64 `json:"max_active_codes_supported,omitempty"` - SupportsBackupAccessCodePool *bool `json:"supports_backup_access_code_pool,omitempty"` - HasNativeEntryEvents *bool `json:"has_native_entry_events,omitempty"` - Locked *bool `json:"locked,omitempty"` - KeypadBattery *PhonePropertiesKeypadBattery `json:"keypad_battery,omitempty"` - DoorOpen *bool `json:"door_open,omitempty"` AssaAbloyCredentialServiceMetadata *PhonePropertiesAssaAbloyCredentialServiceMetadata `json:"assa_abloy_credential_service_metadata,omitempty"` _rawJSON json.RawMessage @@ -3697,30 +3784,25 @@ func (p *PhonePropertiesAssaAbloyCredentialServiceMetadataEndpointsItem) String( return fmt.Sprintf("%#v", p) } -type PhonePropertiesAugustMetadata struct { - LockId string `json:"lock_id"` - LockName string `json:"lock_name"` - HouseName string `json:"house_name"` - HasKeypad bool `json:"has_keypad"` - KeypadBatteryLevel *string `json:"keypad_battery_level,omitempty"` - Model *string `json:"model,omitempty"` - HouseId *string `json:"house_id,omitempty"` +type PhoneWarningsItem struct { + WarningCode string `json:"warning_code"` + Message string `json:"message"` _rawJSON json.RawMessage } -func (p *PhonePropertiesAugustMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesAugustMetadata +func (p *PhoneWarningsItem) UnmarshalJSON(data []byte) error { + type unmarshaler PhoneWarningsItem var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PhonePropertiesAugustMetadata(value) + *p = PhoneWarningsItem(value) p._rawJSON = json.RawMessage(data) return nil } -func (p *PhonePropertiesAugustMetadata) String() string { +func (p *PhoneWarningsItem) String() string { if len(p._rawJSON) > 0 { if value, err := core.StringifyJSON(p._rawJSON); err == nil { return value @@ -3732,1361 +3814,47 @@ func (p *PhonePropertiesAugustMetadata) String() string { return fmt.Sprintf("%#v", p) } -type PhonePropertiesAvigilonAltaMetadata struct { - EntryName string `json:"entry_name"` - OrgName string `json:"org_name"` - ZoneId float64 `json:"zone_id"` - ZoneName string `json:"zone_name"` - SiteId float64 `json:"site_id"` - SiteName string `json:"site_name"` +type ProviderCategory string - _rawJSON json.RawMessage -} +const ( + ProviderCategoryStable ProviderCategory = "stable" + ProviderCategoryConsumerSmartlocks ProviderCategory = "consumer_smartlocks" +) -func (p *PhonePropertiesAvigilonAltaMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesAvigilonAltaMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func NewProviderCategoryFromString(s string) (ProviderCategory, error) { + switch s { + case "stable": + return ProviderCategoryStable, nil + case "consumer_smartlocks": + return ProviderCategoryConsumerSmartlocks, nil } - *p = PhonePropertiesAvigilonAltaMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil + var t ProviderCategory + return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (p *PhonePropertiesAvigilonAltaMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) +func (p ProviderCategory) Ptr() *ProviderCategory { + return &p } -// Represents the current status of the battery charge level. Values are "critical," which indicates an extremely low level, suggesting imminent shutdown or an urgent need for charging; "low," which signifies that the battery is under the preferred threshold and should be charged soon; "good," which denotes a satisfactory charge level, adequate for normal use without the immediate need for recharging; and "full," which represents a battery that is fully charged, providing the maximum duration of usage. -type PhonePropertiesBattery struct { - Level float64 `json:"level"` - Status PhonePropertiesBatteryStatus `json:"status,omitempty"` +type SelectionMode string - _rawJSON json.RawMessage -} +const ( + SelectionModeNone SelectionMode = "none" + SelectionModeSingle SelectionMode = "single" + SelectionModeMultiple SelectionMode = "multiple" +) -func (p *PhonePropertiesBattery) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesBattery - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err +func NewSelectionModeFromString(s string) (SelectionMode, error) { + switch s { + case "none": + return SelectionModeNone, nil + case "single": + return SelectionModeSingle, nil + case "multiple": + return SelectionModeMultiple, nil } - *p = PhonePropertiesBattery(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesBattery) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesBatteryStatus string - -const ( - PhonePropertiesBatteryStatusCritical PhonePropertiesBatteryStatus = "critical" - PhonePropertiesBatteryStatusLow PhonePropertiesBatteryStatus = "low" - PhonePropertiesBatteryStatusGood PhonePropertiesBatteryStatus = "good" - PhonePropertiesBatteryStatusFull PhonePropertiesBatteryStatus = "full" -) - -func NewPhonePropertiesBatteryStatusFromString(s string) (PhonePropertiesBatteryStatus, error) { - switch s { - case "critical": - return PhonePropertiesBatteryStatusCritical, nil - case "low": - return PhonePropertiesBatteryStatusLow, nil - case "good": - return PhonePropertiesBatteryStatusGood, nil - case "full": - return PhonePropertiesBatteryStatusFull, nil - } - var t PhonePropertiesBatteryStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p PhonePropertiesBatteryStatus) Ptr() *PhonePropertiesBatteryStatus { - return &p -} - -type PhonePropertiesBrivoMetadata struct { - DeviceName string `json:"device_name"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesBrivoMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesBrivoMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesBrivoMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesBrivoMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesCodeConstraintsItem struct { - typeName string - PhonePropertiesCodeConstraintsItemZero *PhonePropertiesCodeConstraintsItemZero - PhonePropertiesCodeConstraintsItemMaxLength *PhonePropertiesCodeConstraintsItemMaxLength -} - -func NewPhonePropertiesCodeConstraintsItemFromPhonePropertiesCodeConstraintsItemZero(value *PhonePropertiesCodeConstraintsItemZero) *PhonePropertiesCodeConstraintsItem { - return &PhonePropertiesCodeConstraintsItem{typeName: "phonePropertiesCodeConstraintsItemZero", PhonePropertiesCodeConstraintsItemZero: value} -} - -func NewPhonePropertiesCodeConstraintsItemFromPhonePropertiesCodeConstraintsItemMaxLength(value *PhonePropertiesCodeConstraintsItemMaxLength) *PhonePropertiesCodeConstraintsItem { - return &PhonePropertiesCodeConstraintsItem{typeName: "phonePropertiesCodeConstraintsItemMaxLength", PhonePropertiesCodeConstraintsItemMaxLength: value} -} - -func (p *PhonePropertiesCodeConstraintsItem) UnmarshalJSON(data []byte) error { - valuePhonePropertiesCodeConstraintsItemZero := new(PhonePropertiesCodeConstraintsItemZero) - if err := json.Unmarshal(data, &valuePhonePropertiesCodeConstraintsItemZero); err == nil { - p.typeName = "phonePropertiesCodeConstraintsItemZero" - p.PhonePropertiesCodeConstraintsItemZero = valuePhonePropertiesCodeConstraintsItemZero - return nil - } - valuePhonePropertiesCodeConstraintsItemMaxLength := new(PhonePropertiesCodeConstraintsItemMaxLength) - if err := json.Unmarshal(data, &valuePhonePropertiesCodeConstraintsItemMaxLength); err == nil { - p.typeName = "phonePropertiesCodeConstraintsItemMaxLength" - p.PhonePropertiesCodeConstraintsItemMaxLength = valuePhonePropertiesCodeConstraintsItemMaxLength - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, p) -} - -func (p PhonePropertiesCodeConstraintsItem) MarshalJSON() ([]byte, error) { - switch p.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", p.typeName, p) - case "phonePropertiesCodeConstraintsItemZero": - return json.Marshal(p.PhonePropertiesCodeConstraintsItemZero) - case "phonePropertiesCodeConstraintsItemMaxLength": - return json.Marshal(p.PhonePropertiesCodeConstraintsItemMaxLength) - } -} - -type PhonePropertiesCodeConstraintsItemVisitor interface { - VisitPhonePropertiesCodeConstraintsItemZero(*PhonePropertiesCodeConstraintsItemZero) error - VisitPhonePropertiesCodeConstraintsItemMaxLength(*PhonePropertiesCodeConstraintsItemMaxLength) error -} - -func (p *PhonePropertiesCodeConstraintsItem) Accept(visitor PhonePropertiesCodeConstraintsItemVisitor) error { - switch p.typeName { - default: - return fmt.Errorf("invalid type %s in %T", p.typeName, p) - case "phonePropertiesCodeConstraintsItemZero": - return visitor.VisitPhonePropertiesCodeConstraintsItemZero(p.PhonePropertiesCodeConstraintsItemZero) - case "phonePropertiesCodeConstraintsItemMaxLength": - return visitor.VisitPhonePropertiesCodeConstraintsItemMaxLength(p.PhonePropertiesCodeConstraintsItemMaxLength) - } -} - -type PhonePropertiesCodeConstraintsItemMaxLength struct { - MinLength *float64 `json:"min_length,omitempty"` - MaxLength *float64 `json:"max_length,omitempty"` - constraintType string - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesCodeConstraintsItemMaxLength) ConstraintType() string { - return p.constraintType -} - -func (p *PhonePropertiesCodeConstraintsItemMaxLength) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesCodeConstraintsItemMaxLength - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesCodeConstraintsItemMaxLength(value) - p.constraintType = "name_length" - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesCodeConstraintsItemMaxLength) MarshalJSON() ([]byte, error) { - type embed PhonePropertiesCodeConstraintsItemMaxLength - var marshaler = struct { - embed - ConstraintType string `json:"constraint_type"` - }{ - embed: embed(*p), - ConstraintType: "name_length", - } - return json.Marshal(marshaler) -} - -func (p *PhonePropertiesCodeConstraintsItemMaxLength) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesCodeConstraintsItemZero struct { - ConstraintType PhonePropertiesCodeConstraintsItemZeroConstraintType `json:"constraint_type,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesCodeConstraintsItemZero) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesCodeConstraintsItemZero - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesCodeConstraintsItemZero(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesCodeConstraintsItemZero) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesCodeConstraintsItemZeroConstraintType string - -const ( - PhonePropertiesCodeConstraintsItemZeroConstraintTypeNoZeros PhonePropertiesCodeConstraintsItemZeroConstraintType = "no_zeros" - PhonePropertiesCodeConstraintsItemZeroConstraintTypeCannotStartWith12 PhonePropertiesCodeConstraintsItemZeroConstraintType = "cannot_start_with_12" - PhonePropertiesCodeConstraintsItemZeroConstraintTypeNoTripleConsecutiveInts PhonePropertiesCodeConstraintsItemZeroConstraintType = "no_triple_consecutive_ints" - PhonePropertiesCodeConstraintsItemZeroConstraintTypeCannotSpecifyPinCode PhonePropertiesCodeConstraintsItemZeroConstraintType = "cannot_specify_pin_code" - PhonePropertiesCodeConstraintsItemZeroConstraintTypePinCodeMatchesExistingSet PhonePropertiesCodeConstraintsItemZeroConstraintType = "pin_code_matches_existing_set" - PhonePropertiesCodeConstraintsItemZeroConstraintTypeStartDateInFuture PhonePropertiesCodeConstraintsItemZeroConstraintType = "start_date_in_future" -) - -func NewPhonePropertiesCodeConstraintsItemZeroConstraintTypeFromString(s string) (PhonePropertiesCodeConstraintsItemZeroConstraintType, error) { - switch s { - case "no_zeros": - return PhonePropertiesCodeConstraintsItemZeroConstraintTypeNoZeros, nil - case "cannot_start_with_12": - return PhonePropertiesCodeConstraintsItemZeroConstraintTypeCannotStartWith12, nil - case "no_triple_consecutive_ints": - return PhonePropertiesCodeConstraintsItemZeroConstraintTypeNoTripleConsecutiveInts, nil - case "cannot_specify_pin_code": - return PhonePropertiesCodeConstraintsItemZeroConstraintTypeCannotSpecifyPinCode, nil - case "pin_code_matches_existing_set": - return PhonePropertiesCodeConstraintsItemZeroConstraintTypePinCodeMatchesExistingSet, nil - case "start_date_in_future": - return PhonePropertiesCodeConstraintsItemZeroConstraintTypeStartDateInFuture, nil - } - var t PhonePropertiesCodeConstraintsItemZeroConstraintType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p PhonePropertiesCodeConstraintsItemZeroConstraintType) Ptr() *PhonePropertiesCodeConstraintsItemZeroConstraintType { - return &p -} - -type PhonePropertiesControlbywebMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - RelayName *string `json:"relay_name,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesControlbywebMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesControlbywebMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesControlbywebMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesControlbywebMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesDormakabaOracodeMetadata struct { - DoorId float64 `json:"door_id"` - DoorName string `json:"door_name"` - DeviceId *float64 `json:"device_id,omitempty"` - SiteId float64 `json:"site_id"` - SiteName string `json:"site_name"` - IanaTimezone *string `json:"iana_timezone,omitempty"` - PredefinedTimeSlots []*PhonePropertiesDormakabaOracodeMetadataPredefinedTimeSlotsItem `json:"predefined_time_slots,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesDormakabaOracodeMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesDormakabaOracodeMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesDormakabaOracodeMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesDormakabaOracodeMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesDormakabaOracodeMetadataPredefinedTimeSlotsItem struct { - Name string `json:"name"` - Prefix float64 `json:"prefix"` - CheckInTime string `json:"check_in_time"` - CheckOutTime string `json:"check_out_time"` - Is24Hour bool `json:"is_24_hour"` - IsBiweeklyMode bool `json:"is_biweekly_mode"` - IsOneShot bool `json:"is_one_shot"` - IsMaster bool `json:"is_master"` - ExtDormakabaOracodeUserLevelPrefix float64 `json:"ext_dormakaba_oracode_user_level_prefix"` - DormakabaOracodeUserLevelId string `json:"dormakaba_oracode_user_level_id"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesDormakabaOracodeMetadataPredefinedTimeSlotsItem) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesDormakabaOracodeMetadataPredefinedTimeSlotsItem - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesDormakabaOracodeMetadataPredefinedTimeSlotsItem(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesDormakabaOracodeMetadataPredefinedTimeSlotsItem) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesEcobeeMetadata struct { - EcobeeDeviceId string `json:"ecobee_device_id"` - DeviceName string `json:"device_name"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesEcobeeMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesEcobeeMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesEcobeeMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesEcobeeMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesFourSuitesMetadata struct { - DeviceId float64 `json:"device_id"` - DeviceName string `json:"device_name"` - RecloseDelayInSeconds float64 `json:"reclose_delay_in_seconds"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesFourSuitesMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesFourSuitesMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesFourSuitesMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesFourSuitesMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesGenieMetadata struct { - DeviceName string `json:"device_name"` - DoorName string `json:"door_name"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesGenieMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesGenieMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesGenieMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesGenieMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesHubitatMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - DeviceLabel string `json:"device_label"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesHubitatMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesHubitatMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesHubitatMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesHubitatMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesIglooMetadata struct { - DeviceId string `json:"device_id"` - BridgeId string `json:"bridge_id"` - Model *string `json:"model,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesIglooMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesIglooMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesIglooMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesIglooMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesIgloohomeMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - BridgeId *string `json:"bridge_id,omitempty"` - BridgeName *string `json:"bridge_name,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesIgloohomeMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesIgloohomeMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesIgloohomeMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesIgloohomeMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesKeypadBattery struct { - Level float64 `json:"level"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesKeypadBattery) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesKeypadBattery - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesKeypadBattery(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesKeypadBattery) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesKwiksetMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - ModelNumber string `json:"model_number"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesKwiksetMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesKwiksetMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesKwiksetMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesKwiksetMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesLocklyMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - Model *string `json:"model,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesLocklyMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesLocklyMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesLocklyMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesLocklyMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesMinutMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - LatestSensorValues *PhonePropertiesMinutMetadataLatestSensorValues `json:"latest_sensor_values,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesMinutMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesMinutMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesMinutMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesMinutMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesMinutMetadataLatestSensorValues struct { - Temperature *PhonePropertiesMinutMetadataLatestSensorValuesTemperature `json:"temperature,omitempty"` - Sound *PhonePropertiesMinutMetadataLatestSensorValuesSound `json:"sound,omitempty"` - Humidity *PhonePropertiesMinutMetadataLatestSensorValuesHumidity `json:"humidity,omitempty"` - Pressure *PhonePropertiesMinutMetadataLatestSensorValuesPressure `json:"pressure,omitempty"` - AccelerometerZ *PhonePropertiesMinutMetadataLatestSensorValuesAccelerometerZ `json:"accelerometer_z,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValues) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesMinutMetadataLatestSensorValues - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesMinutMetadataLatestSensorValues(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValues) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesMinutMetadataLatestSensorValuesAccelerometerZ struct { - Time string `json:"time"` - Value float64 `json:"value"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesAccelerometerZ) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesMinutMetadataLatestSensorValuesAccelerometerZ - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesMinutMetadataLatestSensorValuesAccelerometerZ(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesAccelerometerZ) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesMinutMetadataLatestSensorValuesHumidity struct { - Time string `json:"time"` - Value float64 `json:"value"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesHumidity) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesMinutMetadataLatestSensorValuesHumidity - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesMinutMetadataLatestSensorValuesHumidity(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesHumidity) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesMinutMetadataLatestSensorValuesPressure struct { - Time string `json:"time"` - Value float64 `json:"value"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesPressure) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesMinutMetadataLatestSensorValuesPressure - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesMinutMetadataLatestSensorValuesPressure(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesPressure) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesMinutMetadataLatestSensorValuesSound struct { - Time string `json:"time"` - Value float64 `json:"value"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesSound) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesMinutMetadataLatestSensorValuesSound - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesMinutMetadataLatestSensorValuesSound(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesSound) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesMinutMetadataLatestSensorValuesTemperature struct { - Time string `json:"time"` - Value float64 `json:"value"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesTemperature) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesMinutMetadataLatestSensorValuesTemperature - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesMinutMetadataLatestSensorValuesTemperature(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesMinutMetadataLatestSensorValuesTemperature) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesModel struct { - // Display name of the device model. - DisplayName string `json:"display_name"` - // Display name that corresponds to the manufacturer-specific terminology for the device. - ManufacturerDisplayName string `json:"manufacturer_display_name"` - // Indicates whether the device supports offline access codes. - OfflineAccessCodesSupported *bool `json:"offline_access_codes_supported,omitempty"` - // Indicates whether the device supports online access codes. - OnlineAccessCodesSupported *bool `json:"online_access_codes_supported,omitempty"` - // Indicates whether the device supports an accessory keypad. - AccessoryKeypadSupported *bool `json:"accessory_keypad_supported,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesModel) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesModel - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesModel(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesModel) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesNestMetadata struct { - NestDeviceId string `json:"nest_device_id"` - DeviceName string `json:"device_name"` - CustomName string `json:"custom_name"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesNestMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesNestMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesNestMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesNestMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesNoiseawareMetadata struct { - DeviceModel PhonePropertiesNoiseawareMetadataDeviceModel `json:"device_model,omitempty"` - NoiseLevelNrs float64 `json:"noise_level_nrs"` - NoiseLevelDecibel float64 `json:"noise_level_decibel"` - DeviceName string `json:"device_name"` - DeviceId string `json:"device_id"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesNoiseawareMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesNoiseawareMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesNoiseawareMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesNoiseawareMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesNoiseawareMetadataDeviceModel string - -const ( - PhonePropertiesNoiseawareMetadataDeviceModelIndoor PhonePropertiesNoiseawareMetadataDeviceModel = "indoor" - PhonePropertiesNoiseawareMetadataDeviceModelOutdoor PhonePropertiesNoiseawareMetadataDeviceModel = "outdoor" -) - -func NewPhonePropertiesNoiseawareMetadataDeviceModelFromString(s string) (PhonePropertiesNoiseawareMetadataDeviceModel, error) { - switch s { - case "indoor": - return PhonePropertiesNoiseawareMetadataDeviceModelIndoor, nil - case "outdoor": - return PhonePropertiesNoiseawareMetadataDeviceModelOutdoor, nil - } - var t PhonePropertiesNoiseawareMetadataDeviceModel - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p PhonePropertiesNoiseawareMetadataDeviceModel) Ptr() *PhonePropertiesNoiseawareMetadataDeviceModel { - return &p -} - -type PhonePropertiesNukiMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - KeypadBatteryCritical *bool `json:"keypad_battery_critical,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesNukiMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesNukiMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesNukiMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesNukiMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesSaltoMetadata struct { - LockId string `json:"lock_id"` - CustomerReference string `json:"customer_reference"` - LockType string `json:"lock_type"` - BatteryLevel string `json:"battery_level"` - LockedState string `json:"locked_state"` - Model *string `json:"model,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesSaltoMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesSaltoMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesSaltoMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesSaltoMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesSchlageMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - AccessCodeLength float64 `json:"access_code_length"` - Model *string `json:"model,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesSchlageMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesSchlageMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesSchlageMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesSchlageMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesSeamBridgeMetadata struct { - UnlockMethod *PhonePropertiesSeamBridgeMetadataUnlockMethod `json:"unlock_method,omitempty"` - DeviceNum float64 `json:"device_num"` - Name string `json:"name"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesSeamBridgeMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesSeamBridgeMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesSeamBridgeMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesSeamBridgeMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesSeamBridgeMetadataUnlockMethod string - -const ( - PhonePropertiesSeamBridgeMetadataUnlockMethodBridge PhonePropertiesSeamBridgeMetadataUnlockMethod = "bridge" - PhonePropertiesSeamBridgeMetadataUnlockMethodDoorking PhonePropertiesSeamBridgeMetadataUnlockMethod = "doorking" -) - -func NewPhonePropertiesSeamBridgeMetadataUnlockMethodFromString(s string) (PhonePropertiesSeamBridgeMetadataUnlockMethod, error) { - switch s { - case "bridge": - return PhonePropertiesSeamBridgeMetadataUnlockMethodBridge, nil - case "doorking": - return PhonePropertiesSeamBridgeMetadataUnlockMethodDoorking, nil - } - var t PhonePropertiesSeamBridgeMetadataUnlockMethod - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p PhonePropertiesSeamBridgeMetadataUnlockMethod) Ptr() *PhonePropertiesSeamBridgeMetadataUnlockMethod { - return &p -} - -type PhonePropertiesSmartthingsMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - Model *string `json:"model,omitempty"` - LocationId *string `json:"location_id,omitempty"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesSmartthingsMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesSmartthingsMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesSmartthingsMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesSmartthingsMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesTtlockMetadata struct { - LockId float64 `json:"lock_id"` - LockAlias string `json:"lock_alias"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesTtlockMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesTtlockMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesTtlockMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesTtlockMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesTwoNMetadata struct { - DeviceId float64 `json:"device_id"` - DeviceName string `json:"device_name"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesTwoNMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesTwoNMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesTwoNMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesTwoNMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhonePropertiesWyzeMetadata struct { - DeviceId string `json:"device_id"` - DeviceName string `json:"device_name"` - ProductName string `json:"product_name"` - ProductType string `json:"product_type"` - ProductModel string `json:"product_model"` - DeviceInfoModel string `json:"device_info_model"` - - _rawJSON json.RawMessage -} - -func (p *PhonePropertiesWyzeMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler PhonePropertiesWyzeMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhonePropertiesWyzeMetadata(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhonePropertiesWyzeMetadata) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type PhoneWarningsItem struct { - WarningCode string `json:"warning_code"` - Message string `json:"message"` - - _rawJSON json.RawMessage -} - -func (p *PhoneWarningsItem) UnmarshalJSON(data []byte) error { - type unmarshaler PhoneWarningsItem - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PhoneWarningsItem(value) - p._rawJSON = json.RawMessage(data) - return nil -} - -func (p *PhoneWarningsItem) String() string { - if len(p._rawJSON) > 0 { - if value, err := core.StringifyJSON(p._rawJSON); err == nil { - return value - } - } - if value, err := core.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -type ProviderCategory string - -const ( - ProviderCategoryStable ProviderCategory = "stable" - ProviderCategoryConsumerSmartlocks ProviderCategory = "consumer_smartlocks" -) - -func NewProviderCategoryFromString(s string) (ProviderCategory, error) { - switch s { - case "stable": - return ProviderCategoryStable, nil - case "consumer_smartlocks": - return ProviderCategoryConsumerSmartlocks, nil - } - var t ProviderCategory - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p ProviderCategory) Ptr() *ProviderCategory { - return &p -} - -type SelectionMode string - -const ( - SelectionModeNone SelectionMode = "none" - SelectionModeSingle SelectionMode = "single" - SelectionModeMultiple SelectionMode = "multiple" -) - -func NewSelectionModeFromString(s string) (SelectionMode, error) { - switch s { - case "none": - return SelectionModeNone, nil - case "single": - return SelectionModeSingle, nil - case "multiple": - return SelectionModeMultiple, nil - } - var t SelectionMode - return "", fmt.Errorf("%s is not a valid %T", s, t) + var t SelectionMode + return "", fmt.Errorf("%s is not a valid %T", s, t) } func (s SelectionMode) Ptr() *SelectionMode { @@ -5737,6 +4505,34 @@ func (n *NetworksListResponseNetworksItem) String() string { return fmt.Sprintf("%#v", n) } +type ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting string + +const ( + ThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingOff ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting = "off" + ThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingHeat ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting = "heat" + ThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingCool ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting = "cool" + ThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingHeatCool ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting = "heat_cool" +) + +func NewThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingFromString(s string) (ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting, error) { + switch s { + case "off": + return ThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingOff, nil + case "heat": + return ThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingHeat, nil + case "cool": + return ThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingCool, nil + case "heat_cool": + return ThermostatsUpdateRequestDefaultClimateSettingHvacModeSettingHeatCool, nil + } + var t ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (t ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting) Ptr() *ThermostatsUpdateRequestDefaultClimateSettingHvacModeSetting { + return &t +} + type UserIdentitiesCreateResponseUserIdentity struct { UserIdentityId string `json:"user_identity_id"` UserIdentityKey *string `json:"user_identity_key,omitempty"` diff --git a/user_identities.go b/user_identities.go index 832b609..a9f4039 100644 --- a/user_identities.go +++ b/user_identities.go @@ -20,6 +20,10 @@ type UserIdentitiesCreateRequest struct { FullName *string `json:"full_name,omitempty"` } +type UserIdentitiesDeleteRequest struct { + UserIdentityId string `json:"user_identity_id"` +} + type UserIdentitiesGrantAccessToDeviceRequest struct { UserIdentityId string `json:"user_identity_id"` DeviceId string `json:"device_id"` @@ -106,6 +110,35 @@ func (u *UserIdentitiesCreateResponse) String() string { return fmt.Sprintf("%#v", u) } +type UserIdentitiesDeleteResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UserIdentitiesDeleteResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UserIdentitiesDeleteResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserIdentitiesDeleteResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserIdentitiesDeleteResponse) 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 diff --git a/useridentities/client/client.go b/useridentities/client/client.go index 52262e1..f0a4fff 100644 --- a/useridentities/client/client.go +++ b/useridentities/client/client.go @@ -135,6 +135,56 @@ func (c *Client) Create(ctx context.Context, request *seamapigo.UserIdentitiesCr return response, nil } +func (c *Client) Delete(ctx context.Context, request *seamapigo.UserIdentitiesDeleteRequest) (*seamapigo.UserIdentitiesDeleteResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "user_identities/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 *seamapigo.UserIdentitiesDeleteResponse + 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 *seamapigo.UserIdentitiesGetRequest) (*seamapigo.UserIdentitiesGetResponse, error) { baseURL := "https://connect.getseam.com" if c.baseURL != "" {