Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 10, 2024
1 parent e470714 commit 7c23244
Show file tree
Hide file tree
Showing 26 changed files with 6,291 additions and 1,699 deletions.
178 changes: 178 additions & 0 deletions access_codes.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
json "encoding/json"
fmt "fmt"
core "github.com/seamapi/go/core"
time "time"
)

type AccessCodesCreateRequest struct {
Expand Down Expand Up @@ -72,6 +73,183 @@ type AccessCodesPullBackupAccessCodeRequest struct {
AccessCodeId string `json:"access_code_id" url:"access_code_id"`
}

type AccessCode struct {
// Unique identifier for a group of access codes that share the same code.
CommonCodeKey *string `json:"common_code_key,omitempty" url:"common_code_key,omitempty"`
// Indicates whether the code is set on the device according to a preconfigured schedule.
IsScheduledOnDevice *bool `json:"is_scheduled_on_device,omitempty" url:"is_scheduled_on_device,omitempty"`
// Nature of the access code. Values are "ongoing" for access codes that are active continuously until deactivated manually or "time_bound" for access codes that have a specific duration.
Type AccessCodeType `json:"type,omitempty" url:"type,omitempty"`
// Indicates whether the access code is waiting for a code assignment.
IsWaitingForCodeAssignment *bool `json:"is_waiting_for_code_assignment,omitempty" url:"is_waiting_for_code_assignment,omitempty"`
// Unique identifier for the access code.
AccessCodeId string `json:"access_code_id" url:"access_code_id"`
// Unique identifier for the device associated with the access code.
DeviceId string `json:"device_id" url:"device_id"`
// Name of the access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
Name *string `json:"name,omitempty" url:"name,omitempty"`
// Code used for access. Typically, a numeric or alphanumeric string.
Code *string `json:"code,omitempty" url:"code,omitempty"`
// Date and time at which the access code was created.
CreatedAt time.Time `json:"created_at" url:"created_at"`
Errors interface{} `json:"errors,omitempty" url:"errors,omitempty"`
Warnings interface{} `json:"warnings,omitempty" url:"warnings,omitempty"`
// Indicates whether Seam manages the access code.
IsManaged bool `json:"is_managed" url:"is_managed"`
// Date and time at which the time-bound access code becomes active.
StartsAt *time.Time `json:"starts_at,omitempty" url:"starts_at,omitempty"`
// Date and time after which the time-bound access code becomes inactive.
EndsAt *time.Time `json:"ends_at,omitempty" url:"ends_at,omitempty"`
// Current status of the access code within the operational lifecycle. Values are "setting," a transitional phase that indicates that the code is being configured or activated; "set", which indicates that the code is active and operational; "unset," which indicates a deactivated or unused state, either before activation or after deliberate deactivation; "removing," which indicates a transitional period in which the code is being deleted or made inactive; and "unknown," which indicates an indeterminate state, due to reasons such as system errors or incomplete data, that highlights a potential need for system review or troubleshooting.
Status AccessCodeStatus `json:"status,omitempty" url:"status,omitempty"`
// Indicates whether a backup access code is available for use if the primary access code is lost or compromised.
IsBackupAccessCodeAvailable bool `json:"is_backup_access_code_available" url:"is_backup_access_code_available"`
// Indicates whether the access code is a backup code.
IsBackup *bool `json:"is_backup,omitempty" url:"is_backup,omitempty"`
// Identifier of the pulled backup access code. Used to associate the pulled backup access code with the original access code.
PulledBackupAccessCodeId *string `json:"pulled_backup_access_code_id,omitempty" url:"pulled_backup_access_code_id,omitempty"`
// Indicates whether changes to the access code from external sources are permitted.
IsExternalModificationAllowed bool `json:"is_external_modification_allowed" url:"is_external_modification_allowed"`
// Indicates whether the access code can only be used once. If "true," the code becomes invalid after the first use.
IsOneTimeUse bool `json:"is_one_time_use" url:"is_one_time_use"`
// Indicates whether the access code is intended for use in offline scenarios. If "true," this code can be created on a device without a network connection.
IsOfflineAccessCode bool `json:"is_offline_access_code" url:"is_offline_access_code"`

_rawJSON json.RawMessage
}

func (a *AccessCode) UnmarshalJSON(data []byte) error {
type embed AccessCode
var unmarshaler = struct {
embed
CreatedAt *core.DateTime `json:"created_at"`
StartsAt *core.DateTime `json:"starts_at,omitempty"`
EndsAt *core.DateTime `json:"ends_at,omitempty"`
}{
embed: embed(*a),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*a = AccessCode(unmarshaler.embed)
a.CreatedAt = unmarshaler.CreatedAt.Time()
a.StartsAt = unmarshaler.StartsAt.TimePtr()
a.EndsAt = unmarshaler.EndsAt.TimePtr()
a._rawJSON = json.RawMessage(data)
return nil
}

func (a *AccessCode) MarshalJSON() ([]byte, error) {
type embed AccessCode
var marshaler = struct {
embed
CreatedAt *core.DateTime `json:"created_at"`
StartsAt *core.DateTime `json:"starts_at,omitempty"`
EndsAt *core.DateTime `json:"ends_at,omitempty"`
}{
embed: embed(*a),
CreatedAt: core.NewDateTime(a.CreatedAt),
StartsAt: core.NewOptionalDateTime(a.StartsAt),
EndsAt: core.NewOptionalDateTime(a.EndsAt),
}
return json.Marshal(marshaler)
}

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

// Current status of the access code within the operational lifecycle. Values are "setting," a transitional phase that indicates that the code is being configured or activated; "set", which indicates that the code is active and operational; "unset," which indicates a deactivated or unused state, either before activation or after deliberate deactivation; "removing," which indicates a transitional period in which the code is being deleted or made inactive; and "unknown," which indicates an indeterminate state, due to reasons such as system errors or incomplete data, that highlights a potential need for system review or troubleshooting.
type AccessCodeStatus string

const (
AccessCodeStatusSetting AccessCodeStatus = "setting"
AccessCodeStatusSet AccessCodeStatus = "set"
AccessCodeStatusUnset AccessCodeStatus = "unset"
AccessCodeStatusRemoving AccessCodeStatus = "removing"
AccessCodeStatusUnknown AccessCodeStatus = "unknown"
)

func NewAccessCodeStatusFromString(s string) (AccessCodeStatus, error) {
switch s {
case "setting":
return AccessCodeStatusSetting, nil
case "set":
return AccessCodeStatusSet, nil
case "unset":
return AccessCodeStatusUnset, nil
case "removing":
return AccessCodeStatusRemoving, nil
case "unknown":
return AccessCodeStatusUnknown, nil
}
var t AccessCodeStatus
return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (a AccessCodeStatus) Ptr() *AccessCodeStatus {
return &a
}

// Nature of the access code. Values are "ongoing" for access codes that are active continuously until deactivated manually or "time_bound" for access codes that have a specific duration.
type AccessCodeType string

const (
AccessCodeTypeTimeBound AccessCodeType = "time_bound"
AccessCodeTypeOngoing AccessCodeType = "ongoing"
)

func NewAccessCodeTypeFromString(s string) (AccessCodeType, error) {
switch s {
case "time_bound":
return AccessCodeTypeTimeBound, nil
case "ongoing":
return AccessCodeTypeOngoing, nil
}
var t AccessCodeType
return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (a AccessCodeType) Ptr() *AccessCodeType {
return &a
}

type MaxTimeRounding string

const (
MaxTimeRoundingOneHour MaxTimeRounding = "1hour"
MaxTimeRoundingOneDay MaxTimeRounding = "1day"
MaxTimeRoundingOneH MaxTimeRounding = "1h"
MaxTimeRoundingOneD MaxTimeRounding = "1d"
)

func NewMaxTimeRoundingFromString(s string) (MaxTimeRounding, error) {
switch s {
case "1hour":
return MaxTimeRoundingOneHour, nil
case "1day":
return MaxTimeRoundingOneDay, nil
case "1h":
return MaxTimeRoundingOneH, nil
case "1d":
return MaxTimeRoundingOneD, nil
}
var t MaxTimeRounding
return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (m MaxTimeRounding) Ptr() *MaxTimeRounding {
return &m
}

type AccessCodesCreateMultipleRequestBehaviorWhenCodeCannotBeShared string

const (
Expand Down
122 changes: 110 additions & 12 deletions acs/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ type CredentialsGetRequest struct {
}

type CredentialsListRequest struct {
AcsUserId *string `json:"acs_user_id,omitempty" url:"acs_user_id,omitempty"`
AcsSystemId *string `json:"acs_system_id,omitempty" url:"acs_system_id,omitempty"`
UserIdentityId *string `json:"user_identity_id,omitempty" url:"user_identity_id,omitempty"`
IsMultiPhoneSyncCredential *bool `json:"is_multi_phone_sync_credential,omitempty" url:"is_multi_phone_sync_credential,omitempty"`
AcsUserId *string `json:"acs_user_id,omitempty" url:"acs_user_id,omitempty"`
AcsSystemId *string `json:"acs_system_id,omitempty" url:"acs_system_id,omitempty"`
UserIdentityId *string `json:"user_identity_id,omitempty" url:"user_identity_id,omitempty"`
CredentialsListRequestIsMultiPhoneSyncCredential *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 {
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 @@ -158,6 +159,50 @@ func (c *CredentialsCreateRequestVisionlineMetadata) String() string {
return fmt.Sprintf("%#v", c)
}

type CredentialsCreateRequestVisionlineMetadataCardFormat string

const (
CredentialsCreateRequestVisionlineMetadataCardFormatTlCode CredentialsCreateRequestVisionlineMetadataCardFormat = "TLCode"
CredentialsCreateRequestVisionlineMetadataCardFormatRfid48 CredentialsCreateRequestVisionlineMetadataCardFormat = "rfid48"
)

func NewCredentialsCreateRequestVisionlineMetadataCardFormatFromString(s string) (CredentialsCreateRequestVisionlineMetadataCardFormat, error) {
switch s {
case "TLCode":
return CredentialsCreateRequestVisionlineMetadataCardFormatTlCode, nil
case "rfid48":
return CredentialsCreateRequestVisionlineMetadataCardFormatRfid48, nil
}
var t CredentialsCreateRequestVisionlineMetadataCardFormat
return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (c CredentialsCreateRequestVisionlineMetadataCardFormat) Ptr() *CredentialsCreateRequestVisionlineMetadataCardFormat {
return &c
}

type CredentialsCreateRequestVisionlineMetadataCardFunctionType string

const (
CredentialsCreateRequestVisionlineMetadataCardFunctionTypeGuest CredentialsCreateRequestVisionlineMetadataCardFunctionType = "guest"
CredentialsCreateRequestVisionlineMetadataCardFunctionTypeStaff CredentialsCreateRequestVisionlineMetadataCardFunctionType = "staff"
)

func NewCredentialsCreateRequestVisionlineMetadataCardFunctionTypeFromString(s string) (CredentialsCreateRequestVisionlineMetadataCardFunctionType, error) {
switch s {
case "guest":
return CredentialsCreateRequestVisionlineMetadataCardFunctionTypeGuest, nil
case "staff":
return CredentialsCreateRequestVisionlineMetadataCardFunctionTypeStaff, nil
}
var t CredentialsCreateRequestVisionlineMetadataCardFunctionType
return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (c CredentialsCreateRequestVisionlineMetadataCardFunctionType) Ptr() *CredentialsCreateRequestVisionlineMetadataCardFunctionType {
return &c
}

type CredentialsCreateResponse struct {
AcsCredential *seamapigo.AcsCredential `json:"acs_credential,omitempty" url:"acs_credential,omitempty"`
Ok bool `json:"ok" url:"ok"`
Expand Down Expand Up @@ -247,6 +292,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 +418,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)
}
Loading

0 comments on commit 7c23244

Please sign in to comment.