Class: DirectusSDK::TablesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TablesApi

Returns a new instance of TablesApi.



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

def api_client
  @api_client
end

Instance Method Details

#add_column(table_id, opts = {}) ⇒ nil

Create a column in a given table

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Options Hash (opts):

  • :table_name (String)

    Name of table to add

  • :column_name (String)

    The unique name of the column to create

  • :type (String)

    The datatype of the column, eg: INT

  • :ui (String)

    The Directus Interface to use for this column

  • :hidden_input (BOOLEAN)

    Whether the column will be hidden (globally) on the Edit Item page

  • :hidden_list (BOOLEAN)

    Whether the column will be hidden (globally) on the Item Listing page

  • :required (BOOLEAN)

    Whether the column is required. If required, the interface's validation function will be triggered

  • :sort (Integer)

    The sort order of the column used to override the column order in the schema

  • :comment (String)

    A helpful note to users for this column

  • :relationship_type (String)

    The column's relationship type (only used when storing relational data) eg: ONETOMANY, MANYTOMANY or MANYTOONE

  • :related_table (String)

    The table name this column is related to (only used when storing relational data)

  • :junction_table (String)

    The pivot/junction table that joins the column's table with the related table (only used when storing relational data)

  • :junction_key_left (String)

    The column name in junction that is related to the column's table (only used when storing relational data)

  • :junction_key_right (String)

    The column name in junction that is related to the related table (only used when storing relational data)

Returns:

  • (nil)


42
43
44
45
# File 'lib/directus_sdk/api/tables_api.rb', line 42

def add_column(table_id, opts = {})
  add_column_with_http_info(table_id, opts)
  return nil
end

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

Create a column in a given table

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Options Hash (opts):

  • :table_name (String)

    Name of table to add

  • :column_name (String)

    The unique name of the column to create

  • :type (String)

    The datatype of the column, eg: INT

  • :ui (String)

    The Directus Interface to use for this column

  • :hidden_input (BOOLEAN)

    Whether the column will be hidden (globally) on the Edit Item page

  • :hidden_list (BOOLEAN)

    Whether the column will be hidden (globally) on the Item Listing page

  • :required (BOOLEAN)

    Whether the column is required. If required, the interface&#39;s validation function will be triggered

  • :sort (Integer)

    The sort order of the column used to override the column order in the schema

  • :comment (String)

    A helpful note to users for this column

  • :relationship_type (String)

    The column&#39;s relationship type (only used when storing relational data) eg: ONETOMANY, MANYTOMANY or MANYTOONE

  • :related_table (String)

    The table name this column is related to (only used when storing relational data)

  • :junction_table (String)

    The pivot/junction table that joins the column&#39;s table with the related table (only used when storing relational data)

  • :junction_key_left (String)

    The column name in junction that is related to the column&#39;s table (only used when storing relational data)

  • :junction_key_right (String)

    The column name in junction that is related to the related table (only used when storing relational data)

Returns:

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

    nil, response status code and response headers



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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/directus_sdk/api/tables_api.rb', line 66

