Skip to content

Latest commit

 

History

History
738 lines (530 loc) · 28.1 KB

FilesApi.md

File metadata and controls

738 lines (530 loc) · 28.1 KB

RebillySdk::FilesApi

All URIs are relative to https://api-sandbox.rebilly.com/organizations/{organizationId}

Method HTTP request Description
delete_attachment DELETE /attachments/{id} Delete an Attachment
delete_file DELETE /files/{id} Delete a File
get_attachment GET /attachments/{id} Retrieve an Attachment
get_attachment_collection GET /attachments Retrieve a list of Attachments
get_file GET /files/{id} Retrieve a File Record
get_file_collection GET /files Retrieve a list of files
get_file_download GET /files/{id}/download Download a file
get_file_download_extension GET /files/{id}/download{extension} Download image in specific format
post_attachment POST /attachments Create an Attachment
post_file POST /files Create a file
put_attachment PUT /attachments/{id} Update the Attachment with predefined ID
put_file PUT /files/{id} Update the File with predefined ID

delete_attachment

delete_attachment(id, opts)

Delete an Attachment

Delete the Attachment with predefined identifier string.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
id = 'id_example' # String | The resource identifier string.
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Delete an Attachment
  api_instance.delete_attachment(id, opts)
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->delete_attachment: #{e}"
end

Parameters

Name Type Description Notes
id String The resource identifier string.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

nil (empty response body)

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

delete_file

delete_file(id, opts)

Delete a File

Delete the File with predefined identifier string.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
id = 'id_example' # String | The resource identifier string.
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Delete a File
  api_instance.delete_file(id, opts)
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->delete_file: #{e}"
end

Parameters

Name Type Description Notes
id String The resource identifier string.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

nil (empty response body)

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_attachment

Attachment get_attachment(id, opts)

Retrieve an Attachment

