Class: OryClient::ReadApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ory-client/api/read_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ReadApi

Returns a new instance of ReadApi.



19
20
21
# File 'lib/ory-client/api/read_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ory-client/api/read_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_check(opts = {}) ⇒ GetCheckResponse

Check a relation tuple To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :namespace (String)

    Namespace of the Relation Tuple

  • :object (String)

    Object of the Relation Tuple

  • :relation (String)

    Relation of the Relation Tuple

  • :subject_id (String)

    SubjectID of the Relation Tuple

  • :subject_set_namespace (String)

    Namespace of the Subject Set

  • :subject_set_object (String)

    Object of the Subject Set

  • :subject_set_relation (String)

    Relation of the Subject Set

  • :max_depth (Integer)

Returns:



34
35
36
37
# File 'lib/ory-client/api/read_api.rb', line 34

def get_check(opts = {})
  data, _status_code, _headers = get_check_with_http_info(opts)
  data
end

#get_check_with_http_info(opts = {}) ⇒ Array<(GetCheckResponse, Integer, Hash)>

Check a relation tuple To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :namespace (String)

    Namespace of the Relation Tuple

  • :object (String)

    Object of the Relation Tuple

  • :relation (String)

    Relation of the Relation Tuple

  • :subject_id (String)

    SubjectID of the Relation Tuple

  • :subject_set_namespace (String)

    Namespace of the Subject Set

  • :subject_set_object (String)

    Object of the Subject Set

  • :subject_set_relation (String)

    Relation of the Subject Set

  • :max_depth (Integer)

Returns:

  • (Array<(GetCheckResponse, Integer, Hash)>)

    GetCheckResponse data, response status code and response headers



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/ory-client/api/read_api.rb', line 51

def get_check_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReadApi.get_check ...'
  end
  # resource path
  local_var_path = '/relation-tuples/check'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'namespace'] = opts[:'namespace'] if !opts[:'namespace'].nil?
  query_params[:'object'] = opts[:'object'] if !opts[:'object'].nil?
  query_params[:'relation'] = opts[:'relation'] if !opts[:'relation'].nil?
  query_params[:'subject_id'] = opts[:'subject_id'] if !opts[:'subject_id'].nil?
  query_params[:'subject_set.namespace'] = opts[:'subject_set_namespace'] if !opts[:'subject_set_namespace'].nil?
  query_params[:'subject_set.object'] = opts[:'subject_set_object'] if !opts[:'subject_set_object'].nil?
  query_params[:'subject_set.relation'] = opts[:'subject_set_relation'] if !opts[:'subject_set_relation'].nil?
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetCheckResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"ReadApi.get_check",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReadApi#get_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_expand(namespace, object, relation, opts = {}) ⇒ ExpandTree

Expand a Relation Tuple Use this endpoint to expand a relation tuple.

Parameters:

  • namespace (String)

    Namespace of the Subject Set

  • object (String)

    Object of the Subject Set

  • relation (String)

    Relation of the Subject Set

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :max_depth (Integer)

Returns:



111
112
113
114
# File 'lib/ory-client/api/read_api.rb', line 111

def get_expand(namespace, object, relation, opts = {})
  data, _status_code, _headers = get_expand_with_http_info(namespace, object, relation, opts)
  data
end

#get_expand_with_http_info(namespace, object, relation, opts = {}) ⇒ Array<(ExpandTree, Integer, Hash)>

Expand a Relation Tuple Use this endpoint to expand a relation tuple.

Parameters:

  • namespace (String)

    Namespace of the Subject Set

  • object (String)

    Object of the Subject Set

  • relation (String)

    Relation of the Subject Set

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :max_depth (Integer)

Returns:

  • (Array<(ExpandTree, Integer, Hash)>)

    ExpandTree data, response status code and response headers



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/ory-client/api/read_api.rb', line 124

