Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 Fern Regeneration -- July 8, 2024 #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 62 additions & 8 deletions acs/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ type CredentialsListRequest struct {
IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty" url:"is_multi_phone_sync_credential,omitempty"`
}

type CredentialsListAccessibleEntrancesRequest struct {
AcsCredentialId string `json:"acs_credential_id" url:"acs_credential_id"`
}

type CredentialsAssignResponse struct {
AcsCredential *seamapigo.AcsCredential `json:"acs_credential,omitempty" url:"acs_credential,omitempty"`
Ok bool `json:"ok" url:"ok"`
Expand Down Expand Up @@ -125,12 +129,9 @@ type CredentialsCreateRequestVisionlineMetadata struct {
AssaAbloyCredentialServiceMobileEndpointId *string `json:"assa_abloy_credential_service_mobile_endpoint_id,omitempty" url:"assa_abloy_credential_service_mobile_endpoint_id,omitempty"`
CardFormat *CredentialsCreateRequestVisionlineMetadataCardFormat `json:"card_format,omitempty" url:"card_format,omitempty"`
CardFunctionType *CredentialsCreateRequestVisionlineMetadataCardFunctionType `json:"card_function_type,omitempty" url:"card_function_type,omitempty"`
// ---
// deprecated: use override.
// ---
IsOverrideKey *bool `json:"is_override_key,omitempty" url:"is_override_key,omitempty"`
Override *bool `json:"override,omitempty" url:"override,omitempty"`
JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty" url:"joiner_acs_credential_ids,omitempty"`
IsOverrideKey *bool `json:"is_override_key,omitempty" url:"is_override_key,omitempty"`
Override *bool `json:"override,omitempty" url:"override,omitempty"`
JoinerAcsCredentialIds []string `json:"joiner_acs_credential_ids,omitempty" url:"joiner_acs_credential_ids,omitempty"`

_rawJSON json.RawMessage
}
Expand Down Expand Up @@ -247,6 +248,36 @@ func (c *CredentialsGetResponse) String() string {
return fmt.Sprintf("%#v", c)
}

type CredentialsListAccessibleEntrancesResponse struct {
AcsEntrances []*seamapigo.AcsEntrance `json:"acs_entrances,omitempty" url:"acs_entrances,omitempty"`
Ok bool `json:"ok" url:"ok"`

_rawJSON json.RawMessage
}

func (c *CredentialsListAccessibleEntrancesResponse) UnmarshalJSON(data []byte) error {
type unmarshaler CredentialsListAccessibleEntrancesResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = CredentialsListAccessibleEntrancesResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}

func (c *CredentialsListAccessibleEntrancesResponse) String() string {
if len(c._rawJSON) > 0 {
if value, err := core.StringifyJSON(c._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}

type CredentialsListResponse struct {
AcsCredentials []*seamapigo.AcsCredential `json:"acs_credentials,omitempty" url:"acs_credentials,omitempty"`
Ok bool `json:"ok" url:"ok"`
Expand Down Expand Up @@ -343,6 +374,29 @@ type CredentialsUnassignRequest struct {
}

type CredentialsUpdateRequest struct {
AcsCredentialId string `json:"acs_credential_id" url:"acs_credential_id"`
Code string `json:"code" url:"code"`
AcsCredentialId string `json:"acs_credential_id" url:"acs_credential_id"`
Code *string `json:"code,omitempty" url:"code,omitempty"`
EndsAt *time.Time `json:"ends_at,omitempty" url:"ends_at,omitempty"`
}

func (c *CredentialsUpdateRequest) UnmarshalJSON(data []byte) error {
type unmarshaler CredentialsUpdateRequest
var body unmarshaler
if err := json.Unmarshal(data, &body); err != nil {
return err
}
*c = CredentialsUpdateRequest(body)
return nil
}

func (c *CredentialsUpdateRequest) MarshalJSON() ([]byte, error) {
type embed CredentialsUpdateRequest
var marshaler = struct {
embed
EndsAt *core.DateTime `json:"ends_at,omitempty"`
}{
embed: embed(*c),
EndsAt: core.NewOptionalDateTime(c.EndsAt),
}
return json.Marshal(marshaler)
}
63 changes: 63 additions & 0 deletions acs/credentials/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,69 @@ func (c *Client) List(
return response.AcsCredentials, nil
}

func (c *Client) ListAccessibleEntrances(
ctx context.Context,
request *acs.CredentialsListAccessibleEntrancesRequest,
opts ...option.RequestOption,
) ([]*seamapigo.AcsEntrance, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://connect.getseam.com"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := baseURL + "/" + "acs/credentials/list_accessible_entrances"

headers := core.MergeHeaders(c.header.Clone(), options.ToHeader())

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.CredentialsListAccessibleEntrancesResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPost,
MaxAttempts: options.MaxAttempts,
Headers: headers,
Client: options.HTTPClient,
Request: request,
Response: &response,
ErrorDecoder: errorDecoder,
},
); err != nil {
return nil, err
}
return response.AcsEntrances, nil
}

func (c *Client) Unassign(
ctx context.Context,
request *acs.CredentialsUnassignRequest,
Expand Down
34 changes: 34 additions & 0 deletions acs/systems.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ type SystemsListRequest struct {
ConnectedAccountId *string `json:"connected_account_id,omitempty" url:"connected_account_id,omitempty"`
}

type SystemsListCompatibleCredentialManagerAcsSystemsRequest struct {
AcsSystemId string `json:"acs_system_id" url:"acs_system_id"`
}

type SystemsGetResponse struct {
AcsSystem *seamapigo.AcsSystem `json:"acs_system,omitempty" url:"acs_system,omitempty"`
Ok bool `json:"ok" url:"ok"`
Expand Down Expand Up @@ -47,6 +51,36 @@ func (s *SystemsGetResponse) String() string {
return fmt.Sprintf("%#v", s)
}

type SystemsListCompatibleCredentialManagerAcsSystemsResponse struct {
AcsSystems []*seamapigo.AcsSystem `json:"acs_systems,omitempty" url:"acs_systems,omitempty"`
Ok bool `json:"ok" url:"ok"`

_rawJSON json.RawMessage
}

func (s *SystemsListCompatibleCredentialManagerAcsSystemsResponse) UnmarshalJSON(data []byte) error {
type unmarshaler SystemsListCompatibleCredentialManagerAcsSystemsResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*s = SystemsListCompatibleCredentialManagerAcsSystemsResponse(value)
s._rawJSON = json.RawMessage(data)
return nil
}

func (s *SystemsListCompatibleCredentialManagerAcsSystemsResponse) String() string {
if len(s._rawJSON) > 0 {
if value, err := core.StringifyJSON(s._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}

type SystemsListResponse struct {
AcsSystems []*seamapigo.AcsSystem `json:"acs_systems,omitempty" url:"acs_systems,omitempty"`
Ok bool `json:"ok" url:"ok"`
Expand Down
63 changes: 63 additions & 0 deletions acs/systems/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,66 @@ func (c *Client) List(
}
return response.AcsSystems, nil
}

func (c *Client) ListCompatibleCredentialManagerAcsSystems(
ctx context.Context,
request *acs.SystemsListCompatibleCredentialManagerAcsSystemsRequest,
opts ...option.RequestOption,
) ([]*seamapigo.AcsSystem, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://connect.getseam.com"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := baseURL + "/" + "acs/systems/list_compatible_credential_manager_acs_systems"

headers := core.MergeHeaders(c.header.Clone(), options.ToHeader())

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.SystemsListCompatibleCredentialManagerAcsSystemsResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPost,
MaxAttempts: options.MaxAttempts,
Headers: headers,
Client: options.HTTPClient,
Request: request,
Response: &response,
ErrorDecoder: errorDecoder,
},
); err != nil {
return nil, err
}
return response.AcsSystems, nil
}
20 changes: 7 additions & 13 deletions acs/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ type UsersCreateRequest struct {
UserIdentityId *string `json:"user_identity_id,omitempty" url:"user_identity_id,omitempty"`
AccessSchedule *UsersCreateRequestAccessSchedule `json:"access_schedule,omitempty" url:"access_schedule,omitempty"`
FullName *string `json:"full_name,omitempty" url:"full_name,omitempty"`
// ---
// deprecated: use email_address.
// ---
Email *string `json:"email,omitempty" url:"email,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"`
EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"`
Email *string `json:"email,omitempty" url:"email,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"`
EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"`
}

type UsersDeleteRequest struct {
Expand Down Expand Up @@ -496,11 +493,8 @@ type UsersUpdateRequest struct {
AccessSchedule *UsersUpdateRequestAccessSchedule `json:"access_schedule,omitempty" url:"access_schedule,omitempty"`
AcsUserId string `json:"acs_user_id" url:"acs_user_id"`
FullName *string `json:"full_name,omitempty" url:"full_name,omitempty"`
// ---
// deprecated: use email_address.
// ---
Email *string `json:"email,omitempty" url:"email,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"`
EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"`
HidAcsSystemId *string `json:"hid_acs_system_id,omitempty" url:"hid_acs_system_id,omitempty"`
Email *string `json:"email,omitempty" url:"email,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"`
EmailAddress *string `json:"email_address,omitempty" url:"email_address,omitempty"`
HidAcsSystemId *string `json:"hid_acs_system_id,omitempty" url:"hid_acs_system_id,omitempty"`
}
23 changes: 4 additions & 19 deletions connect_webviews.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type ConnectWebviewsListRequest struct {
UserIdentifierKey *string `json:"user_identifier_key,omitempty" url:"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" url:"custom_metadata_has,omitempty"`
Limit *float64 `json:"limit,omitempty" url:"limit,omitempty"`
}

type AcceptedProvider string
Expand Down Expand Up @@ -170,10 +171,9 @@ func (a AcceptedProvider) Ptr() *AcceptedProvider {
}

type ConnectWebviewsCreateRequestCustomMetadataValue struct {
typeName string
String string
Boolean bool
StringOptional *string
typeName string
String string
Boolean bool
}

func NewConnectWebviewsCreateRequestCustomMetadataValueFromString(value string) *ConnectWebviewsCreateRequestCustomMetadataValue {
Expand All @@ -184,10 +184,6 @@ 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 {
Expand All @@ -201,12 +197,6 @@ 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)
}

Expand All @@ -218,15 +208,12 @@ 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 {
Expand All @@ -237,8 +224,6 @@ 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)
}
}

Expand Down
Loading
Loading