Class: CropwisePlatformSdk::WorkspacesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cropwise-platform-sdk/api/workspaces_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WorkspacesApi

Returns a new instance of WorkspacesApi.



19
20
21
# File 'lib/cropwise-platform-sdk/api/workspaces_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/cropwise-platform-sdk/api/workspaces_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_entities_from_account_workspace_id(workspace_id, opts = {}) ⇒ Array<GetV2ContractsWorkspaceIdContractsContractId200Response>

Delete entities in a workspace’s contracts Delete entities from all contracts from one workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 27

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

#delete_entities_from_account_workspace_id_with_http_info(workspace_id, opts = {}) ⇒ Array<(Array<GetV2ContractsWorkspaceIdContractsContractId200Response>, Integer, Hash)>

Delete entities in a workspace&#39;s contracts Delete entities from all contracts from one workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

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

    the optional parameters

Returns:



37
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
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 37

def (workspace_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.delete_entities_from_account_workspace_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling WorkspacesApi.delete_entities_from_account_workspace_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/entities'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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] || 'Array<GetV2ContractsWorkspaceIdContractsContractId200Response>'

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.delete_entities_from_account_workspace_id",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkspacesApi#delete_entities_from_account_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_workspace_workspace_id(workspace_id, opts = {}) ⇒ nil

Delete workspace Delete a single workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

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

    the optional parameters

Returns:

  • (nil)


90
91
92
93
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 90

def delete_workspace_workspace_id(workspace_id, opts = {})
  delete_workspace_workspace_id_with_http_info(workspace_id, opts)
  nil
end

#delete_workspace_workspace_id_with_http_info(workspace_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete workspace Delete a single workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



100
101
102
103
104
105
106
107
108
109
110
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
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 100

def delete_workspace_workspace_id_with_http_info(workspace_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.delete_workspace_workspace_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling WorkspacesApi.delete_workspace_workspace_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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]

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.delete_workspace_workspace_id",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkspacesApi#delete_workspace_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_accounts_by_defualt_workspace_id(opts = {}) ⇒ PagedAccount

Get Accounts from its default workspaces ids Get Accounts by their default workspace ids. If an id does not exist, it does not return it.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include_deleted (Boolean)

    Return only non-deleted or both deleted and non-deleted accounts

  • :page (Integer)

    Requested page number. Starting from zero. Default is zero.

  • :size (Integer)

    Requested page size. Default is unpaged

  • :uuid_list_model (UUIDListModel)

Returns:



156
157
158
159
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 156

def get_accounts_by_defualt_workspace_id(opts = {})
  data, _status_code, _headers = get_accounts_by_defualt_workspace_id_with_http_info(opts)
  data
end

#get_accounts_by_defualt_workspace_id_with_http_info(opts = {}) ⇒ Array<(PagedAccount, Integer, Hash)>

Get Accounts from its default workspaces ids Get Accounts by their default workspace ids. If an id does not exist, it does not return it.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include_deleted (Boolean)

    Return only non-deleted or both deleted and non-deleted accounts

  • :page (Integer)

    Requested page number. Starting from zero. Default is zero.

  • :size (Integer)

    Requested page size. Default is unpaged

  • :uuid_list_model (UUIDListModel)

Returns:

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

    PagedAccount data, response status code and response headers



169
170
171
172
173
174
175
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
213
214
215
216
217
218
219
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 169

def get_accounts_by_defualt_workspace_id_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.get_accounts_by_defualt_workspace_id ...'
  end
  # resource path
  local_var_path = '/v2/workspaces/ids/accounts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].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[:'uuid_list_model'])

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

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.get_accounts_by_defualt_workspace_id",
    :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: WorkspacesApi#get_accounts_by_defualt_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contracts_by_entitlement(opts = {}) ⇒ ContractsByEntitlements

Get contracts by entitlements

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :entitlements (Array<String>)
  • :should_contract_have_all_entitlements (Boolean)
  • :should_consider_deleted_contracts (Boolean)
  • :last_key (String)
  • :last_key_complement (Integer)

Returns:



229
230
231
232
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 229

def get_contracts_by_entitlement(opts = {})
  data, _status_code, _headers = get_contracts_by_entitlement_with_http_info(opts)
  data
end

#get_contracts_by_entitlement_with_http_info(opts = {}) ⇒ Array<(ContractsByEntitlements, Integer, Hash)>

Get contracts by entitlements

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :entitlements (Array<String>)
  • :should_contract_have_all_entitlements (Boolean)
  • :should_consider_deleted_contracts (Boolean)
  • :last_key (String)
  • :last_key_complement (Integer)

Returns:

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

    ContractsByEntitlements data, response status code and response headers



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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 242

def get_contracts_by_entitlement_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.get_contracts_by_entitlement ...'
  end
  # resource path
  local_var_path = '/v2/workspaces/contracts/by-entitlements'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'entitlements'] = @api_client.build_collection_param(opts[:'entitlements'], :multi) if !opts[:'entitlements'].nil?
  query_params[:'shouldContractHaveAllEntitlements'] = opts[:'should_contract_have_all_entitlements'] if !opts[:'should_contract_have_all_entitlements'].nil?
  query_params[:'shouldConsiderDeletedContracts'] = opts[:'should_consider_deleted_contracts'] if !opts[:'should_consider_deleted_contracts'].nil?
  query_params[:'lastKey'] = opts[:'last_key'] if !opts[:'last_key'].nil?
  query_params[:'lastKeyComplement'] = opts[:'last_key_complement'] if !opts[:'last_key_complement'].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] || 'ContractsByEntitlements'

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.get_contracts_by_entitlement",
    :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: WorkspacesApi#get_contracts_by_entitlement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_root_owners_workspace_id(opts = {}) ⇒ PagedAccount