def get_expand_with_http_info(namespace, object, relation, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReadApi.get_expand ...'
  end
  # verify the required parameter 'namespace' is set
  if @api_client.config.client_side_validation && namespace.nil?
    fail ArgumentError, "Missing the required parameter 'namespace' when calling ReadApi.get_expand"
  end
  # verify the required parameter 'object' is set
  if @api_client.config.client_side_validation && object.nil?
    fail ArgumentError, "Missing the required parameter 'object' when calling ReadApi.get_expand"
  end
  # verify the required parameter 'relation' is set
  if @api_client.config.client_side_validation && relation.nil?
    fail ArgumentError, "Missing the required parameter 'relation' when calling ReadApi.get_expand"
  end
  # resource path
  local_var_path = '/relation-tuples/expand'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'namespace'] = namespace
  query_params[:'object'] = object
  query_params[:'relation'] = relation
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ExpandTree'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"ReadApi.get_expand",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReadApi#get_expand\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_relation_tuples(opts = {}) ⇒ GetRelationTuplesResponse

Query relation tuples Get all relation tuples that match the query. Only the namespace field is required.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page_token (String)
  • :page_size (Integer)
  • :namespace (String)

    Namespace of the Relation Tuple

  • :object (String)

    Object of the Relation Tuple

  • :relation (String)

    Relation of the Relation Tuple

  • :subject_id (String)

    SubjectID of the Relation Tuple

  • :subject_set_namespace (String)

    Namespace of the Subject Set

  • :subject_set_object (String)

    Object of the Subject Set

  • :subject_set_relation (String)

    Relation of the Subject Set

Returns:



197
198
199
200
# File 'lib/ory-client/api/read_api.rb', line 197

def get_relation_tuples(opts = {})
  data, _status_code, _headers = get_relation_tuples_with_http_info(opts)
  data
end

#get_relation_tuples_with_http_info(opts = {}) ⇒ Array<(GetRelationTuplesResponse, Integer, Hash)>

Query relation tuples Get all relation tuples that match the query. Only the namespace field is required.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page_token (String)
  • :page_size (Integer)
  • :namespace (String)

    Namespace of the Relation Tuple

  • :object (String)

    Object of the Relation Tuple

  • :relation (String)

    Relation of the Relation Tuple

  • :subject_id (String)

    SubjectID of the Relation Tuple

  • :subject_set_namespace (String)

    Namespace of the Subject Set

  • :subject_set_object (String)

    Object of the Subject Set

  • :subject_set_relation (String)

    Relation of the Subject Set

Returns:

  • (Array<(GetRelationTuplesResponse, Integer, Hash)>)

    GetRelationTuplesResponse data, response status code and response headers



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/ory-client/api/read_api.rb', line 215

def get_relation_tuples_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReadApi.get_relation_tuples ...'
  end
  # resource path
  local_var_path = '/relation-tuples'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page_token'] = opts[:'page_token'] if !opts[:'page_token'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'namespace'] = opts[:'namespace'] if !opts[:'namespace'].nil?
  query_params[:'object'] = opts[:'object'] if !opts[:'object'].nil?
  query_params[:'relation'] = opts[:'relation'] if !opts[:'relation'].nil?
  query_params[:'subject_id'] = opts[:'subject_id'] if !opts[:'subject_id'].nil?
  query_params[:'subject_set.namespace'] = opts[:'subject_set_namespace'] if !opts[:'subject_set_namespace'].nil?
  query_params[:'subject_set.object'] = opts[:'subject_set_object'] if !opts[:'subject_set_object'].nil?
  query_params[:'subject_set.relation'] = opts[:'subject_set_relation'] if !opts[:'subject_set_relation'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetRelationTuplesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"ReadApi.get_relation_tuples",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReadApi#get_relation_tuples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_check(opts = {}) ⇒ GetCheckResponse

Check a relation tuple To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



274
275
276
277
# File 'lib/ory-client/api/read_api.rb', line 274

def post_check(opts = {})
  data, _status_code, _headers = post_check_with_http_info(opts)
  data
end

#post_check_with_http_info(opts = {}) ⇒ Array<(GetCheckResponse, Integer, Hash)>

Check a relation tuple To learn how relation tuples and the check works, head over to [the documentation](../concepts/relation-tuples.mdx).

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(GetCheckResponse, Integer, Hash)>)

    GetCheckResponse data, response status code and response headers



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/ory-client/api/read_api.rb', line 285

def post_check_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReadApi.post_check ...'
  end
  # resource path
  local_var_path = '/relation-tuples/check'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'max-depth'] = opts[:'max_depth'] if !opts[:'max_depth'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'relation_query'])

  # return_type
  return_type = opts[:debug_return_type] || 'GetCheckResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oryAccessToken']

  new_options = opts.merge(
    :operation => :"ReadApi.post_check",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReadApi#post_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end