From 142fdce4db19897408d12d008d4c8a60b3bc279f Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Tue, 26 Sep 2023 15:07:21 -0400 Subject: [PATCH] feat: abac and conditions support --- .openapi-generator/FILES | 22 +- README.md | 11 +- api_open_fga.go | 6 +- api_open_fga_test.go | 26 +- client/client.go | 24 +- docs/Assertion.md | 10 +- docs/AuthorizationModel.md | 26 ++ docs/CheckRequest.md | 36 ++- docs/CheckRequestTupleKey.md | 108 +++++++++ docs/Condition.md | 98 ++++++++ docs/ConditionParamTypeRef.md | 77 ++++++ docs/ExpandRequest.md | 10 +- docs/ExpandRequestTupleKey.md | 82 +++++++ docs/ListObjectsRequest.md | 26 ++ docs/NullValue.md | 11 + docs/OpenFgaApi.md | 6 +- docs/ReadRequest.md | 8 +- docs/ReadRequestTupleKey.md | 108 +++++++++ docs/RelationReference.md | 26 ++ docs/RelationshipCondition.md | 77 ++++++ docs/TupleKey.md | 26 ++ docs/TypeName.md | 33 +++ docs/WriteAuthorizationModelRequest.md | 26 ++ docs/WriteRequest.md | 16 +- docs/WriteRequestTupleKey.md | 134 +++++++++++ ...{TupleKeys.md => WriteRequestTupleKeys.md} | 22 +- model_assertion.go | 14 +- model_authorization_model.go | 42 +++- model_check_request.go | 49 +++- model_check_request_tuple_key.go | 187 +++++++++++++++ model_condition.go | 175 ++++++++++++++ model_condition_param_type_ref.go | 146 ++++++++++++ model_expand_request.go | 14 +- model_expand_request_tuple_key.go | 151 ++++++++++++ model_list_objects_request.go | 37 +++ model_null_value.go | 109 +++++++++ model_read_request.go | 16 +- model_read_request_tuple_key.go | 187 +++++++++++++++ model_relation_reference.go | 37 +++ model_relationship_condition.go | 146 ++++++++++++ model_tuple_key.go | 42 +++- model_type_name.go | 131 ++++++++++ model_write_authorization_model_request.go | 40 +++- model_write_request.go | 26 +- model_write_request_tuple_key.go | 223 ++++++++++++++++++ ...ys.go => model_write_request_tuple_keys.go | 48 ++-- 46 files changed, 2733 insertions(+), 142 deletions(-) create mode 100644 docs/CheckRequestTupleKey.md create mode 100644 docs/Condition.md create mode 100644 docs/ConditionParamTypeRef.md create mode 100644 docs/ExpandRequestTupleKey.md create mode 100644 docs/NullValue.md create mode 100644 docs/ReadRequestTupleKey.md create mode 100644 docs/RelationshipCondition.md create mode 100644 docs/TypeName.md create mode 100644 docs/WriteRequestTupleKey.md rename docs/{TupleKeys.md => WriteRequestTupleKeys.md} (58%) create mode 100644 model_check_request_tuple_key.go create mode 100644 model_condition.go create mode 100644 model_condition_param_type_ref.go create mode 100644 model_expand_request_tuple_key.go create mode 100644 model_null_value.go create mode 100644 model_read_request_tuple_key.go create mode 100644 model_relationship_condition.go create mode 100644 model_type_name.go create mode 100644 model_write_request_tuple_key.go rename model_tuple_keys.go => model_write_request_tuple_keys.go (50%) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 19c3bad..cd7e220 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -23,14 +23,18 @@ docs/Any.md docs/Assertion.md docs/AuthorizationModel.md docs/CheckRequest.md +docs/CheckRequestTupleKey.md docs/CheckResponse.md docs/Computed.md +docs/Condition.md +docs/ConditionParamTypeRef.md docs/ContextualTupleKeys.md docs/CreateStoreRequest.md docs/CreateStoreResponse.md docs/Difference.md docs/ErrorCode.md docs/ExpandRequest.md +docs/ExpandRequestTupleKey.md docs/ExpandResponse.md docs/GetStoreResponse.md docs/InternalErrorCode.md @@ -43,6 +47,7 @@ docs/Metadata.md docs/Node.md docs/Nodes.md docs/NotFoundErrorCode.md +docs/NullValue.md docs/ObjectRelation.md docs/OpenFgaApi.md docs/PathUnknownErrorMessageResponse.md @@ -51,18 +56,20 @@ docs/ReadAuthorizationModelResponse.md docs/ReadAuthorizationModelsResponse.md docs/ReadChangesResponse.md docs/ReadRequest.md +docs/ReadRequestTupleKey.md docs/ReadResponse.md docs/RelationMetadata.md docs/RelationReference.md +docs/RelationshipCondition.md docs/Status.md docs/Store.md docs/Tuple.md docs/TupleChange.md docs/TupleKey.md -docs/TupleKeys.md docs/TupleOperation.md docs/TupleToUserset.md docs/TypeDefinition.md +docs/TypeName.md docs/Users.md docs/Userset.md docs/UsersetTree.md @@ -74,6 +81,8 @@ docs/WriteAssertionsRequest.md docs/WriteAuthorizationModelRequest.md docs/WriteAuthorizationModelResponse.md docs/WriteRequest.md +docs/WriteRequestTupleKey.md +docs/WriteRequestTupleKeys.md git_push.sh go.mod go.sum @@ -84,14 +93,18 @@ model_any.go model_assertion.go model_authorization_model.go model_check_request.go +model_check_request_tuple_key.go model_check_response.go model_computed.go +model_condition.go +model_condition_param_type_ref.go model_contextual_tuple_keys.go model_create_store_request.go model_create_store_response.go model_difference.go model_error_code.go model_expand_request.go +model_expand_request_tuple_key.go model_expand_response.go model_get_store_response.go model_internal_error_code.go @@ -104,6 +117,7 @@ model_metadata.go model_node.go model_nodes.go model_not_found_error_code.go +model_null_value.go model_object_relation.go model_path_unknown_error_message_response.go model_read_assertions_response.go @@ -111,18 +125,20 @@ model_read_authorization_model_response.go model_read_authorization_models_response.go model_read_changes_response.go model_read_request.go +model_read_request_tuple_key.go model_read_response.go model_relation_metadata.go model_relation_reference.go +model_relationship_condition.go model_status.go model_store.go model_tuple.go model_tuple_change.go model_tuple_key.go -model_tuple_keys.go model_tuple_operation.go model_tuple_to_userset.go model_type_definition.go +model_type_name.go model_users.go model_userset.go model_userset_tree.go @@ -134,6 +150,8 @@ model_write_assertions_request.go model_write_authorization_model_request.go model_write_authorization_model_response.go model_write_request.go +model_write_request_tuple_key.go +model_write_request_tuple_keys.go oauth2/LICENSE oauth2/ORIGINAL_AUTHORS oauth2/ORIGINAL_CONTRIBUTORS diff --git a/README.md b/README.md index 5bd1a0d..8870364 100644 --- a/README.md +++ b/README.md @@ -801,14 +801,18 @@ Class | Method | HTTP request | Description - [Assertion](docs/Assertion.md) - [AuthorizationModel](docs/AuthorizationModel.md) - [CheckRequest](docs/CheckRequest.md) + - [CheckRequestTupleKey](docs/CheckRequestTupleKey.md) - [CheckResponse](docs/CheckResponse.md) - [Computed](docs/Computed.md) + - [Condition](docs/Condition.md) + - [ConditionParamTypeRef](docs/ConditionParamTypeRef.md) - [ContextualTupleKeys](docs/ContextualTupleKeys.md) - [CreateStoreRequest](docs/CreateStoreRequest.md) - [CreateStoreResponse](docs/CreateStoreResponse.md) - [Difference](docs/Difference.md) - [ErrorCode](docs/ErrorCode.md) - [ExpandRequest](docs/ExpandRequest.md) + - [ExpandRequestTupleKey](docs/ExpandRequestTupleKey.md) - [ExpandResponse](docs/ExpandResponse.md) - [GetStoreResponse](docs/GetStoreResponse.md) - [InternalErrorCode](docs/InternalErrorCode.md) @@ -821,6 +825,7 @@ Class | Method | HTTP request | Description - [Node](docs/Node.md) - [Nodes](docs/Nodes.md) - [NotFoundErrorCode](docs/NotFoundErrorCode.md) + - [NullValue](docs/NullValue.md) - [ObjectRelation](docs/ObjectRelation.md) - [PathUnknownErrorMessageResponse](docs/PathUnknownErrorMessageResponse.md) - [ReadAssertionsResponse](docs/ReadAssertionsResponse.md) @@ -828,18 +833,20 @@ Class | Method | HTTP request | Description - [ReadAuthorizationModelsResponse](docs/ReadAuthorizationModelsResponse.md) - [ReadChangesResponse](docs/ReadChangesResponse.md) - [ReadRequest](docs/ReadRequest.md) + - [ReadRequestTupleKey](docs/ReadRequestTupleKey.md) - [ReadResponse](docs/ReadResponse.md) - [RelationMetadata](docs/RelationMetadata.md) - [RelationReference](docs/RelationReference.md) + - [RelationshipCondition](docs/RelationshipCondition.md) - [Status](docs/Status.md) - [Store](docs/Store.md) - [Tuple](docs/Tuple.md) - [TupleChange](docs/TupleChange.md) - [TupleKey](docs/TupleKey.md) - - [TupleKeys](docs/TupleKeys.md) - [TupleOperation](docs/TupleOperation.md) - [TupleToUserset](docs/TupleToUserset.md) - [TypeDefinition](docs/TypeDefinition.md) + - [TypeName](docs/TypeName.md) - [Users](docs/Users.md) - [Userset](docs/Userset.md) - [UsersetTree](docs/UsersetTree.md) @@ -851,6 +858,8 @@ Class | Method | HTTP request | Description - [WriteAuthorizationModelRequest](docs/WriteAuthorizationModelRequest.md) - [WriteAuthorizationModelResponse](docs/WriteAuthorizationModelResponse.md) - [WriteRequest](docs/WriteRequest.md) + - [WriteRequestTupleKey](docs/WriteRequestTupleKey.md) + - [WriteRequestTupleKeys](docs/WriteRequestTupleKeys.md) ## Contributing diff --git a/api_open_fga.go b/api_open_fga.go index 40c60e2..0ca0396 100644 --- a/api_open_fga.go +++ b/api_open_fga.go @@ -252,8 +252,7 @@ type OpenFgaApi interface { } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. - The continuation token will be empty if there are no more tuples to query. - ### Query for all stored relationship tuples that have a particular relation and object + The continuation token will be empty if there are no more tuples to query.### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { @@ -2574,8 +2573,7 @@ The API will return tuples and a continuation token, something like ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. -The continuation token will be empty if there are no more tuples to query. -### Query for all stored relationship tuples that have a particular relation and object +The continuation token will be empty if there are no more tuples to query.### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json diff --git a/api_open_fga_test.go b/api_open_fga_test.go index 86b2fbe..cd69292 100644 --- a/api_open_fga_test.go +++ b/api_open_fga_test.go @@ -569,7 +569,7 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ + TupleKey: CheckRequestTupleKey{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -621,8 +621,8 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "write", } requestBody := WriteRequest{ - Writes: &TupleKeys{ - TupleKeys: []TupleKey{{ + Writes: &WriteRequestTupleKeys{ + TupleKeys: []WriteRequestTupleKey{{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -667,8 +667,8 @@ func TestOpenFgaApi(t *testing.T) { } requestBody := WriteRequest{ - Deletes: &TupleKeys{ - TupleKeys: []TupleKey{{ + Deletes: &WriteRequestTupleKeys{ + TupleKeys: []WriteRequestTupleKey{{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -713,7 +713,7 @@ func TestOpenFgaApi(t *testing.T) { } requestBody := ExpandRequest{ - TupleKey: TupleKey{ + TupleKey: ExpandRequestTupleKey{ Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), }, @@ -761,7 +761,7 @@ func TestOpenFgaApi(t *testing.T) { } requestBody := ReadRequest{ - TupleKey: &TupleKey{ + TupleKey: &ReadRequestTupleKey{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -924,7 +924,7 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ + TupleKey: CheckRequestTupleKey{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -987,7 +987,7 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ + TupleKey: CheckRequestTupleKey{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -1043,7 +1043,7 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ + TupleKey: CheckRequestTupleKey{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -1106,7 +1106,7 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ + TupleKey: CheckRequestTupleKey{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -1177,7 +1177,7 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ + TupleKey: CheckRequestTupleKey{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), @@ -1239,7 +1239,7 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ + TupleKey: CheckRequestTupleKey{ User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), Relation: PtrString("viewer"), Object: PtrString("document:roadmap"), diff --git a/client/client.go b/client/client.go index 1a9c0c9..e659a4d 100644 --- a/client/client.go +++ b/client/client.go @@ -127,6 +127,14 @@ func (tupleKey ClientTupleKey) ToTupleKey() openfga.TupleKey { } } +func (tupleKey ClientTupleKey) ToWriteRequestTupleKey() openfga.WriteRequestTupleKey { + return openfga.WriteRequestTupleKey{ + User: openfga.PtrString(tupleKey.User), + Relation: openfga.PtrString(tupleKey.Relation), + Object: openfga.PtrString(tupleKey.Object), + } +} + type ClientPaginationOptions struct { PageSize *int32 `json:"page_size,omitempty"` ContinuationToken *string `json:"continuation_token,omitempty"` @@ -1129,7 +1137,7 @@ func (client *OpenFgaClient) ReadExecute(request SdkClientReadRequestInterface) ContinuationToken: getContinuationTokenFromRequest((*ClientPaginationOptions)(request.GetOptions())), } if request.GetBody() != nil && (request.GetBody().User != nil || request.GetBody().Relation != nil || request.GetBody().Object != nil) { - body.TupleKey = &openfga.TupleKey{ + body.TupleKey = &openfga.ReadRequestTupleKey{ User: request.GetBody().User, Relation: request.GetBody().Relation, Object: request.GetBody().Object, @@ -1292,16 +1300,16 @@ func (client *OpenFgaClient) WriteExecute(request SdkClientWriteRequestInterface AuthorizationModelId: authorizationModelId, } if request.GetBody().Writes != nil && len(*request.GetBody().Writes) > 0 { - writes := openfga.TupleKeys{} + writes := openfga.WriteRequestTupleKeys{} for index := 0; index < len(*request.GetBody().Writes); index++ { - writes.TupleKeys = append(writes.TupleKeys, (*request.GetBody().Writes)[index].ToTupleKey()) + writes.TupleKeys = append(writes.TupleKeys, (*request.GetBody().Writes)[index].ToWriteRequestTupleKey()) } writeRequest.Writes = &writes } if request.GetBody().Deletes != nil && len(*request.GetBody().Deletes) > 0 { - deletes := openfga.TupleKeys{} + deletes := openfga.WriteRequestTupleKeys{} for index := 0; index < len(*request.GetBody().Deletes); index++ { - deletes.TupleKeys = append(deletes.TupleKeys, (*request.GetBody().Deletes)[index].ToTupleKey()) + deletes.TupleKeys = append(deletes.TupleKeys, (*request.GetBody().Deletes)[index].ToWriteRequestTupleKey()) } writeRequest.Deletes = &deletes } @@ -1652,7 +1660,7 @@ func (client *OpenFgaClient) CheckExecute(request SdkClientCheckRequestInterface return nil, err } requestBody := openfga.CheckRequest{ - TupleKey: openfga.TupleKey{ + TupleKey: openfga.CheckRequestTupleKey{ User: openfga.PtrString(request.GetBody().User), Relation: openfga.PtrString(request.GetBody().Relation), Object: openfga.PtrString(request.GetBody().Object), @@ -1869,7 +1877,7 @@ func (client *OpenFgaClient) ExpandExecute(request SdkClientExpandRequestInterfa } data, _, err := client.OpenFgaApi.Expand(request.GetContext()).Body(openfga.ExpandRequest{ - TupleKey: openfga.TupleKey{ + TupleKey: openfga.ExpandRequestTupleKey{ Relation: &request.GetBody().Relation, Object: &request.GetBody().Object, }, @@ -2201,7 +2209,7 @@ type ClientWriteAssertionsRequest = []ClientAssertion func (clientAssertion ClientAssertion) ToAssertion() openfga.Assertion { return openfga.Assertion{ - TupleKey: openfga.TupleKey{ + TupleKey: openfga.CheckRequestTupleKey{ User: openfga.PtrString(clientAssertion.User), Relation: openfga.PtrString(clientAssertion.Relation), Object: openfga.PtrString(clientAssertion.Object), diff --git a/docs/Assertion.md b/docs/Assertion.md index c3662fb..7b64189 100644 --- a/docs/Assertion.md +++ b/docs/Assertion.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**TupleKey** | [**TupleKey**](TupleKey.md) | | +**TupleKey** | [**CheckRequestTupleKey**](CheckRequestTupleKey.md) | | **Expectation** | **bool** | | ## Methods ### NewAssertion -`func NewAssertion(tupleKey TupleKey, expectation bool, ) *Assertion` +`func NewAssertion(tupleKey CheckRequestTupleKey, expectation bool, ) *Assertion` NewAssertion instantiates a new Assertion object This constructor will assign default values to properties that have it defined, @@ -28,20 +28,20 @@ but it doesn't guarantee that properties required by API are set ### GetTupleKey -`func (o *Assertion) GetTupleKey() TupleKey` +`func (o *Assertion) GetTupleKey() CheckRequestTupleKey` GetTupleKey returns the TupleKey field if non-nil, zero value otherwise. ### GetTupleKeyOk -`func (o *Assertion) GetTupleKeyOk() (*TupleKey, bool)` +`func (o *Assertion) GetTupleKeyOk() (*CheckRequestTupleKey, bool)` GetTupleKeyOk returns a tuple with the TupleKey field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTupleKey -`func (o *Assertion) SetTupleKey(v TupleKey)` +`func (o *Assertion) SetTupleKey(v CheckRequestTupleKey)` SetTupleKey sets TupleKey field to given value. diff --git a/docs/AuthorizationModel.md b/docs/AuthorizationModel.md index 7934b9d..52a083d 100644 --- a/docs/AuthorizationModel.md +++ b/docs/AuthorizationModel.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **Id** | Pointer to **string** | | [optional] **SchemaVersion** | **string** | | **TypeDefinitions** | Pointer to [**[]TypeDefinition**](TypeDefinition.md) | | [optional] +**Conditions** | Pointer to [**map[string]Condition**](Condition.md) | | [optional] ## Methods @@ -97,6 +98,31 @@ SetTypeDefinitions sets TypeDefinitions field to given value. HasTypeDefinitions returns a boolean if a field has been set. +### GetConditions + +`func (o *AuthorizationModel) GetConditions() map[string]Condition` + +GetConditions returns the Conditions field if non-nil, zero value otherwise. + +### GetConditionsOk + +`func (o *AuthorizationModel) GetConditionsOk() (*map[string]Condition, bool)` + +GetConditionsOk returns a tuple with the Conditions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConditions + +`func (o *AuthorizationModel) SetConditions(v map[string]Condition)` + +SetConditions sets Conditions field to given value. + +### HasConditions + +`func (o *AuthorizationModel) HasConditions() bool` + +HasConditions returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CheckRequest.md b/docs/CheckRequest.md index 2e21ec6..63dcf65 100644 --- a/docs/CheckRequest.md +++ b/docs/CheckRequest.md @@ -4,16 +4,17 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**TupleKey** | [**TupleKey**](TupleKey.md) | | +**TupleKey** | [**CheckRequestTupleKey**](CheckRequestTupleKey.md) | | **ContextualTuples** | Pointer to [**ContextualTupleKeys**](ContextualTupleKeys.md) | | [optional] **AuthorizationModelId** | Pointer to **string** | | [optional] **Trace** | Pointer to **bool** | Defaults to false. Making it true has performance implications. | [optional] [readonly] +**Context** | Pointer to **map[string]interface{}** | Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. | [optional] ## Methods ### NewCheckRequest -`func NewCheckRequest(tupleKey TupleKey, ) *CheckRequest` +`func NewCheckRequest(tupleKey CheckRequestTupleKey, ) *CheckRequest` NewCheckRequest instantiates a new CheckRequest object This constructor will assign default values to properties that have it defined, @@ -30,20 +31,20 @@ but it doesn't guarantee that properties required by API are set ### GetTupleKey -`func (o *CheckRequest) GetTupleKey() TupleKey` +`func (o *CheckRequest) GetTupleKey() CheckRequestTupleKey` GetTupleKey returns the TupleKey field if non-nil, zero value otherwise. ### GetTupleKeyOk -`func (o *CheckRequest) GetTupleKeyOk() (*TupleKey, bool)` +`func (o *CheckRequest) GetTupleKeyOk() (*CheckRequestTupleKey, bool)` GetTupleKeyOk returns a tuple with the TupleKey field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTupleKey -`func (o *CheckRequest) SetTupleKey(v TupleKey)` +`func (o *CheckRequest) SetTupleKey(v CheckRequestTupleKey)` SetTupleKey sets TupleKey field to given value. @@ -123,6 +124,31 @@ SetTrace sets Trace field to given value. HasTrace returns a boolean if a field has been set. +### GetContext + +`func (o *CheckRequest) GetContext() map[string]interface{}` + +GetContext returns the Context field if non-nil, zero value otherwise. + +### GetContextOk + +`func (o *CheckRequest) GetContextOk() (*map[string]interface{}, bool)` + +GetContextOk returns a tuple with the Context field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContext + +`func (o *CheckRequest) SetContext(v map[string]interface{})` + +SetContext sets Context field to given value. + +### HasContext + +`func (o *CheckRequest) HasContext() bool` + +HasContext returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CheckRequestTupleKey.md b/docs/CheckRequestTupleKey.md new file mode 100644 index 0000000..e990815 --- /dev/null +++ b/docs/CheckRequestTupleKey.md @@ -0,0 +1,108 @@ +# CheckRequestTupleKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**User** | Pointer to **string** | | [optional] +**Relation** | Pointer to **string** | | [optional] +**Object** | Pointer to **string** | | [optional] + +## Methods + +### NewCheckRequestTupleKey + +`func NewCheckRequestTupleKey() *CheckRequestTupleKey` + +NewCheckRequestTupleKey instantiates a new CheckRequestTupleKey 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 + +### NewCheckRequestTupleKeyWithDefaults + +`func NewCheckRequestTupleKeyWithDefaults() *CheckRequestTupleKey` + +NewCheckRequestTupleKeyWithDefaults instantiates a new CheckRequestTupleKey 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 + +### GetUser + +`func (o *CheckRequestTupleKey) GetUser() string` + +GetUser returns the User field if non-nil, zero value otherwise. + +### GetUserOk + +`func (o *CheckRequestTupleKey) GetUserOk() (*string, bool)` + +GetUserOk returns a tuple with the User field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUser + +`func (o *CheckRequestTupleKey) SetUser(v string)` + +SetUser sets User field to given value. + +### HasUser + +`func (o *CheckRequestTupleKey) HasUser() bool` + +HasUser returns a boolean if a field has been set. + +### GetRelation + +`func (o *CheckRequestTupleKey) GetRelation() string` + +GetRelation returns the Relation field if non-nil, zero value otherwise. + +### GetRelationOk + +`func (o *CheckRequestTupleKey) GetRelationOk() (*string, bool)` + +GetRelationOk returns a tuple with the Relation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRelation + +`func (o *CheckRequestTupleKey) SetRelation(v string)` + +SetRelation sets Relation field to given value. + +### HasRelation + +`func (o *CheckRequestTupleKey) HasRelation() bool` + +HasRelation returns a boolean if a field has been set. + +### GetObject + +`func (o *CheckRequestTupleKey) GetObject() string` + +GetObject returns the Object field if non-nil, zero value otherwise. + +### GetObjectOk + +`func (o *CheckRequestTupleKey) GetObjectOk() (*string, bool)` + +GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObject + +`func (o *CheckRequestTupleKey) SetObject(v string)` + +SetObject sets Object field to given value. + +### HasObject + +`func (o *CheckRequestTupleKey) HasObject() bool` + +HasObject returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Condition.md b/docs/Condition.md new file mode 100644 index 0000000..8cc450f --- /dev/null +++ b/docs/Condition.md @@ -0,0 +1,98 @@ +# Condition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | +**Expression** | **string** | A Google CEL expression, expressed as a string. | +**Parameters** | Pointer to [**map[string]ConditionParamTypeRef**](ConditionParamTypeRef.md) | A map of parameter names to the parameter's defined type reference. | [optional] + +## Methods + +### NewCondition + +`func NewCondition(name string, expression string, ) *Condition` + +NewCondition instantiates a new Condition 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 + +### NewConditionWithDefaults + +`func NewConditionWithDefaults() *Condition` + +NewConditionWithDefaults instantiates a new Condition 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 + +### GetName + +`func (o *Condition) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Condition) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Condition) SetName(v string)` + +SetName sets Name field to given value. + + +### GetExpression + +`func (o *Condition) GetExpression() string` + +GetExpression returns the Expression field if non-nil, zero value otherwise. + +### GetExpressionOk + +`func (o *Condition) GetExpressionOk() (*string, bool)` + +GetExpressionOk returns a tuple with the Expression field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetExpression + +`func (o *Condition) SetExpression(v string)` + +SetExpression sets Expression field to given value. + + +### GetParameters + +`func (o *Condition) GetParameters() map[string]ConditionParamTypeRef` + +GetParameters returns the Parameters field if non-nil, zero value otherwise. + +### GetParametersOk + +`func (o *Condition) GetParametersOk() (*map[string]ConditionParamTypeRef, bool)` + +GetParametersOk returns a tuple with the Parameters field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParameters + +`func (o *Condition) SetParameters(v map[string]ConditionParamTypeRef)` + +SetParameters sets Parameters field to given value. + +### HasParameters + +`func (o *Condition) HasParameters() bool` + +HasParameters returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ConditionParamTypeRef.md b/docs/ConditionParamTypeRef.md new file mode 100644 index 0000000..7acb095 --- /dev/null +++ b/docs/ConditionParamTypeRef.md @@ -0,0 +1,77 @@ +# ConditionParamTypeRef + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TypeName** | [**TypeName**](TypeName.md) | | [default to UNSPECIFIED] +**GenericTypes** | Pointer to [**[]ConditionParamTypeRef**](ConditionParamTypeRef.md) | | [optional] + +## Methods + +### NewConditionParamTypeRef + +`func NewConditionParamTypeRef(typeName TypeName, ) *ConditionParamTypeRef` + +NewConditionParamTypeRef instantiates a new ConditionParamTypeRef 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 + +### NewConditionParamTypeRefWithDefaults + +`func NewConditionParamTypeRefWithDefaults() *ConditionParamTypeRef` + +NewConditionParamTypeRefWithDefaults instantiates a new ConditionParamTypeRef 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 + +### GetTypeName + +`func (o *ConditionParamTypeRef) GetTypeName() TypeName` + +GetTypeName returns the TypeName field if non-nil, zero value otherwise. + +### GetTypeNameOk + +`func (o *ConditionParamTypeRef) GetTypeNameOk() (*TypeName, bool)` + +GetTypeNameOk returns a tuple with the TypeName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTypeName + +`func (o *ConditionParamTypeRef) SetTypeName(v TypeName)` + +SetTypeName sets TypeName field to given value. + + +### GetGenericTypes + +`func (o *ConditionParamTypeRef) GetGenericTypes() []ConditionParamTypeRef` + +GetGenericTypes returns the GenericTypes field if non-nil, zero value otherwise. + +### GetGenericTypesOk + +`func (o *ConditionParamTypeRef) GetGenericTypesOk() (*[]ConditionParamTypeRef, bool)` + +GetGenericTypesOk returns a tuple with the GenericTypes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGenericTypes + +`func (o *ConditionParamTypeRef) SetGenericTypes(v []ConditionParamTypeRef)` + +SetGenericTypes sets GenericTypes field to given value. + +### HasGenericTypes + +`func (o *ConditionParamTypeRef) HasGenericTypes() bool` + +HasGenericTypes returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ExpandRequest.md b/docs/ExpandRequest.md index 7b40af2..af7deea 100644 --- a/docs/ExpandRequest.md +++ b/docs/ExpandRequest.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**TupleKey** | [**TupleKey**](TupleKey.md) | | +**TupleKey** | [**ExpandRequestTupleKey**](ExpandRequestTupleKey.md) | | **AuthorizationModelId** | Pointer to **string** | | [optional] ## Methods ### NewExpandRequest -`func NewExpandRequest(tupleKey TupleKey, ) *ExpandRequest` +`func NewExpandRequest(tupleKey ExpandRequestTupleKey, ) *ExpandRequest` NewExpandRequest instantiates a new ExpandRequest object This constructor will assign default values to properties that have it defined, @@ -28,20 +28,20 @@ but it doesn't guarantee that properties required by API are set ### GetTupleKey -`func (o *ExpandRequest) GetTupleKey() TupleKey` +`func (o *ExpandRequest) GetTupleKey() ExpandRequestTupleKey` GetTupleKey returns the TupleKey field if non-nil, zero value otherwise. ### GetTupleKeyOk -`func (o *ExpandRequest) GetTupleKeyOk() (*TupleKey, bool)` +`func (o *ExpandRequest) GetTupleKeyOk() (*ExpandRequestTupleKey, bool)` GetTupleKeyOk returns a tuple with the TupleKey field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTupleKey -`func (o *ExpandRequest) SetTupleKey(v TupleKey)` +`func (o *ExpandRequest) SetTupleKey(v ExpandRequestTupleKey)` SetTupleKey sets TupleKey field to given value. diff --git a/docs/ExpandRequestTupleKey.md b/docs/ExpandRequestTupleKey.md new file mode 100644 index 0000000..bbaac76 --- /dev/null +++ b/docs/ExpandRequestTupleKey.md @@ -0,0 +1,82 @@ +# ExpandRequestTupleKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Object** | Pointer to **string** | | [optional] +**Relation** | Pointer to **string** | | [optional] + +## Methods + +### NewExpandRequestTupleKey + +`func NewExpandRequestTupleKey() *ExpandRequestTupleKey` + +NewExpandRequestTupleKey instantiates a new ExpandRequestTupleKey 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 + +### NewExpandRequestTupleKeyWithDefaults + +`func NewExpandRequestTupleKeyWithDefaults() *ExpandRequestTupleKey` + +NewExpandRequestTupleKeyWithDefaults instantiates a new ExpandRequestTupleKey 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 + +### GetObject + +`func (o *ExpandRequestTupleKey) GetObject() string` + +GetObject returns the Object field if non-nil, zero value otherwise. + +### GetObjectOk + +`func (o *ExpandRequestTupleKey) GetObjectOk() (*string, bool)` + +GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObject + +`func (o *ExpandRequestTupleKey) SetObject(v string)` + +SetObject sets Object field to given value. + +### HasObject + +`func (o *ExpandRequestTupleKey) HasObject() bool` + +HasObject returns a boolean if a field has been set. + +### GetRelation + +`func (o *ExpandRequestTupleKey) GetRelation() string` + +GetRelation returns the Relation field if non-nil, zero value otherwise. + +### GetRelationOk + +`func (o *ExpandRequestTupleKey) GetRelationOk() (*string, bool)` + +GetRelationOk returns a tuple with the Relation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRelation + +`func (o *ExpandRequestTupleKey) SetRelation(v string)` + +SetRelation sets Relation field to given value. + +### HasRelation + +`func (o *ExpandRequestTupleKey) HasRelation() bool` + +HasRelation returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ListObjectsRequest.md b/docs/ListObjectsRequest.md index c3f2b5c..12d1d6e 100644 --- a/docs/ListObjectsRequest.md +++ b/docs/ListObjectsRequest.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **Relation** | **string** | | **User** | **string** | | **ContextualTuples** | Pointer to [**ContextualTupleKeys**](ContextualTupleKeys.md) | | [optional] +**Context** | Pointer to **map[string]interface{}** | Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. | [optional] ## Methods @@ -139,6 +140,31 @@ SetContextualTuples sets ContextualTuples field to given value. HasContextualTuples returns a boolean if a field has been set. +### GetContext + +`func (o *ListObjectsRequest) GetContext() map[string]interface{}` + +GetContext returns the Context field if non-nil, zero value otherwise. + +### GetContextOk + +`func (o *ListObjectsRequest) GetContextOk() (*map[string]interface{}, bool)` + +GetContextOk returns a tuple with the Context field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContext + +`func (o *ListObjectsRequest) SetContext(v map[string]interface{})` + +SetContext sets Context field to given value. + +### HasContext + +`func (o *ListObjectsRequest) HasContext() bool` + +HasContext returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/NullValue.md b/docs/NullValue.md new file mode 100644 index 0000000..a7bcc15 --- /dev/null +++ b/docs/NullValue.md @@ -0,0 +1,11 @@ +# NullValue + +## Enum + + +* `NULL_VALUE` (value: `"NULL_VALUE"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OpenFgaApi.md b/docs/OpenFgaApi.md index 1a37096..ab912f3 100644 --- a/docs/OpenFgaApi.md +++ b/docs/OpenFgaApi.md @@ -44,7 +44,7 @@ import ( func main() { - body := *openapiclient.NewCheckRequest(*openapiclient.NewTupleKey()) // CheckRequest | + body := *openapiclient.NewCheckRequest(*openapiclient.NewCheckRequestTupleKey()) // CheckRequest | configuration, err := openfga.NewConfiguration(openfga.Configuration{ ApiScheme: os.Getenv("OPENFGA_API_SCHEME"), // optional, defaults to "https" @@ -318,7 +318,7 @@ import ( func main() { - body := *openapiclient.NewExpandRequest(*openapiclient.NewTupleKey()) // ExpandRequest | + body := *openapiclient.NewExpandRequest(*openapiclient.NewExpandRequestTupleKey()) // ExpandRequest | configuration, err := openfga.NewConfiguration(openfga.Configuration{ ApiScheme: os.Getenv("OPENFGA_API_SCHEME"), // optional, defaults to "https" @@ -1261,7 +1261,7 @@ import ( func main() { authorizationModelId := "authorizationModelId_example" // string | - body := *openapiclient.NewWriteAssertionsRequest([]openapiclient.Assertion{*openapiclient.NewAssertion(*openapiclient.NewTupleKey(), false)}) // WriteAssertionsRequest | + body := *openapiclient.NewWriteAssertionsRequest([]openapiclient.Assertion{*openapiclient.NewAssertion(*openapiclient.NewCheckRequestTupleKey(), false)}) // WriteAssertionsRequest | configuration, err := openfga.NewConfiguration(openfga.Configuration{ ApiScheme: os.Getenv("OPENFGA_API_SCHEME"), // optional, defaults to "https" diff --git a/docs/ReadRequest.md b/docs/ReadRequest.md index 3c03780..e5a4d75 100644 --- a/docs/ReadRequest.md +++ b/docs/ReadRequest.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**TupleKey** | Pointer to [**TupleKey**](TupleKey.md) | | [optional] +**TupleKey** | Pointer to [**ReadRequestTupleKey**](ReadRequestTupleKey.md) | | [optional] **PageSize** | Pointer to **int32** | | [optional] **ContinuationToken** | Pointer to **string** | | [optional] @@ -29,20 +29,20 @@ but it doesn't guarantee that properties required by API are set ### GetTupleKey -`func (o *ReadRequest) GetTupleKey() TupleKey` +`func (o *ReadRequest) GetTupleKey() ReadRequestTupleKey` GetTupleKey returns the TupleKey field if non-nil, zero value otherwise. ### GetTupleKeyOk -`func (o *ReadRequest) GetTupleKeyOk() (*TupleKey, bool)` +`func (o *ReadRequest) GetTupleKeyOk() (*ReadRequestTupleKey, bool)` GetTupleKeyOk returns a tuple with the TupleKey field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTupleKey -`func (o *ReadRequest) SetTupleKey(v TupleKey)` +`func (o *ReadRequest) SetTupleKey(v ReadRequestTupleKey)` SetTupleKey sets TupleKey field to given value. diff --git a/docs/ReadRequestTupleKey.md b/docs/ReadRequestTupleKey.md new file mode 100644 index 0000000..bb4388d --- /dev/null +++ b/docs/ReadRequestTupleKey.md @@ -0,0 +1,108 @@ +# ReadRequestTupleKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**User** | Pointer to **string** | | [optional] +**Relation** | Pointer to **string** | | [optional] +**Object** | Pointer to **string** | | [optional] + +## Methods + +### NewReadRequestTupleKey + +`func NewReadRequestTupleKey() *ReadRequestTupleKey` + +NewReadRequestTupleKey instantiates a new ReadRequestTupleKey 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 + +### NewReadRequestTupleKeyWithDefaults + +`func NewReadRequestTupleKeyWithDefaults() *ReadRequestTupleKey` + +NewReadRequestTupleKeyWithDefaults instantiates a new ReadRequestTupleKey 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 + +### GetUser + +`func (o *ReadRequestTupleKey) GetUser() string` + +GetUser returns the User field if non-nil, zero value otherwise. + +### GetUserOk + +`func (o *ReadRequestTupleKey) GetUserOk() (*string, bool)` + +GetUserOk returns a tuple with the User field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUser + +`func (o *ReadRequestTupleKey) SetUser(v string)` + +SetUser sets User field to given value. + +### HasUser + +`func (o *ReadRequestTupleKey) HasUser() bool` + +HasUser returns a boolean if a field has been set. + +### GetRelation + +`func (o *ReadRequestTupleKey) GetRelation() string` + +GetRelation returns the Relation field if non-nil, zero value otherwise. + +### GetRelationOk + +`func (o *ReadRequestTupleKey) GetRelationOk() (*string, bool)` + +GetRelationOk returns a tuple with the Relation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRelation + +`func (o *ReadRequestTupleKey) SetRelation(v string)` + +SetRelation sets Relation field to given value. + +### HasRelation + +`func (o *ReadRequestTupleKey) HasRelation() bool` + +HasRelation returns a boolean if a field has been set. + +### GetObject + +`func (o *ReadRequestTupleKey) GetObject() string` + +GetObject returns the Object field if non-nil, zero value otherwise. + +### GetObjectOk + +`func (o *ReadRequestTupleKey) GetObjectOk() (*string, bool)` + +GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObject + +`func (o *ReadRequestTupleKey) SetObject(v string)` + +SetObject sets Object field to given value. + +### HasObject + +`func (o *ReadRequestTupleKey) HasObject() bool` + +HasObject returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RelationReference.md b/docs/RelationReference.md index e45b271..32fe4ee 100644 --- a/docs/RelationReference.md +++ b/docs/RelationReference.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **Type** | **string** | | **Relation** | Pointer to **string** | | [optional] **Wildcard** | Pointer to **map[string]interface{}** | | [optional] +**Condition** | Pointer to **string** | The name of a condition that is enforced over the allowed relation. | [optional] ## Methods @@ -97,6 +98,31 @@ SetWildcard sets Wildcard field to given value. HasWildcard returns a boolean if a field has been set. +### GetCondition + +`func (o *RelationReference) GetCondition() string` + +GetCondition returns the Condition field if non-nil, zero value otherwise. + +### GetConditionOk + +`func (o *RelationReference) GetConditionOk() (*string, bool)` + +GetConditionOk returns a tuple with the Condition field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCondition + +`func (o *RelationReference) SetCondition(v string)` + +SetCondition sets Condition field to given value. + +### HasCondition + +`func (o *RelationReference) HasCondition() bool` + +HasCondition returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/RelationshipCondition.md b/docs/RelationshipCondition.md new file mode 100644 index 0000000..4c4af5a --- /dev/null +++ b/docs/RelationshipCondition.md @@ -0,0 +1,77 @@ +# RelationshipCondition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ConditionName** | **string** | A reference (by name) of the relationship condition defined in the authorization model. | +**Context** | Pointer to **map[string]interface{}** | Additional context/data to persist along with the condition. The keys must match the parameters defined by the condition, and the value types must match the parameter type definitions. | [optional] + +## Methods + +### NewRelationshipCondition + +`func NewRelationshipCondition(conditionName string, ) *RelationshipCondition` + +NewRelationshipCondition instantiates a new RelationshipCondition 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 + +### NewRelationshipConditionWithDefaults + +`func NewRelationshipConditionWithDefaults() *RelationshipCondition` + +NewRelationshipConditionWithDefaults instantiates a new RelationshipCondition 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 + +### GetConditionName + +`func (o *RelationshipCondition) GetConditionName() string` + +GetConditionName returns the ConditionName field if non-nil, zero value otherwise. + +### GetConditionNameOk + +`func (o *RelationshipCondition) GetConditionNameOk() (*string, bool)` + +GetConditionNameOk returns a tuple with the ConditionName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConditionName + +`func (o *RelationshipCondition) SetConditionName(v string)` + +SetConditionName sets ConditionName field to given value. + + +### GetContext + +`func (o *RelationshipCondition) GetContext() map[string]interface{}` + +GetContext returns the Context field if non-nil, zero value otherwise. + +### GetContextOk + +`func (o *RelationshipCondition) GetContextOk() (*map[string]interface{}, bool)` + +GetContextOk returns a tuple with the Context field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContext + +`func (o *RelationshipCondition) SetContext(v map[string]interface{})` + +SetContext sets Context field to given value. + +### HasContext + +`func (o *RelationshipCondition) HasContext() bool` + +HasContext returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TupleKey.md b/docs/TupleKey.md index 6f7cc24..a8a2761 100644 --- a/docs/TupleKey.md +++ b/docs/TupleKey.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **Object** | Pointer to **string** | | [optional] **Relation** | Pointer to **string** | | [optional] **User** | Pointer to **string** | | [optional] +**Condition** | Pointer to [**RelationshipCondition**](RelationshipCondition.md) | | [optional] ## Methods @@ -102,6 +103,31 @@ SetUser sets User field to given value. HasUser returns a boolean if a field has been set. +### GetCondition + +`func (o *TupleKey) GetCondition() RelationshipCondition` + +GetCondition returns the Condition field if non-nil, zero value otherwise. + +### GetConditionOk + +`func (o *TupleKey) GetConditionOk() (*RelationshipCondition, bool)` + +GetConditionOk returns a tuple with the Condition field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCondition + +`func (o *TupleKey) SetCondition(v RelationshipCondition)` + +SetCondition sets Condition field to given value. + +### HasCondition + +`func (o *TupleKey) HasCondition() bool` + +HasCondition returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/TypeName.md b/docs/TypeName.md new file mode 100644 index 0000000..f7889e7 --- /dev/null +++ b/docs/TypeName.md @@ -0,0 +1,33 @@ +# TypeName + +## Enum + + +* `UNSPECIFIED` (value: `"TYPE_NAME_UNSPECIFIED"`) + +* `ANY` (value: `"TYPE_NAME_ANY"`) + +* `BOOL` (value: `"TYPE_NAME_BOOL"`) + +* `STRING` (value: `"TYPE_NAME_STRING"`) + +* `INT` (value: `"TYPE_NAME_INT"`) + +* `UINT` (value: `"TYPE_NAME_UINT"`) + +* `DOUBLE` (value: `"TYPE_NAME_DOUBLE"`) + +* `DURATION` (value: `"TYPE_NAME_DURATION"`) + +* `TIMESTAMP` (value: `"TYPE_NAME_TIMESTAMP"`) + +* `MAP` (value: `"TYPE_NAME_MAP"`) + +* `LIST` (value: `"TYPE_NAME_LIST"`) + +* `IPADDRESS` (value: `"TYPE_NAME_IPADDRESS"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WriteAuthorizationModelRequest.md b/docs/WriteAuthorizationModelRequest.md index 1cb6787..e5663a2 100644 --- a/docs/WriteAuthorizationModelRequest.md +++ b/docs/WriteAuthorizationModelRequest.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **TypeDefinitions** | [**[]TypeDefinition**](TypeDefinition.md) | | **SchemaVersion** | Pointer to **string** | | [optional] +**Conditions** | Pointer to [**map[string]Condition**](Condition.md) | | [optional] ## Methods @@ -71,6 +72,31 @@ SetSchemaVersion sets SchemaVersion field to given value. HasSchemaVersion returns a boolean if a field has been set. +### GetConditions + +`func (o *WriteAuthorizationModelRequest) GetConditions() map[string]Condition` + +GetConditions returns the Conditions field if non-nil, zero value otherwise. + +### GetConditionsOk + +`func (o *WriteAuthorizationModelRequest) GetConditionsOk() (*map[string]Condition, bool)` + +GetConditionsOk returns a tuple with the Conditions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConditions + +`func (o *WriteAuthorizationModelRequest) SetConditions(v map[string]Condition)` + +SetConditions sets Conditions field to given value. + +### HasConditions + +`func (o *WriteAuthorizationModelRequest) HasConditions() bool` + +HasConditions returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/WriteRequest.md b/docs/WriteRequest.md index 0a0a709..f090a70 100644 --- a/docs/WriteRequest.md +++ b/docs/WriteRequest.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Writes** | Pointer to [**TupleKeys**](TupleKeys.md) | | [optional] -**Deletes** | Pointer to [**TupleKeys**](TupleKeys.md) | | [optional] +**Writes** | Pointer to [**WriteRequestTupleKeys**](WriteRequestTupleKeys.md) | | [optional] +**Deletes** | Pointer to [**WriteRequestTupleKeys**](WriteRequestTupleKeys.md) | | [optional] **AuthorizationModelId** | Pointer to **string** | | [optional] ## Methods @@ -29,20 +29,20 @@ but it doesn't guarantee that properties required by API are set ### GetWrites -`func (o *WriteRequest) GetWrites() TupleKeys` +`func (o *WriteRequest) GetWrites() WriteRequestTupleKeys` GetWrites returns the Writes field if non-nil, zero value otherwise. ### GetWritesOk -`func (o *WriteRequest) GetWritesOk() (*TupleKeys, bool)` +`func (o *WriteRequest) GetWritesOk() (*WriteRequestTupleKeys, bool)` GetWritesOk returns a tuple with the Writes field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetWrites -`func (o *WriteRequest) SetWrites(v TupleKeys)` +`func (o *WriteRequest) SetWrites(v WriteRequestTupleKeys)` SetWrites sets Writes field to given value. @@ -54,20 +54,20 @@ HasWrites returns a boolean if a field has been set. ### GetDeletes -`func (o *WriteRequest) GetDeletes() TupleKeys` +`func (o *WriteRequest) GetDeletes() WriteRequestTupleKeys` GetDeletes returns the Deletes field if non-nil, zero value otherwise. ### GetDeletesOk -`func (o *WriteRequest) GetDeletesOk() (*TupleKeys, bool)` +`func (o *WriteRequest) GetDeletesOk() (*WriteRequestTupleKeys, bool)` GetDeletesOk returns a tuple with the Deletes field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetDeletes -`func (o *WriteRequest) SetDeletes(v TupleKeys)` +`func (o *WriteRequest) SetDeletes(v WriteRequestTupleKeys)` SetDeletes sets Deletes field to given value. diff --git a/docs/WriteRequestTupleKey.md b/docs/WriteRequestTupleKey.md new file mode 100644 index 0000000..52f6e4e --- /dev/null +++ b/docs/WriteRequestTupleKey.md @@ -0,0 +1,134 @@ +# WriteRequestTupleKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**User** | Pointer to **string** | | [optional] +**Relation** | Pointer to **string** | | [optional] +**Object** | Pointer to **string** | | [optional] +**Condition** | Pointer to [**RelationshipCondition**](RelationshipCondition.md) | | [optional] + +## Methods + +### NewWriteRequestTupleKey + +`func NewWriteRequestTupleKey() *WriteRequestTupleKey` + +NewWriteRequestTupleKey instantiates a new WriteRequestTupleKey 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 + +### NewWriteRequestTupleKeyWithDefaults + +`func NewWriteRequestTupleKeyWithDefaults() *WriteRequestTupleKey` + +NewWriteRequestTupleKeyWithDefaults instantiates a new WriteRequestTupleKey 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 + +### GetUser + +`func (o *WriteRequestTupleKey) GetUser() string` + +GetUser returns the User field if non-nil, zero value otherwise. + +### GetUserOk + +`func (o *WriteRequestTupleKey) GetUserOk() (*string, bool)` + +GetUserOk returns a tuple with the User field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUser + +`func (o *WriteRequestTupleKey) SetUser(v string)` + +SetUser sets User field to given value. + +### HasUser + +`func (o *WriteRequestTupleKey) HasUser() bool` + +HasUser returns a boolean if a field has been set. + +### GetRelation + +`func (o *WriteRequestTupleKey) GetRelation() string` + +GetRelation returns the Relation field if non-nil, zero value otherwise. + +### GetRelationOk + +`func (o *WriteRequestTupleKey) GetRelationOk() (*string, bool)` + +GetRelationOk returns a tuple with the Relation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRelation + +`func (o *WriteRequestTupleKey) SetRelation(v string)` + +SetRelation sets Relation field to given value. + +### HasRelation + +`func (o *WriteRequestTupleKey) HasRelation() bool` + +HasRelation returns a boolean if a field has been set. + +### GetObject + +`func (o *WriteRequestTupleKey) GetObject() string` + +GetObject returns the Object field if non-nil, zero value otherwise. + +### GetObjectOk + +`func (o *WriteRequestTupleKey) GetObjectOk() (*string, bool)` + +GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObject + +`func (o *WriteRequestTupleKey) SetObject(v string)` + +SetObject sets Object field to given value. + +### HasObject + +`func (o *WriteRequestTupleKey) HasObject() bool` + +HasObject returns a boolean if a field has been set. + +### GetCondition + +`func (o *WriteRequestTupleKey) GetCondition() RelationshipCondition` + +GetCondition returns the Condition field if non-nil, zero value otherwise. + +### GetConditionOk + +`func (o *WriteRequestTupleKey) GetConditionOk() (*RelationshipCondition, bool)` + +GetConditionOk returns a tuple with the Condition field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCondition + +`func (o *WriteRequestTupleKey) SetCondition(v RelationshipCondition)` + +SetCondition sets Condition field to given value. + +### HasCondition + +`func (o *WriteRequestTupleKey) HasCondition() bool` + +HasCondition returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TupleKeys.md b/docs/WriteRequestTupleKeys.md similarity index 58% rename from docs/TupleKeys.md rename to docs/WriteRequestTupleKeys.md index c0a4beb..68c4b9f 100644 --- a/docs/TupleKeys.md +++ b/docs/WriteRequestTupleKeys.md @@ -1,46 +1,46 @@ -# TupleKeys +# WriteRequestTupleKeys ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**TupleKeys** | [**[]TupleKey**](TupleKey.md) | | +**TupleKeys** | [**[]WriteRequestTupleKey**](WriteRequestTupleKey.md) | | ## Methods -### NewTupleKeys +### NewWriteRequestTupleKeys -`func NewTupleKeys(tupleKeys []TupleKey, ) *TupleKeys` +`func NewWriteRequestTupleKeys(tupleKeys []WriteRequestTupleKey, ) *WriteRequestTupleKeys` -NewTupleKeys instantiates a new TupleKeys object +NewWriteRequestTupleKeys instantiates a new WriteRequestTupleKeys 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 -### NewTupleKeysWithDefaults +### NewWriteRequestTupleKeysWithDefaults -`func NewTupleKeysWithDefaults() *TupleKeys` +`func NewWriteRequestTupleKeysWithDefaults() *WriteRequestTupleKeys` -NewTupleKeysWithDefaults instantiates a new TupleKeys object +NewWriteRequestTupleKeysWithDefaults instantiates a new WriteRequestTupleKeys 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 ### GetTupleKeys -`func (o *TupleKeys) GetTupleKeys() []TupleKey` +`func (o *WriteRequestTupleKeys) GetTupleKeys() []WriteRequestTupleKey` GetTupleKeys returns the TupleKeys field if non-nil, zero value otherwise. ### GetTupleKeysOk -`func (o *TupleKeys) GetTupleKeysOk() (*[]TupleKey, bool)` +`func (o *WriteRequestTupleKeys) GetTupleKeysOk() (*[]WriteRequestTupleKey, bool)` GetTupleKeysOk returns a tuple with the TupleKeys field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTupleKeys -`func (o *TupleKeys) SetTupleKeys(v []TupleKey)` +`func (o *WriteRequestTupleKeys) SetTupleKeys(v []WriteRequestTupleKey)` SetTupleKeys sets TupleKeys field to given value. diff --git a/model_assertion.go b/model_assertion.go index 1239cf9..cdb74bd 100644 --- a/model_assertion.go +++ b/model_assertion.go @@ -18,15 +18,15 @@ import ( // Assertion struct for Assertion type Assertion struct { - TupleKey TupleKey `json:"tuple_key"` - Expectation bool `json:"expectation"` + TupleKey CheckRequestTupleKey `json:"tuple_key"` + Expectation bool `json:"expectation"` } // NewAssertion instantiates a new Assertion 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 NewAssertion(tupleKey TupleKey, expectation bool) *Assertion { +func NewAssertion(tupleKey CheckRequestTupleKey, expectation bool) *Assertion { this := Assertion{} this.TupleKey = tupleKey this.Expectation = expectation @@ -42,9 +42,9 @@ func NewAssertionWithDefaults() *Assertion { } // GetTupleKey returns the TupleKey field value -func (o *Assertion) GetTupleKey() TupleKey { +func (o *Assertion) GetTupleKey() CheckRequestTupleKey { if o == nil { - var ret TupleKey + var ret CheckRequestTupleKey return ret } @@ -53,7 +53,7 @@ func (o *Assertion) GetTupleKey() TupleKey { // GetTupleKeyOk returns a tuple with the TupleKey field value // and a boolean to check if the value has been set. -func (o *Assertion) GetTupleKeyOk() (*TupleKey, bool) { +func (o *Assertion) GetTupleKeyOk() (*CheckRequestTupleKey, bool) { if o == nil { return nil, false } @@ -61,7 +61,7 @@ func (o *Assertion) GetTupleKeyOk() (*TupleKey, bool) { } // SetTupleKey sets field value -func (o *Assertion) SetTupleKey(v TupleKey) { +func (o *Assertion) SetTupleKey(v CheckRequestTupleKey) { o.TupleKey = v } diff --git a/model_authorization_model.go b/model_authorization_model.go index d8ea6d1..2a35b17 100644 --- a/model_authorization_model.go +++ b/model_authorization_model.go @@ -18,9 +18,10 @@ import ( // AuthorizationModel struct for AuthorizationModel type AuthorizationModel struct { - Id *string `json:"id,omitempty"` - SchemaVersion string `json:"schema_version"` - TypeDefinitions *[]TypeDefinition `json:"type_definitions,omitempty"` + Id *string `json:"id,omitempty"` + SchemaVersion string `json:"schema_version"` + TypeDefinitions *[]TypeDefinition `json:"type_definitions,omitempty"` + Conditions *map[string]Condition `json:"conditions,omitempty"` } // NewAuthorizationModel instantiates a new AuthorizationModel object @@ -129,6 +130,38 @@ func (o *AuthorizationModel) SetTypeDefinitions(v []TypeDefinition) { o.TypeDefinitions = &v } +// GetConditions returns the Conditions field value if set, zero value otherwise. +func (o *AuthorizationModel) GetConditions() map[string]Condition { + if o == nil || o.Conditions == nil { + var ret map[string]Condition + return ret + } + return *o.Conditions +} + +// GetConditionsOk returns a tuple with the Conditions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuthorizationModel) GetConditionsOk() (*map[string]Condition, bool) { + if o == nil || o.Conditions == nil { + return nil, false + } + return o.Conditions, true +} + +// HasConditions returns a boolean if a field has been set. +func (o *AuthorizationModel) HasConditions() bool { + if o != nil && o.Conditions != nil { + return true + } + + return false +} + +// SetConditions gets a reference to the given map[string]Condition and assigns it to the Conditions field. +func (o *AuthorizationModel) SetConditions(v map[string]Condition) { + o.Conditions = &v +} + func (o AuthorizationModel) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { @@ -140,6 +173,9 @@ func (o AuthorizationModel) MarshalJSON() ([]byte, error) { if o.TypeDefinitions != nil { toSerialize["type_definitions"] = o.TypeDefinitions } + if o.Conditions != nil { + toSerialize["conditions"] = o.Conditions + } return json.Marshal(toSerialize) } diff --git a/model_check_request.go b/model_check_request.go index 78f5326..a443804 100644 --- a/model_check_request.go +++ b/model_check_request.go @@ -18,18 +18,20 @@ import ( // CheckRequest struct for CheckRequest type CheckRequest struct { - TupleKey TupleKey `json:"tuple_key"` + TupleKey CheckRequestTupleKey `json:"tuple_key"` ContextualTuples *ContextualTupleKeys `json:"contextual_tuples,omitempty"` AuthorizationModelId *string `json:"authorization_model_id,omitempty"` // Defaults to false. Making it true has performance implications. Trace *bool `json:"trace,omitempty"` + // Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. + Context *map[string]interface{} `json:"context,omitempty"` } // NewCheckRequest instantiates a new CheckRequest 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 NewCheckRequest(tupleKey TupleKey) *CheckRequest { +func NewCheckRequest(tupleKey CheckRequestTupleKey) *CheckRequest { this := CheckRequest{} this.TupleKey = tupleKey return &this @@ -44,9 +46,9 @@ func NewCheckRequestWithDefaults() *CheckRequest { } // GetTupleKey returns the TupleKey field value -func (o *CheckRequest) GetTupleKey() TupleKey { +func (o *CheckRequest) GetTupleKey() CheckRequestTupleKey { if o == nil { - var ret TupleKey + var ret CheckRequestTupleKey return ret } @@ -55,7 +57,7 @@ func (o *CheckRequest) GetTupleKey() TupleKey { // GetTupleKeyOk returns a tuple with the TupleKey field value // and a boolean to check if the value has been set. -func (o *CheckRequest) GetTupleKeyOk() (*TupleKey, bool) { +func (o *CheckRequest) GetTupleKeyOk() (*CheckRequestTupleKey, bool) { if o == nil { return nil, false } @@ -63,7 +65,7 @@ func (o *CheckRequest) GetTupleKeyOk() (*TupleKey, bool) { } // SetTupleKey sets field value -func (o *CheckRequest) SetTupleKey(v TupleKey) { +func (o *CheckRequest) SetTupleKey(v CheckRequestTupleKey) { o.TupleKey = v } @@ -163,6 +165,38 @@ func (o *CheckRequest) SetTrace(v bool) { o.Trace = &v } +// GetContext returns the Context field value if set, zero value otherwise. +func (o *CheckRequest) GetContext() map[string]interface{} { + if o == nil || o.Context == nil { + var ret map[string]interface{} + return ret + } + return *o.Context +} + +// GetContextOk returns a tuple with the Context field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckRequest) GetContextOk() (*map[string]interface{}, bool) { + if o == nil || o.Context == nil { + return nil, false + } + return o.Context, true +} + +// HasContext returns a boolean if a field has been set. +func (o *CheckRequest) HasContext() bool { + if o != nil && o.Context != nil { + return true + } + + return false +} + +// SetContext gets a reference to the given map[string]interface{} and assigns it to the Context field. +func (o *CheckRequest) SetContext(v map[string]interface{}) { + o.Context = &v +} + func (o CheckRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { @@ -177,6 +211,9 @@ func (o CheckRequest) MarshalJSON() ([]byte, error) { if o.Trace != nil { toSerialize["trace"] = o.Trace } + if o.Context != nil { + toSerialize["context"] = o.Context + } return json.Marshal(toSerialize) } diff --git a/model_check_request_tuple_key.go b/model_check_request_tuple_key.go new file mode 100644 index 0000000..827fe6c --- /dev/null +++ b/model_check_request_tuple_key.go @@ -0,0 +1,187 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" +) + +// CheckRequestTupleKey struct for CheckRequestTupleKey +type CheckRequestTupleKey struct { + User *string `json:"user,omitempty"` + Relation *string `json:"relation,omitempty"` + Object *string `json:"object,omitempty"` +} + +// NewCheckRequestTupleKey instantiates a new CheckRequestTupleKey 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 NewCheckRequestTupleKey() *CheckRequestTupleKey { + this := CheckRequestTupleKey{} + return &this +} + +// NewCheckRequestTupleKeyWithDefaults instantiates a new CheckRequestTupleKey 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 NewCheckRequestTupleKeyWithDefaults() *CheckRequestTupleKey { + this := CheckRequestTupleKey{} + return &this +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *CheckRequestTupleKey) GetUser() string { + if o == nil || o.User == nil { + var ret string + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckRequestTupleKey) GetUserOk() (*string, bool) { + if o == nil || o.User == nil { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *CheckRequestTupleKey) HasUser() bool { + if o != nil && o.User != nil { + return true + } + + return false +} + +// SetUser gets a reference to the given string and assigns it to the User field. +func (o *CheckRequestTupleKey) SetUser(v string) { + o.User = &v +} + +// GetRelation returns the Relation field value if set, zero value otherwise. +func (o *CheckRequestTupleKey) GetRelation() string { + if o == nil || o.Relation == nil { + var ret string + return ret + } + return *o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckRequestTupleKey) GetRelationOk() (*string, bool) { + if o == nil || o.Relation == nil { + return nil, false + } + return o.Relation, true +} + +// HasRelation returns a boolean if a field has been set. +func (o *CheckRequestTupleKey) HasRelation() bool { + if o != nil && o.Relation != nil { + return true + } + + return false +} + +// SetRelation gets a reference to the given string and assigns it to the Relation field. +func (o *CheckRequestTupleKey) SetRelation(v string) { + o.Relation = &v +} + +// GetObject returns the Object field value if set, zero value otherwise. +func (o *CheckRequestTupleKey) GetObject() string { + if o == nil || o.Object == nil { + var ret string + return ret + } + return *o.Object +} + +// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CheckRequestTupleKey) GetObjectOk() (*string, bool) { + if o == nil || o.Object == nil { + return nil, false + } + return o.Object, true +} + +// HasObject returns a boolean if a field has been set. +func (o *CheckRequestTupleKey) HasObject() bool { + if o != nil && o.Object != nil { + return true + } + + return false +} + +// SetObject gets a reference to the given string and assigns it to the Object field. +func (o *CheckRequestTupleKey) SetObject(v string) { + o.Object = &v +} + +func (o CheckRequestTupleKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.User != nil { + toSerialize["user"] = o.User + } + if o.Relation != nil { + toSerialize["relation"] = o.Relation + } + if o.Object != nil { + toSerialize["object"] = o.Object + } + return json.Marshal(toSerialize) +} + +type NullableCheckRequestTupleKey struct { + value *CheckRequestTupleKey + isSet bool +} + +func (v NullableCheckRequestTupleKey) Get() *CheckRequestTupleKey { + return v.value +} + +func (v *NullableCheckRequestTupleKey) Set(val *CheckRequestTupleKey) { + v.value = val + v.isSet = true +} + +func (v NullableCheckRequestTupleKey) IsSet() bool { + return v.isSet +} + +func (v *NullableCheckRequestTupleKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCheckRequestTupleKey(val *CheckRequestTupleKey) *NullableCheckRequestTupleKey { + return &NullableCheckRequestTupleKey{value: val, isSet: true} +} + +func (v NullableCheckRequestTupleKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCheckRequestTupleKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_condition.go b/model_condition.go new file mode 100644 index 0000000..36d73e3 --- /dev/null +++ b/model_condition.go @@ -0,0 +1,175 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" +) + +// Condition struct for Condition +type Condition struct { + Name string `json:"name"` + // A Google CEL expression, expressed as a string. + Expression string `json:"expression"` + // A map of parameter names to the parameter's defined type reference. + Parameters *map[string]ConditionParamTypeRef `json:"parameters,omitempty"` +} + +// NewCondition instantiates a new Condition 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 NewCondition(name string, expression string) *Condition { + this := Condition{} + this.Name = name + this.Expression = expression + return &this +} + +// NewConditionWithDefaults instantiates a new Condition 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 NewConditionWithDefaults() *Condition { + this := Condition{} + return &this +} + +// GetName returns the Name field value +func (o *Condition) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Condition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Condition) SetName(v string) { + o.Name = v +} + +// GetExpression returns the Expression field value +func (o *Condition) GetExpression() string { + if o == nil { + var ret string + return ret + } + + return o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value +// and a boolean to check if the value has been set. +func (o *Condition) GetExpressionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Expression, true +} + +// SetExpression sets field value +func (o *Condition) SetExpression(v string) { + o.Expression = v +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *Condition) GetParameters() map[string]ConditionParamTypeRef { + if o == nil || o.Parameters == nil { + var ret map[string]ConditionParamTypeRef + return ret + } + return *o.Parameters +} + +// GetParametersOk returns a tuple with the Parameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Condition) GetParametersOk() (*map[string]ConditionParamTypeRef, bool) { + if o == nil || o.Parameters == nil { + return nil, false + } + return o.Parameters, true +} + +// HasParameters returns a boolean if a field has been set. +func (o *Condition) HasParameters() bool { + if o != nil && o.Parameters != nil { + return true + } + + return false +} + +// SetParameters gets a reference to the given map[string]ConditionParamTypeRef and assigns it to the Parameters field. +func (o *Condition) SetParameters(v map[string]ConditionParamTypeRef) { + o.Parameters = &v +} + +func (o Condition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["name"] = o.Name + } + if true { + toSerialize["expression"] = o.Expression + } + if o.Parameters != nil { + toSerialize["parameters"] = o.Parameters + } + return json.Marshal(toSerialize) +} + +type NullableCondition struct { + value *Condition + isSet bool +} + +func (v NullableCondition) Get() *Condition { + return v.value +} + +func (v *NullableCondition) Set(val *Condition) { + v.value = val + v.isSet = true +} + +func (v NullableCondition) IsSet() bool { + return v.isSet +} + +func (v *NullableCondition) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCondition(val *Condition) *NullableCondition { + return &NullableCondition{value: val, isSet: true} +} + +func (v NullableCondition) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCondition) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_condition_param_type_ref.go b/model_condition_param_type_ref.go new file mode 100644 index 0000000..6dbb121 --- /dev/null +++ b/model_condition_param_type_ref.go @@ -0,0 +1,146 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" +) + +// ConditionParamTypeRef struct for ConditionParamTypeRef +type ConditionParamTypeRef struct { + TypeName TypeName `json:"typeName"` + GenericTypes *[]ConditionParamTypeRef `json:"genericTypes,omitempty"` +} + +// NewConditionParamTypeRef instantiates a new ConditionParamTypeRef 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 NewConditionParamTypeRef(typeName TypeName) *ConditionParamTypeRef { + this := ConditionParamTypeRef{} + this.TypeName = typeName + return &this +} + +// NewConditionParamTypeRefWithDefaults instantiates a new ConditionParamTypeRef 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 NewConditionParamTypeRefWithDefaults() *ConditionParamTypeRef { + this := ConditionParamTypeRef{} + var typeName TypeName = UNSPECIFIED + this.TypeName = typeName + return &this +} + +// GetTypeName returns the TypeName field value +func (o *ConditionParamTypeRef) GetTypeName() TypeName { + if o == nil { + var ret TypeName + return ret + } + + return o.TypeName +} + +// GetTypeNameOk returns a tuple with the TypeName field value +// and a boolean to check if the value has been set. +func (o *ConditionParamTypeRef) GetTypeNameOk() (*TypeName, bool) { + if o == nil { + return nil, false + } + return &o.TypeName, true +} + +// SetTypeName sets field value +func (o *ConditionParamTypeRef) SetTypeName(v TypeName) { + o.TypeName = v +} + +// GetGenericTypes returns the GenericTypes field value if set, zero value otherwise. +func (o *ConditionParamTypeRef) GetGenericTypes() []ConditionParamTypeRef { + if o == nil || o.GenericTypes == nil { + var ret []ConditionParamTypeRef + return ret + } + return *o.GenericTypes +} + +// GetGenericTypesOk returns a tuple with the GenericTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConditionParamTypeRef) GetGenericTypesOk() (*[]ConditionParamTypeRef, bool) { + if o == nil || o.GenericTypes == nil { + return nil, false + } + return o.GenericTypes, true +} + +// HasGenericTypes returns a boolean if a field has been set. +func (o *ConditionParamTypeRef) HasGenericTypes() bool { + if o != nil && o.GenericTypes != nil { + return true + } + + return false +} + +// SetGenericTypes gets a reference to the given []ConditionParamTypeRef and assigns it to the GenericTypes field. +func (o *ConditionParamTypeRef) SetGenericTypes(v []ConditionParamTypeRef) { + o.GenericTypes = &v +} + +func (o ConditionParamTypeRef) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["typeName"] = o.TypeName + } + if o.GenericTypes != nil { + toSerialize["genericTypes"] = o.GenericTypes + } + return json.Marshal(toSerialize) +} + +type NullableConditionParamTypeRef struct { + value *ConditionParamTypeRef + isSet bool +} + +func (v NullableConditionParamTypeRef) Get() *ConditionParamTypeRef { + return v.value +} + +func (v *NullableConditionParamTypeRef) Set(val *ConditionParamTypeRef) { + v.value = val + v.isSet = true +} + +func (v NullableConditionParamTypeRef) IsSet() bool { + return v.isSet +} + +func (v *NullableConditionParamTypeRef) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConditionParamTypeRef(val *ConditionParamTypeRef) *NullableConditionParamTypeRef { + return &NullableConditionParamTypeRef{value: val, isSet: true} +} + +func (v NullableConditionParamTypeRef) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConditionParamTypeRef) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_expand_request.go b/model_expand_request.go index 3a77915..e105c04 100644 --- a/model_expand_request.go +++ b/model_expand_request.go @@ -18,15 +18,15 @@ import ( // ExpandRequest struct for ExpandRequest type ExpandRequest struct { - TupleKey TupleKey `json:"tuple_key"` - AuthorizationModelId *string `json:"authorization_model_id,omitempty"` + TupleKey ExpandRequestTupleKey `json:"tuple_key"` + AuthorizationModelId *string `json:"authorization_model_id,omitempty"` } // NewExpandRequest instantiates a new ExpandRequest 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 NewExpandRequest(tupleKey TupleKey) *ExpandRequest { +func NewExpandRequest(tupleKey ExpandRequestTupleKey) *ExpandRequest { this := ExpandRequest{} this.TupleKey = tupleKey return &this @@ -41,9 +41,9 @@ func NewExpandRequestWithDefaults() *ExpandRequest { } // GetTupleKey returns the TupleKey field value -func (o *ExpandRequest) GetTupleKey() TupleKey { +func (o *ExpandRequest) GetTupleKey() ExpandRequestTupleKey { if o == nil { - var ret TupleKey + var ret ExpandRequestTupleKey return ret } @@ -52,7 +52,7 @@ func (o *ExpandRequest) GetTupleKey() TupleKey { // GetTupleKeyOk returns a tuple with the TupleKey field value // and a boolean to check if the value has been set. -func (o *ExpandRequest) GetTupleKeyOk() (*TupleKey, bool) { +func (o *ExpandRequest) GetTupleKeyOk() (*ExpandRequestTupleKey, bool) { if o == nil { return nil, false } @@ -60,7 +60,7 @@ func (o *ExpandRequest) GetTupleKeyOk() (*TupleKey, bool) { } // SetTupleKey sets field value -func (o *ExpandRequest) SetTupleKey(v TupleKey) { +func (o *ExpandRequest) SetTupleKey(v ExpandRequestTupleKey) { o.TupleKey = v } diff --git a/model_expand_request_tuple_key.go b/model_expand_request_tuple_key.go new file mode 100644 index 0000000..a44ef83 --- /dev/null +++ b/model_expand_request_tuple_key.go @@ -0,0 +1,151 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" +) + +// ExpandRequestTupleKey struct for ExpandRequestTupleKey +type ExpandRequestTupleKey struct { + Object *string `json:"object,omitempty"` + Relation *string `json:"relation,omitempty"` +} + +// NewExpandRequestTupleKey instantiates a new ExpandRequestTupleKey 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 NewExpandRequestTupleKey() *ExpandRequestTupleKey { + this := ExpandRequestTupleKey{} + return &this +} + +// NewExpandRequestTupleKeyWithDefaults instantiates a new ExpandRequestTupleKey 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 NewExpandRequestTupleKeyWithDefaults() *ExpandRequestTupleKey { + this := ExpandRequestTupleKey{} + return &this +} + +// GetObject returns the Object field value if set, zero value otherwise. +func (o *ExpandRequestTupleKey) GetObject() string { + if o == nil || o.Object == nil { + var ret string + return ret + } + return *o.Object +} + +// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExpandRequestTupleKey) GetObjectOk() (*string, bool) { + if o == nil || o.Object == nil { + return nil, false + } + return o.Object, true +} + +// HasObject returns a boolean if a field has been set. +func (o *ExpandRequestTupleKey) HasObject() bool { + if o != nil && o.Object != nil { + return true + } + + return false +} + +// SetObject gets a reference to the given string and assigns it to the Object field. +func (o *ExpandRequestTupleKey) SetObject(v string) { + o.Object = &v +} + +// GetRelation returns the Relation field value if set, zero value otherwise. +func (o *ExpandRequestTupleKey) GetRelation() string { + if o == nil || o.Relation == nil { + var ret string + return ret + } + return *o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExpandRequestTupleKey) GetRelationOk() (*string, bool) { + if o == nil || o.Relation == nil { + return nil, false + } + return o.Relation, true +} + +// HasRelation returns a boolean if a field has been set. +func (o *ExpandRequestTupleKey) HasRelation() bool { + if o != nil && o.Relation != nil { + return true + } + + return false +} + +// SetRelation gets a reference to the given string and assigns it to the Relation field. +func (o *ExpandRequestTupleKey) SetRelation(v string) { + o.Relation = &v +} + +func (o ExpandRequestTupleKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Object != nil { + toSerialize["object"] = o.Object + } + if o.Relation != nil { + toSerialize["relation"] = o.Relation + } + return json.Marshal(toSerialize) +} + +type NullableExpandRequestTupleKey struct { + value *ExpandRequestTupleKey + isSet bool +} + +func (v NullableExpandRequestTupleKey) Get() *ExpandRequestTupleKey { + return v.value +} + +func (v *NullableExpandRequestTupleKey) Set(val *ExpandRequestTupleKey) { + v.value = val + v.isSet = true +} + +func (v NullableExpandRequestTupleKey) IsSet() bool { + return v.isSet +} + +func (v *NullableExpandRequestTupleKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExpandRequestTupleKey(val *ExpandRequestTupleKey) *NullableExpandRequestTupleKey { + return &NullableExpandRequestTupleKey{value: val, isSet: true} +} + +func (v NullableExpandRequestTupleKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExpandRequestTupleKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_list_objects_request.go b/model_list_objects_request.go index 8c0d51c..abeff1b 100644 --- a/model_list_objects_request.go +++ b/model_list_objects_request.go @@ -23,6 +23,8 @@ type ListObjectsRequest struct { Relation string `json:"relation"` User string `json:"user"` ContextualTuples *ContextualTupleKeys `json:"contextual_tuples,omitempty"` + // Additional request context that will be used to evaluate any ABAC conditions encountered in the query evaluation. + Context *map[string]interface{} `json:"context,omitempty"` } // NewListObjectsRequest instantiates a new ListObjectsRequest object @@ -181,6 +183,38 @@ func (o *ListObjectsRequest) SetContextualTuples(v ContextualTupleKeys) { o.ContextualTuples = &v } +// GetContext returns the Context field value if set, zero value otherwise. +func (o *ListObjectsRequest) GetContext() map[string]interface{} { + if o == nil || o.Context == nil { + var ret map[string]interface{} + return ret + } + return *o.Context +} + +// GetContextOk returns a tuple with the Context field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListObjectsRequest) GetContextOk() (*map[string]interface{}, bool) { + if o == nil || o.Context == nil { + return nil, false + } + return o.Context, true +} + +// HasContext returns a boolean if a field has been set. +func (o *ListObjectsRequest) HasContext() bool { + if o != nil && o.Context != nil { + return true + } + + return false +} + +// SetContext gets a reference to the given map[string]interface{} and assigns it to the Context field. +func (o *ListObjectsRequest) SetContext(v map[string]interface{}) { + o.Context = &v +} + func (o ListObjectsRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.AuthorizationModelId != nil { @@ -198,6 +232,9 @@ func (o ListObjectsRequest) MarshalJSON() ([]byte, error) { if o.ContextualTuples != nil { toSerialize["contextual_tuples"] = o.ContextualTuples } + if o.Context != nil { + toSerialize["context"] = o.Context + } return json.Marshal(toSerialize) } diff --git a/model_null_value.go b/model_null_value.go new file mode 100644 index 0000000..e409c1c --- /dev/null +++ b/model_null_value.go @@ -0,0 +1,109 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" + "fmt" +) + +// NullValue `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value. +type NullValue string + +// List of NullValue +const ( + NULL_VALUE NullValue = "NULL_VALUE" +) + +var allowedNullValueEnumValues = []NullValue{ + "NULL_VALUE", +} + +func (v *NullValue) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := NullValue(value) + for _, existing := range allowedNullValueEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid NullValue", value) +} + +// NewNullValueFromValue returns a pointer to a valid NullValue +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewNullValueFromValue(v string) (*NullValue, error) { + ev := NullValue(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for NullValue: valid values are %v", v, allowedNullValueEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v NullValue) IsValid() bool { + for _, existing := range allowedNullValueEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NullValue value +func (v NullValue) Ptr() *NullValue { + return &v +} + +type NullableNullValue struct { + value *NullValue + isSet bool +} + +func (v NullableNullValue) Get() *NullValue { + return v.value +} + +func (v *NullableNullValue) Set(val *NullValue) { + v.value = val + v.isSet = true +} + +func (v NullableNullValue) IsSet() bool { + return v.isSet +} + +func (v *NullableNullValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNullValue(val *NullValue) *NullableNullValue { + return &NullableNullValue{value: val, isSet: true} +} + +func (v NullableNullValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNullValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_read_request.go b/model_read_request.go index 483b057..8a7c690 100644 --- a/model_read_request.go +++ b/model_read_request.go @@ -18,9 +18,9 @@ import ( // ReadRequest struct for ReadRequest type ReadRequest struct { - TupleKey *TupleKey `json:"tuple_key,omitempty"` - PageSize *int32 `json:"page_size,omitempty"` - ContinuationToken *string `json:"continuation_token,omitempty"` + TupleKey *ReadRequestTupleKey `json:"tuple_key,omitempty"` + PageSize *int32 `json:"page_size,omitempty"` + ContinuationToken *string `json:"continuation_token,omitempty"` } // NewReadRequest instantiates a new ReadRequest object @@ -41,9 +41,9 @@ func NewReadRequestWithDefaults() *ReadRequest { } // GetTupleKey returns the TupleKey field value if set, zero value otherwise. -func (o *ReadRequest) GetTupleKey() TupleKey { +func (o *ReadRequest) GetTupleKey() ReadRequestTupleKey { if o == nil || o.TupleKey == nil { - var ret TupleKey + var ret ReadRequestTupleKey return ret } return *o.TupleKey @@ -51,7 +51,7 @@ func (o *ReadRequest) GetTupleKey() TupleKey { // GetTupleKeyOk returns a tuple with the TupleKey field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *ReadRequest) GetTupleKeyOk() (*TupleKey, bool) { +func (o *ReadRequest) GetTupleKeyOk() (*ReadRequestTupleKey, bool) { if o == nil || o.TupleKey == nil { return nil, false } @@ -67,8 +67,8 @@ func (o *ReadRequest) HasTupleKey() bool { return false } -// SetTupleKey gets a reference to the given TupleKey and assigns it to the TupleKey field. -func (o *ReadRequest) SetTupleKey(v TupleKey) { +// SetTupleKey gets a reference to the given ReadRequestTupleKey and assigns it to the TupleKey field. +func (o *ReadRequest) SetTupleKey(v ReadRequestTupleKey) { o.TupleKey = &v } diff --git a/model_read_request_tuple_key.go b/model_read_request_tuple_key.go new file mode 100644 index 0000000..6f3cd8c --- /dev/null +++ b/model_read_request_tuple_key.go @@ -0,0 +1,187 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" +) + +// ReadRequestTupleKey struct for ReadRequestTupleKey +type ReadRequestTupleKey struct { + User *string `json:"user,omitempty"` + Relation *string `json:"relation,omitempty"` + Object *string `json:"object,omitempty"` +} + +// NewReadRequestTupleKey instantiates a new ReadRequestTupleKey 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 NewReadRequestTupleKey() *ReadRequestTupleKey { + this := ReadRequestTupleKey{} + return &this +} + +// NewReadRequestTupleKeyWithDefaults instantiates a new ReadRequestTupleKey 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 NewReadRequestTupleKeyWithDefaults() *ReadRequestTupleKey { + this := ReadRequestTupleKey{} + return &this +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *ReadRequestTupleKey) GetUser() string { + if o == nil || o.User == nil { + var ret string + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadRequestTupleKey) GetUserOk() (*string, bool) { + if o == nil || o.User == nil { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *ReadRequestTupleKey) HasUser() bool { + if o != nil && o.User != nil { + return true + } + + return false +} + +// SetUser gets a reference to the given string and assigns it to the User field. +func (o *ReadRequestTupleKey) SetUser(v string) { + o.User = &v +} + +// GetRelation returns the Relation field value if set, zero value otherwise. +func (o *ReadRequestTupleKey) GetRelation() string { + if o == nil || o.Relation == nil { + var ret string + return ret + } + return *o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadRequestTupleKey) GetRelationOk() (*string, bool) { + if o == nil || o.Relation == nil { + return nil, false + } + return o.Relation, true +} + +// HasRelation returns a boolean if a field has been set. +func (o *ReadRequestTupleKey) HasRelation() bool { + if o != nil && o.Relation != nil { + return true + } + + return false +} + +// SetRelation gets a reference to the given string and assigns it to the Relation field. +func (o *ReadRequestTupleKey) SetRelation(v string) { + o.Relation = &v +} + +// GetObject returns the Object field value if set, zero value otherwise. +func (o *ReadRequestTupleKey) GetObject() string { + if o == nil || o.Object == nil { + var ret string + return ret + } + return *o.Object +} + +// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadRequestTupleKey) GetObjectOk() (*string, bool) { + if o == nil || o.Object == nil { + return nil, false + } + return o.Object, true +} + +// HasObject returns a boolean if a field has been set. +func (o *ReadRequestTupleKey) HasObject() bool { + if o != nil && o.Object != nil { + return true + } + + return false +} + +// SetObject gets a reference to the given string and assigns it to the Object field. +func (o *ReadRequestTupleKey) SetObject(v string) { + o.Object = &v +} + +func (o ReadRequestTupleKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.User != nil { + toSerialize["user"] = o.User + } + if o.Relation != nil { + toSerialize["relation"] = o.Relation + } + if o.Object != nil { + toSerialize["object"] = o.Object + } + return json.Marshal(toSerialize) +} + +type NullableReadRequestTupleKey struct { + value *ReadRequestTupleKey + isSet bool +} + +func (v NullableReadRequestTupleKey) Get() *ReadRequestTupleKey { + return v.value +} + +func (v *NullableReadRequestTupleKey) Set(val *ReadRequestTupleKey) { + v.value = val + v.isSet = true +} + +func (v NullableReadRequestTupleKey) IsSet() bool { + return v.isSet +} + +func (v *NullableReadRequestTupleKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReadRequestTupleKey(val *ReadRequestTupleKey) *NullableReadRequestTupleKey { + return &NullableReadRequestTupleKey{value: val, isSet: true} +} + +func (v NullableReadRequestTupleKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReadRequestTupleKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_relation_reference.go b/model_relation_reference.go index 2d901b1..3d6441e 100644 --- a/model_relation_reference.go +++ b/model_relation_reference.go @@ -21,6 +21,8 @@ type RelationReference struct { Type string `json:"type"` Relation *string `json:"relation,omitempty"` Wildcard *map[string]interface{} `json:"wildcard,omitempty"` + // The name of a condition that is enforced over the allowed relation. + Condition *string `json:"condition,omitempty"` } // NewRelationReference instantiates a new RelationReference object @@ -129,6 +131,38 @@ func (o *RelationReference) SetWildcard(v map[string]interface{}) { o.Wildcard = &v } +// GetCondition returns the Condition field value if set, zero value otherwise. +func (o *RelationReference) GetCondition() string { + if o == nil || o.Condition == nil { + var ret string + return ret + } + return *o.Condition +} + +// GetConditionOk returns a tuple with the Condition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationReference) GetConditionOk() (*string, bool) { + if o == nil || o.Condition == nil { + return nil, false + } + return o.Condition, true +} + +// HasCondition returns a boolean if a field has been set. +func (o *RelationReference) HasCondition() bool { + if o != nil && o.Condition != nil { + return true + } + + return false +} + +// SetCondition gets a reference to the given string and assigns it to the Condition field. +func (o *RelationReference) SetCondition(v string) { + o.Condition = &v +} + func (o RelationReference) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { @@ -140,6 +174,9 @@ func (o RelationReference) MarshalJSON() ([]byte, error) { if o.Wildcard != nil { toSerialize["wildcard"] = o.Wildcard } + if o.Condition != nil { + toSerialize["condition"] = o.Condition + } return json.Marshal(toSerialize) } diff --git a/model_relationship_condition.go b/model_relationship_condition.go new file mode 100644 index 0000000..bd292e0 --- /dev/null +++ b/model_relationship_condition.go @@ -0,0 +1,146 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" +) + +// RelationshipCondition struct for RelationshipCondition +type RelationshipCondition struct { + // A reference (by name) of the relationship condition defined in the authorization model. + ConditionName string `json:"conditionName"` + // Additional context/data to persist along with the condition. The keys must match the parameters defined by the condition, and the value types must match the parameter type definitions. + Context *map[string]interface{} `json:"context,omitempty"` +} + +// NewRelationshipCondition instantiates a new RelationshipCondition 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 NewRelationshipCondition(conditionName string) *RelationshipCondition { + this := RelationshipCondition{} + this.ConditionName = conditionName + return &this +} + +// NewRelationshipConditionWithDefaults instantiates a new RelationshipCondition 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 NewRelationshipConditionWithDefaults() *RelationshipCondition { + this := RelationshipCondition{} + return &this +} + +// GetConditionName returns the ConditionName field value +func (o *RelationshipCondition) GetConditionName() string { + if o == nil { + var ret string + return ret + } + + return o.ConditionName +} + +// GetConditionNameOk returns a tuple with the ConditionName field value +// and a boolean to check if the value has been set. +func (o *RelationshipCondition) GetConditionNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ConditionName, true +} + +// SetConditionName sets field value +func (o *RelationshipCondition) SetConditionName(v string) { + o.ConditionName = v +} + +// GetContext returns the Context field value if set, zero value otherwise. +func (o *RelationshipCondition) GetContext() map[string]interface{} { + if o == nil || o.Context == nil { + var ret map[string]interface{} + return ret + } + return *o.Context +} + +// GetContextOk returns a tuple with the Context field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RelationshipCondition) GetContextOk() (*map[string]interface{}, bool) { + if o == nil || o.Context == nil { + return nil, false + } + return o.Context, true +} + +// HasContext returns a boolean if a field has been set. +func (o *RelationshipCondition) HasContext() bool { + if o != nil && o.Context != nil { + return true + } + + return false +} + +// SetContext gets a reference to the given map[string]interface{} and assigns it to the Context field. +func (o *RelationshipCondition) SetContext(v map[string]interface{}) { + o.Context = &v +} + +func (o RelationshipCondition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["conditionName"] = o.ConditionName + } + if o.Context != nil { + toSerialize["context"] = o.Context + } + return json.Marshal(toSerialize) +} + +type NullableRelationshipCondition struct { + value *RelationshipCondition + isSet bool +} + +func (v NullableRelationshipCondition) Get() *RelationshipCondition { + return v.value +} + +func (v *NullableRelationshipCondition) Set(val *RelationshipCondition) { + v.value = val + v.isSet = true +} + +func (v NullableRelationshipCondition) IsSet() bool { + return v.isSet +} + +func (v *NullableRelationshipCondition) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRelationshipCondition(val *RelationshipCondition) *NullableRelationshipCondition { + return &NullableRelationshipCondition{value: val, isSet: true} +} + +func (v NullableRelationshipCondition) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRelationshipCondition) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_tuple_key.go b/model_tuple_key.go index 81bdaf4..50c0d99 100644 --- a/model_tuple_key.go +++ b/model_tuple_key.go @@ -18,9 +18,10 @@ import ( // TupleKey struct for TupleKey type TupleKey struct { - Object *string `json:"object,omitempty"` - Relation *string `json:"relation,omitempty"` - User *string `json:"user,omitempty"` + Object *string `json:"object,omitempty"` + Relation *string `json:"relation,omitempty"` + User *string `json:"user,omitempty"` + Condition *RelationshipCondition `json:"condition,omitempty"` } // NewTupleKey instantiates a new TupleKey object @@ -136,6 +137,38 @@ func (o *TupleKey) SetUser(v string) { o.User = &v } +// GetCondition returns the Condition field value if set, zero value otherwise. +func (o *TupleKey) GetCondition() RelationshipCondition { + if o == nil || o.Condition == nil { + var ret RelationshipCondition + return ret + } + return *o.Condition +} + +// GetConditionOk returns a tuple with the Condition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TupleKey) GetConditionOk() (*RelationshipCondition, bool) { + if o == nil || o.Condition == nil { + return nil, false + } + return o.Condition, true +} + +// HasCondition returns a boolean if a field has been set. +func (o *TupleKey) HasCondition() bool { + if o != nil && o.Condition != nil { + return true + } + + return false +} + +// SetCondition gets a reference to the given RelationshipCondition and assigns it to the Condition field. +func (o *TupleKey) SetCondition(v RelationshipCondition) { + o.Condition = &v +} + func (o TupleKey) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Object != nil { @@ -147,6 +180,9 @@ func (o TupleKey) MarshalJSON() ([]byte, error) { if o.User != nil { toSerialize["user"] = o.User } + if o.Condition != nil { + toSerialize["condition"] = o.Condition + } return json.Marshal(toSerialize) } diff --git a/model_type_name.go b/model_type_name.go new file mode 100644 index 0000000..0f8499e --- /dev/null +++ b/model_type_name.go @@ -0,0 +1,131 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" + "fmt" +) + +// TypeName the model 'TypeName' +type TypeName string + +// List of TypeName +const ( + UNSPECIFIED TypeName = "TYPE_NAME_UNSPECIFIED" + ANY TypeName = "TYPE_NAME_ANY" + BOOL TypeName = "TYPE_NAME_BOOL" + STRING TypeName = "TYPE_NAME_STRING" + INT TypeName = "TYPE_NAME_INT" + UINT TypeName = "TYPE_NAME_UINT" + DOUBLE TypeName = "TYPE_NAME_DOUBLE" + DURATION TypeName = "TYPE_NAME_DURATION" + TIMESTAMP TypeName = "TYPE_NAME_TIMESTAMP" + MAP TypeName = "TYPE_NAME_MAP" + LIST TypeName = "TYPE_NAME_LIST" + IPADDRESS TypeName = "TYPE_NAME_IPADDRESS" +) + +var allowedTypeNameEnumValues = []TypeName{ + "TYPE_NAME_UNSPECIFIED", + "TYPE_NAME_ANY", + "TYPE_NAME_BOOL", + "TYPE_NAME_STRING", + "TYPE_NAME_INT", + "TYPE_NAME_UINT", + "TYPE_NAME_DOUBLE", + "TYPE_NAME_DURATION", + "TYPE_NAME_TIMESTAMP", + "TYPE_NAME_MAP", + "TYPE_NAME_LIST", + "TYPE_NAME_IPADDRESS", +} + +func (v *TypeName) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := TypeName(value) + for _, existing := range allowedTypeNameEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TypeName", value) +} + +// NewTypeNameFromValue returns a pointer to a valid TypeName +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTypeNameFromValue(v string) (*TypeName, error) { + ev := TypeName(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TypeName: valid values are %v", v, allowedTypeNameEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TypeName) IsValid() bool { + for _, existing := range allowedTypeNameEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeName value +func (v TypeName) Ptr() *TypeName { + return &v +} + +type NullableTypeName struct { + value *TypeName + isSet bool +} + +func (v NullableTypeName) Get() *TypeName { + return v.value +} + +func (v *NullableTypeName) Set(val *TypeName) { + v.value = val + v.isSet = true +} + +func (v NullableTypeName) IsSet() bool { + return v.isSet +} + +func (v *NullableTypeName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTypeName(val *TypeName) *NullableTypeName { + return &NullableTypeName{value: val, isSet: true} +} + +func (v NullableTypeName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTypeName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_write_authorization_model_request.go b/model_write_authorization_model_request.go index b25570d..8668673 100644 --- a/model_write_authorization_model_request.go +++ b/model_write_authorization_model_request.go @@ -18,8 +18,9 @@ import ( // WriteAuthorizationModelRequest struct for WriteAuthorizationModelRequest type WriteAuthorizationModelRequest struct { - TypeDefinitions []TypeDefinition `json:"type_definitions"` - SchemaVersion *string `json:"schema_version,omitempty"` + TypeDefinitions []TypeDefinition `json:"type_definitions"` + SchemaVersion *string `json:"schema_version,omitempty"` + Conditions *map[string]Condition `json:"conditions,omitempty"` } // NewWriteAuthorizationModelRequest instantiates a new WriteAuthorizationModelRequest object @@ -96,6 +97,38 @@ func (o *WriteAuthorizationModelRequest) SetSchemaVersion(v string) { o.SchemaVersion = &v } +// GetConditions returns the Conditions field value if set, zero value otherwise. +func (o *WriteAuthorizationModelRequest) GetConditions() map[string]Condition { + if o == nil || o.Conditions == nil { + var ret map[string]Condition + return ret + } + return *o.Conditions +} + +// GetConditionsOk returns a tuple with the Conditions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WriteAuthorizationModelRequest) GetConditionsOk() (*map[string]Condition, bool) { + if o == nil || o.Conditions == nil { + return nil, false + } + return o.Conditions, true +} + +// HasConditions returns a boolean if a field has been set. +func (o *WriteAuthorizationModelRequest) HasConditions() bool { + if o != nil && o.Conditions != nil { + return true + } + + return false +} + +// SetConditions gets a reference to the given map[string]Condition and assigns it to the Conditions field. +func (o *WriteAuthorizationModelRequest) SetConditions(v map[string]Condition) { + o.Conditions = &v +} + func (o WriteAuthorizationModelRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { @@ -104,6 +137,9 @@ func (o WriteAuthorizationModelRequest) MarshalJSON() ([]byte, error) { if o.SchemaVersion != nil { toSerialize["schema_version"] = o.SchemaVersion } + if o.Conditions != nil { + toSerialize["conditions"] = o.Conditions + } return json.Marshal(toSerialize) } diff --git a/model_write_request.go b/model_write_request.go index 9567efa..6099d88 100644 --- a/model_write_request.go +++ b/model_write_request.go @@ -18,9 +18,9 @@ import ( // WriteRequest struct for WriteRequest type WriteRequest struct { - Writes *TupleKeys `json:"writes,omitempty"` - Deletes *TupleKeys `json:"deletes,omitempty"` - AuthorizationModelId *string `json:"authorization_model_id,omitempty"` + Writes *WriteRequestTupleKeys `json:"writes,omitempty"` + Deletes *WriteRequestTupleKeys `json:"deletes,omitempty"` + AuthorizationModelId *string `json:"authorization_model_id,omitempty"` } // NewWriteRequest instantiates a new WriteRequest object @@ -41,9 +41,9 @@ func NewWriteRequestWithDefaults() *WriteRequest { } // GetWrites returns the Writes field value if set, zero value otherwise. -func (o *WriteRequest) GetWrites() TupleKeys { +func (o *WriteRequest) GetWrites() WriteRequestTupleKeys { if o == nil || o.Writes == nil { - var ret TupleKeys + var ret WriteRequestTupleKeys return ret } return *o.Writes @@ -51,7 +51,7 @@ func (o *WriteRequest) GetWrites() TupleKeys { // GetWritesOk returns a tuple with the Writes field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *WriteRequest) GetWritesOk() (*TupleKeys, bool) { +func (o *WriteRequest) GetWritesOk() (*WriteRequestTupleKeys, bool) { if o == nil || o.Writes == nil { return nil, false } @@ -67,15 +67,15 @@ func (o *WriteRequest) HasWrites() bool { return false } -// SetWrites gets a reference to the given TupleKeys and assigns it to the Writes field. -func (o *WriteRequest) SetWrites(v TupleKeys) { +// SetWrites gets a reference to the given WriteRequestTupleKeys and assigns it to the Writes field. +func (o *WriteRequest) SetWrites(v WriteRequestTupleKeys) { o.Writes = &v } // GetDeletes returns the Deletes field value if set, zero value otherwise. -func (o *WriteRequest) GetDeletes() TupleKeys { +func (o *WriteRequest) GetDeletes() WriteRequestTupleKeys { if o == nil || o.Deletes == nil { - var ret TupleKeys + var ret WriteRequestTupleKeys return ret } return *o.Deletes @@ -83,7 +83,7 @@ func (o *WriteRequest) GetDeletes() TupleKeys { // GetDeletesOk returns a tuple with the Deletes field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *WriteRequest) GetDeletesOk() (*TupleKeys, bool) { +func (o *WriteRequest) GetDeletesOk() (*WriteRequestTupleKeys, bool) { if o == nil || o.Deletes == nil { return nil, false } @@ -99,8 +99,8 @@ func (o *WriteRequest) HasDeletes() bool { return false } -// SetDeletes gets a reference to the given TupleKeys and assigns it to the Deletes field. -func (o *WriteRequest) SetDeletes(v TupleKeys) { +// SetDeletes gets a reference to the given WriteRequestTupleKeys and assigns it to the Deletes field. +func (o *WriteRequest) SetDeletes(v WriteRequestTupleKeys) { o.Deletes = &v } diff --git a/model_write_request_tuple_key.go b/model_write_request_tuple_key.go new file mode 100644 index 0000000..712112c --- /dev/null +++ b/model_write_request_tuple_key.go @@ -0,0 +1,223 @@ +/** + * Go SDK for OpenFGA + * + * API version: 0.1 + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://discord.gg/8naAwJfWN6 + * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + +package openfga + +import ( + "encoding/json" +) + +// WriteRequestTupleKey struct for WriteRequestTupleKey +type WriteRequestTupleKey struct { + User *string `json:"user,omitempty"` + Relation *string `json:"relation,omitempty"` + Object *string `json:"object,omitempty"` + Condition *RelationshipCondition `json:"condition,omitempty"` +} + +// NewWriteRequestTupleKey instantiates a new WriteRequestTupleKey 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 NewWriteRequestTupleKey() *WriteRequestTupleKey { + this := WriteRequestTupleKey{} + return &this +} + +// NewWriteRequestTupleKeyWithDefaults instantiates a new WriteRequestTupleKey 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 NewWriteRequestTupleKeyWithDefaults() *WriteRequestTupleKey { + this := WriteRequestTupleKey{} + return &this +} + +// GetUser returns the User field value if set, zero value otherwise. +func (o *WriteRequestTupleKey) GetUser() string { + if o == nil || o.User == nil { + var ret string + return ret + } + return *o.User +} + +// GetUserOk returns a tuple with the User field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WriteRequestTupleKey) GetUserOk() (*string, bool) { + if o == nil || o.User == nil { + return nil, false + } + return o.User, true +} + +// HasUser returns a boolean if a field has been set. +func (o *WriteRequestTupleKey) HasUser() bool { + if o != nil && o.User != nil { + return true + } + + return false +} + +// SetUser gets a reference to the given string and assigns it to the User field. +func (o *WriteRequestTupleKey) SetUser(v string) { + o.User = &v +} + +// GetRelation returns the Relation field value if set, zero value otherwise. +func (o *WriteRequestTupleKey) GetRelation() string { + if o == nil || o.Relation == nil { + var ret string + return ret + } + return *o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WriteRequestTupleKey) GetRelationOk() (*string, bool) { + if o == nil || o.Relation == nil { + return nil, false + } + return o.Relation, true +} + +// HasRelation returns a boolean if a field has been set. +func (o *WriteRequestTupleKey) HasRelation() bool { + if o != nil && o.Relation != nil { + return true + } + + return false +} + +// SetRelation gets a reference to the given string and assigns it to the Relation field. +func (o *WriteRequestTupleKey) SetRelation(v string) { + o.Relation = &v +} + +// GetObject returns the Object field value if set, zero value otherwise. +func (o *WriteRequestTupleKey) GetObject() string { + if o == nil || o.Object == nil { + var ret string + return ret + } + return *o.Object +} + +// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WriteRequestTupleKey) GetObjectOk() (*string, bool) { + if o == nil || o.Object == nil { + return nil, false + } + return o.Object, true +} + +// HasObject returns a boolean if a field has been set. +func (o *WriteRequestTupleKey) HasObject() bool { + if o != nil && o.Object != nil { + return true + } + + return false +} + +// SetObject gets a reference to the given string and assigns it to the Object field. +func (o *WriteRequestTupleKey) SetObject(v string) { + o.Object = &v +} + +// GetCondition returns the Condition field value if set, zero value otherwise. +func (o *WriteRequestTupleKey) GetCondition() RelationshipCondition { + if o == nil || o.Condition == nil { + var ret RelationshipCondition + return ret + } + return *o.Condition +} + +// GetConditionOk returns a tuple with the Condition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WriteRequestTupleKey) GetConditionOk() (*RelationshipCondition, bool) { + if o == nil || o.Condition == nil { + return nil, false + } + return o.Condition, true +} + +// HasCondition returns a boolean if a field has been set. +func (o *WriteRequestTupleKey) HasCondition() bool { + if o != nil && o.Condition != nil { + return true + } + + return false +} + +// SetCondition gets a reference to the given RelationshipCondition and assigns it to the Condition field. +func (o *WriteRequestTupleKey) SetCondition(v RelationshipCondition) { + o.Condition = &v +} + +func (o WriteRequestTupleKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.User != nil { + toSerialize["user"] = o.User + } + if o.Relation != nil { + toSerialize["relation"] = o.Relation + } + if o.Object != nil { + toSerialize["object"] = o.Object + } + if o.Condition != nil { + toSerialize["condition"] = o.Condition + } + return json.Marshal(toSerialize) +} + +type NullableWriteRequestTupleKey struct { + value *WriteRequestTupleKey + isSet bool +} + +func (v NullableWriteRequestTupleKey) Get() *WriteRequestTupleKey { + return v.value +} + +func (v *NullableWriteRequestTupleKey) Set(val *WriteRequestTupleKey) { + v.value = val + v.isSet = true +} + +func (v NullableWriteRequestTupleKey) IsSet() bool { + return v.isSet +} + +func (v *NullableWriteRequestTupleKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWriteRequestTupleKey(val *WriteRequestTupleKey) *NullableWriteRequestTupleKey { + return &NullableWriteRequestTupleKey{value: val, isSet: true} +} + +func (v NullableWriteRequestTupleKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWriteRequestTupleKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/model_tuple_keys.go b/model_write_request_tuple_keys.go similarity index 50% rename from model_tuple_keys.go rename to model_write_request_tuple_keys.go index 3a1aedd..9a03055 100644 --- a/model_tuple_keys.go +++ b/model_write_request_tuple_keys.go @@ -16,33 +16,33 @@ import ( "encoding/json" ) -// TupleKeys struct for TupleKeys -type TupleKeys struct { - TupleKeys []TupleKey `json:"tuple_keys"` +// WriteRequestTupleKeys struct for WriteRequestTupleKeys +type WriteRequestTupleKeys struct { + TupleKeys []WriteRequestTupleKey `json:"tuple_keys"` } -// NewTupleKeys instantiates a new TupleKeys object +// NewWriteRequestTupleKeys instantiates a new WriteRequestTupleKeys 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 NewTupleKeys(tupleKeys []TupleKey) *TupleKeys { - this := TupleKeys{} +func NewWriteRequestTupleKeys(tupleKeys []WriteRequestTupleKey) *WriteRequestTupleKeys { + this := WriteRequestTupleKeys{} this.TupleKeys = tupleKeys return &this } -// NewTupleKeysWithDefaults instantiates a new TupleKeys object +// NewWriteRequestTupleKeysWithDefaults instantiates a new WriteRequestTupleKeys 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 NewTupleKeysWithDefaults() *TupleKeys { - this := TupleKeys{} +func NewWriteRequestTupleKeysWithDefaults() *WriteRequestTupleKeys { + this := WriteRequestTupleKeys{} return &this } // GetTupleKeys returns the TupleKeys field value -func (o *TupleKeys) GetTupleKeys() []TupleKey { +func (o *WriteRequestTupleKeys) GetTupleKeys() []WriteRequestTupleKey { if o == nil { - var ret []TupleKey + var ret []WriteRequestTupleKey return ret } @@ -51,7 +51,7 @@ func (o *TupleKeys) GetTupleKeys() []TupleKey { // GetTupleKeysOk returns a tuple with the TupleKeys field value // and a boolean to check if the value has been set. -func (o *TupleKeys) GetTupleKeysOk() (*[]TupleKey, bool) { +func (o *WriteRequestTupleKeys) GetTupleKeysOk() (*[]WriteRequestTupleKey, bool) { if o == nil { return nil, false } @@ -59,11 +59,11 @@ func (o *TupleKeys) GetTupleKeysOk() (*[]TupleKey, bool) { } // SetTupleKeys sets field value -func (o *TupleKeys) SetTupleKeys(v []TupleKey) { +func (o *WriteRequestTupleKeys) SetTupleKeys(v []WriteRequestTupleKey) { o.TupleKeys = v } -func (o TupleKeys) MarshalJSON() ([]byte, error) { +func (o WriteRequestTupleKeys) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { toSerialize["tuple_keys"] = o.TupleKeys @@ -71,38 +71,38 @@ func (o TupleKeys) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableTupleKeys struct { - value *TupleKeys +type NullableWriteRequestTupleKeys struct { + value *WriteRequestTupleKeys isSet bool } -func (v NullableTupleKeys) Get() *TupleKeys { +func (v NullableWriteRequestTupleKeys) Get() *WriteRequestTupleKeys { return v.value } -func (v *NullableTupleKeys) Set(val *TupleKeys) { +func (v *NullableWriteRequestTupleKeys) Set(val *WriteRequestTupleKeys) { v.value = val v.isSet = true } -func (v NullableTupleKeys) IsSet() bool { +func (v NullableWriteRequestTupleKeys) IsSet() bool { return v.isSet } -func (v *NullableTupleKeys) Unset() { +func (v *NullableWriteRequestTupleKeys) Unset() { v.value = nil v.isSet = false } -func NewNullableTupleKeys(val *TupleKeys) *NullableTupleKeys { - return &NullableTupleKeys{value: val, isSet: true} +func NewNullableWriteRequestTupleKeys(val *WriteRequestTupleKeys) *NullableWriteRequestTupleKeys { + return &NullableWriteRequestTupleKeys{value: val, isSet: true} } -func (v NullableTupleKeys) MarshalJSON() ([]byte, error) { +func (v NullableWriteRequestTupleKeys) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableTupleKeys) UnmarshalJSON(src []byte) error { +func (v *NullableWriteRequestTupleKeys) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }