Skip to content

Commit

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

* fix test

---------

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 31, 2024
1 parent eb3b681 commit be88b45
Show file tree
Hide file tree
Showing 17 changed files with 1,713 additions and 1,716 deletions.
36 changes: 36 additions & 0 deletions acs/entrances.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
Expand Down
50 changes: 50 additions & 0 deletions acs/entrances/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
539 changes: 449 additions & 90 deletions acs/types.go

Large diffs are not rendered by default.

100 changes: 97 additions & 3 deletions connect_webviews.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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)
}

Expand All @@ -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 {
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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"`
Expand Down
Loading

0 comments on commit be88b45

Please sign in to comment.