From e70f933c56fe0bd618e43c3b235ba7f611fa4772 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:58:35 +0000 Subject: [PATCH] SDK regeneration --- access_codes.go | 1 + acs/types.go | 21 +++++++++++++++++ acs/users.go | 33 +++++++++++++++++++++++++++ acs/users/client.go | 50 ++++++++++++++++++++++++++++++++++++++++ connect_webviews.go | 3 +++ core/client_option.go | 2 +- types.go | 53 ++++++++++++++++++++++++++++++++++++++----- webhooks.go | 34 +++++++++++++++++++++++++++ webhooks/client.go | 50 ++++++++++++++++++++++++++++++++++++++++ 9 files changed, 240 insertions(+), 7 deletions(-) diff --git a/access_codes.go b/access_codes.go index 4bce1da..6ce5abb 100644 --- a/access_codes.go +++ b/access_codes.go @@ -30,6 +30,7 @@ type AccessCodesCreateRequest struct { type AccessCodesCreateMultipleRequest struct { DeviceIds []string `json:"device_ids,omitempty"` BehaviorWhenCodeCannotBeShared *AccessCodesCreateMultipleRequestBehaviorWhenCodeCannotBeShared `json:"behavior_when_code_cannot_be_shared,omitempty"` + PreferredCodeLength *float64 `json:"preferred_code_length,omitempty"` Name *string `json:"name,omitempty"` StartsAt *string `json:"starts_at,omitempty"` EndsAt *string `json:"ends_at,omitempty"` diff --git a/acs/types.go b/acs/types.go index 65384ba..d93d026 100644 --- a/acs/types.go +++ b/acs/types.go @@ -99,6 +99,7 @@ type CredentialsAssignResponseAcsCredential struct { AcsUserId *string `json:"acs_user_id,omitempty"` AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` AcsSystemId string `json:"acs_system_id"` + ParentAcsCredentialId *string `json:"parent_acs_credential_id,omitempty"` DisplayName string `json:"display_name"` Code *string `json:"code,omitempty"` AccessMethod CredentialsAssignResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` @@ -192,6 +193,8 @@ func (c CredentialsAssignResponseAcsCredentialExternalType) Ptr() *CredentialsAs type CredentialsAssignResponseAcsCredentialVisionlineMetadata struct { JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty"` + GuestAcsEntranceIds []string `json:"guest_acs_entrance_ids,omitempty"` + CommonAcsEntranceIds []string `json:"common_acs_entrance_ids,omitempty"` _rawJSON json.RawMessage } @@ -246,6 +249,7 @@ type CredentialsCreateResponseAcsCredential struct { AcsUserId *string `json:"acs_user_id,omitempty"` AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` AcsSystemId string `json:"acs_system_id"` + ParentAcsCredentialId *string `json:"parent_acs_credential_id,omitempty"` DisplayName string `json:"display_name"` Code *string `json:"code,omitempty"` AccessMethod CredentialsCreateResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` @@ -339,6 +343,8 @@ func (c CredentialsCreateResponseAcsCredentialExternalType) Ptr() *CredentialsCr type CredentialsCreateResponseAcsCredentialVisionlineMetadata struct { JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty"` + GuestAcsEntranceIds []string `json:"guest_acs_entrance_ids,omitempty"` + CommonAcsEntranceIds []string `json:"common_acs_entrance_ids,omitempty"` _rawJSON json.RawMessage } @@ -371,6 +377,7 @@ type CredentialsGetResponseAcsCredential struct { AcsUserId *string `json:"acs_user_id,omitempty"` AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` AcsSystemId string `json:"acs_system_id"` + ParentAcsCredentialId *string `json:"parent_acs_credential_id,omitempty"` DisplayName string `json:"display_name"` Code *string `json:"code,omitempty"` AccessMethod CredentialsGetResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` @@ -464,6 +471,8 @@ func (c CredentialsGetResponseAcsCredentialExternalType) Ptr() *CredentialsGetRe type CredentialsGetResponseAcsCredentialVisionlineMetadata struct { JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty"` + GuestAcsEntranceIds []string `json:"guest_acs_entrance_ids,omitempty"` + CommonAcsEntranceIds []string `json:"common_acs_entrance_ids,omitempty"` _rawJSON json.RawMessage } @@ -613,6 +622,7 @@ type CredentialsListResponseAcsCredentialsItem struct { AcsUserId *string `json:"acs_user_id,omitempty"` AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` AcsSystemId string `json:"acs_system_id"` + ParentAcsCredentialId *string `json:"parent_acs_credential_id,omitempty"` DisplayName string `json:"display_name"` Code *string `json:"code,omitempty"` AccessMethod CredentialsListResponseAcsCredentialsItemAccessMethod `json:"access_method,omitempty"` @@ -706,6 +716,8 @@ func (c CredentialsListResponseAcsCredentialsItemExternalType) Ptr() *Credential type CredentialsListResponseAcsCredentialsItemVisionlineMetadata struct { JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty"` + GuestAcsEntranceIds []string `json:"guest_acs_entrance_ids,omitempty"` + CommonAcsEntranceIds []string `json:"common_acs_entrance_ids,omitempty"` _rawJSON json.RawMessage } @@ -738,6 +750,7 @@ type CredentialsUnassignResponseAcsCredential struct { AcsUserId *string `json:"acs_user_id,omitempty"` AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` AcsSystemId string `json:"acs_system_id"` + ParentAcsCredentialId *string `json:"parent_acs_credential_id,omitempty"` DisplayName string `json:"display_name"` Code *string `json:"code,omitempty"` AccessMethod CredentialsUnassignResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` @@ -831,6 +844,8 @@ func (c CredentialsUnassignResponseAcsCredentialExternalType) Ptr() *Credentials type CredentialsUnassignResponseAcsCredentialVisionlineMetadata struct { JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty"` + GuestAcsEntranceIds []string `json:"guest_acs_entrance_ids,omitempty"` + CommonAcsEntranceIds []string `json:"common_acs_entrance_ids,omitempty"` _rawJSON json.RawMessage } @@ -863,6 +878,7 @@ type CredentialsUpdateResponseAcsCredential struct { AcsUserId *string `json:"acs_user_id,omitempty"` AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` AcsSystemId string `json:"acs_system_id"` + ParentAcsCredentialId *string `json:"parent_acs_credential_id,omitempty"` DisplayName string `json:"display_name"` Code *string `json:"code,omitempty"` AccessMethod CredentialsUpdateResponseAcsCredentialAccessMethod `json:"access_method,omitempty"` @@ -956,6 +972,8 @@ func (c CredentialsUpdateResponseAcsCredentialExternalType) Ptr() *CredentialsUp type CredentialsUpdateResponseAcsCredentialVisionlineMetadata struct { JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty"` + GuestAcsEntranceIds []string `json:"guest_acs_entrance_ids,omitempty"` + CommonAcsEntranceIds []string `json:"common_acs_entrance_ids,omitempty"` _rawJSON json.RawMessage } @@ -1106,6 +1124,7 @@ type EntrancesListCredentialsWithAccessResponseAcsCredentialsItem struct { AcsUserId *string `json:"acs_user_id,omitempty"` AcsCredentialPoolId *string `json:"acs_credential_pool_id,omitempty"` AcsSystemId string `json:"acs_system_id"` + ParentAcsCredentialId *string `json:"parent_acs_credential_id,omitempty"` DisplayName string `json:"display_name"` Code *string `json:"code,omitempty"` AccessMethod EntrancesListCredentialsWithAccessResponseAcsCredentialsItemAccessMethod `json:"access_method,omitempty"` @@ -1199,6 +1218,8 @@ func (e EntrancesListCredentialsWithAccessResponseAcsCredentialsItemExternalType type EntrancesListCredentialsWithAccessResponseAcsCredentialsItemVisionlineMetadata struct { JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty"` + GuestAcsEntranceIds []string `json:"guest_acs_entrance_ids,omitempty"` + CommonAcsEntranceIds []string `json:"common_acs_entrance_ids,omitempty"` _rawJSON json.RawMessage } diff --git a/acs/users.go b/acs/users.go index b845d14..5f397a1 100644 --- a/acs/users.go +++ b/acs/users.go @@ -51,6 +51,10 @@ type UsersRemoveFromAccessGroupRequest struct { AcsAccessGroupId string `json:"acs_access_group_id"` } +type UsersRevokeAccessToAllEntrancesRequest struct { + AcsUserId string `json:"acs_user_id"` +} + type UsersSuspendRequest struct { AcsUserId string `json:"acs_user_id"` } @@ -234,6 +238,35 @@ func (u *UsersListResponse) String() string { return fmt.Sprintf("%#v", u) } +type UsersRevokeAccessToAllEntrancesResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (u *UsersRevokeAccessToAllEntrancesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UsersRevokeAccessToAllEntrancesResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UsersRevokeAccessToAllEntrancesResponse(value) + u._rawJSON = json.RawMessage(data) + return nil +} + +func (u *UsersRevokeAccessToAllEntrancesResponse) String() string { + if len(u._rawJSON) > 0 { + if value, err := core.StringifyJSON(u._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + type UsersSuspendResponse struct { Ok bool `json:"ok"` diff --git a/acs/users/client.go b/acs/users/client.go index 1af2850..5020f46 100644 --- a/acs/users/client.go +++ b/acs/users/client.go @@ -378,6 +378,56 @@ func (c *Client) RemoveFromAccessGroup(ctx context.Context, request *acs.UsersRe return nil } +func (c *Client) RevokeAccessToAllEntrances(ctx context.Context, request *acs.UsersRevokeAccessToAllEntrancesRequest) (*acs.UsersRevokeAccessToAllEntrancesResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "acs/users/revoke_access_to_all_entrances" + + 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.UsersRevokeAccessToAllEntrancesResponse + 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) Suspend(ctx context.Context, request *acs.UsersSuspendRequest) (*acs.UsersSuspendResponse, error) { baseURL := "https://connect.getseam.com" if c.baseURL != "" { diff --git a/connect_webviews.go b/connect_webviews.go index 8458e85..daaf216 100644 --- a/connect_webviews.go +++ b/connect_webviews.go @@ -71,6 +71,7 @@ const ( AcceptedProviderAssaAbloyCredentialService AcceptedProvider = "assa_abloy_credential_service" AcceptedProviderSeamBridge AcceptedProvider = "seam_bridge" AcceptedProviderTedee AcceptedProvider = "tedee" + AcceptedProviderHoneywell AcceptedProvider = "honeywell" AcceptedProviderYaleAccess AcceptedProvider = "yale_access" AcceptedProviderHidCm AcceptedProvider = "hid_cm" AcceptedProviderGoogleNest AcceptedProvider = "google_nest" @@ -148,6 +149,8 @@ func NewAcceptedProviderFromString(s string) (AcceptedProvider, error) { return AcceptedProviderSeamBridge, nil case "tedee": return AcceptedProviderTedee, nil + case "honeywell": + return AcceptedProviderHoneywell, nil case "yale_access": return AcceptedProviderYaleAccess, nil case "hid_cm": diff --git a/core/client_option.go b/core/client_option.go index 035900e..def41c8 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.4.4") + headers.Set("X-Fern-SDK-Version", "v0.2.8") return headers } diff --git a/types.go b/types.go index cb7e09f..4b047a4 100644 --- a/types.go +++ b/types.go @@ -1364,6 +1364,7 @@ type DeviceProperties struct { HubitatMetadata *DevicePropertiesHubitatMetadata `json:"hubitat_metadata,omitempty"` DormakabaOracodeMetadata *DevicePropertiesDormakabaOracodeMetadata `json:"dormakaba_oracode_metadata,omitempty"` WyzeMetadata *DevicePropertiesWyzeMetadata `json:"wyze_metadata,omitempty"` + TedeeMetadata *DevicePropertiesTedeeMetadata `json:"tedee_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"` @@ -1754,12 +1755,14 @@ func (d *DevicePropertiesCodeConstraintsItemZero) String() string { type DevicePropertiesCodeConstraintsItemZeroConstraintType string const ( - DevicePropertiesCodeConstraintsItemZeroConstraintTypeNoZeros DevicePropertiesCodeConstraintsItemZeroConstraintType = "no_zeros" - DevicePropertiesCodeConstraintsItemZeroConstraintTypeCannotStartWith12 DevicePropertiesCodeConstraintsItemZeroConstraintType = "cannot_start_with_12" - DevicePropertiesCodeConstraintsItemZeroConstraintTypeNoTripleConsecutiveInts DevicePropertiesCodeConstraintsItemZeroConstraintType = "no_triple_consecutive_ints" - DevicePropertiesCodeConstraintsItemZeroConstraintTypeCannotSpecifyPinCode DevicePropertiesCodeConstraintsItemZeroConstraintType = "cannot_specify_pin_code" - DevicePropertiesCodeConstraintsItemZeroConstraintTypePinCodeMatchesExistingSet DevicePropertiesCodeConstraintsItemZeroConstraintType = "pin_code_matches_existing_set" - DevicePropertiesCodeConstraintsItemZeroConstraintTypeStartDateInFuture DevicePropertiesCodeConstraintsItemZeroConstraintType = "start_date_in_future" + DevicePropertiesCodeConstraintsItemZeroConstraintTypeNoZeros DevicePropertiesCodeConstraintsItemZeroConstraintType = "no_zeros" + DevicePropertiesCodeConstraintsItemZeroConstraintTypeCannotStartWith12 DevicePropertiesCodeConstraintsItemZeroConstraintType = "cannot_start_with_12" + DevicePropertiesCodeConstraintsItemZeroConstraintTypeNoTripleConsecutiveInts DevicePropertiesCodeConstraintsItemZeroConstraintType = "no_triple_consecutive_ints" + DevicePropertiesCodeConstraintsItemZeroConstraintTypeCannotSpecifyPinCode DevicePropertiesCodeConstraintsItemZeroConstraintType = "cannot_specify_pin_code" + DevicePropertiesCodeConstraintsItemZeroConstraintTypePinCodeMatchesExistingSet DevicePropertiesCodeConstraintsItemZeroConstraintType = "pin_code_matches_existing_set" + DevicePropertiesCodeConstraintsItemZeroConstraintTypeStartDateInFuture DevicePropertiesCodeConstraintsItemZeroConstraintType = "start_date_in_future" + DevicePropertiesCodeConstraintsItemZeroConstraintTypeNoAscendingOrDescendingSequence DevicePropertiesCodeConstraintsItemZeroConstraintType = "no_ascending_or_descending_sequence" + DevicePropertiesCodeConstraintsItemZeroConstraintTypeAtLeastThreeUniqueDigits DevicePropertiesCodeConstraintsItemZeroConstraintType = "at_least_three_unique_digits" ) func NewDevicePropertiesCodeConstraintsItemZeroConstraintTypeFromString(s string) (DevicePropertiesCodeConstraintsItemZeroConstraintType, error) { @@ -1776,6 +1779,10 @@ func NewDevicePropertiesCodeConstraintsItemZeroConstraintTypeFromString(s string return DevicePropertiesCodeConstraintsItemZeroConstraintTypePinCodeMatchesExistingSet, nil case "start_date_in_future": return DevicePropertiesCodeConstraintsItemZeroConstraintTypeStartDateInFuture, nil + case "no_ascending_or_descending_sequence": + return DevicePropertiesCodeConstraintsItemZeroConstraintTypeNoAscendingOrDescendingSequence, nil + case "at_least_three_unique_digits": + return DevicePropertiesCodeConstraintsItemZeroConstraintTypeAtLeastThreeUniqueDigits, nil } var t DevicePropertiesCodeConstraintsItemZeroConstraintType return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -2685,6 +2692,40 @@ func (d *DevicePropertiesSmartthingsMetadata) String() string { return fmt.Sprintf("%#v", d) } +type DevicePropertiesTedeeMetadata struct { + DeviceId float64 `json:"device_id"` + SerialNumber string `json:"serial_number"` + DeviceName string `json:"device_name"` + DeviceModel string `json:"device_model"` + BridgeId float64 `json:"bridge_id"` + BridgeName string `json:"bridge_name"` + + _rawJSON json.RawMessage +} + +func (d *DevicePropertiesTedeeMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler DevicePropertiesTedeeMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DevicePropertiesTedeeMetadata(value) + d._rawJSON = json.RawMessage(data) + return nil +} + +func (d *DevicePropertiesTedeeMetadata) String() string { + if len(d._rawJSON) > 0 { + if value, err := core.StringifyJSON(d._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + type DevicePropertiesTtlockMetadata struct { LockId float64 `json:"lock_id"` LockAlias string `json:"lock_alias"` diff --git a/webhooks.go b/webhooks.go index bb088b2..e588a98 100644 --- a/webhooks.go +++ b/webhooks.go @@ -139,3 +139,37 @@ func (w *WebhooksListResponse) String() string { } return fmt.Sprintf("%#v", w) } + +type WebhooksUpdateResponse struct { + Ok bool `json:"ok"` + + _rawJSON json.RawMessage +} + +func (w *WebhooksUpdateResponse) UnmarshalJSON(data []byte) error { + type unmarshaler WebhooksUpdateResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WebhooksUpdateResponse(value) + w._rawJSON = json.RawMessage(data) + return nil +} + +func (w *WebhooksUpdateResponse) String() string { + if len(w._rawJSON) > 0 { + if value, err := core.StringifyJSON(w._rawJSON); err == nil { + return value + } + } + if value, err := core.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +type WebhooksUpdateRequest struct { + WebhookId string `json:"webhook_id"` + EventTypes []string `json:"event_types,omitempty"` +} diff --git a/webhooks/client.go b/webhooks/client.go index 39f4653..c7add51 100644 --- a/webhooks/client.go +++ b/webhooks/client.go @@ -229,3 +229,53 @@ func (c *Client) List(ctx context.Context) ([]*seamapigo.Webhook, error) { } return response.Webhooks, nil } + +func (c *Client) Update(ctx context.Context, request *seamapigo.WebhooksUpdateRequest) (*seamapigo.WebhooksUpdateResponse, error) { + baseURL := "https://connect.getseam.com" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := baseURL + "/" + "webhooks/update" + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(seamapigo.BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + case 401: + value := new(seamapigo.UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return apiError + } + return value + } + return apiError + } + + var response *seamapigo.WebhooksUpdateResponse + 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 +}