Get Root owners from the orgs that the workspace id is linked Get Root owners from the orgs that the workspace id is linked. If an id does not exist, it does not return it.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include_deleted (Boolean)

    Return only non-deleted or both deleted and non-deleted accounts

  • :page (Integer)

    Requested page number. Starting from zero. Default is zero.

  • :size (Integer)

    Requested page size. Default is unpaged

  • :uuid_list_model (UUIDListModel)

Returns:



299
300
301
302
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 299

def get_root_owners_workspace_id(opts = {})
  data, _status_code, _headers = get_root_owners_workspace_id_with_http_info(opts)
  data
end

#get_root_owners_workspace_id_with_http_info(opts = {}) ⇒ Array<(PagedAccount, Integer, Hash)>

Get Root owners from the orgs that the workspace id is linked Get Root owners from the orgs that the workspace id is linked. If an id does not exist, it does not return it.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include_deleted (Boolean)

    Return only non-deleted or both deleted and non-deleted accounts

  • :page (Integer)

    Requested page number. Starting from zero. Default is zero.

  • :size (Integer)

    Requested page size. Default is unpaged

  • :uuid_list_model (UUIDListModel)

Returns:

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

    PagedAccount data, response status code and response headers



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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 312

def get_root_owners_workspace_id_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.get_root_owners_workspace_id ...'
  end
  # resource path
  local_var_path = '/v2/workspaces/ids/root-owners'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].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[:'uuid_list_model'])

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

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.get_root_owners_workspace_id",
    :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: WorkspacesApi#get_root_owners_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_workspace_by_app_workspace_id(app_id, opts = {}) ⇒ ContractsWorkspaceIdsDTO

Get WorkspaceIds from a App Get all WorkspaceIds from a App

Parameters:

  • app_id (String)

    Numeric ID of the App to get

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

    the optional parameters

Options Hash (opts):

  • :include_inactive (Boolean)

Returns:



370
371
372
373
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 370

def get_workspace_by_app_workspace_id(app_id, opts = {})
  data, _status_code, _headers = get_workspace_by_app_workspace_id_with_http_info(app_id, opts)
  data
end

#get_workspace_by_app_workspace_id_with_http_info(app_id, opts = {}) ⇒ Array<(ContractsWorkspaceIdsDTO, Integer, Hash)>

Get WorkspaceIds from a App Get all WorkspaceIds from a App

Parameters:

  • app_id (String)

    Numeric ID of the App to get

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

    the optional parameters

Options Hash (opts):

  • :include_inactive (Boolean)

Returns:

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

    ContractsWorkspaceIdsDTO data, response status code and response headers



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 381

