diff --git a/models/model_invite.go b/models/model_invite.go index 60deef8..65ca247 100644 --- a/models/model_invite.go +++ b/models/model_invite.go @@ -17,8 +17,8 @@ type Invite struct { InviteId string `json:"inviteId"` TenantId *TenantId `json:"tenantId,omitempty"` // A list of statements which match roles to resources. The invited user will all statements apply to them when the invite is accepted. - Statements []Statement `json:"statements"` - Links *AccountLinks `json:"links,omitempty"` + Statements []InviteStatement `json:"statements"` + Links *AccountLinks `json:"links,omitempty"` } type _Invite Invite @@ -27,7 +27,7 @@ type _Invite Invite // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewInvite(inviteId string, statements []Statement) *Invite { +func NewInvite(inviteId string, statements []InviteStatement) *Invite { this := Invite{} this.InviteId = inviteId this.Statements = statements @@ -99,9 +99,9 @@ func (o *Invite) SetTenantId(v TenantId) { } // GetStatements returns the Statements field value -func (o *Invite) GetStatements() []Statement { +func (o *Invite) GetStatements() []InviteStatement { if o == nil { - var ret []Statement + var ret []InviteStatement return ret } @@ -110,7 +110,7 @@ func (o *Invite) GetStatements() []Statement { // GetStatementsOk returns a tuple with the Statements field value // and a boolean to check if the value has been set. -func (o *Invite) GetStatementsOk() ([]Statement, bool) { +func (o *Invite) GetStatementsOk() ([]InviteStatement, bool) { if o == nil { return nil, false } @@ -118,7 +118,7 @@ func (o *Invite) GetStatementsOk() ([]Statement, bool) { } // SetStatements sets field value -func (o *Invite) SetStatements(v []Statement) { +func (o *Invite) SetStatements(v []InviteStatement) { o.Statements = v } diff --git a/models/model_invite_statement.go b/models/model_invite_statement.go new file mode 100644 index 0000000..0aad49e --- /dev/null +++ b/models/model_invite_statement.go @@ -0,0 +1,187 @@ +/* +Authress + +
Welcome to the Authress Authorization API.
The Authress REST API provides the operations and resources necessary to create records, assign permissions, and verify any user in your platform.
For more in-depth scenarios check out the Authress knowledge base.
+ +API version: v1 +Contact: support@authress.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package authress + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the Statement type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InviteStatement{} + +// Statement struct for Statement +type InviteStatement struct { + Roles []string `json:"roles"` + Resources []Resource `json:"resources"` +} + +type _InviteStatement InviteStatement + +// NewStatement instantiates a new Statement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewStatement(roles []string, resources []Resource) *InviteStatement { + this := InviteStatement{} + this.Roles = roles + this.Resources = resources + return &this +} + +// NewStatementWithDefaults instantiates a new Statement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInviteStatementWithDefaults() *InviteStatement { + this := InviteStatement{} + return &this +} + +// GetRoles returns the Roles field value +func (o *InviteStatement) GetRoles() []string { + if o == nil { + var ret []string + return ret + } + + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value +// and a boolean to check if the value has been set. +func (o *InviteStatement) GetRolesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Roles, true +} + +// SetRoles sets field value +func (o *InviteStatement) SetRoles(v []string) { + o.Roles = v +} + +// GetResources returns the Resources field value +func (o *InviteStatement) GetResources() []Resource { + if o == nil { + var ret []Resource + return ret + } + + return o.Resources +} + +// GetResourcesOk returns a tuple with the Resources field value +// and a boolean to check if the value has been set. +func (o *InviteStatement) GetResourcesOk() ([]Resource, bool) { + if o == nil { + return nil, false + } + return o.Resources, true +} + +// SetResources sets field value +func (o *InviteStatement) SetResources(v []Resource) { + o.Resources = v +} + +func (o InviteStatement) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InviteStatement) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["roles"] = o.Roles + toSerialize["resources"] = o.Resources + return toSerialize, nil +} + +func (o *InviteStatement) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "roles", + "resources", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varInviteStatement := _InviteStatement{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varInviteStatement) + + if err != nil { + return err + } + + *o = InviteStatement(varInviteStatement) + + return err +} + +type NullableInviteStatement struct { + value *InviteStatement + isSet bool +} + +func (v NullableInviteStatement) Get() *InviteStatement { + return v.value +} + +func (v *NullableInviteStatement) Set(val *InviteStatement) { + v.value = val + v.isSet = true +} + +func (v NullableInviteStatement) IsSet() bool { + return v.isSet +} + +func (v *NullableInviteStatement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInviteStatement(val *InviteStatement) *NullableInviteStatement { + return &NullableInviteStatement{value: val, isSet: true} +} + +func (v NullableInviteStatement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInviteStatement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +