Skip to content

Commit

Permalink
🌿 Fern Regeneration -- January 13, 2024 (#19)
Browse files Browse the repository at this point in the history
* SDK regeneration

* fix compile

* SDK regeneration

* SDK regeneration

* SDK regeneration

* SDK regeneration

* SDK regeneration

---------

Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Co-authored-by: dsinghvi <[email protected]>
  • Loading branch information
fern-api[bot] and dsinghvi authored Jan 14, 2024
1 parent f4af2c5 commit eb3b681
Show file tree
Hide file tree
Showing 52 changed files with 7,032 additions and 2,021 deletions.
100 changes: 77 additions & 23 deletions access_codes.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ import (
)

type AccessCodesCreateRequest struct {
DeviceId string `json:"device_id"`
Name *string `json:"name,omitempty"`
StartsAt *string `json:"starts_at,omitempty"`
EndsAt *string `json:"ends_at,omitempty"`
Code *string `json:"code,omitempty"`
Sync *bool `json:"sync,omitempty"`
AttemptForOfflineDevice *bool `json:"attempt_for_offline_device,omitempty"`
CommonCodeKey *string `json:"common_code_key,omitempty"`
PreferNativeScheduling *bool `json:"prefer_native_scheduling,omitempty"`
UseBackupAccessCodePool *bool `json:"use_backup_access_code_pool,omitempty"`
DeviceId string `json:"device_id"`
Name *string `json:"name,omitempty"`
StartsAt *string `json:"starts_at,omitempty"`
EndsAt *string `json:"ends_at,omitempty"`
Code *string `json:"code,omitempty"`
Sync *bool `json:"sync,omitempty"`
AttemptForOfflineDevice *bool `json:"attempt_for_offline_device,omitempty"`
CommonCodeKey *string `json:"common_code_key,omitempty"`
PreferNativeScheduling *bool `json:"prefer_native_scheduling,omitempty"`
UseBackupAccessCodePool *bool `json:"use_backup_access_code_pool,omitempty"`
AllowExternalModification *bool `json:"allow_external_modification,omitempty"`
IsExternalModificationAllowed *bool `json:"is_external_modification_allowed,omitempty"`
UseOfflineAccessCode *bool `json:"use_offline_access_code,omitempty"`
IsOfflineAccessCode *bool `json:"is_offline_access_code,omitempty"`
IsOneTimeUse *bool `json:"is_one_time_use,omitempty"`
MaxTimeRounding *MaxTimeRounding `json:"max_time_rounding,omitempty"`
}

type AccessCodesCreateMultipleRequest struct {
Expand All @@ -31,6 +37,12 @@ type AccessCodesCreateMultipleRequest struct {
AttemptForOfflineDevice *bool `json:"attempt_for_offline_device,omitempty"`
PreferNativeScheduling *bool `json:"prefer_native_scheduling,omitempty"`
UseBackupAccessCodePool *bool `json:"use_backup_access_code_pool,omitempty"`
AllowExternalModification *bool `json:"allow_external_modification,omitempty"`
IsExternalModificationAllowed *bool `json:"is_external_modification_allowed,omitempty"`
UseOfflineAccessCode *bool `json:"use_offline_access_code,omitempty"`
IsOfflineAccessCode *bool `json:"is_offline_access_code,omitempty"`
IsOneTimeUse *bool `json:"is_one_time_use,omitempty"`
MaxTimeRounding *MaxTimeRounding `json:"max_time_rounding,omitempty"`
}

type AccessCodesDeleteRequest struct {
Expand All @@ -39,15 +51,20 @@ type AccessCodesDeleteRequest struct {
Sync *bool `json:"sync,omitempty"`
}

type AccessCodesGenerateCodeRequest struct {
DeviceId string `json:"device_id"`
}

type AccessCodesGetRequest struct {
DeviceId *string `json:"device_id,omitempty"`
AccessCodeId *string `json:"access_code_id,omitempty"`
Code *string `json:"code,omitempty"`
}

type AccessCodesListRequest struct {
DeviceId string `json:"device_id"`
AccessCodeIds []string `json:"access_code_ids,omitempty"`
DeviceId string `json:"device_id"`
AccessCodeIds []string `json:"access_code_ids,omitempty"`
UserIdentifierKey *string `json:"user_identifier_key,omitempty"`
}

type AccessCodesPullBackupAccessCodeRequest struct {
Expand Down Expand Up @@ -167,6 +184,36 @@ func (a *AccessCodesDeleteResponse) String() string {
return fmt.Sprintf("%#v", a)
}

type AccessCodesGenerateCodeResponse struct {
GeneratedCode *AccessCode `json:"generated_code,omitempty"`
Ok bool `json:"ok"`

_rawJSON json.RawMessage
}

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

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

type AccessCodesGetResponse struct {
AccessCode *AccessCode `json:"access_code,omitempty"`
Ok bool `json:"ok"`
Expand Down Expand Up @@ -310,15 +357,22 @@ func (a *AccessCodesUpdateResponse) String() string {
}

type AccessCodesUpdateRequest struct {
Name *string `json:"name,omitempty"`
StartsAt *string `json:"starts_at,omitempty"`
EndsAt *string `json:"ends_at,omitempty"`
Code *string `json:"code,omitempty"`
Sync *bool `json:"sync,omitempty"`
AttemptForOfflineDevice *bool `json:"attempt_for_offline_device,omitempty"`
PreferNativeScheduling *bool `json:"prefer_native_scheduling,omitempty"`
UseBackupAccessCodePool *bool `json:"use_backup_access_code_pool,omitempty"`
AccessCodeId string `json:"access_code_id"`
DeviceId *string `json:"device_id,omitempty"`
Type *AccessCodesUpdateRequestType `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
StartsAt *string `json:"starts_at,omitempty"`
EndsAt *string `json:"ends_at,omitempty"`
Code *string `json:"code,omitempty"`
Sync *bool `json:"sync,omitempty"`
AttemptForOfflineDevice *bool `json:"attempt_for_offline_device,omitempty"`
PreferNativeScheduling *bool `json:"prefer_native_scheduling,omitempty"`
UseBackupAccessCodePool *bool `json:"use_backup_access_code_pool,omitempty"`
AllowExternalModification *bool `json:"allow_external_modification,omitempty"`
IsExternalModificationAllowed *bool `json:"is_external_modification_allowed,omitempty"`
UseOfflineAccessCode *bool `json:"use_offline_access_code,omitempty"`
IsOfflineAccessCode *bool `json:"is_offline_access_code,omitempty"`
IsOneTimeUse *bool `json:"is_one_time_use,omitempty"`
MaxTimeRounding *MaxTimeRounding `json:"max_time_rounding,omitempty"`
AccessCodeId string `json:"access_code_id"`
DeviceId *string `json:"device_id,omitempty"`
Type *AccessCodesUpdateRequestType `json:"type,omitempty"`
IsManaged *bool `json:"is_managed,omitempty"`
}
52 changes: 51 additions & 1 deletion accesscodes/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (c *Client) Delete(ctx context.Context, request *seamapigo.AccessCodesDelet
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodDelete,
Method: http.MethodPost,
Headers: c.header,
Request: request,
Response: &response,
Expand All @@ -188,6 +188,56 @@ func (c *Client) Delete(ctx context.Context, request *seamapigo.AccessCodesDelet
return response.ActionAttempt, nil
}

func (c *Client) GenerateCode(ctx context.Context, request *seamapigo.AccessCodesGenerateCodeRequest) (*seamapigo.AccessCode, error) {
baseURL := "https://connect.getseam.com"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "access_codes/generate_code"

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.AccessCodesGenerateCodeResponse
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.GeneratedCode, nil
}

func (c *Client) Get(ctx context.Context, request *seamapigo.AccessCodesGetRequest) (*seamapigo.AccessCode, error) {
baseURL := "https://connect.getseam.com"
if c.baseURL != "" {
Expand Down
37 changes: 37 additions & 0 deletions accesscodes/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,45 @@

package accesscodes

import (
json "encoding/json"
fmt "fmt"
seamapigo "github.com/seamapi/go"
core "github.com/seamapi/go/core"
)

type SimulateCreateUnmanagedAccessCodeRequest struct {
DeviceId string `json:"device_id"`
Name string `json:"name"`
Code string `json:"code"`
}

type SimulateCreateUnmanagedAccessCodeResponse struct {
AccessCode *seamapigo.UnmanagedAccessCode `json:"access_code,omitempty"`
Ok bool `json:"ok"`

_rawJSON json.RawMessage
}

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

func (s *SimulateCreateUnmanagedAccessCodeResponse) 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)
}
6 changes: 3 additions & 3 deletions accesscodes/simulate/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewClient(opts ...core.ClientOption) *Client {
}
}

func (c *Client) CreateUnmanagedAccessCode(ctx context.Context, request *accesscodes.SimulateCreateUnmanagedAccessCodeRequest) (*seamapigo.SimulateCreateUnmanagedAccessCodeResponse, error) {
func (c *Client) CreateUnmanagedAccessCode(ctx context.Context, request *accesscodes.SimulateCreateUnmanagedAccessCodeRequest) (*seamapigo.UnmanagedAccessCode, error) {
baseURL := "https://connect.getseam.com"
if c.baseURL != "" {
baseURL = c.baseURL
Expand Down Expand Up @@ -65,7 +65,7 @@ func (c *Client) CreateUnmanagedAccessCode(ctx context.Context, request *accessc
return apiError
}

var response *seamapigo.SimulateCreateUnmanagedAccessCodeResponse
var response *accesscodes.SimulateCreateUnmanagedAccessCodeResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
Expand All @@ -79,5 +79,5 @@ func (c *Client) CreateUnmanagedAccessCode(ctx context.Context, request *accessc
); err != nil {
return nil, err
}
return response, nil
return response.AccessCode, nil
}
Loading

0 comments on commit eb3b681

Please sign in to comment.