Retrieve a Attachment with specified identifier string.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
id = 'id_example' # String | The resource identifier string.
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Retrieve an Attachment
  result = api_instance.get_attachment(id, opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->get_attachment: #{e}"
end

Parameters

Name Type Description Notes
id String The resource identifier string.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

Attachment

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_attachment_collection

Array<Attachment> get_attachment_collection(opts)

Retrieve a list of Attachments

Retrieve a list of attachments. You may sort by the id, name, relatedId, relatedType, fileId, createdTime, and updatedTime.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
opts = { 
  organization_id: RebillySdk::ResourceId.new, # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
  limit: 56, # Integer | The collection items limit.
  offset: 56, # Integer | The collection items offset.
  filter: 'filter_example', # String | The collection items filter requires a special format. Use \",\" for multiple allowed values.  Use \";\" for multiple fields. See the [filter guide](https://api-reference.rebilly.com/#section/Using-filter-with-collections) for more options and examples about this format. 
  q: 'q_example', # String | The partial search of the text fields.
  expand: 'expand_example', # String | Expand a response to get a full related object included inside of the `_embedded` path in the response. It accepts a comma-separated list of objects to expand. See the [expand guide](https://api-reference.rebilly.com/#section/Expand-to-include-embedded-objects) for more info. 
  fields: 'fields_example', # String | Limit the returned fields to the list specified, separated by comma. Note that id is always returned.
  sort: ['sort_example'] # Array<String> | The collection items sort field and order (prefix with \"-\" for descending sort).
}

begin
  #Retrieve a list of Attachments
  result = api_instance.get_attachment_collection(opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->get_attachment_collection: #{e}"
end

Parameters

Name Type Description Notes
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]
limit Integer The collection items limit. [optional]
offset Integer The collection items offset. [optional]
filter String The collection items filter requires a special format. Use &quot;,&quot; for multiple allowed values. Use &quot;;&quot; for multiple fields. See the filter guide for more options and examples about this format. [optional]
q String The partial search of the text fields. [optional]
expand String Expand a response to get a full related object included inside of the `_embedded` path in the response. It accepts a comma-separated list of objects to expand. See the expand guide for more info. [optional]
fields String Limit the returned fields to the list specified, separated by comma. Note that id is always returned. [optional]
sort Array<String> The collection items sort field and order (prefix with &quot;-&quot; for descending sort). [optional]

Return type

Array<Attachment>

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_file

File get_file(id, opts)

Retrieve a File Record

Retrieve a File with specified identifier string.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
id = 'id_example' # String | The resource identifier string.
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Retrieve a File Record
  result = api_instance.get_file(id, opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->get_file: #{e}"
end

Parameters

Name Type Description Notes
id String The resource identifier string.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

File

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_file_collection

Array<File> get_file_collection(opts)

Retrieve a list of files

Retrieve a list of files.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
opts = { 
  organization_id: RebillySdk::ResourceId.new, # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
  limit: 56, # Integer | The collection items limit.
  offset: 56, # Integer | The collection items offset.
  filter: 'filter_example', # String | The collection items filter requires a special format. Use \",\" for multiple allowed values.  Use \";\" for multiple fields. See the [filter guide](https://api-reference.rebilly.com/#section/Using-filter-with-collections) for more options and examples about this format. 
  q: 'q_example', # String | The partial search of the text fields.
  expand: 'expand_example', # String | Expand a response to get a full related object included inside of the `_embedded` path in the response. It accepts a comma-separated list of objects to expand. See the [expand guide](https://api-reference.rebilly.com/#section/Expand-to-include-embedded-objects) for more info. 
  fields: 'fields_example', # String | Limit the returned fields to the list specified, separated by comma. Note that id is always returned.
  sort: ['sort_example'] # Array<String> | The collection items sort field and order (prefix with \"-\" for descending sort).
}

begin
  #Retrieve a list of files
  result = api_instance.get_file_collection(opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->get_file_collection: #{e}"
end

Parameters

Name Type Description Notes
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]
limit Integer The collection items limit. [optional]
offset Integer The collection items offset. [optional]
filter String The collection items filter requires a special format. Use &quot;,&quot; for multiple allowed values. Use &quot;;&quot; for multiple fields. See the filter guide for more options and examples about this format. [optional]
q String The partial search of the text fields. [optional]
expand String Expand a response to get a full related object included inside of the `_embedded` path in the response. It accepts a comma-separated list of objects to expand. See the expand guide for more info. [optional]
fields String Limit the returned fields to the list specified, separated by comma. Note that id is always returned. [optional]
sort Array<String> The collection items sort field and order (prefix with &quot;-&quot; for descending sort). [optional]

Return type

Array<File>

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_file_download

String get_file_download(id, opts)

Download a file

Download a file.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
id = 'id_example' # String | The resource identifier string.
opts = { 
  organization_id: RebillySdk::ResourceId.new, # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
  image_size: 'image_size_example' # String | Resize image to specified size. Supports any sizes from 10x10 to 2000x2000 (format `{width}x{height}`). The image will be returned in the original size if the value is invalid. This parameter will be ignored for non-image files.
}

begin
  #Download a file
  result = api_instance.get_file_download(id, opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->get_file_download: #{e}"
end

Parameters

Name Type Description Notes
id String The resource identifier string.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]
image_size String Resize image to specified size. Supports any sizes from 10x10 to 2000x2000 (format `{width}x{height}`). The image will be returned in the original size if the value is invalid. This parameter will be ignored for non-image files. [optional]

Return type

String

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_file_download_extension

String get_file_download_extension(id, extension, opts)

Download image in specific format

Download image in specific format. Images are converted server-side.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
id = 'id_example' # String | The resource identifier string.
extension = 'extension_example' # String | File extension which also indicates the desired file format.
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Download image in specific format
  result = api_instance.get_file_download_extension(id, extension, opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->get_file_download_extension: #{e}"
end

Parameters

Name Type Description Notes
id String The resource identifier string.
extension String File extension which also indicates the desired file format.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

String

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

post_attachment

Attachment post_attachment(body, opts)

Create an Attachment

Create an Attachment.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
body = RebillySdk::Attachment.new # Attachment | Attachment resource.
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Create an Attachment
  result = api_instance.post_attachment(body, opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->post_attachment: #{e}"
end

Parameters

Name Type Description Notes
body Attachment Attachment resource.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

Attachment

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

post_file

File post_file(body, opts)

Create a file

Additionally, a file can be sent with:. - multipart/form-data POST request: in this case all property names are the same as the JSON ones (file is an uploaded file) - file body request: the file body is sent as the request body, with the appropriate Content-Type. No additional properties can be set along the request data The following file types only are allowed: - jpg - png - gif - pdf - mp3 If using a Publishable Api Key, only private files can be created. The files can later on be modified or used using a secret API key.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: PublishableApiKey
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['Authorization'] = 'Bearer'

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
body = RebillySdk::FilesBody.new # FilesBody | 
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Create a file
  result = api_instance.post_file(body, opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->post_file: #{e}"
end

Parameters

Name Type Description Notes
body FilesBody
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

File

Authorization

JWT, PublishableApiKey, SecretApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

put_attachment

Attachment put_attachment(bodyid, opts)

Update the Attachment with predefined ID

Update the Attachment with predefined ID.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
body = RebillySdk::Attachment.new # Attachment | Attachment resource.
id = 'id_example' # String | The resource identifier string.
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Update the Attachment with predefined ID
  result = api_instance.put_attachment(bodyid, opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->put_attachment: #{e}"
end

Parameters

Name Type Description Notes
body Attachment Attachment resource.
id String The resource identifier string.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

Attachment

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

put_file

File put_file(bodyid, opts)

Update the File with predefined ID

Update the File with predefined ID. Note that file can be uploaded with POST. only.

Example

# load the gem
require 'rebilly_sdk'
# setup authorization
RebillySdk.configure do |config|

  # Configure API key authorization: SecretApiKey
  config.api_key['REB-APIKEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['REB-APIKEY'] = 'Bearer'
end

api_instance = RebillySdk::FilesApi.new
body = File.new('/path/to/file') # File | File resource.
id = 'id_example' # String | The resource identifier string.
opts = { 
  organization_id: RebillySdk::ResourceId.new # ResourceId | Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).  It is deprecated. Use servers with `/organizations/{organizationId}` base path instead.
}

begin
  #Update the File with predefined ID
  result = api_instance.put_file(bodyid, opts)
  p result
rescue RebillySdk::ApiError => e
  puts "Exception when calling FilesApi->put_file: #{e}"
end

Parameters

Name Type Description Notes
body File File resource.
id String The resource identifier string.
organization_id ResourceId Organization identifier in scope of which need to perform request (if not specified, the default organization will be used). It is deprecated. Use servers with `/organizations/{organizationId}` base path instead. [optional]

Return type

File

Authorization

JWT, SecretApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json