Class AuthorizationModelsApi

java.lang.Object
org.apache.syncope.ext.openfga.client.api.AuthorizationModelsApi

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", date="2025-03-07T14:52:32.408381154+01:00[Europe/Rome]", comments="Generator version: 7.12.0") public class AuthorizationModelsApi extends Object
  • Constructor Details

    • AuthorizationModelsApi

      public AuthorizationModelsApi()
    • AuthorizationModelsApi

      public AuthorizationModelsApi(ApiClient apiClient)
  • Method Details

    • getApiException

      protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException
      Throws:
      IOException
    • readAuthorizationModel

      public ReadAuthorizationModelResponse readAuthorizationModel(String storeId, String id) throws ApiException
      Return a particular version of an authorization model The ReadAuthorizationModel API returns an authorization model by its identifier. The response will return the authorization model for the particular version. ## Example To retrieve the authorization model with ID `01G5JAVJ41T49E9TT3SKVS7X1J` for the store, call the GET authorization-models by ID API with `01G5JAVJ41T49E9TT3SKVS7X1J` as the `id` path parameter. The API will return: ```json { \"authorization_model\":{ \"id\":\"01G5JAVJ41T49E9TT3SKVS7X1J\", \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } } ``` In the above example, there are 2 types (`user` and `document`). The `document` type has 2 relations (`writer` and `reader`).
      Parameters:
      storeId - (required)
      id - (required)
      Returns:
      ReadAuthorizationModelResponse
      Throws:
      ApiException - if fails to make API call
    • readAuthorizationModelWithHttpInfo

      public ApiResponse<ReadAuthorizationModelResponse> readAuthorizationModelWithHttpInfo(String storeId, String id) throws ApiException
      Return a particular version of an authorization model The ReadAuthorizationModel API returns an authorization model by its identifier. The response will return the authorization model for the particular version. ## Example To retrieve the authorization model with ID `01G5JAVJ41T49E9TT3SKVS7X1J` for the store, call the GET authorization-models by ID API with `01G5JAVJ41T49E9TT3SKVS7X1J` as the `id` path parameter. The API will return: ```json { \"authorization_model\":{ \"id\":\"01G5JAVJ41T49E9TT3SKVS7X1J\", \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } } ``` In the above example, there are 2 types (`user` and `document`). The `document` type has 2 relations (`writer` and `reader`).
      Parameters:
      storeId - (required)
      id - (required)
      Returns:
      ApiResponse<ReadAuthorizationModelResponse>
      Throws:
      ApiException - if fails to make API call
    • readAuthorizationModels

      public ReadAuthorizationModelsResponse readAuthorizationModels(String storeId, Integer pageSize, String continuationToken) throws ApiException
      Return all the authorization models for a particular store The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` If there are no more authorization models available, the `continuation_token` field will be empty ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"\" } ```
      Parameters:
      storeId - (required)
      pageSize - (optional)
      continuationToken - (optional)
      Returns:
      ReadAuthorizationModelsResponse
      Throws:
      ApiException - if fails to make API call
    • readAuthorizationModelsWithHttpInfo

      public ApiResponse<ReadAuthorizationModelsResponse> readAuthorizationModelsWithHttpInfo(String storeId, Integer pageSize, String continuationToken) throws ApiException
      Return all the authorization models for a particular store The ReadAuthorizationModels API will return all the authorization models for a certain store. OpenFGA's response will contain an array of all authorization models, sorted in descending order of creation. ## Example Assume that a store's authorization model has been configured twice. To get all the authorization models that have been created in this store, call GET authorization-models. The API will return a response that looks like: ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` If there are no more authorization models available, the `continuation_token` field will be empty ```json { \"authorization_models\": [ { \"id\": \"01G50QVV17PECNVAHX1GG4Y5NC\", \"type_definitions\": [...] }, { \"id\": \"01G4ZW8F4A07AKQ8RHSVG9RW04\", \"type_definitions\": [...] }, ], \"continuation_token\": \"\" } ```
      Parameters:
      storeId - (required)
      pageSize - (optional)
      continuationToken - (optional)
      Returns:
      ApiResponse<ReadAuthorizationModelsResponse>
      Throws:
      ApiException - if fails to make API call
    • writeAuthorizationModel

      public WriteAuthorizationModelResponse writeAuthorizationModel(String storeId, WriteAuthorizationModelRequest body) throws ApiException
      Create a new authorization model The WriteAuthorizationModel API will add a new authorization model to a store. Each item in the `type_definitions` array is a type definition as specified in the field `type_definition`. The response will return the authorization model's ID in the `id` field. ## Example To add an authorization model with `user` and `document` type definitions, call POST authorization-models API with the body: ```json { \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } ``` OpenFGA's response will include the version id for this authorization model, which will look like ``` {\"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\"} ```
      Parameters:
      storeId - (required)
      body - (required)
      Returns:
      WriteAuthorizationModelResponse
      Throws:
      ApiException - if fails to make API call
    • writeAuthorizationModelWithHttpInfo

      public ApiResponse<WriteAuthorizationModelResponse> writeAuthorizationModelWithHttpInfo(String storeId, WriteAuthorizationModelRequest body) throws ApiException
      Create a new authorization model The WriteAuthorizationModel API will add a new authorization model to a store. Each item in the `type_definitions` array is a type definition as specified in the field `type_definition`. The response will return the authorization model's ID in the `id` field. ## Example To add an authorization model with `user` and `document` type definitions, call POST authorization-models API with the body: ```json { \"type_definitions\":[ { \"type\":\"user\" }, { \"type\":\"document\", \"relations\":{ \"reader\":{ \"union\":{ \"child\":[ { \"this\":{} }, { \"computedUserset\":{ \"object\":\"\", \"relation\":\"writer\" } } ] } }, \"writer\":{ \"this\":{} } } } ] } ``` OpenFGA's response will include the version id for this authorization model, which will look like ``` {\"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\"} ```
      Parameters:
      storeId - (required)
      body - (required)
      Returns:
      ApiResponse<WriteAuthorizationModelResponse>
      Throws:
      ApiException - if fails to make API call