Class: AlfrescoAPI::DownloadsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/alfresco_api/api/downloads_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DownloadsApi

Returns a new instance of DownloadsApi.



19
20
21
# File 'lib/alfresco_api/api/downloads_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/alfresco_api/api/downloads_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_download(download_id, opts = {}) ⇒ nil

Cancel a download Note: this endpoint is available in Alfresco 5.2.1 and newer versions. Cancels the creation of a download request. Note: The download node can be deleted using the **DELETE /nodes/downloadId** endpoint By default, if the download node is not deleted it will be picked up by a cleaner job which removes download nodes older than a configurable amount of time (default is 1 hour) Information about the existing progress at the time of cancelling can be retrieved by calling the **GET /downloads/downloadId** endpoint The cancel operation is done asynchronously.

Parameters:

  • download_id

    The identifier of a download node.

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

    the optional parameters

Returns:

  • (nil)


28
29
30
31
# File 'lib/alfresco_api/api/downloads_api.rb', line 28

def cancel_download(download_id, opts = {})
  cancel_download_with_http_info(download_id, opts)
  return nil
end

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

Cancel a download Note: this endpoint is available in Alfresco 5.2.1 and newer versions. Cancels the creation of a download request. Note: The download node can be deleted using the **DELETE /nodes/downloadId** endpoint By default, if the download node is not deleted it will be picked up by a cleaner job which removes download nodes older than a configurable amount of time (default is 1 hour) Information about the existing progress at the time of cancelling can be retrieved by calling the **GET /downloads/downloadId** endpoint The cancel operation is done asynchronously.

Parameters:

  • download_id

    The identifier of a download node.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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

def cancel_download_with_http_info(download_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DownloadsApi.cancel_download ..."
  end
  # verify the required parameter 'download_id' is set
  if @api_client.config.client_side_validation && download_id.nil?
    fail ArgumentError, "Missing the required parameter 'download_id' when calling DownloadsApi.cancel_download"
  end
  # resource path
  local_var_path = "/downloads/{downloadId}".sub('{' + 'downloadId' + '}', download_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/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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: DownloadsApi#cancel_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_download(download_body_create, opts = {}) ⇒ DownloadEntry

Create a new download Note: this endpoint is available in Alfresco 5.2.1 and newer versions. Creates a new download node asynchronously, the content of which will be the zipped content of the nodeIds specified in the JSON body like this: “‘JSON { "nodeIds": [ "c8bb482a-ff3c-4704-a3a3-de1c83ccd84c", "cffa62db-aa01-493d-9594-058bc058eeb1" ] } “` Note: The content of the download node can be obtained using the **GET /nodes/downloadId/content** endpoint

Parameters:

  • download_body_create

    The nodeIds the content of which will be zipped, which zip will be set as the content of our download node.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter.

Returns:



83
84
85
86
# File 'lib/alfresco_api/api/downloads_api.rb', line 83

def create_download(download_body_create, opts = {})
  data, _status_code, _headers = create_download_with_http_info(download_body_create, opts)
  return data
end

#create_download_with_http_info(download_body_create, opts = {}) ⇒ Array<(DownloadEntry, Fixnum, Hash)>

Create a new download Note: this endpoint is available in Alfresco 5.2.1 and newer versions. Creates a new download node asynchronously, the content of which will be the zipped content of the nodeIds specified in the JSON body like this: &#x60;&#x60;&#x60;JSON { &quot;nodeIds&quot;: [ &quot;c8bb482a-ff3c-4704-a3a3-de1c83ccd84c&quot;, &quot;cffa62db-aa01-493d-9594-058bc058eeb1&quot; ] } &#x60;&#x60;&#x60; Note: The content of the download node can be obtained using the **GET /nodes/downloadId/content** endpoint

Parameters:

  • download_body_create

    The nodeIds the content of which will be zipped, which zip will be set as the content of our download node.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter.

Returns:

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

    DownloadEntry data, response status code and response headers



94
95
96
97
98
99
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
# File 'lib/alfresco_api/api/downloads_api.rb', line 94

def create_download_with_http_info(download_body_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DownloadsApi.create_download ..."
  end
  # verify the required parameter 'download_body_create' is set
  if @api_client.config.client_side_validation && download_body_create.nil?
    fail ArgumentError, "Missing the required parameter 'download_body_create' when calling DownloadsApi.create_download"
  end
  # resource path
  local_var_path = "/downloads"

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?

  # 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/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(download_body_create)
  auth_names = ['basicAuth']
  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,
    :return_type => 'DownloadEntry')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DownloadsApi#create_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_download(download_id, opts = {}) ⇒ DownloadEntry

Get a download Note: this endpoint is available in Alfresco 5.2.1 and newer versions. Retrieve status information for download node downloadId

Parameters:

  • download_id

    The identifier of a download node.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter.

Returns:



141
142
143
144
# File 'lib/alfresco_api/api/downloads_api.rb', line 141

def get_download(download_id, opts = {})
  data, _status_code, _headers = get_download_with_http_info(download_id, opts)
  return data
end

#get_download_with_http_info(download_id, opts = {}) ⇒ Array<(DownloadEntry, Fixnum, Hash)>

Get a download Note: this endpoint is available in Alfresco 5.2.1 and newer versions. Retrieve status information for download node downloadId

Parameters:

  • download_id

    The identifier of a download node.

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter.

Returns:

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

    DownloadEntry data, response status code and response headers



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/alfresco_api/api/downloads_api.rb', line 152

def get_download_with_http_info(download_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DownloadsApi.get_download ..."
  end
  # verify the required parameter 'download_id' is set
  if @api_client.config.client_side_validation && download_id.nil?
    fail ArgumentError, "Missing the required parameter 'download_id' when calling DownloadsApi.get_download"
  end
  # resource path
  local_var_path = "/downloads/{downloadId}".sub('{' + 'downloadId' + '}', download_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?

  # 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/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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 => 'DownloadEntry')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DownloadsApi#get_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end