diff --git a/.github/workflows/semgrep.yaml b/.github/workflows/semgrep.yaml index 44718e2..92f9ad6 100644 --- a/.github/workflows/semgrep.yaml +++ b/.github/workflows/semgrep.yaml @@ -11,7 +11,9 @@ jobs: image: returntocorp/semgrep if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot') steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.2 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 - run: semgrep ci env: SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} 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/CHANGELOG.md b/CHANGELOG.md index cbc0cd2..cbf27af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v0.3.0 + +### [0.3.0](https://github.com/openfga/go-sdk/compare/v0.2.3...v0.3.0) (2023-11-02) + +- feat!: initial support for conditions + ## v0.2.3 ### [0.2.3](https://github.com/openfga/go-sdk/compare/v0.2.2...v0.2.3) (2023-10-13) 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_test.go b/api_open_fga_test.go index 86b2fbe..af76e2f 100644 --- a/api_open_fga_test.go +++ b/api_open_fga_test.go @@ -117,14 +117,14 @@ func TestOpenFgaApiConfiguration(t *testing.T) { defer httpmock.DeactivateAndReset() httpmock.RegisterResponder("GET", fmt.Sprintf("%s://%s/stores/%s/authorization-models", configuration.ApiScheme, configuration.ApiHost, configuration.StoreId), func(req *http.Request) (*http.Response, error) { - resp, err := httpmock.NewJsonResponse(200, ReadAuthorizationModelsResponse{AuthorizationModels: &[]AuthorizationModel{ + resp, err := httpmock.NewJsonResponse(200, ReadAuthorizationModelsResponse{AuthorizationModels: []AuthorizationModel{ { Id: PtrString("01GXSA8YR785C4FYS3C0RTG7B1"), - TypeDefinitions: &[]TypeDefinition{}, + TypeDefinitions: []TypeDefinition{}, }, { Id: PtrString("01GXSBM5PVYHCJNRNKXMB4QZTW"), - TypeDefinitions: &[]TypeDefinition{}, + TypeDefinitions: []TypeDefinition{}, }, }}) if err != nil { @@ -249,14 +249,14 @@ func TestOpenFgaApiConfiguration(t *testing.T) { defer httpmock.DeactivateAndReset() httpmock.RegisterResponder("GET", fmt.Sprintf("%s://%s/stores/%s/authorization-models", configuration.ApiScheme, configuration.ApiHost, configuration.StoreId), func(req *http.Request) (*http.Response, error) { - resp, err := httpmock.NewJsonResponse(200, ReadAuthorizationModelsResponse{AuthorizationModels: &[]AuthorizationModel{ + resp, err := httpmock.NewJsonResponse(200, ReadAuthorizationModelsResponse{AuthorizationModels: []AuthorizationModel{ { Id: PtrString("01GXSA8YR785C4FYS3C0RTG7B1"), - TypeDefinitions: &[]TypeDefinition{}, + TypeDefinitions: []TypeDefinition{}, }, { Id: PtrString("01GXSBM5PVYHCJNRNKXMB4QZTW"), - TypeDefinitions: &[]TypeDefinition{}, + TypeDefinitions: []TypeDefinition{}, }, }}) if err != nil { @@ -313,14 +313,14 @@ func TestOpenFgaApiConfiguration(t *testing.T) { defer httpmock.DeactivateAndReset() httpmock.RegisterResponder("GET", fmt.Sprintf("%s://%s/stores/%s/authorization-models", configuration.ApiScheme, configuration.ApiHost, configuration.StoreId), func(req *http.Request) (*http.Response, error) { - resp, err := httpmock.NewJsonResponse(200, ReadAuthorizationModelsResponse{AuthorizationModels: &[]AuthorizationModel{ + resp, err := httpmock.NewJsonResponse(200, ReadAuthorizationModelsResponse{AuthorizationModels: []AuthorizationModel{ { Id: PtrString("01GXSA8YR785C4FYS3C0RTG7B1"), - TypeDefinitions: &[]TypeDefinition{}, + TypeDefinitions: []TypeDefinition{}, }, { Id: PtrString("01GXSBM5PVYHCJNRNKXMB4QZTW"), - TypeDefinitions: &[]TypeDefinition{}, + TypeDefinitions: []TypeDefinition{}, }, }}) if err != nil { @@ -447,12 +447,12 @@ func TestOpenFgaApi(t *testing.T) { t.Fatalf("OpenFga%v().Execute() = %v, want %v", test.Name, response.StatusCode, test.ResponseStatus) } - if len(*got.AuthorizationModels) != 1 { + if len(got.AuthorizationModels) != 1 { t.Fatalf("%v", err) } - if *((*got.AuthorizationModels)[0].Id) != *((*expectedResponse.AuthorizationModels)[0].Id) { - t.Fatalf("OpenFga%v().Execute() = %v, want %v", test.Name, *((*got.AuthorizationModels)[0].Id), *((*expectedResponse.AuthorizationModels)[0].Id)) + if *(got.AuthorizationModels[0].Id) != *(expectedResponse.AuthorizationModels[0].Id) { + t.Fatalf("OpenFga%v().Execute() = %v, want %v", test.Name, *(got.AuthorizationModels[0].Id), *(expectedResponse.AuthorizationModels[0].Id)) } }) @@ -472,7 +472,7 @@ func TestOpenFgaApi(t *testing.T) { This: &map[string]interface{}{}, }, "viewer": {Union: &Usersets{ - Child: &[]Userset{ + Child: []Userset{ {This: &map[string]interface{}{}}, {ComputedUserset: &ObjectRelation{ Object: PtrString(""), @@ -569,10 +569,10 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + TupleKey: CheckRequestTupleKey{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }, AuthorizationModelId: PtrString("01GAHCE4YVKPQEKZQHT2R89MQV"), } @@ -621,11 +621,11 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "write", } requestBody := WriteRequest{ - Writes: &TupleKeys{ - TupleKeys: []TupleKey{{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + Writes: &WriteRequestTupleKeys{ + TupleKeys: []WriteRequestTupleKey{{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }}, }, AuthorizationModelId: PtrString("01GAHCE4YVKPQEKZQHT2R89MQV"), @@ -667,11 +667,11 @@ func TestOpenFgaApi(t *testing.T) { } requestBody := WriteRequest{ - Deletes: &TupleKeys{ - TupleKeys: []TupleKey{{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + Deletes: &WriteRequestTupleKeys{ + TupleKeys: []WriteRequestTupleKey{{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }}, }, AuthorizationModelId: PtrString("01GAHCE4YVKPQEKZQHT2R89MQV"), @@ -713,9 +713,9 @@ func TestOpenFgaApi(t *testing.T) { } requestBody := ExpandRequest{ - TupleKey: TupleKey{ - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + TupleKey: ExpandRequestTupleKey{ + Relation: "viewer", + Object: "document:roadmap", }, AuthorizationModelId: PtrString("01GAHCE4YVKPQEKZQHT2R89MQV"), } @@ -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"), @@ -798,7 +798,7 @@ func TestOpenFgaApi(t *testing.T) { t.Fatalf("%v", err) } - if len(*got.Tuples) != len(*expectedResponse.Tuples) { + if len(got.Tuples) != len(expectedResponse.Tuples) { t.Fatalf("OpenFga%v().Execute() = %v, want %v", test.Name, string(responseJson), test.JsonResponse) } }) @@ -846,7 +846,7 @@ func TestOpenFgaApi(t *testing.T) { t.Fatalf("%v", err) } - if len(*got.Changes) != len(*expectedResponse.Changes) { + if len(got.Changes) != len(expectedResponse.Changes) { t.Fatalf("OpenFga%v().Execute() = %v, want %v", test.Name, string(responseJson), test.JsonResponse) } }) @@ -867,13 +867,13 @@ func TestOpenFgaApi(t *testing.T) { Type: "document", ContextualTuples: &ContextualTupleKeys{ TupleKeys: []TupleKey{{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("editor"), - Object: PtrString("folder:product"), + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "editor", + Object: "folder:product", }, { - User: PtrString("folder:product"), - Relation: PtrString("parent"), - Object: PtrString("document:roadmap"), + User: "folder:product", + Relation: "parent", + Object: "document:roadmap", }}, }, } @@ -910,7 +910,7 @@ func TestOpenFgaApi(t *testing.T) { t.Fatalf("%v", err) } - if len(*got.Objects) != len(*expectedResponse.Objects) || (*got.Objects)[0] != (*expectedResponse.Objects)[0] { + if len(got.Objects) != len(expectedResponse.Objects) || (got.Objects)[0] != (expectedResponse.Objects)[0] { t.Fatalf("OpenFga%v().Execute() = %v, want %v", test.Name, string(responseJson), test.JsonResponse) } }) @@ -924,10 +924,10 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + TupleKey: CheckRequestTupleKey{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }, } @@ -987,10 +987,10 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + TupleKey: CheckRequestTupleKey{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }, } @@ -1043,10 +1043,10 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + TupleKey: CheckRequestTupleKey{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }, } @@ -1106,10 +1106,10 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + TupleKey: CheckRequestTupleKey{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }, } @@ -1177,10 +1177,10 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + TupleKey: CheckRequestTupleKey{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }, } @@ -1239,10 +1239,10 @@ func TestOpenFgaApi(t *testing.T) { RequestPath: "check", } requestBody := CheckRequest{ - TupleKey: TupleKey{ - User: PtrString("user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - Relation: PtrString("viewer"), - Object: PtrString("document:roadmap"), + TupleKey: CheckRequestTupleKey{ + User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation: "viewer", + Object: "document:roadmap", }, } diff --git a/client/client.go b/client/client.go index 1a9c0c9..40375ec 100644 --- a/client/client.go +++ b/client/client.go @@ -19,9 +19,9 @@ import ( "math" _nethttp "net/http" - "github.com/openfga/go-sdk" + fgaSdk "github.com/openfga/go-sdk" "github.com/openfga/go-sdk/credentials" - "github.com/openfga/go-sdk/internal/utils" + internalutils "github.com/openfga/go-sdk/internal/utils" "golang.org/x/sync/errgroup" ) @@ -34,7 +34,7 @@ var ( var DEFAULT_MAX_METHOD_PARALLEL_REQS = int32(10) type ClientConfiguration struct { - openfga.Configuration + fgaSdk.Configuration ApiScheme string `json:"api_scheme,omitempty"` ApiHost string `json:"api_host,omitempty"` StoreId string `json:"store_id,omitempty"` @@ -44,10 +44,10 @@ type ClientConfiguration struct { UserAgent string `json:"user_agent,omitempty"` Debug bool `json:"debug,omitempty"` HTTPClient *_nethttp.Client - RetryParams *openfga.RetryParams + RetryParams *fgaSdk.RetryParams } -func newClientConfiguration(cfg *openfga.Configuration) ClientConfiguration { +func newClientConfiguration(cfg *fgaSdk.Configuration) ClientConfiguration { return ClientConfiguration{ ApiScheme: cfg.ApiScheme, ApiHost: cfg.ApiHost, @@ -63,11 +63,11 @@ func newClientConfiguration(cfg *openfga.Configuration) ClientConfiguration { type OpenFgaClient struct { config ClientConfiguration SdkClient - openfga.APIClient + fgaSdk.APIClient } func NewSdkClient(cfg *ClientConfiguration) (*OpenFgaClient, error) { - apiConfiguration, err := openfga.NewConfiguration(openfga.Configuration{ + apiConfiguration, err := fgaSdk.NewConfiguration(fgaSdk.Configuration{ ApiScheme: cfg.ApiScheme, ApiHost: cfg.ApiHost, StoreId: cfg.StoreId, @@ -91,7 +91,7 @@ func NewSdkClient(cfg *ClientConfiguration) (*OpenFgaClient, error) { return nil, FgaInvalidError{param: "AuthorizationModelId", description: "ULID"} } - apiClient := openfga.NewAPIClient(apiConfiguration) + apiClient := fgaSdk.NewAPIClient(apiConfiguration) return &OpenFgaClient{ config: clientConfig, @@ -113,19 +113,12 @@ type ClientRequestOptionsWithAuthZModelId struct { AuthorizationModelIdOptions } -type ClientTupleKey struct { - Object string `json:"object,omitempty"` - Relation string `json:"relation,omitempty"` - User string `json:"user,omitempty"` -} - -func (tupleKey ClientTupleKey) ToTupleKey() openfga.TupleKey { - return openfga.TupleKey{ - User: openfga.PtrString(tupleKey.User), - Relation: openfga.PtrString(tupleKey.Relation), - Object: openfga.PtrString(tupleKey.Object), - } -} +type ClientTupleKey = fgaSdk.TupleKey +type ClientWriteRequestTupleKey = fgaSdk.WriteRequestTupleKey +type ClientCheckRequestTupleKey = fgaSdk.CheckRequestTupleKey +type ClientReadRequestTupleKey = fgaSdk.ReadRequestTupleKey +type ClientExpandRequestTupleKey = fgaSdk.ExpandRequestTupleKey +type ClientContextualTupleKey = ClientTupleKey type ClientPaginationOptions struct { PageSize *int32 `json:"page_size,omitempty"` @@ -436,7 +429,7 @@ func (client *OpenFgaClient) checkValidApiConnection(ctx _context.Context, autho return err } else { _, err := client.ReadAuthorizationModels(ctx).Options(ClientReadAuthorizationModelsOptions{ - PageSize: openfga.PtrInt32(1), + PageSize: fgaSdk.PtrInt32(1), }).Execute() return err } @@ -464,7 +457,7 @@ type ClientListStoresOptions struct { ContinuationToken *string `json:"continuation_token,omitempty"` } -type ClientListStoresResponse = openfga.ListStoresResponse +type ClientListStoresResponse = fgaSdk.ListStoresResponse func (request *SdkClientListStoresRequest) Options(options ClientListStoresOptions) SdkClientListStoresRequestInterface { request.options = &options @@ -533,7 +526,7 @@ type ClientCreateStoreRequest struct { type ClientCreateStoreOptions struct { } -type ClientCreateStoreResponse = openfga.CreateStoreResponse +type ClientCreateStoreResponse = fgaSdk.CreateStoreResponse func (request *SdkClientCreateStoreRequest) Options(options ClientCreateStoreOptions) SdkClientCreateStoreRequestInterface { request.options = &options @@ -562,7 +555,7 @@ func (request *SdkClientCreateStoreRequest) GetBody() *ClientCreateStoreRequest } func (client *OpenFgaClient) CreateStoreExecute(request SdkClientCreateStoreRequestInterface) (*ClientCreateStoreResponse, error) { - data, _, err := client.OpenFgaApi.CreateStore(request.GetContext()).Body(openfga.CreateStoreRequest{ + data, _, err := client.OpenFgaApi.CreateStore(request.GetContext()).Body(fgaSdk.CreateStoreRequest{ Name: request.GetBody().Name, }).Execute() if err != nil { @@ -597,7 +590,7 @@ type SdkClientGetStoreRequestInterface interface { type ClientGetStoreOptions struct { } -type ClientGetStoreResponse = openfga.GetStoreResponse +type ClientGetStoreResponse = fgaSdk.GetStoreResponse func (request *SdkClientGetStoreRequest) Options(options ClientGetStoreOptions) SdkClientGetStoreRequestInterface { request.options = &options @@ -707,7 +700,7 @@ type ClientReadAuthorizationModelsOptions struct { ContinuationToken *string `json:"continuation_token,omitempty"` } -type ClientReadAuthorizationModelsResponse = openfga.ReadAuthorizationModelsResponse +type ClientReadAuthorizationModelsResponse = fgaSdk.ReadAuthorizationModelsResponse func (request *SdkClientReadAuthorizationModelsRequest) Options(options ClientReadAuthorizationModelsOptions) SdkClientReadAuthorizationModelsRequestInterface { request.options = &options @@ -770,14 +763,14 @@ type SdkClientWriteAuthorizationModelRequestInterface interface { } type ClientWriteAuthorizationModelRequest struct { - TypeDefinitions []openfga.TypeDefinition `json:"type_definitions"` - SchemaVersion string `json:"schema_version,omitempty"` + TypeDefinitions []fgaSdk.TypeDefinition `json:"type_definitions"` + SchemaVersion string `json:"schema_version,omitempty"` } type ClientWriteAuthorizationModelOptions struct { } -type ClientWriteAuthorizationModelResponse = openfga.WriteAuthorizationModelResponse +type ClientWriteAuthorizationModelResponse = fgaSdk.WriteAuthorizationModelResponse func (request *SdkClientWriteAuthorizationModelRequest) Options(options ClientWriteAuthorizationModelOptions) SdkClientWriteAuthorizationModelRequestInterface { request.options = &options @@ -806,9 +799,9 @@ func (request *SdkClientWriteAuthorizationModelRequest) GetContext() _context.Co } func (client *OpenFgaClient) WriteAuthorizationModelExecute(request SdkClientWriteAuthorizationModelRequestInterface) (*ClientWriteAuthorizationModelResponse, error) { - data, _, err := client.OpenFgaApi.WriteAuthorizationModel(request.GetContext()).Body(openfga.WriteAuthorizationModelRequest{ + data, _, err := client.OpenFgaApi.WriteAuthorizationModel(request.GetContext()).Body(fgaSdk.WriteAuthorizationModelRequest{ TypeDefinitions: request.GetBody().TypeDefinitions, - SchemaVersion: openfga.PtrString(request.GetBody().SchemaVersion), + SchemaVersion: request.GetBody().SchemaVersion, }).Execute() if err != nil { return nil, err @@ -850,7 +843,7 @@ type ClientReadAuthorizationModelOptions struct { AuthorizationModelId *string `json:"authorization_model_id,omitempty"` } -type ClientReadAuthorizationModelResponse = openfga.ReadAuthorizationModelResponse +type ClientReadAuthorizationModelResponse = fgaSdk.ReadAuthorizationModelResponse func (request *SdkClientReadAuthorizationModelRequest) Options(options ClientReadAuthorizationModelOptions) SdkClientReadAuthorizationModelRequestInterface { request.options = &options @@ -953,20 +946,20 @@ func (request *SdkClientReadLatestAuthorizationModelRequest) GetOptions() *Clien func (client *OpenFgaClient) ReadLatestAuthorizationModelExecute(request SdkClientReadLatestAuthorizationModelRequestInterface) (*ClientReadAuthorizationModelResponse, error) { response, err := client.ReadAuthorizationModels(request.GetContext()).Options(ClientReadAuthorizationModelsOptions{ - PageSize: openfga.PtrInt32(1), + PageSize: fgaSdk.PtrInt32(1), }).Execute() if err != nil { return nil, err } - var authorizationModel *openfga.AuthorizationModel + var authorizationModel *fgaSdk.AuthorizationModel - if len(*response.AuthorizationModels) > 0 { - authorizationModels := *response.AuthorizationModels + if len(response.AuthorizationModels) > 0 { + authorizationModels := response.AuthorizationModels authorizationModel = &(authorizationModels)[0] } - return &openfga.ReadAuthorizationModelResponse{ + return &fgaSdk.ReadAuthorizationModelResponse{ AuthorizationModel: authorizationModel, }, nil } @@ -1001,7 +994,7 @@ type ClientReadChangesOptions struct { ContinuationToken *string `json:"continuation_token,omitempty"` } -type ClientReadChangesResponse = openfga.ReadChangesResponse +type ClientReadChangesResponse = fgaSdk.ReadChangesResponse func (client *OpenFgaClient) ReadChanges(ctx _context.Context) SdkClientReadChangesRequestInterface { return &SdkClientReadChangesRequest{ @@ -1088,7 +1081,7 @@ type ClientReadOptions struct { ContinuationToken *string `json:"continuation_token,omitempty"` } -type ClientReadResponse = openfga.ReadResponse +type ClientReadResponse = fgaSdk.ReadResponse func (client *OpenFgaClient) Read(ctx _context.Context) SdkClientReadRequestInterface { return &SdkClientReadRequest{ @@ -1124,12 +1117,12 @@ func (request *SdkClientReadRequest) GetOptions() *ClientReadOptions { } func (client *OpenFgaClient) ReadExecute(request SdkClientReadRequestInterface) (*ClientReadResponse, error) { - body := openfga.ReadRequest{ + body := fgaSdk.ReadRequest{ PageSize: getPageSizeFromRequest((*ClientPaginationOptions)(request.GetOptions())), 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 = &fgaSdk.ReadRequestTupleKey{ User: request.GetBody().User, Relation: request.GetBody().Relation, Object: request.GetBody().Object, @@ -1163,8 +1156,8 @@ type SdkClientWriteRequestInterface interface { } type ClientWriteRequest struct { - Writes *[]ClientTupleKey - Deletes *[]ClientTupleKey + Writes []ClientWriteRequestTupleKey + Deletes []ClientWriteRequestTupleKey } type TransactionOptions struct { @@ -1190,10 +1183,10 @@ const ( ) type ClientWriteSingleResponse struct { - TupleKey ClientTupleKey `json:"tuple_key,omitempty"` - Status ClientWriteStatus `json:"status,omitempty"` - HttpResponse *_nethttp.Response `json:"http_response,omitempty"` - Error error `json:"error,omitempty"` + TupleKey ClientWriteRequestTupleKey `json:"tuple_key,omitempty"` + Status ClientWriteStatus `json:"status,omitempty"` + HttpResponse *_nethttp.Response `json:"http_response,omitempty"` + Error error `json:"error,omitempty"` } func (o ClientWriteSingleResponse) MarshalJSON() ([]byte, error) { @@ -1288,20 +1281,20 @@ func (client *OpenFgaClient) WriteExecute(request SdkClientWriteRequestInterface // Unless explicitly disabled, transaction mode is enabled // In transaction mode, the client will send the request to the server as is if request.GetOptions() == nil || request.GetOptions().Transaction == nil || !request.GetOptions().Transaction.Disable { - writeRequest := openfga.WriteRequest{ + writeRequest := fgaSdk.WriteRequest{ AuthorizationModelId: authorizationModelId, } - if request.GetBody().Writes != nil && len(*request.GetBody().Writes) > 0 { - writes := openfga.TupleKeys{} - for index := 0; index < len(*request.GetBody().Writes); index++ { - writes.TupleKeys = append(writes.TupleKeys, (*request.GetBody().Writes)[index].ToTupleKey()) + if request.GetBody().Writes != nil && len(request.GetBody().Writes) > 0 { + writes := fgaSdk.WriteRequestTupleKeys{} + for index := 0; index < len(request.GetBody().Writes); index++ { + writes.TupleKeys = append(writes.TupleKeys, (request.GetBody().Writes)[index]) } writeRequest.Writes = &writes } - if request.GetBody().Deletes != nil && len(*request.GetBody().Deletes) > 0 { - deletes := openfga.TupleKeys{} - for index := 0; index < len(*request.GetBody().Deletes); index++ { - deletes.TupleKeys = append(deletes.TupleKeys, (*request.GetBody().Deletes)[index].ToTupleKey()) + if request.GetBody().Deletes != nil && len(request.GetBody().Deletes) > 0 { + deletes := fgaSdk.WriteRequestTupleKeys{} + for index := 0; index < len(request.GetBody().Deletes); index++ { + deletes.TupleKeys = append(deletes.TupleKeys, (request.GetBody().Deletes)[index]) } writeRequest.Deletes = &deletes } @@ -1313,7 +1306,7 @@ func (client *OpenFgaClient) WriteExecute(request SdkClientWriteRequestInterface } if request.GetBody() != nil && request.GetBody().Writes != nil { - writeRequestTupleKeys := *request.GetBody().Writes + writeRequestTupleKeys := request.GetBody().Writes for index := 0; index < len(writeRequestTupleKeys); index++ { response.Writes = append(response.Writes, ClientWriteSingleResponse{ TupleKey: writeRequestTupleKeys[index], @@ -1325,7 +1318,7 @@ func (client *OpenFgaClient) WriteExecute(request SdkClientWriteRequestInterface } if request.GetBody() != nil && request.GetBody().Deletes != nil { - deleteRequestTupleKeys := *request.GetBody().Deletes + deleteRequestTupleKeys := request.GetBody().Deletes for index := 0; index < len(deleteRequestTupleKeys); index++ { response.Deletes = append(response.Deletes, ClientWriteSingleResponse{ TupleKey: deleteRequestTupleKeys[index], @@ -1344,12 +1337,12 @@ func (client *OpenFgaClient) WriteExecute(request SdkClientWriteRequestInterface // - each request is a transaction // - the max items in each request are based on maxPerChunk (default=1) var writeChunkSize = int(maxPerChunk) - var writeChunks [][]ClientTupleKey + var writeChunks [][]ClientWriteRequestTupleKey if request.GetBody() != nil { - for i := 0; i < len(*request.GetBody().Writes); i += writeChunkSize { - end := int(math.Min(float64(i+writeChunkSize), float64(len(*request.GetBody().Writes)))) + for i := 0; i < len(request.GetBody().Writes); i += writeChunkSize { + end := int(math.Min(float64(i+writeChunkSize), float64(len(request.GetBody().Writes)))) - writeChunks = append(writeChunks, (*request.GetBody().Writes)[i:end]) + writeChunks = append(writeChunks, (request.GetBody().Writes)[i:end]) } } @@ -1368,7 +1361,7 @@ func (client *OpenFgaClient) WriteExecute(request SdkClientWriteRequestInterface ctx: ctx, Client: client, body: &ClientWriteRequest{ - Writes: &writeBody, + Writes: writeBody, }, options: &ClientWriteOptions{ AuthorizationModelId: authorizationModelId, @@ -1384,12 +1377,12 @@ func (client *OpenFgaClient) WriteExecute(request SdkClientWriteRequestInterface _ = writeGroup.Wait() var deleteChunkSize = int(maxPerChunk) - var deleteChunks [][]ClientTupleKey + var deleteChunks [][]ClientWriteRequestTupleKey if request.GetBody() != nil { - for i := 0; i < len(*request.GetBody().Deletes); i += deleteChunkSize { - end := int(math.Min(float64(i+writeChunkSize), float64(len(*request.GetBody().Deletes)))) + for i := 0; i < len(request.GetBody().Deletes); i += deleteChunkSize { + end := int(math.Min(float64(i+writeChunkSize), float64(len(request.GetBody().Deletes)))) - deleteChunks = append(deleteChunks, (*request.GetBody().Deletes)[i:end]) + deleteChunks = append(deleteChunks, (request.GetBody().Deletes)[i:end]) } } @@ -1403,7 +1396,7 @@ func (client *OpenFgaClient) WriteExecute(request SdkClientWriteRequestInterface ctx: ctx, Client: client, body: &ClientWriteRequest{ - Deletes: &deleteBody, + Deletes: deleteBody, }, options: &ClientWriteOptions{ AuthorizationModelId: authorizationModelId, @@ -1452,7 +1445,7 @@ type SdkClientWriteTuplesRequestInterface interface { GetOptions() *ClientWriteOptions } -type ClientWriteTuplesBody = []ClientTupleKey +type ClientWriteTuplesBody = []ClientWriteRequestTupleKey func (client *OpenFgaClient) WriteTuples(ctx _context.Context) SdkClientWriteTuplesRequestInterface { return &SdkClientWriteTuplesRequest{ @@ -1489,7 +1482,7 @@ func (request *SdkClientWriteTuplesRequest) GetOptions() *ClientWriteOptions { func (client *OpenFgaClient) WriteTuplesExecute(request SdkClientWriteTuplesRequestInterface) (*ClientWriteResponse, error) { baseReq := client.Write(request.GetContext()).Body(ClientWriteRequest{ - Writes: request.GetBody(), + Writes: *request.GetBody(), }) if request.GetOptions() != nil { baseReq = baseReq.Options(*request.GetOptions()) @@ -1516,7 +1509,7 @@ type SdkClientDeleteTuplesRequestInterface interface { GetOptions() *ClientWriteOptions } -type ClientDeleteTuplesBody = []ClientTupleKey +type ClientDeleteTuplesBody = []ClientWriteRequestTupleKey func (client *OpenFgaClient) DeleteTuples(ctx _context.Context) SdkClientDeleteTuplesRequestInterface { return &SdkClientDeleteTuplesRequest{ @@ -1553,7 +1546,7 @@ func (request *SdkClientDeleteTuplesRequest) GetOptions() *ClientWriteOptions { func (client *OpenFgaClient) DeleteTuplesExecute(request SdkClientDeleteTuplesRequestInterface) (*ClientWriteResponse, error) { baseReq := client.Write(request.GetContext()).Body(ClientWriteRequest{ - Deletes: request.GetBody(), + Deletes: *request.GetBody(), }) if request.GetOptions() != nil { baseReq = baseReq.Options(*request.GetOptions()) @@ -1585,10 +1578,11 @@ type SdkClientCheckRequestInterface interface { } type ClientCheckRequest struct { - User string `json:"user,omitempty"` - Relation string `json:"relation,omitempty"` - Object string `json:"object,omitempty"` - ContextualTuples *[]ClientTupleKey `json:"contextual_tuples,omitempty"` + User string `json:"user,omitempty"` + Relation string `json:"relation,omitempty"` + Object string `json:"object,omitempty"` + Context *map[string]interface{} `json:"context,omitempty"` + ContextualTuples []ClientContextualTupleKey `json:"contextual_tuples,omitempty"` } type ClientCheckOptions struct { @@ -1596,7 +1590,7 @@ type ClientCheckOptions struct { } type ClientCheckResponse struct { - openfga.CheckResponse + fgaSdk.CheckResponse HttpResponse *_nethttp.Response } @@ -1641,23 +1635,24 @@ func (request *SdkClientCheckRequest) GetOptions() *ClientCheckOptions { } func (client *OpenFgaClient) CheckExecute(request SdkClientCheckRequestInterface) (*ClientCheckResponse, error) { - var contextualTuples []openfga.TupleKey + var contextualTuples []ClientContextualTupleKey if request.GetBody().ContextualTuples != nil { - for index := 0; index < len(*request.GetBody().ContextualTuples); index++ { - contextualTuples = append(contextualTuples, (*request.GetBody().ContextualTuples)[index].ToTupleKey()) + for index := 0; index < len(request.GetBody().ContextualTuples); index++ { + contextualTuples = append(contextualTuples, (request.GetBody().ContextualTuples)[index]) } } authorizationModelId, err := client.getAuthorizationModelId(request.GetAuthorizationModelIdOverride()) if err != nil { return nil, err } - requestBody := openfga.CheckRequest{ - TupleKey: openfga.TupleKey{ - User: openfga.PtrString(request.GetBody().User), - Relation: openfga.PtrString(request.GetBody().Relation), - Object: openfga.PtrString(request.GetBody().Object), + requestBody := fgaSdk.CheckRequest{ + TupleKey: fgaSdk.CheckRequestTupleKey{ + User: request.GetBody().User, + Relation: request.GetBody().Relation, + Object: request.GetBody().Object, }, - ContextualTuples: openfga.NewContextualTupleKeys(contextualTuples), + Context: request.GetBody().Context, + ContextualTuples: fgaSdk.NewContextualTupleKeys(contextualTuples), AuthorizationModelId: authorizationModelId, } @@ -1820,7 +1815,7 @@ type ClientExpandOptions struct { AuthorizationModelId *string `json:"authorization_model_id,omitempty"` } -type ClientExpandResponse = openfga.ExpandResponse +type ClientExpandResponse = fgaSdk.ExpandResponse func (client *OpenFgaClient) Expand(ctx _context.Context) SdkClientExpandRequestInterface { return &SdkClientExpandRequest{ @@ -1868,10 +1863,10 @@ func (client *OpenFgaClient) ExpandExecute(request SdkClientExpandRequestInterfa return nil, err } - data, _, err := client.OpenFgaApi.Expand(request.GetContext()).Body(openfga.ExpandRequest{ - TupleKey: openfga.TupleKey{ - Relation: &request.GetBody().Relation, - Object: &request.GetBody().Object, + data, _, err := client.OpenFgaApi.Expand(request.GetContext()).Body(fgaSdk.ExpandRequest{ + TupleKey: fgaSdk.ExpandRequestTupleKey{ + Relation: request.GetBody().Relation, + Object: request.GetBody().Object, }, AuthorizationModelId: authorizationModelId, }).Execute() @@ -1902,17 +1897,18 @@ type SdkClientListObjectsRequestInterface interface { } type ClientListObjectsRequest struct { - User string `json:"user,omitempty"` - Relation string `json:"relation,omitempty"` - Type string `json:"type,omitempty"` - ContextualTuples *[]ClientTupleKey `json:"contextual_tuples,omitempty"` + User string `json:"user,omitempty"` + Relation string `json:"relation,omitempty"` + Type string `json:"type,omitempty"` + Context *map[string]interface{} `json:"context,omitempty"` + ContextualTuples []ClientContextualTupleKey `json:"contextual_tuples,omitempty"` } type ClientListObjectsOptions struct { AuthorizationModelId *string `json:"authorization_model_id,omitempty"` } -type ClientListObjectsResponse = openfga.ListObjectsResponse +type ClientListObjectsResponse = fgaSdk.ListObjectsResponse func (client *OpenFgaClient) ListObjects(ctx _context.Context) SdkClientListObjectsRequestInterface { return &SdkClientListObjectsRequest{ @@ -1955,21 +1951,21 @@ func (request *SdkClientListObjectsRequest) GetOptions() *ClientListObjectsOptio } func (client *OpenFgaClient) ListObjectsExecute(request SdkClientListObjectsRequestInterface) (*ClientListObjectsResponse, error) { - var contextualTuples []openfga.TupleKey + var contextualTuples []ClientContextualTupleKey if request.GetBody().ContextualTuples != nil { - for index := 0; index < len(*request.GetBody().ContextualTuples); index++ { - contextualTuples = append(contextualTuples, (*request.GetBody().ContextualTuples)[index].ToTupleKey()) + for index := 0; index < len(request.GetBody().ContextualTuples); index++ { + contextualTuples = append(contextualTuples, (request.GetBody().ContextualTuples)[index]) } } authorizationModelId, err := client.getAuthorizationModelId(request.GetAuthorizationModelIdOverride()) if err != nil { return nil, err } - data, _, err := client.OpenFgaApi.ListObjects(request.GetContext()).Body(openfga.ListObjectsRequest{ + data, _, err := client.OpenFgaApi.ListObjects(request.GetContext()).Body(fgaSdk.ListObjectsRequest{ User: request.GetBody().User, Relation: request.GetBody().Relation, Type: request.GetBody().Type, - ContextualTuples: openfga.NewContextualTupleKeys(contextualTuples), + ContextualTuples: fgaSdk.NewContextualTupleKeys(contextualTuples), AuthorizationModelId: authorizationModelId, }).Execute() if err != nil { @@ -2000,10 +1996,11 @@ type SdkClientListRelationsRequestInterface interface { } type ClientListRelationsRequest struct { - User string `json:"user,omitempty"` - Object string `json:"object,omitempty"` - Relations []string `json:"relations,omitempty"` - ContextualTuples *[]ClientTupleKey `json:"contextual_tuples,omitempty"` + User string `json:"user,omitempty"` + Object string `json:"object,omitempty"` + Relations []string `json:"relations,omitempty"` + Context *map[string]interface{} `json:"context,omitempty"` + ContextualTuples []ClientContextualTupleKey `json:"contextual_tuples,omitempty"` } type ClientListRelationsOptions struct { @@ -2071,6 +2068,7 @@ func (client *OpenFgaClient) ListRelationsExecute(request SdkClientListRelations User: request.GetBody().User, Relation: request.GetBody().Relations[index], Object: request.GetBody().Object, + Context: request.GetBody().Context, ContextualTuples: request.GetBody().ContextualTuples, }) } @@ -2122,7 +2120,7 @@ type ClientReadAssertionsOptions struct { AuthorizationModelId *string `json:"authorization_model_id,omitempty"` } -type ClientReadAssertionsResponse = openfga.ReadAssertionsResponse +type ClientReadAssertionsResponse = fgaSdk.ReadAssertionsResponse func (client *OpenFgaClient) ReadAssertions(ctx _context.Context) SdkClientReadAssertionsRequestInterface { return &SdkClientReadAssertionsRequest{ @@ -2199,12 +2197,12 @@ type ClientAssertion struct { type ClientWriteAssertionsRequest = []ClientAssertion -func (clientAssertion ClientAssertion) ToAssertion() openfga.Assertion { - return openfga.Assertion{ - TupleKey: openfga.TupleKey{ - User: openfga.PtrString(clientAssertion.User), - Relation: openfga.PtrString(clientAssertion.Relation), - Object: openfga.PtrString(clientAssertion.Object), +func (clientAssertion ClientAssertion) ToAssertion() fgaSdk.Assertion { + return fgaSdk.Assertion{ + TupleKey: fgaSdk.CheckRequestTupleKey{ + User: clientAssertion.User, + Relation: clientAssertion.Relation, + Object: clientAssertion.Object, }, Expectation: clientAssertion.Expectation, } @@ -2258,7 +2256,7 @@ func (request *SdkClientWriteAssertionsRequest) GetOptions() *ClientWriteAsserti } func (client *OpenFgaClient) WriteAssertionsExecute(request SdkClientWriteAssertionsRequestInterface) (*ClientWriteAssertionsResponse, error) { - writeAssertionsRequest := openfga.WriteAssertionsRequest{} + writeAssertionsRequest := fgaSdk.WriteAssertionsRequest{} authorizationModelId, err := client.getAuthorizationModelId(request.GetAuthorizationModelIdOverride()) if err != nil { return nil, err diff --git a/client/client_test.go b/client/client_test.go index 03162ac..8fb326c 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -127,12 +127,12 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err) } - if len(*got.Stores) != 1 { + if len(got.Stores) != 1 { t.Fatalf("%v", err) } - if *((*got.Stores)[0].Id) != *((*expectedResponse.Stores)[0].Id) { - t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, *((*got.Stores)[0].Id), *((*expectedResponse.Stores)[0].Id)) + if got.Stores[0].Id != expectedResponse.Stores[0].Id { + t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, got.Stores[0].Id, expectedResponse.Stores[0].Id) } // ListStores without options should work _, err = fgaClient.ListStores(context.Background()).Execute() @@ -177,8 +177,8 @@ func TestOpenFgaClient(t *testing.T) { if err != nil { t.Fatalf("%v", err) } - if *got.Name != *expectedResponse.Name { - t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, *got.Name, *expectedResponse.Name) + if got.Name != expectedResponse.Name { + t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, got.Name, expectedResponse.Name) } // CreateStore without options should work _, err = fgaClient.CreateStore(context.Background()).Body(requestBody).Execute() @@ -217,8 +217,8 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err) } - if *got.Id != *expectedResponse.Id { - t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, *got.Id, *expectedResponse.Id) + if got.Id != expectedResponse.Id { + t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, got.Id, expectedResponse.Id) } // GetStore without options should work _, err = fgaClient.GetStore(context.Background()).Execute() @@ -265,11 +265,11 @@ func TestOpenFgaClient(t *testing.T) { if err != nil { t.Fatalf("%v", err) } - if *got1.Name != *expectedResponse.Name { - t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, *got1.Name, *expectedResponse.Name) + if got1.Name != expectedResponse.Name { + t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, got1.Name, expectedResponse.Name) } - storeId := *got1.Id + storeId := got1.Id fgaClient.SetStoreId(storeId) httpmock.Activate() @@ -289,8 +289,8 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err2) } - if *got2.Id != storeId { - t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, *got2.Id, storeId) + if got2.Id != storeId { + t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, got2.Id, storeId) } }) @@ -360,12 +360,12 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err) } - if len(*got.AuthorizationModels) != 1 { + if len(got.AuthorizationModels) != 1 { t.Fatalf("%v", err) } - if *((*got.AuthorizationModels)[0].Id) != *((*expectedResponse.AuthorizationModels)[0].Id) { - t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, *((*got.AuthorizationModels)[0].Id), *((*expectedResponse.AuthorizationModels)[0].Id)) + if *(got.AuthorizationModels[0].Id) != *(expectedResponse.AuthorizationModels[0].Id) { + t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, *(got.AuthorizationModels[0].Id), *(expectedResponse.AuthorizationModels[0].Id)) } // ReadAuthorizationModels without options should work _, err = fgaClient.ReadAuthorizationModels(context.Background()).Execute() @@ -393,7 +393,7 @@ func TestOpenFgaClient(t *testing.T) { This: &map[string]interface{}{}, }, "viewer": {Union: &openfga.Usersets{ - Child: &[]openfga.Userset{ + Child: []openfga.Userset{ {This: &map[string]interface{}{}}, {ComputedUserset: &openfga.ObjectRelation{ Object: openfga.PtrString(""), @@ -470,7 +470,7 @@ func TestOpenFgaClient(t *testing.T) { if err := json.Unmarshal([]byte(test.JsonResponse), &expectedResponse); err != nil { t.Fatalf("%v", err) } - modelId := *(*expectedResponse.AuthorizationModel).Id + modelId := *(expectedResponse.AuthorizationModel).Id httpmock.Activate() defer httpmock.DeactivateAndReset() @@ -496,7 +496,7 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err) } - if *(*got.AuthorizationModel).Id != modelId { + if *(got.AuthorizationModel).Id != modelId { t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, string(responseJson), test.JsonResponse) } // ReadAuthorizationModel without options should not work @@ -528,7 +528,7 @@ func TestOpenFgaClient(t *testing.T) { if err := json.Unmarshal([]byte(test.JsonResponse), &expectedResponse); err != nil { t.Fatalf("%v", err) } - modelId := *((*expectedResponse.AuthorizationModels)[0].Id) + modelId := *(expectedResponse.AuthorizationModels[0].Id) httpmock.Activate() defer httpmock.DeactivateAndReset() @@ -552,7 +552,7 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err) } - if (*got.AuthorizationModel).GetId() != modelId { + if got.AuthorizationModel.GetId() != modelId { t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, string(responseJson), test.JsonResponse) } // ReadLatestAuthorizationModel without options should work @@ -602,7 +602,7 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err) } - if len(*got.Changes) != len(*expectedResponse.Changes) { + if len(got.Changes) != len(expectedResponse.Changes) { t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, string(responseJson), test.JsonResponse) } // ReadChanges without options should work @@ -658,7 +658,7 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err) } - if len(*got.Tuples) != len(*expectedResponse.Tuples) { + if len(got.Tuples) != len(expectedResponse.Tuples) { t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, string(responseJson), test.JsonResponse) } // Read without options should work @@ -677,7 +677,7 @@ func TestOpenFgaClient(t *testing.T) { RequestPath: "write", } requestBody := ClientWriteRequest{ - Writes: &[]ClientTupleKey{{ + Writes: []ClientWriteRequestTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:roadmap", @@ -761,7 +761,7 @@ func TestOpenFgaClient(t *testing.T) { RequestPath: "write", } requestBody := ClientWriteRequest{ - Writes: &[]ClientTupleKey{{ + Writes: []ClientWriteRequestTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:roadmap", @@ -791,7 +791,7 @@ func TestOpenFgaClient(t *testing.T) { RequestPath: "write", } requestBody := ClientWriteRequest{ - Writes: &[]ClientTupleKey{{ + Writes: []ClientWriteRequestTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:roadmap", @@ -800,7 +800,7 @@ func TestOpenFgaClient(t *testing.T) { Relation: "viewer", Object: "document:budget", }}, - Deletes: &[]ClientTupleKey{{ + Deletes: []ClientWriteRequestTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:planning", @@ -889,7 +889,7 @@ func TestOpenFgaClient(t *testing.T) { Method: http.MethodPost, RequestPath: "write", } - requestBody := []ClientTupleKey{{ + requestBody := []ClientWriteRequestTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:roadmap", @@ -972,7 +972,7 @@ func TestOpenFgaClient(t *testing.T) { RequestPath: "write", } - requestBody := []ClientTupleKey{{ + requestBody := []ClientWriteRequestTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:roadmap", @@ -1059,7 +1059,7 @@ func TestOpenFgaClient(t *testing.T) { User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:roadmap", - ContextualTuples: &[]ClientTupleKey{{ + ContextualTuples: []ClientContextualTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "editor", Object: "document:roadmap", @@ -1128,7 +1128,7 @@ func TestOpenFgaClient(t *testing.T) { User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:roadmap", - ContextualTuples: &[]ClientTupleKey{{ + ContextualTuples: []ClientContextualTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "editor", Object: "document:roadmap", @@ -1137,7 +1137,7 @@ func TestOpenFgaClient(t *testing.T) { User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "admin", Object: "document:roadmap", - ContextualTuples: &[]ClientTupleKey{{ + ContextualTuples: []ClientContextualTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "editor", Object: "document:roadmap", @@ -1245,7 +1245,7 @@ func TestOpenFgaClient(t *testing.T) { User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "viewer", Object: "document:roadmap", - ContextualTuples: &[]ClientTupleKey{{ + ContextualTuples: []ClientContextualTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "editor", Object: "document:roadmap", @@ -1254,7 +1254,7 @@ func TestOpenFgaClient(t *testing.T) { User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "admin", Object: "document:roadmap", - ContextualTuples: &[]ClientTupleKey{{ + ContextualTuples: []ClientContextualTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "editor", Object: "document:roadmap", @@ -1379,7 +1379,7 @@ func TestOpenFgaClient(t *testing.T) { User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "can_read", Type: "document", - ContextualTuples: &[]ClientTupleKey{{ + ContextualTuples: []ClientContextualTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "editor", Object: "folder:product", @@ -1422,7 +1422,7 @@ func TestOpenFgaClient(t *testing.T) { t.Fatalf("%v", err) } - if len(*got.Objects) != len(*expectedResponse.Objects) || (*got.Objects)[0] != (*expectedResponse.Objects)[0] { + if len(got.Objects) != len(expectedResponse.Objects) || (got.Objects)[0] != (expectedResponse.Objects)[0] { t.Fatalf("OpenFgaClient.%v() = %v, want %v", test.Name, string(responseJson), test.JsonResponse) } // ListObjects without options should work @@ -1456,7 +1456,7 @@ func TestOpenFgaClient(t *testing.T) { User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Object: "document:roadmap", Relations: []string{"can_view", "can_edit", "can_delete", "can_rename"}, - ContextualTuples: &[]ClientTupleKey{{ + ContextualTuples: []ClientContextualTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "editor", Object: "document:roadmap", @@ -1556,7 +1556,7 @@ func TestOpenFgaClient(t *testing.T) { User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Object: "document:roadmap", Relations: []string{}, - ContextualTuples: &[]ClientTupleKey{{ + ContextualTuples: []ClientContextualTupleKey{{ User: "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation: "editor", Object: "document:roadmap", diff --git a/configuration.go b/configuration.go index 5047324..a36d07a 100644 --- a/configuration.go +++ b/configuration.go @@ -20,9 +20,9 @@ import ( ) const ( - SdkVersion = "0.2.3" + SdkVersion = "0.3.0-beta.1" - defaultUserAgent = "openfga-sdk go/0.2.3" + defaultUserAgent = "openfga-sdk go/0.3.0-beta.1" ) // RetryParams configures configuration for retry in case of HTTP too many request 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..5e78b2b 100644 --- a/docs/AuthorizationModel.md +++ b/docs/AuthorizationModel.md @@ -6,13 +6,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | Pointer to **string** | | [optional] **SchemaVersion** | **string** | | -**TypeDefinitions** | Pointer to [**[]TypeDefinition**](TypeDefinition.md) | | [optional] +**TypeDefinitions** | [**[]TypeDefinition**](TypeDefinition.md) | | +**Conditions** | Pointer to [**map[string]Condition**](Condition.md) | | [optional] ## Methods ### NewAuthorizationModel -`func NewAuthorizationModel(schemaVersion string, ) *AuthorizationModel` +`func NewAuthorizationModel(schemaVersion string, typeDefinitions []TypeDefinition, ) *AuthorizationModel` NewAuthorizationModel instantiates a new AuthorizationModel object This constructor will assign default values to properties that have it defined, @@ -91,11 +92,31 @@ and a boolean to check if the value has been set. SetTypeDefinitions sets TypeDefinitions field to given value. -### HasTypeDefinitions -`func (o *AuthorizationModel) HasTypeDefinitions() bool` +### GetConditions -HasTypeDefinitions returns a boolean if a field has been set. +`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..fc12a52 --- /dev/null +++ b/docs/CheckRequestTupleKey.md @@ -0,0 +1,93 @@ +# CheckRequestTupleKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**User** | **string** | | +**Relation** | **string** | | +**Object** | **string** | | + +## Methods + +### NewCheckRequestTupleKey + +`func NewCheckRequestTupleKey(user string, relation string, object string, ) *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. + + +### 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. + + +### 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. + + + +[[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/Computed.md b/docs/Computed.md index a70bdd6..2a2cc5a 100644 --- a/docs/Computed.md +++ b/docs/Computed.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Userset** | Pointer to **string** | | [optional] +**Userset** | **string** | | ## Methods ### NewComputed -`func NewComputed() *Computed` +`func NewComputed(userset string, ) *Computed` NewComputed instantiates a new Computed object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetUserset sets Userset field to given value. -### HasUserset - -`func (o *Computed) HasUserset() bool` - -HasUserset 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/CreateStoreResponse.md b/docs/CreateStoreResponse.md index 0ed7abe..75448fb 100644 --- a/docs/CreateStoreResponse.md +++ b/docs/CreateStoreResponse.md @@ -4,16 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] -**Name** | Pointer to **string** | | [optional] -**CreatedAt** | Pointer to **time.Time** | | [optional] -**UpdatedAt** | Pointer to **time.Time** | | [optional] +**Id** | **string** | | +**Name** | **string** | | +**CreatedAt** | **time.Time** | | +**UpdatedAt** | **time.Time** | | ## Methods ### NewCreateStoreResponse -`func NewCreateStoreResponse() *CreateStoreResponse` +`func NewCreateStoreResponse(id string, name string, createdAt time.Time, updatedAt time.Time, ) *CreateStoreResponse` NewCreateStoreResponse instantiates a new CreateStoreResponse object This constructor will assign default values to properties that have it defined, @@ -47,11 +47,6 @@ and a boolean to check if the value has been set. SetId sets Id field to given value. -### HasId - -`func (o *CreateStoreResponse) HasId() bool` - -HasId returns a boolean if a field has been set. ### GetName @@ -72,11 +67,6 @@ and a boolean to check if the value has been set. SetName sets Name field to given value. -### HasName - -`func (o *CreateStoreResponse) HasName() bool` - -HasName returns a boolean if a field has been set. ### GetCreatedAt @@ -97,11 +87,6 @@ and a boolean to check if the value has been set. SetCreatedAt sets CreatedAt field to given value. -### HasCreatedAt - -`func (o *CreateStoreResponse) HasCreatedAt() bool` - -HasCreatedAt returns a boolean if a field has been set. ### GetUpdatedAt @@ -122,11 +107,6 @@ and a boolean to check if the value has been set. SetUpdatedAt sets UpdatedAt field to given value. -### HasUpdatedAt - -`func (o *CreateStoreResponse) HasUpdatedAt() bool` - -HasUpdatedAt 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..3af78ec --- /dev/null +++ b/docs/ExpandRequestTupleKey.md @@ -0,0 +1,72 @@ +# ExpandRequestTupleKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Relation** | **string** | | +**Object** | **string** | | + +## Methods + +### NewExpandRequestTupleKey + +`func NewExpandRequestTupleKey(relation string, object string, ) *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 + +### 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. + + +### 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. + + + +[[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/GetStoreResponse.md b/docs/GetStoreResponse.md index 5704a0e..1d5d7e1 100644 --- a/docs/GetStoreResponse.md +++ b/docs/GetStoreResponse.md @@ -4,16 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] -**Name** | Pointer to **string** | | [optional] -**CreatedAt** | Pointer to **time.Time** | | [optional] -**UpdatedAt** | Pointer to **time.Time** | | [optional] +**Id** | **string** | | +**Name** | **string** | | +**CreatedAt** | **time.Time** | | +**UpdatedAt** | **time.Time** | | ## Methods ### NewGetStoreResponse -`func NewGetStoreResponse() *GetStoreResponse` +`func NewGetStoreResponse(id string, name string, createdAt time.Time, updatedAt time.Time, ) *GetStoreResponse` NewGetStoreResponse instantiates a new GetStoreResponse object This constructor will assign default values to properties that have it defined, @@ -47,11 +47,6 @@ and a boolean to check if the value has been set. SetId sets Id field to given value. -### HasId - -`func (o *GetStoreResponse) HasId() bool` - -HasId returns a boolean if a field has been set. ### GetName @@ -72,11 +67,6 @@ and a boolean to check if the value has been set. SetName sets Name field to given value. -### HasName - -`func (o *GetStoreResponse) HasName() bool` - -HasName returns a boolean if a field has been set. ### GetCreatedAt @@ -97,11 +87,6 @@ and a boolean to check if the value has been set. SetCreatedAt sets CreatedAt field to given value. -### HasCreatedAt - -`func (o *GetStoreResponse) HasCreatedAt() bool` - -HasCreatedAt returns a boolean if a field has been set. ### GetUpdatedAt @@ -122,11 +107,6 @@ and a boolean to check if the value has been set. SetUpdatedAt sets UpdatedAt field to given value. -### HasUpdatedAt - -`func (o *GetStoreResponse) HasUpdatedAt() bool` - -HasUpdatedAt 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/ListObjectsResponse.md b/docs/ListObjectsResponse.md index c5649c5..371e410 100644 --- a/docs/ListObjectsResponse.md +++ b/docs/ListObjectsResponse.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Objects** | Pointer to **[]string** | | [optional] +**Objects** | **[]string** | | ## Methods ### NewListObjectsResponse -`func NewListObjectsResponse() *ListObjectsResponse` +`func NewListObjectsResponse(objects []string, ) *ListObjectsResponse` NewListObjectsResponse instantiates a new ListObjectsResponse object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetObjects sets Objects field to given value. -### HasObjects - -`func (o *ListObjectsResponse) HasObjects() bool` - -HasObjects 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/ListStoresResponse.md b/docs/ListStoresResponse.md index e3f2bbb..a325748 100644 --- a/docs/ListStoresResponse.md +++ b/docs/ListStoresResponse.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Stores** | Pointer to [**[]Store**](Store.md) | | [optional] -**ContinuationToken** | Pointer to **string** | The continuation token will be empty if there are no more stores. | [optional] +**Stores** | [**[]Store**](Store.md) | | +**ContinuationToken** | **string** | The continuation token will be empty if there are no more stores. | ## Methods ### NewListStoresResponse -`func NewListStoresResponse() *ListStoresResponse` +`func NewListStoresResponse(stores []Store, continuationToken string, ) *ListStoresResponse` NewListStoresResponse instantiates a new ListStoresResponse object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetStores sets Stores field to given value. -### HasStores - -`func (o *ListStoresResponse) HasStores() bool` - -HasStores returns a boolean if a field has been set. ### GetContinuationToken @@ -70,11 +65,6 @@ and a boolean to check if the value has been set. SetContinuationToken sets ContinuationToken field to given value. -### HasContinuationToken - -`func (o *ListStoresResponse) HasContinuationToken() bool` - -HasContinuationToken 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/Node.md b/docs/Node.md index 6d65e46..8e71bf5 100644 --- a/docs/Node.md +++ b/docs/Node.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | Pointer to **string** | | [optional] +**Name** | **string** | | **Leaf** | Pointer to [**Leaf**](Leaf.md) | | [optional] **Difference** | Pointer to [**UsersetTreeDifference**](UsersetTreeDifference.md) | | [optional] **Union** | Pointer to [**Nodes**](Nodes.md) | | [optional] @@ -14,7 +14,7 @@ Name | Type | Description | Notes ### NewNode -`func NewNode() *Node` +`func NewNode(name string, ) *Node` NewNode instantiates a new Node object This constructor will assign default values to properties that have it defined, @@ -48,11 +48,6 @@ and a boolean to check if the value has been set. SetName sets Name field to given value. -### HasName - -`func (o *Node) HasName() bool` - -HasName returns a boolean if a field has been set. ### GetLeaf diff --git a/docs/Nodes.md b/docs/Nodes.md index 43709f1..7809eaf 100644 --- a/docs/Nodes.md +++ b/docs/Nodes.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Nodes** | Pointer to [**[]Node**](Node.md) | | [optional] +**Nodes** | [**[]Node**](Node.md) | | ## Methods ### NewNodes -`func NewNodes() *Nodes` +`func NewNodes(nodes []Node, ) *Nodes` NewNodes instantiates a new Nodes object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetNodes sets Nodes field to given value. -### HasNodes - -`func (o *Nodes) HasNodes() bool` - -HasNodes 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..cff0ed4 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("user:anne", "reader", "document:2021-budget")) // 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("reader", "document:2021-budget")) // 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("user:anne", "reader", "document:2021-budget"), false)}) // WriteAssertionsRequest | configuration, err := openfga.NewConfiguration(openfga.Configuration{ ApiScheme: os.Getenv("OPENFGA_API_SCHEME"), // optional, defaults to "https" @@ -1354,7 +1354,7 @@ import ( func main() { - body := *openapiclient.NewWriteAuthorizationModelRequest([]openapiclient.TypeDefinition{*openapiclient.NewTypeDefinition("document")}) // WriteAuthorizationModelRequest | + body := *openapiclient.NewWriteAuthorizationModelRequest([]openapiclient.TypeDefinition{*openapiclient.NewTypeDefinition("document")}, "SchemaVersion_example") // WriteAuthorizationModelRequest | configuration, err := openfga.NewConfiguration(openfga.Configuration{ ApiScheme: os.Getenv("OPENFGA_API_SCHEME"), // optional, defaults to "https" diff --git a/docs/ReadAssertionsResponse.md b/docs/ReadAssertionsResponse.md index 313cb66..0ae7c8d 100644 --- a/docs/ReadAssertionsResponse.md +++ b/docs/ReadAssertionsResponse.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**AuthorizationModelId** | Pointer to **string** | | [optional] +**AuthorizationModelId** | **string** | | **Assertions** | Pointer to [**[]Assertion**](Assertion.md) | | [optional] ## Methods ### NewReadAssertionsResponse -`func NewReadAssertionsResponse() *ReadAssertionsResponse` +`func NewReadAssertionsResponse(authorizationModelId string, ) *ReadAssertionsResponse` NewReadAssertionsResponse instantiates a new ReadAssertionsResponse object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetAuthorizationModelId sets AuthorizationModelId field to given value. -### HasAuthorizationModelId - -`func (o *ReadAssertionsResponse) HasAuthorizationModelId() bool` - -HasAuthorizationModelId returns a boolean if a field has been set. ### GetAssertions diff --git a/docs/ReadAuthorizationModelsResponse.md b/docs/ReadAuthorizationModelsResponse.md index f176ebc..6ccae0e 100644 --- a/docs/ReadAuthorizationModelsResponse.md +++ b/docs/ReadAuthorizationModelsResponse.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**AuthorizationModels** | Pointer to [**[]AuthorizationModel**](AuthorizationModel.md) | | [optional] +**AuthorizationModels** | [**[]AuthorizationModel**](AuthorizationModel.md) | | **ContinuationToken** | Pointer to **string** | The continuation token will be empty if there are no more models. | [optional] ## Methods ### NewReadAuthorizationModelsResponse -`func NewReadAuthorizationModelsResponse() *ReadAuthorizationModelsResponse` +`func NewReadAuthorizationModelsResponse(authorizationModels []AuthorizationModel, ) *ReadAuthorizationModelsResponse` NewReadAuthorizationModelsResponse instantiates a new ReadAuthorizationModelsResponse object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetAuthorizationModels sets AuthorizationModels field to given value. -### HasAuthorizationModels - -`func (o *ReadAuthorizationModelsResponse) HasAuthorizationModels() bool` - -HasAuthorizationModels returns a boolean if a field has been set. ### GetContinuationToken diff --git a/docs/ReadChangesResponse.md b/docs/ReadChangesResponse.md index 552d697..ef08cd6 100644 --- a/docs/ReadChangesResponse.md +++ b/docs/ReadChangesResponse.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Changes** | Pointer to [**[]TupleChange**](TupleChange.md) | | [optional] +**Changes** | [**[]TupleChange**](TupleChange.md) | | **ContinuationToken** | Pointer to **string** | The continuation token will be identical if there are no new changes. | [optional] ## Methods ### NewReadChangesResponse -`func NewReadChangesResponse() *ReadChangesResponse` +`func NewReadChangesResponse(changes []TupleChange, ) *ReadChangesResponse` NewReadChangesResponse instantiates a new ReadChangesResponse object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetChanges sets Changes field to given value. -### HasChanges - -`func (o *ReadChangesResponse) HasChanges() bool` - -HasChanges returns a boolean if a field has been set. ### GetContinuationToken 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/ReadResponse.md b/docs/ReadResponse.md index a698890..fe516e2 100644 --- a/docs/ReadResponse.md +++ b/docs/ReadResponse.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Tuples** | Pointer to [**[]Tuple**](Tuple.md) | | [optional] -**ContinuationToken** | Pointer to **string** | The continuation token will be empty if there are no more tuples. | [optional] +**Tuples** | [**[]Tuple**](Tuple.md) | | +**ContinuationToken** | **string** | The continuation token will be empty if there are no more tuples. | ## Methods ### NewReadResponse -`func NewReadResponse() *ReadResponse` +`func NewReadResponse(tuples []Tuple, continuationToken string, ) *ReadResponse` NewReadResponse instantiates a new ReadResponse object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetTuples sets Tuples field to given value. -### HasTuples - -`func (o *ReadResponse) HasTuples() bool` - -HasTuples returns a boolean if a field has been set. ### GetContinuationToken @@ -70,11 +65,6 @@ and a boolean to check if the value has been set. SetContinuationToken sets ContinuationToken field to given value. -### HasContinuationToken - -`func (o *ReadResponse) HasContinuationToken() bool` - -HasContinuationToken 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..43e3cef --- /dev/null +++ b/docs/RelationshipCondition.md @@ -0,0 +1,72 @@ +# RelationshipCondition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | A reference (by name) of the relationship condition defined in the authorization model. | +**Context** | **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. | + +## Methods + +### NewRelationshipCondition + +`func NewRelationshipCondition(name string, context map[string]interface{}, ) *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 + +### GetName + +`func (o *RelationshipCondition) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *RelationshipCondition) 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 *RelationshipCondition) SetName(v string)` + +SetName sets Name 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. + + + +[[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/Store.md b/docs/Store.md index 3df5fa7..7bf953d 100644 --- a/docs/Store.md +++ b/docs/Store.md @@ -4,17 +4,17 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] -**Name** | Pointer to **string** | | [optional] -**CreatedAt** | Pointer to **time.Time** | | [optional] -**UpdatedAt** | Pointer to **time.Time** | | [optional] -**DeletedAt** | Pointer to **time.Time** | | [optional] +**Id** | **string** | | +**Name** | **string** | | +**CreatedAt** | **time.Time** | | +**UpdatedAt** | **time.Time** | | +**DeletedAt** | **time.Time** | | ## Methods ### NewStore -`func NewStore() *Store` +`func NewStore(id string, name string, createdAt time.Time, updatedAt time.Time, deletedAt time.Time, ) *Store` NewStore instantiates a new Store object This constructor will assign default values to properties that have it defined, @@ -48,11 +48,6 @@ and a boolean to check if the value has been set. SetId sets Id field to given value. -### HasId - -`func (o *Store) HasId() bool` - -HasId returns a boolean if a field has been set. ### GetName @@ -73,11 +68,6 @@ and a boolean to check if the value has been set. SetName sets Name field to given value. -### HasName - -`func (o *Store) HasName() bool` - -HasName returns a boolean if a field has been set. ### GetCreatedAt @@ -98,11 +88,6 @@ and a boolean to check if the value has been set. SetCreatedAt sets CreatedAt field to given value. -### HasCreatedAt - -`func (o *Store) HasCreatedAt() bool` - -HasCreatedAt returns a boolean if a field has been set. ### GetUpdatedAt @@ -123,11 +108,6 @@ and a boolean to check if the value has been set. SetUpdatedAt sets UpdatedAt field to given value. -### HasUpdatedAt - -`func (o *Store) HasUpdatedAt() bool` - -HasUpdatedAt returns a boolean if a field has been set. ### GetDeletedAt @@ -148,11 +128,6 @@ and a boolean to check if the value has been set. SetDeletedAt sets DeletedAt field to given value. -### HasDeletedAt - -`func (o *Store) HasDeletedAt() bool` - -HasDeletedAt 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/Tuple.md b/docs/Tuple.md index f05c235..6a3d829 100644 --- a/docs/Tuple.md +++ b/docs/Tuple.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Key** | Pointer to [**TupleKey**](TupleKey.md) | | [optional] -**Timestamp** | Pointer to **time.Time** | | [optional] +**Key** | [**TupleKey**](TupleKey.md) | | +**Timestamp** | **time.Time** | | ## Methods ### NewTuple -`func NewTuple() *Tuple` +`func NewTuple(key TupleKey, timestamp time.Time, ) *Tuple` NewTuple instantiates a new Tuple object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetKey sets Key field to given value. -### HasKey - -`func (o *Tuple) HasKey() bool` - -HasKey returns a boolean if a field has been set. ### GetTimestamp @@ -70,11 +65,6 @@ and a boolean to check if the value has been set. SetTimestamp sets Timestamp field to given value. -### HasTimestamp - -`func (o *Tuple) HasTimestamp() bool` - -HasTimestamp 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/TupleChange.md b/docs/TupleChange.md index 2f51d40..a3badc2 100644 --- a/docs/TupleChange.md +++ b/docs/TupleChange.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**TupleKey** | Pointer to [**TupleKey**](TupleKey.md) | | [optional] -**Operation** | Pointer to [**TupleOperation**](TupleOperation.md) | | [optional] [default to WRITE] -**Timestamp** | Pointer to **time.Time** | | [optional] +**TupleKey** | [**TupleKey**](TupleKey.md) | | +**Operation** | [**TupleOperation**](TupleOperation.md) | | [default to WRITE] +**Timestamp** | **time.Time** | | ## Methods ### NewTupleChange -`func NewTupleChange() *TupleChange` +`func NewTupleChange(tupleKey TupleKey, operation TupleOperation, timestamp time.Time, ) *TupleChange` NewTupleChange instantiates a new TupleChange object This constructor will assign default values to properties that have it defined, @@ -46,11 +46,6 @@ and a boolean to check if the value has been set. SetTupleKey sets TupleKey field to given value. -### HasTupleKey - -`func (o *TupleChange) HasTupleKey() bool` - -HasTupleKey returns a boolean if a field has been set. ### GetOperation @@ -71,11 +66,6 @@ and a boolean to check if the value has been set. SetOperation sets Operation field to given value. -### HasOperation - -`func (o *TupleChange) HasOperation() bool` - -HasOperation returns a boolean if a field has been set. ### GetTimestamp @@ -96,11 +86,6 @@ and a boolean to check if the value has been set. SetTimestamp sets Timestamp field to given value. -### HasTimestamp - -`func (o *TupleChange) HasTimestamp() bool` - -HasTimestamp 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..52d6b30 100644 --- a/docs/TupleKey.md +++ b/docs/TupleKey.md @@ -4,15 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Object** | Pointer to **string** | | [optional] -**Relation** | Pointer to **string** | | [optional] -**User** | Pointer to **string** | | [optional] +**User** | **string** | | +**Relation** | **string** | | +**Object** | **string** | | +**Condition** | Pointer to [**RelationshipCondition**](RelationshipCondition.md) | | [optional] ## Methods ### NewTupleKey -`func NewTupleKey() *TupleKey` +`func NewTupleKey(user string, relation string, object string, ) *TupleKey` NewTupleKey instantiates a new TupleKey object This constructor will assign default values to properties that have it defined, @@ -27,30 +28,25 @@ NewTupleKeyWithDefaults instantiates a new TupleKey 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 +### GetUser -`func (o *TupleKey) GetObject() string` +`func (o *TupleKey) GetUser() string` -GetObject returns the Object field if non-nil, zero value otherwise. +GetUser returns the User field if non-nil, zero value otherwise. -### GetObjectOk +### GetUserOk -`func (o *TupleKey) GetObjectOk() (*string, bool)` +`func (o *TupleKey) GetUserOk() (*string, bool)` -GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise +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. -### SetObject - -`func (o *TupleKey) SetObject(v string)` - -SetObject sets Object field to given value. +### SetUser -### HasObject +`func (o *TupleKey) SetUser(v string)` -`func (o *TupleKey) HasObject() bool` +SetUser sets User field to given value. -HasObject returns a boolean if a field has been set. ### GetRelation @@ -71,36 +67,51 @@ and a boolean to check if the value has been set. SetRelation sets Relation field to given value. -### HasRelation -`func (o *TupleKey) HasRelation() bool` +### GetObject -HasRelation returns a boolean if a field has been set. +`func (o *TupleKey) GetObject() string` -### GetUser +GetObject returns the Object field if non-nil, zero value otherwise. -`func (o *TupleKey) GetUser() string` +### GetObjectOk -GetUser returns the User field if non-nil, zero value otherwise. +`func (o *TupleKey) GetObjectOk() (*string, bool)` -### GetUserOk +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. -`func (o *TupleKey) GetUserOk() (*string, bool)` +### SetObject -GetUserOk returns a tuple with the User field if it's non-nil, zero value otherwise +`func (o *TupleKey) SetObject(v string)` + +SetObject sets Object field to given value. + + +### 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. -### SetUser +### SetCondition -`func (o *TupleKey) SetUser(v string)` +`func (o *TupleKey) SetCondition(v RelationshipCondition)` -SetUser sets User field to given value. +SetCondition sets Condition field to given value. -### HasUser +### HasCondition -`func (o *TupleKey) HasUser() bool` +`func (o *TupleKey) HasCondition() bool` -HasUser returns a boolean if a field has been set. +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/TupleToUserset.md b/docs/TupleToUserset.md index 9022eca..4222790 100644 --- a/docs/TupleToUserset.md +++ b/docs/TupleToUserset.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Tupleset** | Pointer to [**ObjectRelation**](ObjectRelation.md) | | [optional] -**ComputedUserset** | Pointer to [**ObjectRelation**](ObjectRelation.md) | | [optional] +**Tupleset** | [**ObjectRelation**](ObjectRelation.md) | | +**ComputedUserset** | [**ObjectRelation**](ObjectRelation.md) | | ## Methods ### NewTupleToUserset -`func NewTupleToUserset() *TupleToUserset` +`func NewTupleToUserset(tupleset ObjectRelation, computedUserset ObjectRelation, ) *TupleToUserset` NewTupleToUserset instantiates a new TupleToUserset object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetTupleset sets Tupleset field to given value. -### HasTupleset - -`func (o *TupleToUserset) HasTupleset() bool` - -HasTupleset returns a boolean if a field has been set. ### GetComputedUserset @@ -70,11 +65,6 @@ and a boolean to check if the value has been set. SetComputedUserset sets ComputedUserset field to given value. -### HasComputedUserset - -`func (o *TupleToUserset) HasComputedUserset() bool` - -HasComputedUserset 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/Users.md b/docs/Users.md index b9fb17c..d3b0f05 100644 --- a/docs/Users.md +++ b/docs/Users.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Users** | Pointer to **[]string** | | [optional] +**Users** | **[]string** | | ## Methods ### NewUsers -`func NewUsers() *Users` +`func NewUsers(users []string, ) *Users` NewUsers instantiates a new Users object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetUsers sets Users field to given value. -### HasUsers - -`func (o *Users) HasUsers() bool` - -HasUsers 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/UsersetTreeDifference.md b/docs/UsersetTreeDifference.md index 4389c77..fa9a97b 100644 --- a/docs/UsersetTreeDifference.md +++ b/docs/UsersetTreeDifference.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Base** | Pointer to [**Node**](Node.md) | | [optional] -**Subtract** | Pointer to [**Node**](Node.md) | | [optional] +**Base** | [**Node**](Node.md) | | +**Subtract** | [**Node**](Node.md) | | ## Methods ### NewUsersetTreeDifference -`func NewUsersetTreeDifference() *UsersetTreeDifference` +`func NewUsersetTreeDifference(base Node, subtract Node, ) *UsersetTreeDifference` NewUsersetTreeDifference instantiates a new UsersetTreeDifference object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetBase sets Base field to given value. -### HasBase - -`func (o *UsersetTreeDifference) HasBase() bool` - -HasBase returns a boolean if a field has been set. ### GetSubtract @@ -70,11 +65,6 @@ and a boolean to check if the value has been set. SetSubtract sets Subtract field to given value. -### HasSubtract - -`func (o *UsersetTreeDifference) HasSubtract() bool` - -HasSubtract 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/UsersetTreeTupleToUserset.md b/docs/UsersetTreeTupleToUserset.md index 500eadf..30426ff 100644 --- a/docs/UsersetTreeTupleToUserset.md +++ b/docs/UsersetTreeTupleToUserset.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Tupleset** | Pointer to **string** | | [optional] -**Computed** | Pointer to [**[]Computed**](Computed.md) | | [optional] +**Tupleset** | **string** | | +**Computed** | [**[]Computed**](Computed.md) | | ## Methods ### NewUsersetTreeTupleToUserset -`func NewUsersetTreeTupleToUserset() *UsersetTreeTupleToUserset` +`func NewUsersetTreeTupleToUserset(tupleset string, computed []Computed, ) *UsersetTreeTupleToUserset` NewUsersetTreeTupleToUserset instantiates a new UsersetTreeTupleToUserset object This constructor will assign default values to properties that have it defined, @@ -45,11 +45,6 @@ and a boolean to check if the value has been set. SetTupleset sets Tupleset field to given value. -### HasTupleset - -`func (o *UsersetTreeTupleToUserset) HasTupleset() bool` - -HasTupleset returns a boolean if a field has been set. ### GetComputed @@ -70,11 +65,6 @@ and a boolean to check if the value has been set. SetComputed sets Computed field to given value. -### HasComputed - -`func (o *UsersetTreeTupleToUserset) HasComputed() bool` - -HasComputed 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/Usersets.md b/docs/Usersets.md index 5e777c9..c0a519e 100644 --- a/docs/Usersets.md +++ b/docs/Usersets.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Child** | Pointer to [**[]Userset**](Userset.md) | | [optional] +**Child** | [**[]Userset**](Userset.md) | | ## Methods ### NewUsersets -`func NewUsersets() *Usersets` +`func NewUsersets(child []Userset, ) *Usersets` NewUsersets instantiates a new Usersets object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetChild sets Child field to given value. -### HasChild - -`func (o *Usersets) HasChild() bool` - -HasChild 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/WriteAuthorizationModelRequest.md b/docs/WriteAuthorizationModelRequest.md index 1cb6787..2182531 100644 --- a/docs/WriteAuthorizationModelRequest.md +++ b/docs/WriteAuthorizationModelRequest.md @@ -5,13 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **TypeDefinitions** | [**[]TypeDefinition**](TypeDefinition.md) | | -**SchemaVersion** | Pointer to **string** | | [optional] +**SchemaVersion** | **string** | | +**Conditions** | Pointer to [**map[string]Condition**](Condition.md) | | [optional] ## Methods ### NewWriteAuthorizationModelRequest -`func NewWriteAuthorizationModelRequest(typeDefinitions []TypeDefinition, ) *WriteAuthorizationModelRequest` +`func NewWriteAuthorizationModelRequest(typeDefinitions []TypeDefinition, schemaVersion string, ) *WriteAuthorizationModelRequest` NewWriteAuthorizationModelRequest instantiates a new WriteAuthorizationModelRequest object This constructor will assign default values to properties that have it defined, @@ -65,11 +66,31 @@ and a boolean to check if the value has been set. SetSchemaVersion sets SchemaVersion field to given value. -### HasSchemaVersion -`func (o *WriteAuthorizationModelRequest) HasSchemaVersion() bool` +### GetConditions -HasSchemaVersion returns a boolean if a field has been set. +`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/WriteAuthorizationModelResponse.md b/docs/WriteAuthorizationModelResponse.md index 93e05ef..1198cc7 100644 --- a/docs/WriteAuthorizationModelResponse.md +++ b/docs/WriteAuthorizationModelResponse.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**AuthorizationModelId** | Pointer to **string** | | [optional] +**AuthorizationModelId** | **string** | | ## Methods ### NewWriteAuthorizationModelResponse -`func NewWriteAuthorizationModelResponse() *WriteAuthorizationModelResponse` +`func NewWriteAuthorizationModelResponse(authorizationModelId string, ) *WriteAuthorizationModelResponse` NewWriteAuthorizationModelResponse instantiates a new WriteAuthorizationModelResponse object This constructor will assign default values to properties that have it defined, @@ -44,11 +44,6 @@ and a boolean to check if the value has been set. SetAuthorizationModelId sets AuthorizationModelId field to given value. -### HasAuthorizationModelId - -`func (o *WriteAuthorizationModelResponse) HasAuthorizationModelId() bool` - -HasAuthorizationModelId 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..0bbb904 --- /dev/null +++ b/docs/WriteRequestTupleKey.md @@ -0,0 +1,119 @@ +# WriteRequestTupleKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**User** | **string** | | +**Relation** | **string** | | +**Object** | **string** | | +**Condition** | Pointer to [**RelationshipCondition**](RelationshipCondition.md) | | [optional] + +## Methods + +### NewWriteRequestTupleKey + +`func NewWriteRequestTupleKey(user string, relation string, object string, ) *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. + + +### 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. + + +### 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. + + +### 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_any.go b/model_any.go index 6617f20..82c44fe 100644 --- a/model_any.go +++ b/model_any.go @@ -18,7 +18,7 @@ import ( // Any struct for Any type Any struct { - Type *string `json:"@type,omitempty"` + Type *string `json:"@type,omitempty"yaml:"@type,omitempty"` } // NewAny instantiates a new Any object diff --git a/model_assertion.go b/model_assertion.go index 80e8b64..8876211 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"yaml:"tuple_key"` + Expectation bool `json:"expectation"yaml:"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 ec3aa2d..58af688 100644 --- a/model_authorization_model.go +++ b/model_authorization_model.go @@ -18,18 +18,20 @@ 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"yaml:"id,omitempty"` + SchemaVersion string `json:"schema_version"yaml:"schema_version"` + TypeDefinitions []TypeDefinition `json:"type_definitions"yaml:"type_definitions"` + Conditions *map[string]Condition `json:"conditions,omitempty"yaml:"conditions,omitempty"` } // NewAuthorizationModel instantiates a new AuthorizationModel 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 NewAuthorizationModel(schemaVersion string) *AuthorizationModel { +func NewAuthorizationModel(schemaVersion string, typeDefinitions []TypeDefinition) *AuthorizationModel { this := AuthorizationModel{} this.SchemaVersion = schemaVersion + this.TypeDefinitions = typeDefinitions return &this } @@ -97,36 +99,60 @@ func (o *AuthorizationModel) SetSchemaVersion(v string) { o.SchemaVersion = v } -// GetTypeDefinitions returns the TypeDefinitions field value if set, zero value otherwise. +// GetTypeDefinitions returns the TypeDefinitions field value func (o *AuthorizationModel) GetTypeDefinitions() []TypeDefinition { - if o == nil || o.TypeDefinitions == nil { + if o == nil { var ret []TypeDefinition return ret } - return *o.TypeDefinitions + + return o.TypeDefinitions } -// GetTypeDefinitionsOk returns a tuple with the TypeDefinitions field value if set, nil otherwise +// GetTypeDefinitionsOk returns a tuple with the TypeDefinitions field value // and a boolean to check if the value has been set. func (o *AuthorizationModel) GetTypeDefinitionsOk() (*[]TypeDefinition, bool) { - if o == nil || o.TypeDefinitions == nil { + if o == nil { + return nil, false + } + return &o.TypeDefinitions, true +} + +// SetTypeDefinitions sets field value +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.TypeDefinitions, true + return o.Conditions, true } -// HasTypeDefinitions returns a boolean if a field has been set. -func (o *AuthorizationModel) HasTypeDefinitions() bool { - if o != nil && o.TypeDefinitions != nil { +// 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 } -// SetTypeDefinitions gets a reference to the given []TypeDefinition and assigns it to the TypeDefinitions field. -func (o *AuthorizationModel) SetTypeDefinitions(v []TypeDefinition) { - o.TypeDefinitions = &v +// 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) { @@ -135,8 +161,9 @@ func (o AuthorizationModel) MarshalJSON() ([]byte, error) { toSerialize["id"] = o.Id } toSerialize["schema_version"] = o.SchemaVersion - if o.TypeDefinitions != nil { - toSerialize["type_definitions"] = o.TypeDefinitions + 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 0918e12..ba25c10 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"` - ContextualTuples *ContextualTupleKeys `json:"contextual_tuples,omitempty"` - AuthorizationModelId *string `json:"authorization_model_id,omitempty"` + TupleKey CheckRequestTupleKey `json:"tuple_key"yaml:"tuple_key"` + ContextualTuples *ContextualTupleKeys `json:"contextual_tuples,omitempty"yaml:"contextual_tuples,omitempty"` + AuthorizationModelId *string `json:"authorization_model_id,omitempty"yaml:"authorization_model_id,omitempty"` // Defaults to false. Making it true has performance implications. - Trace *bool `json:"trace,omitempty"` + Trace *bool `json:"trace,omitempty"yaml:"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"yaml:"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{}{} toSerialize["tuple_key"] = o.TupleKey @@ -175,6 +209,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..58560a9 --- /dev/null +++ b/model_check_request_tuple_key.go @@ -0,0 +1,160 @@ +/** + * 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"yaml:"user"` + Relation string `json:"relation"yaml:"relation"` + Object string `json:"object"yaml:"object"` +} + +// 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(user string, relation string, object string) *CheckRequestTupleKey { + this := CheckRequestTupleKey{} + this.User = user + this.Relation = relation + this.Object = object + 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 +func (o *CheckRequestTupleKey) GetUser() string { + if o == nil { + var ret string + return ret + } + + return o.User +} + +// GetUserOk returns a tuple with the User field value +// and a boolean to check if the value has been set. +func (o *CheckRequestTupleKey) GetUserOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.User, true +} + +// SetUser sets field value +func (o *CheckRequestTupleKey) SetUser(v string) { + o.User = v +} + +// GetRelation returns the Relation field value +func (o *CheckRequestTupleKey) GetRelation() string { + if o == nil { + var ret string + return ret + } + + return o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value +// and a boolean to check if the value has been set. +func (o *CheckRequestTupleKey) GetRelationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Relation, true +} + +// SetRelation sets field value +func (o *CheckRequestTupleKey) SetRelation(v string) { + o.Relation = v +} + +// GetObject returns the Object field value +func (o *CheckRequestTupleKey) GetObject() string { + if o == nil { + var ret string + return ret + } + + return o.Object +} + +// GetObjectOk returns a tuple with the Object field value +// and a boolean to check if the value has been set. +func (o *CheckRequestTupleKey) GetObjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Object, true +} + +// SetObject sets field value +func (o *CheckRequestTupleKey) SetObject(v string) { + o.Object = v +} + +func (o CheckRequestTupleKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + toSerialize["user"] = o.User + toSerialize["relation"] = o.Relation + 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_check_response.go b/model_check_response.go index 6ed415e..1d9ec8c 100644 --- a/model_check_response.go +++ b/model_check_response.go @@ -18,9 +18,9 @@ import ( // CheckResponse struct for CheckResponse type CheckResponse struct { - Allowed *bool `json:"allowed,omitempty"` + Allowed *bool `json:"allowed,omitempty"yaml:"allowed,omitempty"` // For internal use only. - Resolution *string `json:"resolution,omitempty"` + Resolution *string `json:"resolution,omitempty"yaml:"resolution,omitempty"` } // NewCheckResponse instantiates a new CheckResponse object diff --git a/model_computed.go b/model_computed.go index 6385f4b..b6a8d55 100644 --- a/model_computed.go +++ b/model_computed.go @@ -18,15 +18,16 @@ import ( // Computed struct for Computed type Computed struct { - Userset *string `json:"userset,omitempty"` + Userset string `json:"userset"yaml:"userset"` } // NewComputed instantiates a new Computed 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 NewComputed() *Computed { +func NewComputed(userset string) *Computed { this := Computed{} + this.Userset = userset return &this } @@ -38,43 +39,33 @@ func NewComputedWithDefaults() *Computed { return &this } -// GetUserset returns the Userset field value if set, zero value otherwise. +// GetUserset returns the Userset field value func (o *Computed) GetUserset() string { - if o == nil || o.Userset == nil { + if o == nil { var ret string return ret } - return *o.Userset + + return o.Userset } -// GetUsersetOk returns a tuple with the Userset field value if set, nil otherwise +// GetUsersetOk returns a tuple with the Userset field value // and a boolean to check if the value has been set. func (o *Computed) GetUsersetOk() (*string, bool) { - if o == nil || o.Userset == nil { + if o == nil { return nil, false } - return o.Userset, true -} - -// HasUserset returns a boolean if a field has been set. -func (o *Computed) HasUserset() bool { - if o != nil && o.Userset != nil { - return true - } - - return false + return &o.Userset, true } -// SetUserset gets a reference to the given string and assigns it to the Userset field. +// SetUserset sets field value func (o *Computed) SetUserset(v string) { - o.Userset = &v + o.Userset = v } func (o Computed) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Userset != nil { - toSerialize["userset"] = o.Userset - } + toSerialize["userset"] = o.Userset return json.Marshal(toSerialize) } diff --git a/model_condition.go b/model_condition.go new file mode 100644 index 0000000..6c66973 --- /dev/null +++ b/model_condition.go @@ -0,0 +1,171 @@ +/** + * 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"yaml:"name"` + // A Google CEL expression, expressed as a string. + Expression string `json:"expression"yaml:"expression"` + // A map of parameter names to the parameter's defined type reference. + Parameters *map[string]ConditionParamTypeRef `json:"parameters,omitempty"yaml:"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{}{} + toSerialize["name"] = o.Name + 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..c251041 --- /dev/null +++ b/model_condition_param_type_ref.go @@ -0,0 +1,144 @@ +/** + * 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:"type_name"yaml:"type_name"` + GenericTypes *[]ConditionParamTypeRef `json:"generic_types,omitempty"yaml:"generic_types,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{}{} + toSerialize["type_name"] = o.TypeName + if o.GenericTypes != nil { + toSerialize["generic_types"] = 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_contextual_tuple_keys.go b/model_contextual_tuple_keys.go index e9e4302..f464a2e 100644 --- a/model_contextual_tuple_keys.go +++ b/model_contextual_tuple_keys.go @@ -18,7 +18,7 @@ import ( // ContextualTupleKeys struct for ContextualTupleKeys type ContextualTupleKeys struct { - TupleKeys []TupleKey `json:"tuple_keys"` + TupleKeys []TupleKey `json:"tuple_keys"yaml:"tuple_keys"` } // NewContextualTupleKeys instantiates a new ContextualTupleKeys object diff --git a/model_create_store_request.go b/model_create_store_request.go index 7814527..581ee96 100644 --- a/model_create_store_request.go +++ b/model_create_store_request.go @@ -18,7 +18,7 @@ import ( // CreateStoreRequest struct for CreateStoreRequest type CreateStoreRequest struct { - Name string `json:"name"` + Name string `json:"name"yaml:"name"` } // NewCreateStoreRequest instantiates a new CreateStoreRequest object diff --git a/model_create_store_response.go b/model_create_store_response.go index c7e3ce1..8f1ec34 100644 --- a/model_create_store_response.go +++ b/model_create_store_response.go @@ -19,18 +19,22 @@ import ( // CreateStoreResponse struct for CreateStoreResponse type CreateStoreResponse struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` + Id string `json:"id"yaml:"id"` + Name string `json:"name"yaml:"name"` + CreatedAt time.Time `json:"created_at"yaml:"created_at"` + UpdatedAt time.Time `json:"updated_at"yaml:"updated_at"` } // NewCreateStoreResponse instantiates a new CreateStoreResponse 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 NewCreateStoreResponse() *CreateStoreResponse { +func NewCreateStoreResponse(id string, name string, createdAt time.Time, updatedAt time.Time) *CreateStoreResponse { this := CreateStoreResponse{} + this.Id = id + this.Name = name + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt return &this } @@ -42,148 +46,108 @@ func NewCreateStoreResponseWithDefaults() *CreateStoreResponse { return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value func (o *CreateStoreResponse) GetId() string { - if o == nil || o.Id == nil { + if o == nil { var ret string return ret } - return *o.Id + + return o.Id } -// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *CreateStoreResponse) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil { return nil, false } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *CreateStoreResponse) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false + return &o.Id, true } -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId sets field value func (o *CreateStoreResponse) SetId(v string) { - o.Id = &v + o.Id = v } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value func (o *CreateStoreResponse) GetName() string { - if o == nil || o.Name == nil { + if o == nil { var ret string return ret } - return *o.Name + + return o.Name } -// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *CreateStoreResponse) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { + if o == nil { return nil, false } - return o.Name, true + return &o.Name, true } -// HasName returns a boolean if a field has been set. -func (o *CreateStoreResponse) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName sets field value func (o *CreateStoreResponse) SetName(v string) { - o.Name = &v + o.Name = v } -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +// GetCreatedAt returns the CreatedAt field value func (o *CreateStoreResponse) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil { var ret time.Time return ret } - return *o.CreatedAt + + return o.CreatedAt } -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// GetCreatedAtOk returns a tuple with the CreatedAt field value // and a boolean to check if the value has been set. func (o *CreateStoreResponse) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil { return nil, false } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *CreateStoreResponse) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false + return &o.CreatedAt, true } -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +// SetCreatedAt sets field value func (o *CreateStoreResponse) SetCreatedAt(v time.Time) { - o.CreatedAt = &v + o.CreatedAt = v } -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +// GetUpdatedAt returns the UpdatedAt field value func (o *CreateStoreResponse) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil { var ret time.Time return ret } - return *o.UpdatedAt + + return o.UpdatedAt } -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value // and a boolean to check if the value has been set. func (o *CreateStoreResponse) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil { return nil, false } - return o.UpdatedAt, true -} - -// HasUpdatedAt returns a boolean if a field has been set. -func (o *CreateStoreResponse) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { - return true - } - - return false + return &o.UpdatedAt, true } -// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +// SetUpdatedAt sets field value func (o *CreateStoreResponse) SetUpdatedAt(v time.Time) { - o.UpdatedAt = &v + o.UpdatedAt = v } func (o CreateStoreResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.UpdatedAt != nil { - toSerialize["updated_at"] = o.UpdatedAt - } + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["created_at"] = o.CreatedAt + toSerialize["updated_at"] = o.UpdatedAt return json.Marshal(toSerialize) } diff --git a/model_difference.go b/model_difference.go index 8875a82..22d3f69 100644 --- a/model_difference.go +++ b/model_difference.go @@ -18,8 +18,8 @@ import ( // Difference struct for Difference type Difference struct { - Base Userset `json:"base"` - Subtract Userset `json:"subtract"` + Base Userset `json:"base"yaml:"base"` + Subtract Userset `json:"subtract"yaml:"subtract"` } // NewDifference instantiates a new Difference object diff --git a/model_expand_request.go b/model_expand_request.go index c054b79..bd89345 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"yaml:"tuple_key"` + AuthorizationModelId *string `json:"authorization_model_id,omitempty"yaml:"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..557c731 --- /dev/null +++ b/model_expand_request_tuple_key.go @@ -0,0 +1,133 @@ +/** + * 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 { + Relation string `json:"relation"yaml:"relation"` + Object string `json:"object"yaml:"object"` +} + +// 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(relation string, object string) *ExpandRequestTupleKey { + this := ExpandRequestTupleKey{} + this.Relation = relation + this.Object = object + 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 +} + +// GetRelation returns the Relation field value +func (o *ExpandRequestTupleKey) GetRelation() string { + if o == nil { + var ret string + return ret + } + + return o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value +// and a boolean to check if the value has been set. +func (o *ExpandRequestTupleKey) GetRelationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Relation, true +} + +// SetRelation sets field value +func (o *ExpandRequestTupleKey) SetRelation(v string) { + o.Relation = v +} + +// GetObject returns the Object field value +func (o *ExpandRequestTupleKey) GetObject() string { + if o == nil { + var ret string + return ret + } + + return o.Object +} + +// GetObjectOk returns a tuple with the Object field value +// and a boolean to check if the value has been set. +func (o *ExpandRequestTupleKey) GetObjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Object, true +} + +// SetObject sets field value +func (o *ExpandRequestTupleKey) SetObject(v string) { + o.Object = v +} + +func (o ExpandRequestTupleKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + toSerialize["relation"] = o.Relation + toSerialize["object"] = o.Object + 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_expand_response.go b/model_expand_response.go index 8aa0574..67d0f90 100644 --- a/model_expand_response.go +++ b/model_expand_response.go @@ -18,7 +18,7 @@ import ( // ExpandResponse struct for ExpandResponse type ExpandResponse struct { - Tree *UsersetTree `json:"tree,omitempty"` + Tree *UsersetTree `json:"tree,omitempty"yaml:"tree,omitempty"` } // NewExpandResponse instantiates a new ExpandResponse object diff --git a/model_get_store_response.go b/model_get_store_response.go index bd63938..2399873 100644 --- a/model_get_store_response.go +++ b/model_get_store_response.go @@ -19,18 +19,22 @@ import ( // GetStoreResponse struct for GetStoreResponse type GetStoreResponse struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` + Id string `json:"id"yaml:"id"` + Name string `json:"name"yaml:"name"` + CreatedAt time.Time `json:"created_at"yaml:"created_at"` + UpdatedAt time.Time `json:"updated_at"yaml:"updated_at"` } // NewGetStoreResponse instantiates a new GetStoreResponse 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 NewGetStoreResponse() *GetStoreResponse { +func NewGetStoreResponse(id string, name string, createdAt time.Time, updatedAt time.Time) *GetStoreResponse { this := GetStoreResponse{} + this.Id = id + this.Name = name + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt return &this } @@ -42,148 +46,108 @@ func NewGetStoreResponseWithDefaults() *GetStoreResponse { return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value func (o *GetStoreResponse) GetId() string { - if o == nil || o.Id == nil { + if o == nil { var ret string return ret } - return *o.Id + + return o.Id } -// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *GetStoreResponse) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil { return nil, false } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *GetStoreResponse) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false + return &o.Id, true } -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId sets field value func (o *GetStoreResponse) SetId(v string) { - o.Id = &v + o.Id = v } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value func (o *GetStoreResponse) GetName() string { - if o == nil || o.Name == nil { + if o == nil { var ret string return ret } - return *o.Name + + return o.Name } -// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *GetStoreResponse) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { + if o == nil { return nil, false } - return o.Name, true + return &o.Name, true } -// HasName returns a boolean if a field has been set. -func (o *GetStoreResponse) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName sets field value func (o *GetStoreResponse) SetName(v string) { - o.Name = &v + o.Name = v } -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +// GetCreatedAt returns the CreatedAt field value func (o *GetStoreResponse) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil { var ret time.Time return ret } - return *o.CreatedAt + + return o.CreatedAt } -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// GetCreatedAtOk returns a tuple with the CreatedAt field value // and a boolean to check if the value has been set. func (o *GetStoreResponse) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil { return nil, false } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *GetStoreResponse) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false + return &o.CreatedAt, true } -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +// SetCreatedAt sets field value func (o *GetStoreResponse) SetCreatedAt(v time.Time) { - o.CreatedAt = &v + o.CreatedAt = v } -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +// GetUpdatedAt returns the UpdatedAt field value func (o *GetStoreResponse) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil { var ret time.Time return ret } - return *o.UpdatedAt + + return o.UpdatedAt } -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value // and a boolean to check if the value has been set. func (o *GetStoreResponse) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil { return nil, false } - return o.UpdatedAt, true -} - -// HasUpdatedAt returns a boolean if a field has been set. -func (o *GetStoreResponse) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { - return true - } - - return false + return &o.UpdatedAt, true } -// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +// SetUpdatedAt sets field value func (o *GetStoreResponse) SetUpdatedAt(v time.Time) { - o.UpdatedAt = &v + o.UpdatedAt = v } func (o GetStoreResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.UpdatedAt != nil { - toSerialize["updated_at"] = o.UpdatedAt - } + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["created_at"] = o.CreatedAt + toSerialize["updated_at"] = o.UpdatedAt return json.Marshal(toSerialize) } diff --git a/model_internal_error_message_response.go b/model_internal_error_message_response.go index 9bf7ec9..7beb336 100644 --- a/model_internal_error_message_response.go +++ b/model_internal_error_message_response.go @@ -18,8 +18,8 @@ import ( // InternalErrorMessageResponse struct for InternalErrorMessageResponse type InternalErrorMessageResponse struct { - Code *InternalErrorCode `json:"code,omitempty"` - Message *string `json:"message,omitempty"` + Code *InternalErrorCode `json:"code,omitempty"yaml:"code,omitempty"` + Message *string `json:"message,omitempty"yaml:"message,omitempty"` } // NewInternalErrorMessageResponse instantiates a new InternalErrorMessageResponse object diff --git a/model_leaf.go b/model_leaf.go index 3f33b84..659f5a1 100644 --- a/model_leaf.go +++ b/model_leaf.go @@ -18,9 +18,9 @@ import ( // Leaf A leaf node contains either - a set of users (which may be individual users, or usersets referencing other relations) - a computed node, which is the result of a computed userset value in the authorization model - a tupleToUserset nodes, containing the result of expanding a tupleToUserset value in a authorization model. type Leaf struct { - Users *Users `json:"users,omitempty"` - Computed *Computed `json:"computed,omitempty"` - TupleToUserset *UsersetTreeTupleToUserset `json:"tupleToUserset,omitempty"` + Users *Users `json:"users,omitempty"yaml:"users,omitempty"` + Computed *Computed `json:"computed,omitempty"yaml:"computed,omitempty"` + TupleToUserset *UsersetTreeTupleToUserset `json:"tupleToUserset,omitempty"yaml:"tupleToUserset,omitempty"` } // NewLeaf instantiates a new Leaf object diff --git a/model_list_objects_request.go b/model_list_objects_request.go index e80e3b1..93a1bd4 100644 --- a/model_list_objects_request.go +++ b/model_list_objects_request.go @@ -18,11 +18,13 @@ import ( // ListObjectsRequest struct for ListObjectsRequest type ListObjectsRequest struct { - AuthorizationModelId *string `json:"authorization_model_id,omitempty"` - Type string `json:"type"` - Relation string `json:"relation"` - User string `json:"user"` - ContextualTuples *ContextualTupleKeys `json:"contextual_tuples,omitempty"` + AuthorizationModelId *string `json:"authorization_model_id,omitempty"yaml:"authorization_model_id,omitempty"` + Type string `json:"type"yaml:"type"` + Relation string `json:"relation"yaml:"relation"` + User string `json:"user"yaml:"user"` + ContextualTuples *ContextualTupleKeys `json:"contextual_tuples,omitempty"yaml:"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"yaml:"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 { @@ -192,6 +226,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_list_objects_response.go b/model_list_objects_response.go index bd595c5..dd4bf0f 100644 --- a/model_list_objects_response.go +++ b/model_list_objects_response.go @@ -18,15 +18,16 @@ import ( // ListObjectsResponse struct for ListObjectsResponse type ListObjectsResponse struct { - Objects *[]string `json:"objects,omitempty"` + Objects []string `json:"objects"yaml:"objects"` } // NewListObjectsResponse instantiates a new ListObjectsResponse 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 NewListObjectsResponse() *ListObjectsResponse { +func NewListObjectsResponse(objects []string) *ListObjectsResponse { this := ListObjectsResponse{} + this.Objects = objects return &this } @@ -38,43 +39,33 @@ func NewListObjectsResponseWithDefaults() *ListObjectsResponse { return &this } -// GetObjects returns the Objects field value if set, zero value otherwise. +// GetObjects returns the Objects field value func (o *ListObjectsResponse) GetObjects() []string { - if o == nil || o.Objects == nil { + if o == nil { var ret []string return ret } - return *o.Objects + + return o.Objects } -// GetObjectsOk returns a tuple with the Objects field value if set, nil otherwise +// GetObjectsOk returns a tuple with the Objects field value // and a boolean to check if the value has been set. func (o *ListObjectsResponse) GetObjectsOk() (*[]string, bool) { - if o == nil || o.Objects == nil { + if o == nil { return nil, false } - return o.Objects, true -} - -// HasObjects returns a boolean if a field has been set. -func (o *ListObjectsResponse) HasObjects() bool { - if o != nil && o.Objects != nil { - return true - } - - return false + return &o.Objects, true } -// SetObjects gets a reference to the given []string and assigns it to the Objects field. +// SetObjects sets field value func (o *ListObjectsResponse) SetObjects(v []string) { - o.Objects = &v + o.Objects = v } func (o ListObjectsResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Objects != nil { - toSerialize["objects"] = o.Objects - } + toSerialize["objects"] = o.Objects return json.Marshal(toSerialize) } diff --git a/model_list_stores_response.go b/model_list_stores_response.go index e8cbf58..8ea9d6f 100644 --- a/model_list_stores_response.go +++ b/model_list_stores_response.go @@ -18,17 +18,19 @@ import ( // ListStoresResponse struct for ListStoresResponse type ListStoresResponse struct { - Stores *[]Store `json:"stores,omitempty"` + Stores []Store `json:"stores"yaml:"stores"` // The continuation token will be empty if there are no more stores. - ContinuationToken *string `json:"continuation_token,omitempty"` + ContinuationToken string `json:"continuation_token"yaml:"continuation_token"` } // NewListStoresResponse instantiates a new ListStoresResponse 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 NewListStoresResponse() *ListStoresResponse { +func NewListStoresResponse(stores []Store, continuationToken string) *ListStoresResponse { this := ListStoresResponse{} + this.Stores = stores + this.ContinuationToken = continuationToken return &this } @@ -40,78 +42,58 @@ func NewListStoresResponseWithDefaults() *ListStoresResponse { return &this } -// GetStores returns the Stores field value if set, zero value otherwise. +// GetStores returns the Stores field value func (o *ListStoresResponse) GetStores() []Store { - if o == nil || o.Stores == nil { + if o == nil { var ret []Store return ret } - return *o.Stores + + return o.Stores } -// GetStoresOk returns a tuple with the Stores field value if set, nil otherwise +// GetStoresOk returns a tuple with the Stores field value // and a boolean to check if the value has been set. func (o *ListStoresResponse) GetStoresOk() (*[]Store, bool) { - if o == nil || o.Stores == nil { + if o == nil { return nil, false } - return o.Stores, true -} - -// HasStores returns a boolean if a field has been set. -func (o *ListStoresResponse) HasStores() bool { - if o != nil && o.Stores != nil { - return true - } - - return false + return &o.Stores, true } -// SetStores gets a reference to the given []Store and assigns it to the Stores field. +// SetStores sets field value func (o *ListStoresResponse) SetStores(v []Store) { - o.Stores = &v + o.Stores = v } -// GetContinuationToken returns the ContinuationToken field value if set, zero value otherwise. +// GetContinuationToken returns the ContinuationToken field value func (o *ListStoresResponse) GetContinuationToken() string { - if o == nil || o.ContinuationToken == nil { + if o == nil { var ret string return ret } - return *o.ContinuationToken + + return o.ContinuationToken } -// GetContinuationTokenOk returns a tuple with the ContinuationToken field value if set, nil otherwise +// GetContinuationTokenOk returns a tuple with the ContinuationToken field value // and a boolean to check if the value has been set. func (o *ListStoresResponse) GetContinuationTokenOk() (*string, bool) { - if o == nil || o.ContinuationToken == nil { + if o == nil { return nil, false } - return o.ContinuationToken, true + return &o.ContinuationToken, true } -// HasContinuationToken returns a boolean if a field has been set. -func (o *ListStoresResponse) HasContinuationToken() bool { - if o != nil && o.ContinuationToken != nil { - return true - } - - return false -} - -// SetContinuationToken gets a reference to the given string and assigns it to the ContinuationToken field. +// SetContinuationToken sets field value func (o *ListStoresResponse) SetContinuationToken(v string) { - o.ContinuationToken = &v + o.ContinuationToken = v } func (o ListStoresResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Stores != nil { - toSerialize["stores"] = o.Stores - } - if o.ContinuationToken != nil { - toSerialize["continuation_token"] = o.ContinuationToken - } + toSerialize["stores"] = o.Stores + toSerialize["continuation_token"] = o.ContinuationToken return json.Marshal(toSerialize) } diff --git a/model_metadata.go b/model_metadata.go index c2a6d98..9ece70c 100644 --- a/model_metadata.go +++ b/model_metadata.go @@ -18,7 +18,7 @@ import ( // Metadata struct for Metadata type Metadata struct { - Relations *map[string]RelationMetadata `json:"relations,omitempty"` + Relations *map[string]RelationMetadata `json:"relations,omitempty"yaml:"relations,omitempty"` } // NewMetadata instantiates a new Metadata object diff --git a/model_node.go b/model_node.go index 40e66ca..9f0f20d 100644 --- a/model_node.go +++ b/model_node.go @@ -18,19 +18,20 @@ import ( // Node struct for Node type Node struct { - Name *string `json:"name,omitempty"` - Leaf *Leaf `json:"leaf,omitempty"` - Difference *UsersetTreeDifference `json:"difference,omitempty"` - Union *Nodes `json:"union,omitempty"` - Intersection *Nodes `json:"intersection,omitempty"` + Name string `json:"name"yaml:"name"` + Leaf *Leaf `json:"leaf,omitempty"yaml:"leaf,omitempty"` + Difference *UsersetTreeDifference `json:"difference,omitempty"yaml:"difference,omitempty"` + Union *Nodes `json:"union,omitempty"yaml:"union,omitempty"` + Intersection *Nodes `json:"intersection,omitempty"yaml:"intersection,omitempty"` } // NewNode instantiates a new Node 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 NewNode() *Node { +func NewNode(name string) *Node { this := Node{} + this.Name = name return &this } @@ -42,36 +43,28 @@ func NewNodeWithDefaults() *Node { return &this } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value func (o *Node) GetName() string { - if o == nil || o.Name == nil { + if o == nil { var ret string return ret } - return *o.Name + + return o.Name } -// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *Node) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { + if o == nil { return nil, false } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *Node) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + return &o.Name, true } -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName sets field value func (o *Node) SetName(v string) { - o.Name = &v + o.Name = v } // GetLeaf returns the Leaf field value if set, zero value otherwise. @@ -204,9 +197,7 @@ func (o *Node) SetIntersection(v Nodes) { func (o Node) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } + toSerialize["name"] = o.Name if o.Leaf != nil { toSerialize["leaf"] = o.Leaf } diff --git a/model_nodes.go b/model_nodes.go index 5f1932c..93c8571 100644 --- a/model_nodes.go +++ b/model_nodes.go @@ -18,15 +18,16 @@ import ( // Nodes struct for Nodes type Nodes struct { - Nodes *[]Node `json:"nodes,omitempty"` + Nodes []Node `json:"nodes"yaml:"nodes"` } // NewNodes instantiates a new Nodes 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 NewNodes() *Nodes { +func NewNodes(nodes []Node) *Nodes { this := Nodes{} + this.Nodes = nodes return &this } @@ -38,43 +39,33 @@ func NewNodesWithDefaults() *Nodes { return &this } -// GetNodes returns the Nodes field value if set, zero value otherwise. +// GetNodes returns the Nodes field value func (o *Nodes) GetNodes() []Node { - if o == nil || o.Nodes == nil { + if o == nil { var ret []Node return ret } - return *o.Nodes + + return o.Nodes } -// GetNodesOk returns a tuple with the Nodes field value if set, nil otherwise +// GetNodesOk returns a tuple with the Nodes field value // and a boolean to check if the value has been set. func (o *Nodes) GetNodesOk() (*[]Node, bool) { - if o == nil || o.Nodes == nil { + if o == nil { return nil, false } - return o.Nodes, true -} - -// HasNodes returns a boolean if a field has been set. -func (o *Nodes) HasNodes() bool { - if o != nil && o.Nodes != nil { - return true - } - - return false + return &o.Nodes, true } -// SetNodes gets a reference to the given []Node and assigns it to the Nodes field. +// SetNodes sets field value func (o *Nodes) SetNodes(v []Node) { - o.Nodes = &v + o.Nodes = v } func (o Nodes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Nodes != nil { - toSerialize["nodes"] = o.Nodes - } + toSerialize["nodes"] = o.Nodes 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_object_relation.go b/model_object_relation.go index 2d7d697..f81c9bc 100644 --- a/model_object_relation.go +++ b/model_object_relation.go @@ -18,8 +18,8 @@ import ( // ObjectRelation struct for ObjectRelation type ObjectRelation struct { - Object *string `json:"object,omitempty"` - Relation *string `json:"relation,omitempty"` + Object *string `json:"object,omitempty"yaml:"object,omitempty"` + Relation *string `json:"relation,omitempty"yaml:"relation,omitempty"` } // NewObjectRelation instantiates a new ObjectRelation object diff --git a/model_path_unknown_error_message_response.go b/model_path_unknown_error_message_response.go index c0e5be8..ddc8de4 100644 --- a/model_path_unknown_error_message_response.go +++ b/model_path_unknown_error_message_response.go @@ -18,8 +18,8 @@ import ( // PathUnknownErrorMessageResponse struct for PathUnknownErrorMessageResponse type PathUnknownErrorMessageResponse struct { - Code *NotFoundErrorCode `json:"code,omitempty"` - Message *string `json:"message,omitempty"` + Code *NotFoundErrorCode `json:"code,omitempty"yaml:"code,omitempty"` + Message *string `json:"message,omitempty"yaml:"message,omitempty"` } // NewPathUnknownErrorMessageResponse instantiates a new PathUnknownErrorMessageResponse object diff --git a/model_read_assertions_response.go b/model_read_assertions_response.go index c88ae6c..84e968e 100644 --- a/model_read_assertions_response.go +++ b/model_read_assertions_response.go @@ -18,16 +18,17 @@ import ( // ReadAssertionsResponse struct for ReadAssertionsResponse type ReadAssertionsResponse struct { - AuthorizationModelId *string `json:"authorization_model_id,omitempty"` - Assertions *[]Assertion `json:"assertions,omitempty"` + AuthorizationModelId string `json:"authorization_model_id"yaml:"authorization_model_id"` + Assertions *[]Assertion `json:"assertions,omitempty"yaml:"assertions,omitempty"` } // NewReadAssertionsResponse instantiates a new ReadAssertionsResponse 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 NewReadAssertionsResponse() *ReadAssertionsResponse { +func NewReadAssertionsResponse(authorizationModelId string) *ReadAssertionsResponse { this := ReadAssertionsResponse{} + this.AuthorizationModelId = authorizationModelId return &this } @@ -39,36 +40,28 @@ func NewReadAssertionsResponseWithDefaults() *ReadAssertionsResponse { return &this } -// GetAuthorizationModelId returns the AuthorizationModelId field value if set, zero value otherwise. +// GetAuthorizationModelId returns the AuthorizationModelId field value func (o *ReadAssertionsResponse) GetAuthorizationModelId() string { - if o == nil || o.AuthorizationModelId == nil { + if o == nil { var ret string return ret } - return *o.AuthorizationModelId + + return o.AuthorizationModelId } -// GetAuthorizationModelIdOk returns a tuple with the AuthorizationModelId field value if set, nil otherwise +// GetAuthorizationModelIdOk returns a tuple with the AuthorizationModelId field value // and a boolean to check if the value has been set. func (o *ReadAssertionsResponse) GetAuthorizationModelIdOk() (*string, bool) { - if o == nil || o.AuthorizationModelId == nil { + if o == nil { return nil, false } - return o.AuthorizationModelId, true -} - -// HasAuthorizationModelId returns a boolean if a field has been set. -func (o *ReadAssertionsResponse) HasAuthorizationModelId() bool { - if o != nil && o.AuthorizationModelId != nil { - return true - } - - return false + return &o.AuthorizationModelId, true } -// SetAuthorizationModelId gets a reference to the given string and assigns it to the AuthorizationModelId field. +// SetAuthorizationModelId sets field value func (o *ReadAssertionsResponse) SetAuthorizationModelId(v string) { - o.AuthorizationModelId = &v + o.AuthorizationModelId = v } // GetAssertions returns the Assertions field value if set, zero value otherwise. @@ -105,9 +98,7 @@ func (o *ReadAssertionsResponse) SetAssertions(v []Assertion) { func (o ReadAssertionsResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.AuthorizationModelId != nil { - toSerialize["authorization_model_id"] = o.AuthorizationModelId - } + toSerialize["authorization_model_id"] = o.AuthorizationModelId if o.Assertions != nil { toSerialize["assertions"] = o.Assertions } diff --git a/model_read_authorization_model_response.go b/model_read_authorization_model_response.go index e439e49..04179bc 100644 --- a/model_read_authorization_model_response.go +++ b/model_read_authorization_model_response.go @@ -18,7 +18,7 @@ import ( // ReadAuthorizationModelResponse struct for ReadAuthorizationModelResponse type ReadAuthorizationModelResponse struct { - AuthorizationModel *AuthorizationModel `json:"authorization_model,omitempty"` + AuthorizationModel *AuthorizationModel `json:"authorization_model,omitempty"yaml:"authorization_model,omitempty"` } // NewReadAuthorizationModelResponse instantiates a new ReadAuthorizationModelResponse object diff --git a/model_read_authorization_models_response.go b/model_read_authorization_models_response.go index be5ceab..bf60fda 100644 --- a/model_read_authorization_models_response.go +++ b/model_read_authorization_models_response.go @@ -18,17 +18,18 @@ import ( // ReadAuthorizationModelsResponse struct for ReadAuthorizationModelsResponse type ReadAuthorizationModelsResponse struct { - AuthorizationModels *[]AuthorizationModel `json:"authorization_models,omitempty"` + AuthorizationModels []AuthorizationModel `json:"authorization_models"yaml:"authorization_models"` // The continuation token will be empty if there are no more models. - ContinuationToken *string `json:"continuation_token,omitempty"` + ContinuationToken *string `json:"continuation_token,omitempty"yaml:"continuation_token,omitempty"` } // NewReadAuthorizationModelsResponse instantiates a new ReadAuthorizationModelsResponse 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 NewReadAuthorizationModelsResponse() *ReadAuthorizationModelsResponse { +func NewReadAuthorizationModelsResponse(authorizationModels []AuthorizationModel) *ReadAuthorizationModelsResponse { this := ReadAuthorizationModelsResponse{} + this.AuthorizationModels = authorizationModels return &this } @@ -40,36 +41,28 @@ func NewReadAuthorizationModelsResponseWithDefaults() *ReadAuthorizationModelsRe return &this } -// GetAuthorizationModels returns the AuthorizationModels field value if set, zero value otherwise. +// GetAuthorizationModels returns the AuthorizationModels field value func (o *ReadAuthorizationModelsResponse) GetAuthorizationModels() []AuthorizationModel { - if o == nil || o.AuthorizationModels == nil { + if o == nil { var ret []AuthorizationModel return ret } - return *o.AuthorizationModels + + return o.AuthorizationModels } -// GetAuthorizationModelsOk returns a tuple with the AuthorizationModels field value if set, nil otherwise +// GetAuthorizationModelsOk returns a tuple with the AuthorizationModels field value // and a boolean to check if the value has been set. func (o *ReadAuthorizationModelsResponse) GetAuthorizationModelsOk() (*[]AuthorizationModel, bool) { - if o == nil || o.AuthorizationModels == nil { + if o == nil { return nil, false } - return o.AuthorizationModels, true -} - -// HasAuthorizationModels returns a boolean if a field has been set. -func (o *ReadAuthorizationModelsResponse) HasAuthorizationModels() bool { - if o != nil && o.AuthorizationModels != nil { - return true - } - - return false + return &o.AuthorizationModels, true } -// SetAuthorizationModels gets a reference to the given []AuthorizationModel and assigns it to the AuthorizationModels field. +// SetAuthorizationModels sets field value func (o *ReadAuthorizationModelsResponse) SetAuthorizationModels(v []AuthorizationModel) { - o.AuthorizationModels = &v + o.AuthorizationModels = v } // GetContinuationToken returns the ContinuationToken field value if set, zero value otherwise. @@ -106,9 +99,7 @@ func (o *ReadAuthorizationModelsResponse) SetContinuationToken(v string) { func (o ReadAuthorizationModelsResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.AuthorizationModels != nil { - toSerialize["authorization_models"] = o.AuthorizationModels - } + toSerialize["authorization_models"] = o.AuthorizationModels if o.ContinuationToken != nil { toSerialize["continuation_token"] = o.ContinuationToken } diff --git a/model_read_changes_response.go b/model_read_changes_response.go index d519c2c..380cce7 100644 --- a/model_read_changes_response.go +++ b/model_read_changes_response.go @@ -18,17 +18,18 @@ import ( // ReadChangesResponse struct for ReadChangesResponse type ReadChangesResponse struct { - Changes *[]TupleChange `json:"changes,omitempty"` + Changes []TupleChange `json:"changes"yaml:"changes"` // The continuation token will be identical if there are no new changes. - ContinuationToken *string `json:"continuation_token,omitempty"` + ContinuationToken *string `json:"continuation_token,omitempty"yaml:"continuation_token,omitempty"` } // NewReadChangesResponse instantiates a new ReadChangesResponse 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 NewReadChangesResponse() *ReadChangesResponse { +func NewReadChangesResponse(changes []TupleChange) *ReadChangesResponse { this := ReadChangesResponse{} + this.Changes = changes return &this } @@ -40,36 +41,28 @@ func NewReadChangesResponseWithDefaults() *ReadChangesResponse { return &this } -// GetChanges returns the Changes field value if set, zero value otherwise. +// GetChanges returns the Changes field value func (o *ReadChangesResponse) GetChanges() []TupleChange { - if o == nil || o.Changes == nil { + if o == nil { var ret []TupleChange return ret } - return *o.Changes + + return o.Changes } -// GetChangesOk returns a tuple with the Changes field value if set, nil otherwise +// GetChangesOk returns a tuple with the Changes field value // and a boolean to check if the value has been set. func (o *ReadChangesResponse) GetChangesOk() (*[]TupleChange, bool) { - if o == nil || o.Changes == nil { + if o == nil { return nil, false } - return o.Changes, true -} - -// HasChanges returns a boolean if a field has been set. -func (o *ReadChangesResponse) HasChanges() bool { - if o != nil && o.Changes != nil { - return true - } - - return false + return &o.Changes, true } -// SetChanges gets a reference to the given []TupleChange and assigns it to the Changes field. +// SetChanges sets field value func (o *ReadChangesResponse) SetChanges(v []TupleChange) { - o.Changes = &v + o.Changes = v } // GetContinuationToken returns the ContinuationToken field value if set, zero value otherwise. @@ -106,9 +99,7 @@ func (o *ReadChangesResponse) SetContinuationToken(v string) { func (o ReadChangesResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Changes != nil { - toSerialize["changes"] = o.Changes - } + toSerialize["changes"] = o.Changes if o.ContinuationToken != nil { toSerialize["continuation_token"] = o.ContinuationToken } diff --git a/model_read_request.go b/model_read_request.go index 483b057..eaf2e76 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"yaml:"tuple_key,omitempty"` + PageSize *int32 `json:"page_size,omitempty"yaml:"page_size,omitempty"` + ContinuationToken *string `json:"continuation_token,omitempty"yaml:"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..f8b8c2d --- /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"yaml:"user,omitempty"` + Relation *string `json:"relation,omitempty"yaml:"relation,omitempty"` + Object *string `json:"object,omitempty"yaml:"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_read_response.go b/model_read_response.go index b3036b2..a8bbe74 100644 --- a/model_read_response.go +++ b/model_read_response.go @@ -18,17 +18,19 @@ import ( // ReadResponse struct for ReadResponse type ReadResponse struct { - Tuples *[]Tuple `json:"tuples,omitempty"` + Tuples []Tuple `json:"tuples"yaml:"tuples"` // The continuation token will be empty if there are no more tuples. - ContinuationToken *string `json:"continuation_token,omitempty"` + ContinuationToken string `json:"continuation_token"yaml:"continuation_token"` } // NewReadResponse instantiates a new ReadResponse 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 NewReadResponse() *ReadResponse { +func NewReadResponse(tuples []Tuple, continuationToken string) *ReadResponse { this := ReadResponse{} + this.Tuples = tuples + this.ContinuationToken = continuationToken return &this } @@ -40,78 +42,58 @@ func NewReadResponseWithDefaults() *ReadResponse { return &this } -// GetTuples returns the Tuples field value if set, zero value otherwise. +// GetTuples returns the Tuples field value func (o *ReadResponse) GetTuples() []Tuple { - if o == nil || o.Tuples == nil { + if o == nil { var ret []Tuple return ret } - return *o.Tuples + + return o.Tuples } -// GetTuplesOk returns a tuple with the Tuples field value if set, nil otherwise +// GetTuplesOk returns a tuple with the Tuples field value // and a boolean to check if the value has been set. func (o *ReadResponse) GetTuplesOk() (*[]Tuple, bool) { - if o == nil || o.Tuples == nil { + if o == nil { return nil, false } - return o.Tuples, true -} - -// HasTuples returns a boolean if a field has been set. -func (o *ReadResponse) HasTuples() bool { - if o != nil && o.Tuples != nil { - return true - } - - return false + return &o.Tuples, true } -// SetTuples gets a reference to the given []Tuple and assigns it to the Tuples field. +// SetTuples sets field value func (o *ReadResponse) SetTuples(v []Tuple) { - o.Tuples = &v + o.Tuples = v } -// GetContinuationToken returns the ContinuationToken field value if set, zero value otherwise. +// GetContinuationToken returns the ContinuationToken field value func (o *ReadResponse) GetContinuationToken() string { - if o == nil || o.ContinuationToken == nil { + if o == nil { var ret string return ret } - return *o.ContinuationToken + + return o.ContinuationToken } -// GetContinuationTokenOk returns a tuple with the ContinuationToken field value if set, nil otherwise +// GetContinuationTokenOk returns a tuple with the ContinuationToken field value // and a boolean to check if the value has been set. func (o *ReadResponse) GetContinuationTokenOk() (*string, bool) { - if o == nil || o.ContinuationToken == nil { + if o == nil { return nil, false } - return o.ContinuationToken, true + return &o.ContinuationToken, true } -// HasContinuationToken returns a boolean if a field has been set. -func (o *ReadResponse) HasContinuationToken() bool { - if o != nil && o.ContinuationToken != nil { - return true - } - - return false -} - -// SetContinuationToken gets a reference to the given string and assigns it to the ContinuationToken field. +// SetContinuationToken sets field value func (o *ReadResponse) SetContinuationToken(v string) { - o.ContinuationToken = &v + o.ContinuationToken = v } func (o ReadResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Tuples != nil { - toSerialize["tuples"] = o.Tuples - } - if o.ContinuationToken != nil { - toSerialize["continuation_token"] = o.ContinuationToken - } + toSerialize["tuples"] = o.Tuples + toSerialize["continuation_token"] = o.ContinuationToken return json.Marshal(toSerialize) } diff --git a/model_relation_metadata.go b/model_relation_metadata.go index 7dc578a..43c2985 100644 --- a/model_relation_metadata.go +++ b/model_relation_metadata.go @@ -18,7 +18,7 @@ import ( // RelationMetadata struct for RelationMetadata type RelationMetadata struct { - DirectlyRelatedUserTypes *[]RelationReference `json:"directly_related_user_types,omitempty"` + DirectlyRelatedUserTypes *[]RelationReference `json:"directly_related_user_types,omitempty"yaml:"directly_related_user_types,omitempty"` } // NewRelationMetadata instantiates a new RelationMetadata object diff --git a/model_relation_reference.go b/model_relation_reference.go index e3ac5da..13d5d9e 100644 --- a/model_relation_reference.go +++ b/model_relation_reference.go @@ -18,9 +18,11 @@ import ( // RelationReference RelationReference represents a relation of a particular object type (e.g. 'document#viewer'). type RelationReference struct { - Type string `json:"type"` - Relation *string `json:"relation,omitempty"` - Wildcard *map[string]interface{} `json:"wildcard,omitempty"` + Type string `json:"type"yaml:"type"` + Relation *string `json:"relation,omitempty"yaml:"relation,omitempty"` + Wildcard *map[string]interface{} `json:"wildcard,omitempty"yaml:"wildcard,omitempty"` + // The name of a condition that is enforced over the allowed relation. + Condition *string `json:"condition,omitempty"yaml:"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{}{} toSerialize["type"] = o.Type @@ -138,6 +172,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..36565ad --- /dev/null +++ b/model_relationship_condition.go @@ -0,0 +1,135 @@ +/** + * 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. + Name string `json:"name"yaml:"name"` + // 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"yaml:"context"` +} + +// 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(name string, context map[string]interface{}) *RelationshipCondition { + this := RelationshipCondition{} + this.Name = name + this.Context = context + 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 +} + +// GetName returns the Name field value +func (o *RelationshipCondition) 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 *RelationshipCondition) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *RelationshipCondition) SetName(v string) { + o.Name = v +} + +// GetContext returns the Context field value +func (o *RelationshipCondition) GetContext() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + + return o.Context +} + +// GetContextOk returns a tuple with the Context field value +// and a boolean to check if the value has been set. +func (o *RelationshipCondition) GetContextOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return &o.Context, true +} + +// SetContext sets field value +func (o *RelationshipCondition) SetContext(v map[string]interface{}) { + o.Context = v +} + +func (o RelationshipCondition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + 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_status.go b/model_status.go index e5c4e82..eb46b31 100644 --- a/model_status.go +++ b/model_status.go @@ -18,9 +18,9 @@ import ( // Status struct for Status type Status struct { - Code *int32 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Details *[]Any `json:"details,omitempty"` + Code *int32 `json:"code,omitempty"yaml:"code,omitempty"` + Message *string `json:"message,omitempty"yaml:"message,omitempty"` + Details *[]Any `json:"details,omitempty"yaml:"details,omitempty"` } // NewStatus instantiates a new Status object diff --git a/model_store.go b/model_store.go index 967db1f..753311c 100644 --- a/model_store.go +++ b/model_store.go @@ -19,19 +19,24 @@ import ( // Store struct for Store type Store struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - DeletedAt *time.Time `json:"deleted_at,omitempty"` + Id string `json:"id"yaml:"id"` + Name string `json:"name"yaml:"name"` + CreatedAt time.Time `json:"created_at"yaml:"created_at"` + UpdatedAt time.Time `json:"updated_at"yaml:"updated_at"` + DeletedAt time.Time `json:"deleted_at"yaml:"deleted_at"` } // NewStore instantiates a new Store 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 NewStore() *Store { +func NewStore(id string, name string, createdAt time.Time, updatedAt time.Time, deletedAt time.Time) *Store { this := Store{} + this.Id = id + this.Name = name + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.DeletedAt = deletedAt return &this } @@ -43,183 +48,133 @@ func NewStoreWithDefaults() *Store { return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value func (o *Store) GetId() string { - if o == nil || o.Id == nil { + if o == nil { var ret string return ret } - return *o.Id + + return o.Id } -// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *Store) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { + if o == nil { return nil, false } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *Store) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false + return &o.Id, true } -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId sets field value func (o *Store) SetId(v string) { - o.Id = &v + o.Id = v } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value func (o *Store) GetName() string { - if o == nil || o.Name == nil { + if o == nil { var ret string return ret } - return *o.Name + + return o.Name } -// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *Store) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { + if o == nil { return nil, false } - return o.Name, true + return &o.Name, true } -// HasName returns a boolean if a field has been set. -func (o *Store) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName sets field value func (o *Store) SetName(v string) { - o.Name = &v + o.Name = v } -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +// GetCreatedAt returns the CreatedAt field value func (o *Store) GetCreatedAt() time.Time { - if o == nil || o.CreatedAt == nil { + if o == nil { var ret time.Time return ret } - return *o.CreatedAt + + return o.CreatedAt } -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// GetCreatedAtOk returns a tuple with the CreatedAt field value // and a boolean to check if the value has been set. func (o *Store) GetCreatedAtOk() (*time.Time, bool) { - if o == nil || o.CreatedAt == nil { + if o == nil { return nil, false } - return o.CreatedAt, true -} - -// HasCreatedAt returns a boolean if a field has been set. -func (o *Store) HasCreatedAt() bool { - if o != nil && o.CreatedAt != nil { - return true - } - - return false + return &o.CreatedAt, true } -// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +// SetCreatedAt sets field value func (o *Store) SetCreatedAt(v time.Time) { - o.CreatedAt = &v + o.CreatedAt = v } -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +// GetUpdatedAt returns the UpdatedAt field value func (o *Store) GetUpdatedAt() time.Time { - if o == nil || o.UpdatedAt == nil { + if o == nil { var ret time.Time return ret } - return *o.UpdatedAt + + return o.UpdatedAt } -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value // and a boolean to check if the value has been set. func (o *Store) GetUpdatedAtOk() (*time.Time, bool) { - if o == nil || o.UpdatedAt == nil { + if o == nil { return nil, false } - return o.UpdatedAt, true -} - -// HasUpdatedAt returns a boolean if a field has been set. -func (o *Store) HasUpdatedAt() bool { - if o != nil && o.UpdatedAt != nil { - return true - } - - return false + return &o.UpdatedAt, true } -// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +// SetUpdatedAt sets field value func (o *Store) SetUpdatedAt(v time.Time) { - o.UpdatedAt = &v + o.UpdatedAt = v } -// GetDeletedAt returns the DeletedAt field value if set, zero value otherwise. +// GetDeletedAt returns the DeletedAt field value func (o *Store) GetDeletedAt() time.Time { - if o == nil || o.DeletedAt == nil { + if o == nil { var ret time.Time return ret } - return *o.DeletedAt + + return o.DeletedAt } -// GetDeletedAtOk returns a tuple with the DeletedAt field value if set, nil otherwise +// GetDeletedAtOk returns a tuple with the DeletedAt field value // and a boolean to check if the value has been set. func (o *Store) GetDeletedAtOk() (*time.Time, bool) { - if o == nil || o.DeletedAt == nil { + if o == nil { return nil, false } - return o.DeletedAt, true + return &o.DeletedAt, true } -// HasDeletedAt returns a boolean if a field has been set. -func (o *Store) HasDeletedAt() bool { - if o != nil && o.DeletedAt != nil { - return true - } - - return false -} - -// SetDeletedAt gets a reference to the given time.Time and assigns it to the DeletedAt field. +// SetDeletedAt sets field value func (o *Store) SetDeletedAt(v time.Time) { - o.DeletedAt = &v + o.DeletedAt = v } func (o Store) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { - toSerialize["id"] = o.Id - } - if o.Name != nil { - toSerialize["name"] = o.Name - } - if o.CreatedAt != nil { - toSerialize["created_at"] = o.CreatedAt - } - if o.UpdatedAt != nil { - toSerialize["updated_at"] = o.UpdatedAt - } - if o.DeletedAt != nil { - toSerialize["deleted_at"] = o.DeletedAt - } + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["created_at"] = o.CreatedAt + toSerialize["updated_at"] = o.UpdatedAt + toSerialize["deleted_at"] = o.DeletedAt return json.Marshal(toSerialize) } diff --git a/model_tuple.go b/model_tuple.go index 7af10c8..1a7661e 100644 --- a/model_tuple.go +++ b/model_tuple.go @@ -19,16 +19,18 @@ import ( // Tuple struct for Tuple type Tuple struct { - Key *TupleKey `json:"key,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` + Key TupleKey `json:"key"yaml:"key"` + Timestamp time.Time `json:"timestamp"yaml:"timestamp"` } // NewTuple instantiates a new Tuple 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 NewTuple() *Tuple { +func NewTuple(key TupleKey, timestamp time.Time) *Tuple { this := Tuple{} + this.Key = key + this.Timestamp = timestamp return &this } @@ -40,78 +42,58 @@ func NewTupleWithDefaults() *Tuple { return &this } -// GetKey returns the Key field value if set, zero value otherwise. +// GetKey returns the Key field value func (o *Tuple) GetKey() TupleKey { - if o == nil || o.Key == nil { + if o == nil { var ret TupleKey return ret } - return *o.Key + + return o.Key } -// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// GetKeyOk returns a tuple with the Key field value // and a boolean to check if the value has been set. func (o *Tuple) GetKeyOk() (*TupleKey, bool) { - if o == nil || o.Key == nil { + if o == nil { return nil, false } - return o.Key, true -} - -// HasKey returns a boolean if a field has been set. -func (o *Tuple) HasKey() bool { - if o != nil && o.Key != nil { - return true - } - - return false + return &o.Key, true } -// SetKey gets a reference to the given TupleKey and assigns it to the Key field. +// SetKey sets field value func (o *Tuple) SetKey(v TupleKey) { - o.Key = &v + o.Key = v } -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +// GetTimestamp returns the Timestamp field value func (o *Tuple) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { + if o == nil { var ret time.Time return ret } - return *o.Timestamp + + return o.Timestamp } -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// GetTimestampOk returns a tuple with the Timestamp field value // and a boolean to check if the value has been set. func (o *Tuple) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { + if o == nil { return nil, false } - return o.Timestamp, true + return &o.Timestamp, true } -// HasTimestamp returns a boolean if a field has been set. -func (o *Tuple) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +// SetTimestamp sets field value func (o *Tuple) SetTimestamp(v time.Time) { - o.Timestamp = &v + o.Timestamp = v } func (o Tuple) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Key != nil { - toSerialize["key"] = o.Key - } - if o.Timestamp != nil { - toSerialize["timestamp"] = o.Timestamp - } + toSerialize["key"] = o.Key + toSerialize["timestamp"] = o.Timestamp return json.Marshal(toSerialize) } diff --git a/model_tuple_change.go b/model_tuple_change.go index 862e190..8175ebb 100644 --- a/model_tuple_change.go +++ b/model_tuple_change.go @@ -19,19 +19,20 @@ import ( // TupleChange struct for TupleChange type TupleChange struct { - TupleKey *TupleKey `json:"tuple_key,omitempty"` - Operation *TupleOperation `json:"operation,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty"` + TupleKey TupleKey `json:"tuple_key"yaml:"tuple_key"` + Operation TupleOperation `json:"operation"yaml:"operation"` + Timestamp time.Time `json:"timestamp"yaml:"timestamp"` } // NewTupleChange instantiates a new TupleChange 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 NewTupleChange() *TupleChange { +func NewTupleChange(tupleKey TupleKey, operation TupleOperation, timestamp time.Time) *TupleChange { this := TupleChange{} - var operation TupleOperation = WRITE - this.Operation = &operation + this.TupleKey = tupleKey + this.Operation = operation + this.Timestamp = timestamp return &this } @@ -41,117 +42,87 @@ func NewTupleChange() *TupleChange { func NewTupleChangeWithDefaults() *TupleChange { this := TupleChange{} var operation TupleOperation = WRITE - this.Operation = &operation + this.Operation = operation return &this } -// GetTupleKey returns the TupleKey field value if set, zero value otherwise. +// GetTupleKey returns the TupleKey field value func (o *TupleChange) GetTupleKey() TupleKey { - if o == nil || o.TupleKey == nil { + if o == nil { var ret TupleKey return ret } - return *o.TupleKey + + return o.TupleKey } -// GetTupleKeyOk returns a tuple with the TupleKey field value if set, nil otherwise +// GetTupleKeyOk returns a tuple with the TupleKey field value // and a boolean to check if the value has been set. func (o *TupleChange) GetTupleKeyOk() (*TupleKey, bool) { - if o == nil || o.TupleKey == nil { + if o == nil { return nil, false } - return o.TupleKey, true -} - -// HasTupleKey returns a boolean if a field has been set. -func (o *TupleChange) HasTupleKey() bool { - if o != nil && o.TupleKey != nil { - return true - } - - return false + return &o.TupleKey, true } -// SetTupleKey gets a reference to the given TupleKey and assigns it to the TupleKey field. +// SetTupleKey sets field value func (o *TupleChange) SetTupleKey(v TupleKey) { - o.TupleKey = &v + o.TupleKey = v } -// GetOperation returns the Operation field value if set, zero value otherwise. +// GetOperation returns the Operation field value func (o *TupleChange) GetOperation() TupleOperation { - if o == nil || o.Operation == nil { + if o == nil { var ret TupleOperation return ret } - return *o.Operation + + return o.Operation } -// GetOperationOk returns a tuple with the Operation field value if set, nil otherwise +// GetOperationOk returns a tuple with the Operation field value // and a boolean to check if the value has been set. func (o *TupleChange) GetOperationOk() (*TupleOperation, bool) { - if o == nil || o.Operation == nil { + if o == nil { return nil, false } - return o.Operation, true + return &o.Operation, true } -// HasOperation returns a boolean if a field has been set. -func (o *TupleChange) HasOperation() bool { - if o != nil && o.Operation != nil { - return true - } - - return false -} - -// SetOperation gets a reference to the given TupleOperation and assigns it to the Operation field. +// SetOperation sets field value func (o *TupleChange) SetOperation(v TupleOperation) { - o.Operation = &v + o.Operation = v } -// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +// GetTimestamp returns the Timestamp field value func (o *TupleChange) GetTimestamp() time.Time { - if o == nil || o.Timestamp == nil { + if o == nil { var ret time.Time return ret } - return *o.Timestamp + + return o.Timestamp } -// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// GetTimestampOk returns a tuple with the Timestamp field value // and a boolean to check if the value has been set. func (o *TupleChange) GetTimestampOk() (*time.Time, bool) { - if o == nil || o.Timestamp == nil { + if o == nil { return nil, false } - return o.Timestamp, true + return &o.Timestamp, true } -// HasTimestamp returns a boolean if a field has been set. -func (o *TupleChange) HasTimestamp() bool { - if o != nil && o.Timestamp != nil { - return true - } - - return false -} - -// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +// SetTimestamp sets field value func (o *TupleChange) SetTimestamp(v time.Time) { - o.Timestamp = &v + o.Timestamp = v } func (o TupleChange) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.TupleKey != nil { - toSerialize["tuple_key"] = o.TupleKey - } - if o.Operation != nil { - toSerialize["operation"] = o.Operation - } - if o.Timestamp != nil { - toSerialize["timestamp"] = o.Timestamp - } + toSerialize["tuple_key"] = o.TupleKey + toSerialize["operation"] = o.Operation + toSerialize["timestamp"] = o.Timestamp return json.Marshal(toSerialize) } diff --git a/model_tuple_key.go b/model_tuple_key.go index 81bdaf4..db46fbe 100644 --- a/model_tuple_key.go +++ b/model_tuple_key.go @@ -18,17 +18,21 @@ import ( // TupleKey struct for TupleKey type TupleKey struct { - Object *string `json:"object,omitempty"` - Relation *string `json:"relation,omitempty"` - User *string `json:"user,omitempty"` + User string `json:"user"yaml:"user"` + Relation string `json:"relation"yaml:"relation"` + Object string `json:"object"yaml:"object"` + Condition *RelationshipCondition `json:"condition,omitempty"yaml:"condition,omitempty"` } // NewTupleKey instantiates a new TupleKey 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 NewTupleKey() *TupleKey { +func NewTupleKey(user string, relation string, object string) *TupleKey { this := TupleKey{} + this.User = user + this.Relation = relation + this.Object = object return &this } @@ -40,112 +44,117 @@ func NewTupleKeyWithDefaults() *TupleKey { return &this } -// GetObject returns the Object field value if set, zero value otherwise. -func (o *TupleKey) GetObject() string { - if o == nil || o.Object == nil { +// GetUser returns the User field value +func (o *TupleKey) GetUser() string { + if o == nil { var ret string return ret } - return *o.Object + + return o.User } -// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// GetUserOk returns a tuple with the User field value // and a boolean to check if the value has been set. -func (o *TupleKey) GetObjectOk() (*string, bool) { - if o == nil || o.Object == nil { +func (o *TupleKey) GetUserOk() (*string, bool) { + if o == nil { return nil, false } - return o.Object, true -} - -// HasObject returns a boolean if a field has been set. -func (o *TupleKey) HasObject() bool { - if o != nil && o.Object != nil { - return true - } - - return false + return &o.User, true } -// SetObject gets a reference to the given string and assigns it to the Object field. -func (o *TupleKey) SetObject(v string) { - o.Object = &v +// SetUser sets field value +func (o *TupleKey) SetUser(v string) { + o.User = v } -// GetRelation returns the Relation field value if set, zero value otherwise. +// GetRelation returns the Relation field value func (o *TupleKey) GetRelation() string { - if o == nil || o.Relation == nil { + if o == nil { var ret string return ret } - return *o.Relation + + return o.Relation } -// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise +// GetRelationOk returns a tuple with the Relation field value // and a boolean to check if the value has been set. func (o *TupleKey) GetRelationOk() (*string, bool) { - if o == nil || o.Relation == nil { + if o == nil { return nil, false } - return o.Relation, true + return &o.Relation, true } -// HasRelation returns a boolean if a field has been set. -func (o *TupleKey) HasRelation() bool { - if o != nil && o.Relation != nil { - return true +// SetRelation sets field value +func (o *TupleKey) SetRelation(v string) { + o.Relation = v +} + +// GetObject returns the Object field value +func (o *TupleKey) GetObject() string { + if o == nil { + var ret string + return ret } - return false + return o.Object } -// SetRelation gets a reference to the given string and assigns it to the Relation field. -func (o *TupleKey) SetRelation(v string) { - o.Relation = &v +// GetObjectOk returns a tuple with the Object field value +// and a boolean to check if the value has been set. +func (o *TupleKey) GetObjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Object, true } -// GetUser returns the User field value if set, zero value otherwise. -func (o *TupleKey) GetUser() string { - if o == nil || o.User == nil { - var ret string +// SetObject sets field value +func (o *TupleKey) SetObject(v string) { + o.Object = 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.User + return *o.Condition } -// GetUserOk returns a tuple with the User field value if set, nil otherwise +// 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) GetUserOk() (*string, bool) { - if o == nil || o.User == nil { +func (o *TupleKey) GetConditionOk() (*RelationshipCondition, bool) { + if o == nil || o.Condition == nil { return nil, false } - return o.User, true + return o.Condition, true } -// HasUser returns a boolean if a field has been set. -func (o *TupleKey) HasUser() bool { - if o != nil && o.User != nil { +// 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 } -// SetUser gets a reference to the given string and assigns it to the User field. -func (o *TupleKey) SetUser(v string) { - o.User = &v +// 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 { - toSerialize["object"] = o.Object - } - if o.Relation != nil { - toSerialize["relation"] = o.Relation - } - if o.User != nil { - toSerialize["user"] = o.User + toSerialize["user"] = o.User + toSerialize["relation"] = o.Relation + toSerialize["object"] = o.Object + if o.Condition != nil { + toSerialize["condition"] = o.Condition } return json.Marshal(toSerialize) } diff --git a/model_tuple_to_userset.go b/model_tuple_to_userset.go index a314b22..b33239a 100644 --- a/model_tuple_to_userset.go +++ b/model_tuple_to_userset.go @@ -18,16 +18,18 @@ import ( // TupleToUserset struct for TupleToUserset type TupleToUserset struct { - Tupleset *ObjectRelation `json:"tupleset,omitempty"` - ComputedUserset *ObjectRelation `json:"computedUserset,omitempty"` + Tupleset ObjectRelation `json:"tupleset"yaml:"tupleset"` + ComputedUserset ObjectRelation `json:"computedUserset"yaml:"computedUserset"` } // NewTupleToUserset instantiates a new TupleToUserset 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 NewTupleToUserset() *TupleToUserset { +func NewTupleToUserset(tupleset ObjectRelation, computedUserset ObjectRelation) *TupleToUserset { this := TupleToUserset{} + this.Tupleset = tupleset + this.ComputedUserset = computedUserset return &this } @@ -39,78 +41,58 @@ func NewTupleToUsersetWithDefaults() *TupleToUserset { return &this } -// GetTupleset returns the Tupleset field value if set, zero value otherwise. +// GetTupleset returns the Tupleset field value func (o *TupleToUserset) GetTupleset() ObjectRelation { - if o == nil || o.Tupleset == nil { + if o == nil { var ret ObjectRelation return ret } - return *o.Tupleset + + return o.Tupleset } -// GetTuplesetOk returns a tuple with the Tupleset field value if set, nil otherwise +// GetTuplesetOk returns a tuple with the Tupleset field value // and a boolean to check if the value has been set. func (o *TupleToUserset) GetTuplesetOk() (*ObjectRelation, bool) { - if o == nil || o.Tupleset == nil { + if o == nil { return nil, false } - return o.Tupleset, true -} - -// HasTupleset returns a boolean if a field has been set. -func (o *TupleToUserset) HasTupleset() bool { - if o != nil && o.Tupleset != nil { - return true - } - - return false + return &o.Tupleset, true } -// SetTupleset gets a reference to the given ObjectRelation and assigns it to the Tupleset field. +// SetTupleset sets field value func (o *TupleToUserset) SetTupleset(v ObjectRelation) { - o.Tupleset = &v + o.Tupleset = v } -// GetComputedUserset returns the ComputedUserset field value if set, zero value otherwise. +// GetComputedUserset returns the ComputedUserset field value func (o *TupleToUserset) GetComputedUserset() ObjectRelation { - if o == nil || o.ComputedUserset == nil { + if o == nil { var ret ObjectRelation return ret } - return *o.ComputedUserset + + return o.ComputedUserset } -// GetComputedUsersetOk returns a tuple with the ComputedUserset field value if set, nil otherwise +// GetComputedUsersetOk returns a tuple with the ComputedUserset field value // and a boolean to check if the value has been set. func (o *TupleToUserset) GetComputedUsersetOk() (*ObjectRelation, bool) { - if o == nil || o.ComputedUserset == nil { + if o == nil { return nil, false } - return o.ComputedUserset, true + return &o.ComputedUserset, true } -// HasComputedUserset returns a boolean if a field has been set. -func (o *TupleToUserset) HasComputedUserset() bool { - if o != nil && o.ComputedUserset != nil { - return true - } - - return false -} - -// SetComputedUserset gets a reference to the given ObjectRelation and assigns it to the ComputedUserset field. +// SetComputedUserset sets field value func (o *TupleToUserset) SetComputedUserset(v ObjectRelation) { - o.ComputedUserset = &v + o.ComputedUserset = v } func (o TupleToUserset) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Tupleset != nil { - toSerialize["tupleset"] = o.Tupleset - } - if o.ComputedUserset != nil { - toSerialize["computedUserset"] = o.ComputedUserset - } + toSerialize["tupleset"] = o.Tupleset + toSerialize["computedUserset"] = o.ComputedUserset return json.Marshal(toSerialize) } diff --git a/model_type_definition.go b/model_type_definition.go index b09752d..6dc38b3 100644 --- a/model_type_definition.go +++ b/model_type_definition.go @@ -18,9 +18,9 @@ import ( // TypeDefinition struct for TypeDefinition type TypeDefinition struct { - Type string `json:"type"` - Relations *map[string]Userset `json:"relations,omitempty"` - Metadata *Metadata `json:"metadata,omitempty"` + Type string `json:"type"yaml:"type"` + Relations *map[string]Userset `json:"relations,omitempty"yaml:"relations,omitempty"` + Metadata *Metadata `json:"metadata,omitempty"yaml:"metadata,omitempty"` } // NewTypeDefinition instantiates a new TypeDefinition object 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_users.go b/model_users.go index b6a072b..3b0d68a 100644 --- a/model_users.go +++ b/model_users.go @@ -18,15 +18,16 @@ import ( // Users struct for Users type Users struct { - Users *[]string `json:"users,omitempty"` + Users []string `json:"users"yaml:"users"` } // NewUsers instantiates a new Users 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 NewUsers() *Users { +func NewUsers(users []string) *Users { this := Users{} + this.Users = users return &this } @@ -38,43 +39,33 @@ func NewUsersWithDefaults() *Users { return &this } -// GetUsers returns the Users field value if set, zero value otherwise. +// GetUsers returns the Users field value func (o *Users) GetUsers() []string { - if o == nil || o.Users == nil { + if o == nil { var ret []string return ret } - return *o.Users + + return o.Users } -// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// GetUsersOk returns a tuple with the Users field value // and a boolean to check if the value has been set. func (o *Users) GetUsersOk() (*[]string, bool) { - if o == nil || o.Users == nil { + if o == nil { return nil, false } - return o.Users, true -} - -// HasUsers returns a boolean if a field has been set. -func (o *Users) HasUsers() bool { - if o != nil && o.Users != nil { - return true - } - - return false + return &o.Users, true } -// SetUsers gets a reference to the given []string and assigns it to the Users field. +// SetUsers sets field value func (o *Users) SetUsers(v []string) { - o.Users = &v + o.Users = v } func (o Users) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Users != nil { - toSerialize["users"] = o.Users - } + toSerialize["users"] = o.Users return json.Marshal(toSerialize) } diff --git a/model_userset.go b/model_userset.go index eba20ef..612384c 100644 --- a/model_userset.go +++ b/model_userset.go @@ -19,12 +19,12 @@ import ( // Userset struct for Userset type Userset struct { // A DirectUserset is a sentinel message for referencing the direct members specified by an object/relation mapping. - This *map[string]interface{} `json:"this,omitempty"` - ComputedUserset *ObjectRelation `json:"computedUserset,omitempty"` - TupleToUserset *TupleToUserset `json:"tupleToUserset,omitempty"` - Union *Usersets `json:"union,omitempty"` - Intersection *Usersets `json:"intersection,omitempty"` - Difference *Difference `json:"difference,omitempty"` + This *map[string]interface{} `json:"this,omitempty"yaml:"this,omitempty"` + ComputedUserset *ObjectRelation `json:"computedUserset,omitempty"yaml:"computedUserset,omitempty"` + TupleToUserset *TupleToUserset `json:"tupleToUserset,omitempty"yaml:"tupleToUserset,omitempty"` + Union *Usersets `json:"union,omitempty"yaml:"union,omitempty"` + Intersection *Usersets `json:"intersection,omitempty"yaml:"intersection,omitempty"` + Difference *Difference `json:"difference,omitempty"yaml:"difference,omitempty"` } // NewUserset instantiates a new Userset object diff --git a/model_userset_tree.go b/model_userset_tree.go index ec44d41..c9aafb3 100644 --- a/model_userset_tree.go +++ b/model_userset_tree.go @@ -18,7 +18,7 @@ import ( // UsersetTree A UsersetTree contains the result of an Expansion. type UsersetTree struct { - Root *Node `json:"root,omitempty"` + Root *Node `json:"root,omitempty"yaml:"root,omitempty"` } // NewUsersetTree instantiates a new UsersetTree object diff --git a/model_userset_tree_difference.go b/model_userset_tree_difference.go index d4bd2d0..f16444d 100644 --- a/model_userset_tree_difference.go +++ b/model_userset_tree_difference.go @@ -18,16 +18,18 @@ import ( // UsersetTreeDifference struct for UsersetTreeDifference type UsersetTreeDifference struct { - Base *Node `json:"base,omitempty"` - Subtract *Node `json:"subtract,omitempty"` + Base Node `json:"base"yaml:"base"` + Subtract Node `json:"subtract"yaml:"subtract"` } // NewUsersetTreeDifference instantiates a new UsersetTreeDifference 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 NewUsersetTreeDifference() *UsersetTreeDifference { +func NewUsersetTreeDifference(base Node, subtract Node) *UsersetTreeDifference { this := UsersetTreeDifference{} + this.Base = base + this.Subtract = subtract return &this } @@ -39,78 +41,58 @@ func NewUsersetTreeDifferenceWithDefaults() *UsersetTreeDifference { return &this } -// GetBase returns the Base field value if set, zero value otherwise. +// GetBase returns the Base field value func (o *UsersetTreeDifference) GetBase() Node { - if o == nil || o.Base == nil { + if o == nil { var ret Node return ret } - return *o.Base + + return o.Base } -// GetBaseOk returns a tuple with the Base field value if set, nil otherwise +// GetBaseOk returns a tuple with the Base field value // and a boolean to check if the value has been set. func (o *UsersetTreeDifference) GetBaseOk() (*Node, bool) { - if o == nil || o.Base == nil { + if o == nil { return nil, false } - return o.Base, true -} - -// HasBase returns a boolean if a field has been set. -func (o *UsersetTreeDifference) HasBase() bool { - if o != nil && o.Base != nil { - return true - } - - return false + return &o.Base, true } -// SetBase gets a reference to the given Node and assigns it to the Base field. +// SetBase sets field value func (o *UsersetTreeDifference) SetBase(v Node) { - o.Base = &v + o.Base = v } -// GetSubtract returns the Subtract field value if set, zero value otherwise. +// GetSubtract returns the Subtract field value func (o *UsersetTreeDifference) GetSubtract() Node { - if o == nil || o.Subtract == nil { + if o == nil { var ret Node return ret } - return *o.Subtract + + return o.Subtract } -// GetSubtractOk returns a tuple with the Subtract field value if set, nil otherwise +// GetSubtractOk returns a tuple with the Subtract field value // and a boolean to check if the value has been set. func (o *UsersetTreeDifference) GetSubtractOk() (*Node, bool) { - if o == nil || o.Subtract == nil { + if o == nil { return nil, false } - return o.Subtract, true + return &o.Subtract, true } -// HasSubtract returns a boolean if a field has been set. -func (o *UsersetTreeDifference) HasSubtract() bool { - if o != nil && o.Subtract != nil { - return true - } - - return false -} - -// SetSubtract gets a reference to the given Node and assigns it to the Subtract field. +// SetSubtract sets field value func (o *UsersetTreeDifference) SetSubtract(v Node) { - o.Subtract = &v + o.Subtract = v } func (o UsersetTreeDifference) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Base != nil { - toSerialize["base"] = o.Base - } - if o.Subtract != nil { - toSerialize["subtract"] = o.Subtract - } + toSerialize["base"] = o.Base + toSerialize["subtract"] = o.Subtract return json.Marshal(toSerialize) } diff --git a/model_userset_tree_tuple_to_userset.go b/model_userset_tree_tuple_to_userset.go index 0ef7471..857590a 100644 --- a/model_userset_tree_tuple_to_userset.go +++ b/model_userset_tree_tuple_to_userset.go @@ -18,16 +18,18 @@ import ( // UsersetTreeTupleToUserset struct for UsersetTreeTupleToUserset type UsersetTreeTupleToUserset struct { - Tupleset *string `json:"tupleset,omitempty"` - Computed *[]Computed `json:"computed,omitempty"` + Tupleset string `json:"tupleset"yaml:"tupleset"` + Computed []Computed `json:"computed"yaml:"computed"` } // NewUsersetTreeTupleToUserset instantiates a new UsersetTreeTupleToUserset 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 NewUsersetTreeTupleToUserset() *UsersetTreeTupleToUserset { +func NewUsersetTreeTupleToUserset(tupleset string, computed []Computed) *UsersetTreeTupleToUserset { this := UsersetTreeTupleToUserset{} + this.Tupleset = tupleset + this.Computed = computed return &this } @@ -39,78 +41,58 @@ func NewUsersetTreeTupleToUsersetWithDefaults() *UsersetTreeTupleToUserset { return &this } -// GetTupleset returns the Tupleset field value if set, zero value otherwise. +// GetTupleset returns the Tupleset field value func (o *UsersetTreeTupleToUserset) GetTupleset() string { - if o == nil || o.Tupleset == nil { + if o == nil { var ret string return ret } - return *o.Tupleset + + return o.Tupleset } -// GetTuplesetOk returns a tuple with the Tupleset field value if set, nil otherwise +// GetTuplesetOk returns a tuple with the Tupleset field value // and a boolean to check if the value has been set. func (o *UsersetTreeTupleToUserset) GetTuplesetOk() (*string, bool) { - if o == nil || o.Tupleset == nil { + if o == nil { return nil, false } - return o.Tupleset, true -} - -// HasTupleset returns a boolean if a field has been set. -func (o *UsersetTreeTupleToUserset) HasTupleset() bool { - if o != nil && o.Tupleset != nil { - return true - } - - return false + return &o.Tupleset, true } -// SetTupleset gets a reference to the given string and assigns it to the Tupleset field. +// SetTupleset sets field value func (o *UsersetTreeTupleToUserset) SetTupleset(v string) { - o.Tupleset = &v + o.Tupleset = v } -// GetComputed returns the Computed field value if set, zero value otherwise. +// GetComputed returns the Computed field value func (o *UsersetTreeTupleToUserset) GetComputed() []Computed { - if o == nil || o.Computed == nil { + if o == nil { var ret []Computed return ret } - return *o.Computed + + return o.Computed } -// GetComputedOk returns a tuple with the Computed field value if set, nil otherwise +// GetComputedOk returns a tuple with the Computed field value // and a boolean to check if the value has been set. func (o *UsersetTreeTupleToUserset) GetComputedOk() (*[]Computed, bool) { - if o == nil || o.Computed == nil { + if o == nil { return nil, false } - return o.Computed, true + return &o.Computed, true } -// HasComputed returns a boolean if a field has been set. -func (o *UsersetTreeTupleToUserset) HasComputed() bool { - if o != nil && o.Computed != nil { - return true - } - - return false -} - -// SetComputed gets a reference to the given []Computed and assigns it to the Computed field. +// SetComputed sets field value func (o *UsersetTreeTupleToUserset) SetComputed(v []Computed) { - o.Computed = &v + o.Computed = v } func (o UsersetTreeTupleToUserset) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Tupleset != nil { - toSerialize["tupleset"] = o.Tupleset - } - if o.Computed != nil { - toSerialize["computed"] = o.Computed - } + toSerialize["tupleset"] = o.Tupleset + toSerialize["computed"] = o.Computed return json.Marshal(toSerialize) } diff --git a/model_usersets.go b/model_usersets.go index 3b2af64..7c28227 100644 --- a/model_usersets.go +++ b/model_usersets.go @@ -18,15 +18,16 @@ import ( // Usersets struct for Usersets type Usersets struct { - Child *[]Userset `json:"child,omitempty"` + Child []Userset `json:"child"yaml:"child"` } // NewUsersets instantiates a new Usersets 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 NewUsersets() *Usersets { +func NewUsersets(child []Userset) *Usersets { this := Usersets{} + this.Child = child return &this } @@ -38,43 +39,33 @@ func NewUsersetsWithDefaults() *Usersets { return &this } -// GetChild returns the Child field value if set, zero value otherwise. +// GetChild returns the Child field value func (o *Usersets) GetChild() []Userset { - if o == nil || o.Child == nil { + if o == nil { var ret []Userset return ret } - return *o.Child + + return o.Child } -// GetChildOk returns a tuple with the Child field value if set, nil otherwise +// GetChildOk returns a tuple with the Child field value // and a boolean to check if the value has been set. func (o *Usersets) GetChildOk() (*[]Userset, bool) { - if o == nil || o.Child == nil { + if o == nil { return nil, false } - return o.Child, true -} - -// HasChild returns a boolean if a field has been set. -func (o *Usersets) HasChild() bool { - if o != nil && o.Child != nil { - return true - } - - return false + return &o.Child, true } -// SetChild gets a reference to the given []Userset and assigns it to the Child field. +// SetChild sets field value func (o *Usersets) SetChild(v []Userset) { - o.Child = &v + o.Child = v } func (o Usersets) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Child != nil { - toSerialize["child"] = o.Child - } + toSerialize["child"] = o.Child return json.Marshal(toSerialize) } diff --git a/model_validation_error_message_response.go b/model_validation_error_message_response.go index 0825dee..9760a1c 100644 --- a/model_validation_error_message_response.go +++ b/model_validation_error_message_response.go @@ -18,8 +18,8 @@ import ( // ValidationErrorMessageResponse struct for ValidationErrorMessageResponse type ValidationErrorMessageResponse struct { - Code *ErrorCode `json:"code,omitempty"` - Message *string `json:"message,omitempty"` + Code *ErrorCode `json:"code,omitempty"yaml:"code,omitempty"` + Message *string `json:"message,omitempty"yaml:"message,omitempty"` } // NewValidationErrorMessageResponse instantiates a new ValidationErrorMessageResponse object diff --git a/model_write_assertions_request.go b/model_write_assertions_request.go index 52c0435..5f6b3c8 100644 --- a/model_write_assertions_request.go +++ b/model_write_assertions_request.go @@ -18,7 +18,7 @@ import ( // WriteAssertionsRequest struct for WriteAssertionsRequest type WriteAssertionsRequest struct { - Assertions []Assertion `json:"assertions"` + Assertions []Assertion `json:"assertions"yaml:"assertions"` } // NewWriteAssertionsRequest instantiates a new WriteAssertionsRequest object diff --git a/model_write_authorization_model_request.go b/model_write_authorization_model_request.go index 84f04a7..c066737 100644 --- a/model_write_authorization_model_request.go +++ b/model_write_authorization_model_request.go @@ -18,17 +18,19 @@ import ( // WriteAuthorizationModelRequest struct for WriteAuthorizationModelRequest type WriteAuthorizationModelRequest struct { - TypeDefinitions []TypeDefinition `json:"type_definitions"` - SchemaVersion *string `json:"schema_version,omitempty"` + TypeDefinitions []TypeDefinition `json:"type_definitions"yaml:"type_definitions"` + SchemaVersion string `json:"schema_version"yaml:"schema_version"` + Conditions *map[string]Condition `json:"conditions,omitempty"yaml:"conditions,omitempty"` } // NewWriteAuthorizationModelRequest instantiates a new WriteAuthorizationModelRequest 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 NewWriteAuthorizationModelRequest(typeDefinitions []TypeDefinition) *WriteAuthorizationModelRequest { +func NewWriteAuthorizationModelRequest(typeDefinitions []TypeDefinition, schemaVersion string) *WriteAuthorizationModelRequest { this := WriteAuthorizationModelRequest{} this.TypeDefinitions = typeDefinitions + this.SchemaVersion = schemaVersion return &this } @@ -64,43 +66,68 @@ func (o *WriteAuthorizationModelRequest) SetTypeDefinitions(v []TypeDefinition) o.TypeDefinitions = v } -// GetSchemaVersion returns the SchemaVersion field value if set, zero value otherwise. +// GetSchemaVersion returns the SchemaVersion field value func (o *WriteAuthorizationModelRequest) GetSchemaVersion() string { - if o == nil || o.SchemaVersion == nil { + if o == nil { var ret string return ret } - return *o.SchemaVersion + + return o.SchemaVersion } -// GetSchemaVersionOk returns a tuple with the SchemaVersion field value if set, nil otherwise +// GetSchemaVersionOk returns a tuple with the SchemaVersion field value // and a boolean to check if the value has been set. func (o *WriteAuthorizationModelRequest) GetSchemaVersionOk() (*string, bool) { - if o == nil || o.SchemaVersion == nil { + if o == nil { + return nil, false + } + return &o.SchemaVersion, true +} + +// SetSchemaVersion sets field value +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.SchemaVersion, true + return o.Conditions, true } -// HasSchemaVersion returns a boolean if a field has been set. -func (o *WriteAuthorizationModelRequest) HasSchemaVersion() bool { - if o != nil && o.SchemaVersion != nil { +// 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 } -// SetSchemaVersion gets a reference to the given string and assigns it to the SchemaVersion field. -func (o *WriteAuthorizationModelRequest) SetSchemaVersion(v string) { - o.SchemaVersion = &v +// 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{}{} toSerialize["type_definitions"] = o.TypeDefinitions - if o.SchemaVersion != nil { - toSerialize["schema_version"] = o.SchemaVersion + toSerialize["schema_version"] = o.SchemaVersion + if o.Conditions != nil { + toSerialize["conditions"] = o.Conditions } return json.Marshal(toSerialize) } diff --git a/model_write_authorization_model_response.go b/model_write_authorization_model_response.go index eb16de3..622d6bf 100644 --- a/model_write_authorization_model_response.go +++ b/model_write_authorization_model_response.go @@ -18,15 +18,16 @@ import ( // WriteAuthorizationModelResponse struct for WriteAuthorizationModelResponse type WriteAuthorizationModelResponse struct { - AuthorizationModelId *string `json:"authorization_model_id,omitempty"` + AuthorizationModelId string `json:"authorization_model_id"yaml:"authorization_model_id"` } // NewWriteAuthorizationModelResponse instantiates a new WriteAuthorizationModelResponse 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 NewWriteAuthorizationModelResponse() *WriteAuthorizationModelResponse { +func NewWriteAuthorizationModelResponse(authorizationModelId string) *WriteAuthorizationModelResponse { this := WriteAuthorizationModelResponse{} + this.AuthorizationModelId = authorizationModelId return &this } @@ -38,43 +39,33 @@ func NewWriteAuthorizationModelResponseWithDefaults() *WriteAuthorizationModelRe return &this } -// GetAuthorizationModelId returns the AuthorizationModelId field value if set, zero value otherwise. +// GetAuthorizationModelId returns the AuthorizationModelId field value func (o *WriteAuthorizationModelResponse) GetAuthorizationModelId() string { - if o == nil || o.AuthorizationModelId == nil { + if o == nil { var ret string return ret } - return *o.AuthorizationModelId + + return o.AuthorizationModelId } -// GetAuthorizationModelIdOk returns a tuple with the AuthorizationModelId field value if set, nil otherwise +// GetAuthorizationModelIdOk returns a tuple with the AuthorizationModelId field value // and a boolean to check if the value has been set. func (o *WriteAuthorizationModelResponse) GetAuthorizationModelIdOk() (*string, bool) { - if o == nil || o.AuthorizationModelId == nil { + if o == nil { return nil, false } - return o.AuthorizationModelId, true -} - -// HasAuthorizationModelId returns a boolean if a field has been set. -func (o *WriteAuthorizationModelResponse) HasAuthorizationModelId() bool { - if o != nil && o.AuthorizationModelId != nil { - return true - } - - return false + return &o.AuthorizationModelId, true } -// SetAuthorizationModelId gets a reference to the given string and assigns it to the AuthorizationModelId field. +// SetAuthorizationModelId sets field value func (o *WriteAuthorizationModelResponse) SetAuthorizationModelId(v string) { - o.AuthorizationModelId = &v + o.AuthorizationModelId = v } func (o WriteAuthorizationModelResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.AuthorizationModelId != nil { - toSerialize["authorization_model_id"] = o.AuthorizationModelId - } + toSerialize["authorization_model_id"] = o.AuthorizationModelId return json.Marshal(toSerialize) } diff --git a/model_write_request.go b/model_write_request.go index 9567efa..7acf8b6 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"yaml:"writes,omitempty"` + Deletes *WriteRequestTupleKeys `json:"deletes,omitempty"yaml:"deletes,omitempty"` + AuthorizationModelId *string `json:"authorization_model_id,omitempty"yaml:"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..b5e6d5f --- /dev/null +++ b/model_write_request_tuple_key.go @@ -0,0 +1,196 @@ +/** + * 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"yaml:"user"` + Relation string `json:"relation"yaml:"relation"` + Object string `json:"object"yaml:"object"` + Condition *RelationshipCondition `json:"condition,omitempty"yaml:"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(user string, relation string, object string) *WriteRequestTupleKey { + this := WriteRequestTupleKey{} + this.User = user + this.Relation = relation + this.Object = object + 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 +func (o *WriteRequestTupleKey) GetUser() string { + if o == nil { + var ret string + return ret + } + + return o.User +} + +// GetUserOk returns a tuple with the User field value +// and a boolean to check if the value has been set. +func (o *WriteRequestTupleKey) GetUserOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.User, true +} + +// SetUser sets field value +func (o *WriteRequestTupleKey) SetUser(v string) { + o.User = v +} + +// GetRelation returns the Relation field value +func (o *WriteRequestTupleKey) GetRelation() string { + if o == nil { + var ret string + return ret + } + + return o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value +// and a boolean to check if the value has been set. +func (o *WriteRequestTupleKey) GetRelationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Relation, true +} + +// SetRelation sets field value +func (o *WriteRequestTupleKey) SetRelation(v string) { + o.Relation = v +} + +// GetObject returns the Object field value +func (o *WriteRequestTupleKey) GetObject() string { + if o == nil { + var ret string + return ret + } + + return o.Object +} + +// GetObjectOk returns a tuple with the Object field value +// and a boolean to check if the value has been set. +func (o *WriteRequestTupleKey) GetObjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Object, true +} + +// SetObject sets field value +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{}{} + toSerialize["user"] = o.User + toSerialize["relation"] = o.Relation + 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 f2b8dd1..0fb3009 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"yaml:"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,48 +59,48 @@ 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{}{} toSerialize["tuple_keys"] = o.TupleKeys 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) }