Skip to content

onehub/openfga_client

Repository files navigation

openfga_client

OpenfgaClient - the Ruby gem for the OpenFGA

A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.x
  • Package version: 1.0.0
  • Generator version: 7.8.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://openfga.dev

Installation

Build a gem

To build the Ruby code into a gem:

gem build openfga_client.gemspec

Then either install the gem locally:

gem install ./openfga_client-1.0.0.gem

(for development, run gem install --dev ./openfga_client-1.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'openfga_client', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'openfga_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'openfga_client'

api_instance = OpenfgaClient::AssertionsApi.new
store_id = 'store_id_example' # String | 
authorization_model_id = 'authorization_model_id_example' # String | 

begin
  #Read assertions for an authorization model ID
  result = api_instance.read_assertions(store_id, authorization_model_id)
  p result
rescue OpenfgaClient::ApiError => e
  puts "Exception when calling AssertionsApi->read_assertions: #{e}"
end

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
OpenfgaClient::AssertionsApi read_assertions GET /stores/{store_id}/assertions/{authorization_model_id} Read assertions for an authorization model ID
OpenfgaClient::AssertionsApi write_assertions PUT /stores/{store_id}/assertions/{authorization_model_id} Upsert assertions for an authorization model ID
OpenfgaClient::AuthorizationModelsApi read_authorization_model GET /stores/{store_id}/authorization-models/{id} Return a particular version of an authorization model
OpenfgaClient::AuthorizationModelsApi read_authorization_models GET /stores/{store_id}/authorization-models Return all the authorization models for a particular store
OpenfgaClient::AuthorizationModelsApi write_authorization_model POST /stores/{store_id}/authorization-models Create a new authorization model
OpenfgaClient::RelationshipQueriesApi check POST /stores/{store_id}/check Check whether a user is authorized to access an object
OpenfgaClient::RelationshipQueriesApi expand POST /stores/{store_id}/expand Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship
OpenfgaClient::RelationshipQueriesApi list_objects POST /stores/{store_id}/list-objects List all objects of the given type that the user has a relation with
OpenfgaClient::RelationshipQueriesApi list_users POST /stores/{store_id}/list-users List the users matching the provided filter who have a certain relation to a particular type.
OpenfgaClient::RelationshipQueriesApi streamed_list_objects POST /stores/{store_id}/streamed-list-objects Stream all objects of the given type that the user has a relation with
OpenfgaClient::RelationshipTuplesApi read POST /stores/{store_id}/read Get tuples from the store that matches a query, without following userset rewrite rules
OpenfgaClient::RelationshipTuplesApi read_changes GET /stores/{store_id}/changes Return a list of all the tuple changes
OpenfgaClient::RelationshipTuplesApi write POST /stores/{store_id}/write Add or delete tuples from the store
OpenfgaClient::StoresApi create_store POST /stores Create a store
OpenfgaClient::StoresApi delete_store DELETE /stores/{store_id} Delete a store
OpenfgaClient::StoresApi get_store GET /stores/{store_id} Get a store
OpenfgaClient::StoresApi list_stores GET /stores List all stores

Documentation for Models

Documentation for Authorization

Endpoints do not require authorization.

About

Ruby gem for OpenFGA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published