def get_workspace_by_app_workspace_id_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.get_workspace_by_app_workspace_id ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling WorkspacesApi.get_workspace_by_app_workspace_id"
  end
  # resource path
  local_var_path = '/v2/apps/{appId}/workspaces/simple'.sub('{' + 'appId' + '}', CGI.escape(app_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_inactive'] = opts[:'include_inactive'] if !opts[:'include_inactive'].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] || 'ContractsWorkspaceIdsDTO'

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.get_workspace_by_app_workspace_id",
    :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: WorkspacesApi#get_workspace_by_app_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_workspace_workspace_id(workspace_id, opts = {}) ⇒ Workspace

Get workspace by Id Get a single workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

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

    the optional parameters

Returns:



435
436
437
438
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 435

def get_workspace_workspace_id(workspace_id, opts = {})
  data, _status_code, _headers = get_workspace_workspace_id_with_http_info(workspace_id, opts)
  data
end

#get_workspace_workspace_id_with_http_info(workspace_id, opts = {}) ⇒ Array<(Workspace, Integer, Hash)>

Get workspace by Id Get a single workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

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

    the optional parameters

Returns:

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

    Workspace data, response status code and response headers



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 445

def get_workspace_workspace_id_with_http_info(workspace_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.get_workspace_workspace_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling WorkspacesApi.get_workspace_workspace_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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] || 'Workspace'

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.get_workspace_workspace_id",
    :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: WorkspacesApi#get_workspace_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_workspaces(opts = {}) ⇒ PageableWorkspaces

Get Workspaces Get all workspaces

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :size (Integer)

    Number of workspaces to return

  • :last_key (String)

    Id of the last workspace returned by the previous query

  • :name (String)

    Filter accounts containing this name

  • :country (String)

    Filter accounts containing this country

  • :app_id (String)

    Filter accounts containing this appId

Returns:



502
503
504
505
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 502

def get_workspaces(opts = {})
  data, _status_code, _headers = get_workspaces_with_http_info(opts)
  data
end

#get_workspaces_with_http_info(opts = {}) ⇒ Array<(PageableWorkspaces, Integer, Hash)>

Get Workspaces Get all workspaces

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :size (Integer)

    Number of workspaces to return

  • :last_key (String)

    Id of the last workspace returned by the previous query

  • :name (String)

    Filter accounts containing this name

  • :country (String)

    Filter accounts containing this country

  • :app_id (String)

    Filter accounts containing this appId

Returns:

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

    PageableWorkspaces data, response status code and response headers



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
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
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 516

def get_workspaces_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.get_workspaces ...'
  end
  # resource path
  local_var_path = '/v2/workspaces'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'last_key'] = opts[:'last_key'] if !opts[:'last_key'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
  query_params[:'app_id'] = opts[:'app_id'] if !opts[:'app_id'].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] || 'PageableWorkspaces'

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.get_workspaces",
    :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: WorkspacesApi#get_workspaces\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_workspace(post_workspace_request, opts = {}) ⇒ Workspace

Create a new workspace Create a workspace

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :country (String)

    Filter accounts containing this country

  • :set_workspace_owner (Boolean)

    Set Workspace Owner role to current user or not

Returns:



572
573
574
575
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 572

def post_workspace(post_workspace_request, opts = {})
  data, _status_code, _headers = post_workspace_with_http_info(post_workspace_request, opts)
  data
end

#post_workspace_with_http_info(post_workspace_request, opts = {}) ⇒ Array<(Workspace, Integer, Hash)>

Create a new workspace Create a workspace

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :country (String)

    Filter accounts containing this country

  • :set_workspace_owner (Boolean)

    Set Workspace Owner role to current user or not

Returns:

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

    Workspace data, response status code and response headers



584
585
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
627
628
629
630
631
632
633
634
635
636
637
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 584

def post_workspace_with_http_info(post_workspace_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.post_workspace ...'
  end
  # verify the required parameter 'post_workspace_request' is set
  if @api_client.config.client_side_validation && post_workspace_request.nil?
    fail ArgumentError, "Missing the required parameter 'post_workspace_request' when calling WorkspacesApi.post_workspace"
  end
  # resource path
  local_var_path = '/v2/workspaces'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
  query_params[:'set_workspace_owner'] = opts[:'set_workspace_owner'] if !opts[:'set_workspace_owner'].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(post_workspace_request)

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

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.post_workspace",
    :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: WorkspacesApi#post_workspace\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_workspace_workspace_id(workspace_id, workspace, opts = {}) ⇒ WorkspaceData

Edit workspace Update a single workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

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

    the optional parameters

Returns:



645
646
647
648
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 645

def put_workspace_workspace_id(workspace_id, workspace, opts = {})
  data, _status_code, _headers = put_workspace_workspace_id_with_http_info(workspace_id, workspace, opts)
  data
end

#put_workspace_workspace_id_with_http_info(workspace_id, workspace, opts = {}) ⇒ Array<(WorkspaceData, Integer, Hash)>

Edit workspace Update a single workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

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

    the optional parameters

Returns:

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

    WorkspaceData data, response status code and response headers



656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
# File 'lib/cropwise-platform-sdk/api/workspaces_api.rb', line 656

def put_workspace_workspace_id_with_http_info(workspace_id, workspace, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkspacesApi.put_workspace_workspace_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling WorkspacesApi.put_workspace_workspace_id"
  end
  # verify the required parameter 'workspace' is set
  if @api_client.config.client_side_validation && workspace.nil?
    fail ArgumentError, "Missing the required parameter 'workspace' when calling WorkspacesApi.put_workspace_workspace_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # 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(workspace)

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

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

  new_options = opts.merge(
    :operation => :"WorkspacesApi.put_workspace_workspace_id",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkspacesApi#put_workspace_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end