Class: DirectusSDK::GroupsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/directus_sdk/api/groups_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ GroupsApi

Returns a new instance of GroupsApi.



19
20
21
# File 'lib/directus_sdk/api/groups_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/directus_sdk/api/groups_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_group(opts = {}) ⇒ nil

Add a new group

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :name (String)

    Name of group to add

Returns:

  • (nil)


28
29
30
31
# File 'lib/directus_sdk/api/groups_api.rb', line 28

def add_group(opts = {})
  add_group_with_http_info(opts)
  return nil
end

#add_group_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Add a new group

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :name (String)

    Name of group to add

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/directus_sdk/api/groups_api.rb', line 38

def add_group_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: GroupsApi.add_group ..."
  end
  # resource path
  local_var_path = "/groups"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["name"] = opts[:'name'] if !opts[:'name'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GroupsApi#add_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#add_privilege(group_id, opts = {}) ⇒ nil

Create new table privileges for the specified user group

Parameters:

  • group_id

    ID of group to return

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

    the optional parameters

Options Hash (opts):

  • :id (Integer)

    Privilege&#39;s Unique Identification number

  • :table_name (String)

    Name of table to add

  • :allow_add (Integer)

    Permission to add/create entries in the table (See values below)

  • :allow_edit (Integer)

    Permission to edit/update entries in the table (See values below)

  • :allow_delete (Integer)

    Permission to delete/remove entries in the table (See values below)

  • :allow_view (Integer)

    Permission to view/read entries in the table (See values below)

  • :allow_alter (Integer)

    Permission to add/create entries in the table (See values below)

  • :nav_listed (BOOLEAN)

    If the table should be visible in the sidebar for this user group

  • :read_field_blacklist (String)

    A CSV of column names that the group can&#39;t view (read)

  • :write_field_blacklist (String)

    A CSV of column names that the group can&#39;t edit (update)

  • :status_id (String)

    State of the record that this permissions belongs to (Draft, Active or Soft Deleted)

Returns:

  • (nil)


90
91
92
93
# File 'lib/directus_sdk/api/groups_api.rb', line 90

def add_privilege(group_id, opts = {})
  add_privilege_with_http_info(group_id, opts)
  return nil
end

#add_privilege_with_http_info(group_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create new table privileges for the specified user group

Parameters:

  • group_id

    ID of group to return

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

    the optional parameters

Options Hash (opts):

  • :id (Integer)

    Privilege&#39;s Unique Identification number

  • :table_name (String)

    Name of table to add

  • :allow_add (Integer)

    Permission to add/create entries in the table (See values below)

  • :allow_edit (Integer)

    Permission to edit/update entries in the table (See values below)

  • :allow_delete (Integer)

    Permission to delete/remove entries in the table (See values below)

  • :allow_view (Integer)

    Permission to view/read entries in the table (See values below)

  • :allow_alter (Integer)

    Permission to add/create entries in the table (See values below)

  • :nav_listed (BOOLEAN)

    If the table should be visible in the sidebar for this user group

  • :read_field_blacklist (String)

    A CSV of column names that the group can&#39;t view (read)

  • :write_field_blacklist (String)

    A CSV of column names that the group can&#39;t edit (update)

  • :status_id (String)

    State of the record that this permissions belongs to (Draft, Active or Soft Deleted)

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



111
112
113
114
115
116
117
118
119
120
121
122
123
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
# File 'lib/directus_sdk/api/groups_api.rb', line 111

def add_privilege_with_http_info(group_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: GroupsApi.add_privilege ..."
  end
  # verify the required parameter 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling GroupsApi.add_privilege"
  end
  # resource path
  local_var_path = "/privileges/{groupId}".sub('{' + 'groupId' + '}', group_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["id"] = opts[:'id'] if !opts[:'id'].nil?
  form_params["table_name"] = opts[:'table_name'] if !opts[:'table_name'].nil?
  form_params["allow_add"] = opts[:'allow_add'] if !opts[:'allow_add'].nil?
  form_params["allow_edit"] = opts[:'allow_edit'] if !opts[:'allow_edit'].nil?
  form_params["allow_delete"] = opts[:'allow_delete'] if !opts[:'allow_delete'].nil?
  form_params["allow_view"] = opts[:'allow_view'] if !opts[:'allow_view'].nil?
  form_params["allow_alter"] = opts[:'allow_alter'] if !opts[:'allow_alter'].nil?
  form_params["nav_listed"] = opts[:'nav_listed'] if !opts[:'nav_listed'].nil?
  form_params["read_field_blacklist"] = opts[:'read_field_blacklist'] if !opts[:'read_field_blacklist'].nil?
  form_params["write_field_blacklist"] = opts[:'write_field_blacklist'] if !opts[:'write_field_blacklist'].nil?
  form_params["status_id"] = opts[:'status_id'] if !opts[:'status_id'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GroupsApi#add_privilege\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_group(group_id, opts = {}) ⇒ GetGroup

Returns specific group

Parameters:

  • group_id

    ID of group to return

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

    the optional parameters

Returns:



166
167
168
169
# File 'lib/directus_sdk/api/groups_api.rb', line 166

def get_group(group_id, opts = {})
  data, _status_code, _headers = get_group_with_http_info(group_id, opts)
  return data
end

#get_group_with_http_info(group_id, opts = {}) ⇒ Array<(GetGroup, Fixnum, Hash)>

Returns specific group

Parameters:

  • group_id

    ID of group to return

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

    the optional parameters

Returns:

  • (Array<(GetGroup, Fixnum, Hash)>)

    GetGroup data, response status code and response headers



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/directus_sdk/api/groups_api.rb', line 176

def get_group_with_http_info(group_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: GroupsApi.get_group ..."
  end
  # verify the required parameter 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling GroupsApi.get_group"
  end
  # resource path
  local_var_path = "/groups/{groupId}".sub('{' + 'groupId' + '}', group_id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetGroup')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GroupsApi#get_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_groups(opts = {}) ⇒ GetGroups

Returns groups

Parameters:

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

    the optional parameters

Returns:



218
219
220
221
# File 'lib/directus_sdk/api/groups_api.rb', line 218

def get_groups(opts = {})
  data, _status_code, _headers = get_groups_with_http_info(opts)
  return data
end

#get_groups_with_http_info(opts = {}) ⇒ Array<(GetGroups, Fixnum, Hash)>

Returns groups

Parameters:

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

    the optional parameters

Returns:

  • (Array<(GetGroups, Fixnum, Hash)>)

    GetGroups data, response status code and response headers



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
# File 'lib/directus_sdk/api/groups_api.rb', line 227

def get_groups_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: GroupsApi.get_groups ..."
  end
  # resource path
  local_var_path = "/groups"

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetGroups')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GroupsApi#get_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_privileges(group_id, opts = {}) ⇒ GetPrivileges

Returns group privileges

Parameters:

  • group_id

    ID of group to return

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

    the optional parameters

Returns:



266
267
268
269
# File 'lib/directus_sdk/api/groups_api.rb', line 266

def get_privileges(group_id, opts = {})
  data, _status_code, _headers = get_privileges_with_http_info(group_id, opts)
  return data
end

#get_privileges_for_table(group_id, table_name_or_privilege_id, opts = {}) ⇒ GetPrivilegesForTable

Returns group privileges by tableName

Parameters:

  • group_id

    ID of group to return

  • table_name_or_privilege_id

    ID of privileges or Table Name to use

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

    the optional parameters

Returns:



320
321
322
323
# File 'lib/directus_sdk/api/groups_api.rb', line 320

def get_privileges_for_table(group_id, table_name_or_privilege_id, opts = {})
  data, _status_code, _headers = get_privileges_for_table_with_http_info(group_id, table_name_or_privilege_id, opts)
  return data
end

#get_privileges_for_table_with_http_info(group_id, table_name_or_privilege_id, opts = {}) ⇒ Array<(GetPrivilegesForTable, Fixnum, Hash)>

Returns group privileges by tableName

Parameters:

  • group_id

    ID of group to return

  • table_name_or_privilege_id

    ID of privileges or Table Name to use

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

    the optional parameters

Returns:

  • (Array<(GetPrivilegesForTable, Fixnum, Hash)>)

    GetPrivilegesForTable data, response status code and response headers



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/directus_sdk/api/groups_api.rb', line 331

def get_privileges_for_table_with_http_info(group_id, table_name_or_privilege_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: GroupsApi.get_privileges_for_table ..."
  end
  # verify the required parameter 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling GroupsApi.get_privileges_for_table"
  end
  # verify the required parameter 'table_name_or_privilege_id' is set
  if @api_client.config.client_side_validation && table_name_or_privilege_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_name_or_privilege_id' when calling GroupsApi.get_privileges_for_table"
  end
  # resource path
  local_var_path = "/privileges/{groupId}/{tableNameOrPrivilegeId}".sub('{' + 'groupId' + '}', group_id.to_s).sub('{' + 'tableNameOrPrivilegeId' + '}', table_name_or_privilege_id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetPrivilegesForTable')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GroupsApi#get_privileges_for_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_privileges_with_http_info(group_id, opts = {}) ⇒ Array<(GetPrivileges, Fixnum, Hash)>

Returns group privileges

Parameters:

  • group_id

    ID of group to return

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

    the optional parameters

Returns:

  • (Array<(GetPrivileges, Fixnum, Hash)>)

    GetPrivileges data, response status code and response headers



276
277
278
279
280
281
282
283
284
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
# File 'lib/directus_sdk/api/groups_api.rb', line 276

def get_privileges_with_http_info(group_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: GroupsApi.get_privileges ..."
  end
  # verify the required parameter 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling GroupsApi.get_privileges"
  end
  # resource path
  local_var_path = "/privileges/{groupId}".sub('{' + 'groupId' + '}', group_id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetPrivileges')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GroupsApi#get_privileges\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_privileges(group_id, table_name_or_privilege_id, opts = {}) ⇒ nil

Update privileges by privilegeId

Parameters:

  • group_id

    ID of group to return

  • table_name_or_privilege_id

    ID of privileges or Table Name to use

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

    the optional parameters

Options Hash (opts):

  • :privileges_id (String)

    ubique privilege ID

  • :group_id2 (String)

    ID of group to return

  • :table_name (String)

    Name of table to add

  • :allow_add (Integer)

    Permission to add/create entries in the table (See values below)

  • :allow_edit (Integer)

    Permission to edit/update entries in the table (See values below)

  • :allow_delete (Integer)

    Permission to delete/remove entries in the table (See values below)

  • :allow_view (Integer)

    Permission to view/read entries in the table (See values below)

  • :allow_alter (Integer)

    Permission to add/create entries in the table (See values below)

  • :nav_listed (BOOLEAN)

    If the table should be visible in the sidebar for this user group

  • :read_field_blacklist (String)

    A CSV of column names that the group can&#39;t view (read)

  • :write_field_blacklist (String)

    A CSV of column names that the group can&#39;t edit (update)

  • :status_id (String)

    State of the record that this permissions belongs to (Draft, Active or Soft Deleted)

Returns:

  • (nil)


391
392
393
394
# File 'lib/directus_sdk/api/groups_api.rb', line 391

def update_privileges(group_id, table_name_or_privilege_id, opts = {})
  update_privileges_with_http_info(group_id, table_name_or_privilege_id, opts)
  return nil
end

#update_privileges_with_http_info(group_id, table_name_or_privilege_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update privileges by privilegeId

Parameters:

  • group_id

    ID of group to return

  • table_name_or_privilege_id

    ID of privileges or Table Name to use

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

    the optional parameters

Options Hash (opts):

  • :privileges_id (String)

    ubique privilege ID

  • :group_id2 (String)

    ID of group to return

  • :table_name (String)

    Name of table to add

  • :allow_add (Integer)

    Permission to add/create entries in the table (See values below)

  • :allow_edit (Integer)

    Permission to edit/update entries in the table (See values below)

  • :allow_delete (Integer)

    Permission to delete/remove entries in the table (See values below)

  • :allow_view (Integer)

    Permission to view/read entries in the table (See values below)

  • :allow_alter (Integer)

    Permission to add/create entries in the table (See values below)

  • :nav_listed (BOOLEAN)

    If the table should be visible in the sidebar for this user group

  • :read_field_blacklist (String)

    A CSV of column names that the group can&#39;t view (read)

  • :write_field_blacklist (String)

    A CSV of column names that the group can&#39;t edit (update)

  • :status_id (String)

    State of the record that this permissions belongs to (Draft, Active or Soft Deleted)

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/directus_sdk/api/groups_api.rb', line 414

def update_privileges_with_http_info(group_id, table_name_or_privilege_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: GroupsApi.update_privileges ..."
  end
  # verify the required parameter 'group_id' is set
  if @api_client.config.client_side_validation && group_id.nil?
    fail ArgumentError, "Missing the required parameter 'group_id' when calling GroupsApi.update_privileges"
  end
  # verify the required parameter 'table_name_or_privilege_id' is set
  if @api_client.config.client_side_validation && table_name_or_privilege_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_name_or_privilege_id' when calling GroupsApi.update_privileges"
  end
  # resource path
  local_var_path = "/privileges/{groupId}/{tableNameOrPrivilegeId}".sub('{' + 'groupId' + '}', group_id.to_s).sub('{' + 'tableNameOrPrivilegeId' + '}', table_name_or_privilege_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["privileges_id"] = opts[:'privileges_id'] if !opts[:'privileges_id'].nil?
  form_params["group_id"] = opts[:'group_id2'] if !opts[:'group_id2'].nil?
  form_params["table_name"] = opts[:'table_name'] if !opts[:'table_name'].nil?
  form_params["allow_add"] = opts[:'allow_add'] if !opts[:'allow_add'].nil?
  form_params["allow_edit"] = opts[:'allow_edit'] if !opts[:'allow_edit'].nil?
  form_params["allow_delete"] = opts[:'allow_delete'] if !opts[:'allow_delete'].nil?
  form_params["allow_view"] = opts[:'allow_view'] if !opts[:'allow_view'].nil?
  form_params["allow_alter"] = opts[:'allow_alter'] if !opts[:'allow_alter'].nil?
  form_params["nav_listed"] = opts[:'nav_listed'] if !opts[:'nav_listed'].nil?
  form_params["read_field_blacklist"] = opts[:'read_field_blacklist'] if !opts[:'read_field_blacklist'].nil?
  form_params["write_field_blacklist"] = opts[:'write_field_blacklist'] if !opts[:'write_field_blacklist'].nil?
  form_params["status_id"] = opts[:'status_id'] if !opts[:'status_id'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: GroupsApi#update_privileges\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end