def add_column_with_http_info(table_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.add_column ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.add_column"
  end
  # resource path
  local_var_path = "/tables/{tableId}/columns".sub('{' + 'tableId' + '}', table_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', 'application/xml'])
  # 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["table_name"] = opts[:'table_name'] if !opts[:'table_name'].nil?
  form_params["column_name"] = opts[:'column_name'] if !opts[:'column_name'].nil?
  form_params["type"] = opts[:'type'] if !opts[:'type'].nil?
  form_params["ui"] = opts[:'ui'] if !opts[:'ui'].nil?
  form_params["hidden_input"] = opts[:'hidden_input'] if !opts[:'hidden_input'].nil?
  form_params["hidden_list"] = opts[:'hidden_list'] if !opts[:'hidden_list'].nil?
  form_params["required"] = opts[:'required'] if !opts[:'required'].nil?
  form_params["sort"] = opts[:'sort'] if !opts[:'sort'].nil?
  form_params["comment"] = opts[:'comment'] if !opts[:'comment'].nil?
  form_params["relationship_type"] = opts[:'relationship_type'] if !opts[:'relationship_type'].nil?
  form_params["related_table"] = opts[:'related_table'] if !opts[:'related_table'].nil?
  form_params["junction_table"] = opts[:'junction_table'] if !opts[:'junction_table'].nil?
  form_params["junction_key_left"] = opts[:'junction_key_left'] if !opts[:'junction_key_left'].nil?
  form_params["junction_key_right"] = opts[:'junction_key_right'] if !opts[:'junction_key_right'].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: TablesApi#add_column\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#add_row(table_id, custom_data, opts = {}) ⇒ nil

Add a new row

Parameters:

  • table_id

    ID of table to return rows from

  • custom_data

    Data based on your specific schema eg: active&#x3D;1&amp;title&#x3D;LoremIpsum

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

    the optional parameters

Returns:

  • (nil)


125
126
127
128
# File 'lib/directus_sdk/api/tables_api.rb', line 125

def add_row(table_id, custom_data, opts = {})
  add_row_with_http_info(table_id, custom_data, opts)
  return nil
end

#add_row_with_http_info(table_id, custom_data, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Add a new row

Parameters:

  • table_id

    ID of table to return rows from

  • custom_data

    Data based on your specific schema eg: active&#x3D;1&amp;title&#x3D;LoremIpsum

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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

def add_row_with_http_info(table_id, custom_data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.add_row ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.add_row"
  end
  # verify the required parameter 'custom_data' is set
  if @api_client.config.client_side_validation && custom_data.nil?
    fail ArgumentError, "Missing the required parameter 'custom_data' when calling TablesApi.add_row"
  end
  # resource path
  local_var_path = "/tables/{tableId}/rows".sub('{' + 'tableId' + '}', table_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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(custom_data)
  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: TablesApi#add_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#add_table(opts = {}) ⇒ nil

Add a new table

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :name (String)

    Name of table to add

Returns:

  • (nil)


184
185
186
187
# File 'lib/directus_sdk/api/tables_api.rb', line 184

def add_table(opts = {})
  add_table_with_http_info(opts)
  return nil
end

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

Add a new table

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :name (String)

    Name of table to add

Returns:

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

    nil, response status code and response headers



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/directus_sdk/api/tables_api.rb', line 194

def add_table_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.add_table ..."
  end
  # resource path
  local_var_path = "/tables"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
  # 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: TablesApi#add_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_column(table_id, column_name, opts = {}) ⇒ nil

Delete row

Parameters:

  • table_id

    ID of table to return rows from

  • column_name

    Name of column to return

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

    the optional parameters

Returns:

  • (nil)


236
237
238
239
# File 'lib/directus_sdk/api/tables_api.rb', line 236

def delete_column(table_id, column_name, opts = {})
  delete_column_with_http_info(table_id, column_name, opts)
  return nil
end

#delete_column_with_http_info(table_id, column_name, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete row

Parameters:

  • table_id

    ID of table to return rows from

  • column_name

    Name of column to return

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/directus_sdk/api/tables_api.rb', line 247

def delete_column_with_http_info(table_id, column_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.delete_column ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.delete_column"
  end
  # verify the required parameter 'column_name' is set
  if @api_client.config.client_side_validation && column_name.nil?
    fail ArgumentError, "Missing the required parameter 'column_name' when calling TablesApi.delete_column"
  end
  # resource path
  local_var_path = "/tables/{tableId}/columns/{columnName}".sub('{' + 'tableId' + '}', table_id.to_s).sub('{' + 'columnName' + '}', column_name.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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:DELETE, 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: TablesApi#delete_column\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_row(table_id, row_id, opts = {}) ⇒ nil

Delete row

Parameters:

  • table_id

    ID of table to return rows from

  • row_id

    ID of row to return from rows

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

    the optional parameters

Returns:

  • (nil)


296
297
298
299
# File 'lib/directus_sdk/api/tables_api.rb', line 296

def delete_row(table_id, row_id, opts = {})
  delete_row_with_http_info(table_id, row_id, opts)
  return nil
end

#delete_row_with_http_info(table_id, row_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete row

Parameters:

  • table_id

    ID of table to return rows from

  • row_id

    ID of row to return from rows

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/directus_sdk/api/tables_api.rb', line 307

def delete_row_with_http_info(table_id, row_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.delete_row ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.delete_row"
  end
  # verify the required parameter 'row_id' is set
  if @api_client.config.client_side_validation && row_id.nil?
    fail ArgumentError, "Missing the required parameter 'row_id' when calling TablesApi.delete_row"
  end
  # resource path
  local_var_path = "/tables/{tableId}/rows/{rowId}".sub('{' + 'tableId' + '}', table_id.to_s).sub('{' + 'rowId' + '}', row_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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:DELETE, 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: TablesApi#delete_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_table(table_id, opts = {}) ⇒ nil

Delete Table

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Returns:

  • (nil)


355
356
357
358
# File 'lib/directus_sdk/api/tables_api.rb', line 355

def delete_table(table_id, opts = {})
  delete_table_with_http_info(table_id, opts)
  return nil
end

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

Delete Table

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/directus_sdk/api/tables_api.rb', line 365

def delete_table_with_http_info(table_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.delete_table ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.delete_table"
  end
  # resource path
  local_var_path = "/tables/{tableId}".sub('{' + 'tableId' + '}', table_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 = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:DELETE, 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: TablesApi#delete_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_table(table_id, opts = {}) ⇒ GetTable

Returns specific table

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Returns:



409
410
411
412
# File 'lib/directus_sdk/api/tables_api.rb', line 409

def get_table(table_id, opts = {})
  data, _status_code, _headers = get_table_with_http_info(table_id, opts)
  return data
end

#get_table_column(table_id, column_name, opts = {}) ⇒ GetTableColumn

Returns specific table column

Parameters:

  • table_id

    ID of table to return rows from

  • column_name

    Name of column to return

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

    the optional parameters

Returns:



463
464
465
466
# File 'lib/directus_sdk/api/tables_api.rb', line 463

def get_table_column(table_id, column_name, opts = {})
  data, _status_code, _headers = get_table_column_with_http_info(table_id, column_name, opts)
  return data
end

#get_table_column_with_http_info(table_id, column_name, opts = {}) ⇒ Array<(GetTableColumn, Fixnum, Hash)>

Returns specific table column

Parameters:

  • table_id

    ID of table to return rows from

  • column_name

    Name of column to return

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

    the optional parameters

Returns:

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

    GetTableColumn data, response status code and response headers



474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/directus_sdk/api/tables_api.rb', line 474

def get_table_column_with_http_info(table_id, column_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.get_table_column ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.get_table_column"
  end
  # verify the required parameter 'column_name' is set
  if @api_client.config.client_side_validation && column_name.nil?
    fail ArgumentError, "Missing the required parameter 'column_name' when calling TablesApi.get_table_column"
  end
  # resource path
  local_var_path = "/tables/{tableId}/columns/{columnName}".sub('{' + 'tableId' + '}', table_id.to_s).sub('{' + 'columnName' + '}', column_name.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 => 'GetTableColumn')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TablesApi#get_table_column\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_table_columns(table_id, opts = {}) ⇒ GetTableColumns

Returns table columns

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Returns:



521
522
523
524
# File 'lib/directus_sdk/api/tables_api.rb', line 521

def get_table_columns(table_id, opts = {})
  data, _status_code, _headers = get_table_columns_with_http_info(table_id, opts)
  return data
end

#get_table_columns_with_http_info(table_id, opts = {}) ⇒ Array<(GetTableColumns, Fixnum, Hash)>

Returns table columns

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Returns:

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

    GetTableColumns data, response status code and response headers



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/directus_sdk/api/tables_api.rb', line 531

def get_table_columns_with_http_info(table_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.get_table_columns ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.get_table_columns"
  end
  # resource path
  local_var_path = "/tables/{tableId}/columns".sub('{' + 'tableId' + '}', table_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 => 'GetTableColumns')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TablesApi#get_table_columns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_table_row(table_id, row_id, opts = {}) ⇒ GetTableRow

Returns specific table row

Parameters:

  • table_id

    ID of table to return rows from

  • row_id

    ID of row to return from rows

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

    the optional parameters

Returns:



575
576
577
578
# File 'lib/directus_sdk/api/tables_api.rb', line 575

def get_table_row(table_id, row_id, opts = {})
  data, _status_code, _headers = get_table_row_with_http_info(table_id, row_id, opts)
  return data
end

#get_table_row_with_http_info(table_id, row_id, opts = {}) ⇒ Array<(GetTableRow, Fixnum, Hash)>

Returns specific table row

Parameters:

  • table_id

    ID of table to return rows from

  • row_id

    ID of row to return from rows

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

    the optional parameters

Returns:

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

    GetTableRow data, response status code and response headers



586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
# File 'lib/directus_sdk/api/tables_api.rb', line 586

def get_table_row_with_http_info(table_id, row_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.get_table_row ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.get_table_row"
  end
  # verify the required parameter 'row_id' is set
  if @api_client.config.client_side_validation && row_id.nil?
    fail ArgumentError, "Missing the required parameter 'row_id' when calling TablesApi.get_table_row"
  end
  # resource path
  local_var_path = "/tables/{tableId}/rows/{rowId}".sub('{' + 'tableId' + '}', table_id.to_s).sub('{' + 'rowId' + '}', row_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 => 'GetTableRow')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TablesApi#get_table_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_table_rows(table_id, opts = {}) ⇒ GetTableRows

Returns table rows

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Returns:



633
634
635
636
# File 'lib/directus_sdk/api/tables_api.rb', line 633

def get_table_rows(table_id, opts = {})
  data, _status_code, _headers = get_table_rows_with_http_info(table_id, opts)
  return data
end

#get_table_rows_with_http_info(table_id, opts = {}) ⇒ Array<(GetTableRows, Fixnum, Hash)>

Returns table rows

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Returns:

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

    GetTableRows data, response status code and response headers



643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# File 'lib/directus_sdk/api/tables_api.rb', line 643

def get_table_rows_with_http_info(table_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.get_table_rows ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.get_table_rows"
  end
  # resource path
  local_var_path = "/tables/{tableId}/rows".sub('{' + 'tableId' + '}', table_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 => 'GetTableRows')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TablesApi#get_table_rows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_table_with_http_info(table_id, opts = {}) ⇒ Array<(GetTable, Fixnum, Hash)>

Returns specific table

Parameters:

  • table_id

    ID of table to return rows from

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

    the optional parameters

Returns:

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

    GetTable data, response status code and response headers



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

def get_table_with_http_info(table_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.get_table ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.get_table"
  end
  # resource path
  local_var_path = "/tables/{tableId}".sub('{' + 'tableId' + '}', table_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 => 'GetTable')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TablesApi#get_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_tables(opts = {}) ⇒ GetTables

Returns tables

Parameters:

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

    the optional parameters

Returns:



685
686
687
688
# File 'lib/directus_sdk/api/tables_api.rb', line 685

def get_tables(opts = {})
  data, _status_code, _headers = get_tables_with_http_info(opts)
  return data
end

#get_tables_with_http_info(opts = {}) ⇒ Array<(GetTables, Fixnum, Hash)>

Returns tables

Parameters:

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

    the optional parameters

Returns:

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

    GetTables data, response status code and response headers



694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
# File 'lib/directus_sdk/api/tables_api.rb', line 694

def get_tables_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.get_tables ..."
  end
  # resource path
  local_var_path = "/tables"

  # 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 => 'GetTables')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TablesApi#get_tables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_column(table_id, column_name, opts = {}) ⇒ nil

Update column

Parameters:

  • table_id

    ID of table to return rows from

  • column_name

    Name of column to return

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

    the optional parameters

Options Hash (opts):

  • :data_type (String)

    The datatype of the column, eg: INT

  • :ui (String)

    The Directus Interface to use for this column

  • :hidden_input (BOOLEAN)

    Whether the column will be hidden (globally) on the Edit Item page

  • :hidden_list (BOOLEAN)

    Whether the column will be hidden (globally) on the Item Listing page

  • :required (BOOLEAN)

    Whether the column is required. If required, the interface&#39;s validation function will be triggered

  • :sort (Integer)

    The sort order of the column used to override the column order in the schema

  • :comment (String)

    A helpful note to users for this column

  • :relationship_type (String)

    The column&#39;s relationship type (only used when storing relational data) eg: ONETOMANY, MANYTOMANY or MANYTOONE

  • :related_table (String)

    The table name this column is related to (only used when storing relational data)

  • :junction_table (String)

    The pivot/junction table that joins the column&#39;s table with the related table (only used when storing relational data)

  • :junction_key_left (String)

    The column name in junction that is related to the column&#39;s table (only used when storing relational data)

  • :junction_key_right (String)

    The column name in junction that is related to the related table (only used when storing relational data)

Returns:

  • (nil)


746
747
748
749
# File 'lib/directus_sdk/api/tables_api.rb', line 746

def update_column(table_id, column_name, opts = {})
  update_column_with_http_info(table_id, column_name, opts)
  return nil
end

#update_column_with_http_info(table_id, column_name, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update column

Parameters:

  • table_id

    ID of table to return rows from

  • column_name

    Name of column to return

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

    the optional parameters

Options Hash (opts):

  • :data_type (String)

    The datatype of the column, eg: INT

  • :ui (String)

    The Directus Interface to use for this column

  • :hidden_input (BOOLEAN)

    Whether the column will be hidden (globally) on the Edit Item page

  • :hidden_list (BOOLEAN)

    Whether the column will be hidden (globally) on the Item Listing page

  • :required (BOOLEAN)

    Whether the column is required. If required, the interface&#39;s validation function will be triggered

  • :sort (Integer)

    The sort order of the column used to override the column order in the schema

  • :comment (String)

    A helpful note to users for this column

  • :relationship_type (String)

    The column&#39;s relationship type (only used when storing relational data) eg: ONETOMANY, MANYTOMANY or MANYTOONE

  • :related_table (String)

    The table name this column is related to (only used when storing relational data)

  • :junction_table (String)

    The pivot/junction table that joins the column&#39;s table with the related table (only used when storing relational data)

  • :junction_key_left (String)

    The column name in junction that is related to the column&#39;s table (only used when storing relational data)

  • :junction_key_right (String)

    The column name in junction that is related to the related table (only used when storing relational data)

Returns:

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

    nil, response status code and response headers



769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
# File 'lib/directus_sdk/api/tables_api.rb', line 769

def update_column_with_http_info(table_id, column_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.update_column ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.update_column"
  end
  # verify the required parameter 'column_name' is set
  if @api_client.config.client_side_validation && column_name.nil?
    fail ArgumentError, "Missing the required parameter 'column_name' when calling TablesApi.update_column"
  end
  # resource path
  local_var_path = "/tables/{tableId}/columns/{columnName}".sub('{' + 'tableId' + '}', table_id.to_s).sub('{' + 'columnName' + '}', column_name.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["data_type"] = opts[:'data_type'] if !opts[:'data_type'].nil?
  form_params["ui"] = opts[:'ui'] if !opts[:'ui'].nil?
  form_params["hidden_input"] = opts[:'hidden_input'] if !opts[:'hidden_input'].nil?
  form_params["hidden_list"] = opts[:'hidden_list'] if !opts[:'hidden_list'].nil?
  form_params["required"] = opts[:'required'] if !opts[:'required'].nil?
  form_params["sort"] = opts[:'sort'] if !opts[:'sort'].nil?
  form_params["comment"] = opts[:'comment'] if !opts[:'comment'].nil?
  form_params["relationship_type"] = opts[:'relationship_type'] if !opts[:'relationship_type'].nil?
  form_params["related_table"] = opts[:'related_table'] if !opts[:'related_table'].nil?
  form_params["junction_table"] = opts[:'junction_table'] if !opts[:'junction_table'].nil?
  form_params["junction_key_left"] = opts[:'junction_key_left'] if !opts[:'junction_key_left'].nil?
  form_params["junction_key_right"] = opts[:'junction_key_right'] if !opts[:'junction_key_right'].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: TablesApi#update_column\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_row(table_id, row_id, custom_data, opts = {}) ⇒ nil

Update row

Parameters:

  • table_id

    ID of table to return rows from

  • row_id

    ID of row to return from rows

  • custom_data

    Data based on your specific schema eg: active&#x3D;1&amp;title&#x3D;LoremIpsum

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

    the optional parameters

Returns:

  • (nil)


831
832
833
834
# File 'lib/directus_sdk/api/tables_api.rb', line 831

def update_row(table_id, row_id, custom_data, opts = {})
  update_row_with_http_info(table_id, row_id, custom_data, opts)
  return nil
end

#update_row_with_http_info(table_id, row_id, custom_data, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update row

Parameters:

  • table_id

    ID of table to return rows from

  • row_id

    ID of row to return from rows

  • custom_data

    Data based on your specific schema eg: active&#x3D;1&amp;title&#x3D;LoremIpsum

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
# File 'lib/directus_sdk/api/tables_api.rb', line 843

def update_row_with_http_info(table_id, row_id, custom_data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: TablesApi.update_row ..."
  end
  # verify the required parameter 'table_id' is set
  if @api_client.config.client_side_validation && table_id.nil?
    fail ArgumentError, "Missing the required parameter 'table_id' when calling TablesApi.update_row"
  end
  # verify the required parameter 'row_id' is set
  if @api_client.config.client_side_validation && row_id.nil?
    fail ArgumentError, "Missing the required parameter 'row_id' when calling TablesApi.update_row"
  end
  # verify the required parameter 'custom_data' is set
  if @api_client.config.client_side_validation && custom_data.nil?
    fail ArgumentError, "Missing the required parameter 'custom_data' when calling TablesApi.update_row"
  end
  # resource path
  local_var_path = "/tables/{tableId}/rows/{rowId}".sub('{' + 'tableId' + '}', table_id.to_s).sub('{' + 'rowId' + '}', row_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 = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(custom_data)
  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: TablesApi#update_row\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end