Class: AlfrescoAPI::VersionsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ VersionsApi

Returns a new instance of VersionsApi.



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

def api_client
  @api_client
end

Instance Method Details

#delete_version(node_id, version_id, opts = {}) ⇒ nil

Delete a version Note: this endpoint is available in Alfresco 5.2 and newer versions. Delete the version identified by versionId and *nodeId. If the version is successfully deleted then the content and metadata for that versioned node will be deleted and will no longer appear in the version history. This operation cannot be undone. If the most recent version is deleted the live node will revert to the next most recent version. We currently do not allow the last version to be deleted. If you wish to clear the history then you can remove the "cm:versionable" aspect (via update node) which will also disable versioning. In this case, you can re-enable versioning by adding back the "cm:versionable" aspect or using the version params (majorVersion and comment) on a subsequent file content update.

Parameters:

  • node_id

    The identifier of a node.

  • version_id

    The identifier of a version, ie. version label, within the version history of a node.

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

    the optional parameters

Returns:

  • (nil)


29
30
31
32
# File 'lib/alfresco_api/api/versions_api.rb', line 29

def delete_version(node_id, version_id, opts = {})
  delete_version_with_http_info(node_id, version_id, opts)
  return nil
end

#delete_version_with_http_info(node_id, version_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a version Note: this endpoint is available in Alfresco 5.2 and newer versions. Delete the version identified by versionId and *nodeId. If the version is successfully deleted then the content and metadata for that versioned node will be deleted and will no longer appear in the version history. This operation cannot be undone. If the most recent version is deleted the live node will revert to the next most recent version. We currently do not allow the last version to be deleted. If you wish to clear the history then you can remove the &quot;cm:versionable&quot; aspect (via update node) which will also disable versioning. In this case, you can re-enable versioning by adding back the &quot;cm:versionable&quot; aspect or using the version params (majorVersion and comment) on a subsequent file content update.

Parameters:

  • node_id

    The identifier of a node.

  • version_id

    The identifier of a version, ie. version label, within the version history of a node.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/alfresco_api/api/versions_api.rb', line 40

def delete_version_with_http_info(node_id, version_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: VersionsApi.delete_version ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling VersionsApi.delete_version"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VersionsApi.delete_version"
  end
  # resource path
  local_var_path = "/nodes/{nodeId}/versions/{versionId}".sub('{' + 'nodeId' + '}', node_id.to_s).sub('{' + 'versionId' + '}', version_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: VersionsApi#delete_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_version(node_id, version_id, opts = {}) ⇒ VersionEntry

Get version information Note: this endpoint is available in Alfresco 5.2 and newer versions. Gets the version information for versionId of file node nodeId.

Parameters:

  • node_id

    The identifier of a node.

  • version_id

    The identifier of a version, ie. version label, within the version history of a node.

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

    the optional parameters

Returns:



89
90
91
92
# File 'lib/alfresco_api/api/versions_api.rb', line 89

def get_version(node_id, version_id, opts = {})
  data, _status_code, _headers = get_version_with_http_info(node_id, version_id, opts)
  return data
end

#get_version_content(node_id, version_id, opts = {}) ⇒ nil

Get version content Note: this endpoint is available in Alfresco 5.2 and newer versions. Gets the version content for versionId of file node nodeId.

Parameters:

  • node_id

    The identifier of a node.

  • version_id

    The identifier of a version, ie. version label, within the version history of a node.

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

    the optional parameters

Options Hash (opts):

  • :attachment (BOOLEAN)

    true enables a web browser to download the file as an attachment. false means a web browser may preview the file in a new tab or window, but not download the file. You can only set this parameter to false if the content type of the file is in the supported list; for example, certain image files and PDF files. If the content type is not supported for preview, then a value of false is ignored, and the attachment will be returned in the response. (default to true)

  • :if_modified_since (DateTime)

    Only returns the content if it has been modified since the date provided. Use the date format defined by HTTP. For example, &#x60;Wed, 09 Mar 2016 16:56:34 GMT&#x60;.

Returns:

  • (nil)


152
153
154
155
# File 'lib/alfresco_api/api/versions_api.rb', line 152

def get_version_content(node_id, version_id, opts = {})
  get_version_content_with_http_info(node_id, version_id, opts)
  return nil
end

#get_version_content_with_http_info(node_id, version_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Get version content Note: this endpoint is available in Alfresco 5.2 and newer versions. Gets the version content for versionId of file node nodeId.

Parameters:

  • node_id

    The identifier of a node.

  • version_id

    The identifier of a version, ie. version label, within the version history of a node.

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

    the optional parameters

Options Hash (opts):

  • :attachment (BOOLEAN)

    true enables a web browser to download the file as an attachment. false means a web browser may preview the file in a new tab or window, but not download the file. You can only set this parameter to false if the content type of the file is in the supported list; for example, certain image files and PDF files. If the content type is not supported for preview, then a value of false is ignored, and the attachment will be returned in the response.

  • :if_modified_since (DateTime)

    Only returns the content if it has been modified since the date provided. Use the date format defined by HTTP. For example, &#x60;Wed, 09 Mar 2016 16:56:34 GMT&#x60;.

Returns:

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

    nil, response status code and response headers



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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/alfresco_api/api/versions_api.rb', line 165

def get_version_content_with_http_info(node_id, version_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: VersionsApi.get_version_content ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling VersionsApi.get_version_content"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VersionsApi.get_version_content"
  end
  # resource path
  local_var_path = "/nodes/{nodeId}/versions/{versionId}/content".sub('{' + 'nodeId' + '}', node_id.to_s).sub('{' + 'versionId' + '}', version_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'attachment'] = opts[:'attachment'] if !opts[:'attachment'].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'])
  header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?

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

#get_version_with_http_info(node_id, version_id, opts = {}) ⇒ Array<(VersionEntry, Fixnum, Hash)>

Get version information Note: this endpoint is available in Alfresco 5.2 and newer versions. Gets the version information for versionId of file node nodeId.

Parameters:

  • node_id

    The identifier of a node.

  • version_id

    The identifier of a version, ie. version label, within the version history of a node.

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

    the optional parameters

Returns:

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

    VersionEntry data, 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
# File 'lib/alfresco_api/api/versions_api.rb', line 100

def get_version_with_http_info(node_id, version_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: VersionsApi.get_version ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling VersionsApi.get_version"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VersionsApi.get_version"
  end
  # resource path
  local_var_path = "/nodes/{nodeId}/versions/{versionId}".sub('{' + 'nodeId' + '}', node_id.to_s).sub('{' + 'versionId' + '}', version_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(: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 => 'VersionEntry')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VersionsApi#get_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_version_history(node_id, opts = {}) ⇒ VersionPaging

List version history Note: this endpoint is available in Alfresco 5.2 and newer versions. Gets the version history as an ordered list of versions for the specified nodeId. The list is ordered in descending modified order. So the most recent version is first and the original version is last in the list.

Parameters:

  • node_id

    The identifier of a node.

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

    the optional parameters

Options Hash (opts):

  • :include (Array<String>)

    Returns additional information about the version node. The following optional fields can be requested: * properties * aspectNames

  • :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.

  • :skip_count (Integer)

    The number of entities that exist in the collection before those included in this list. If not supplied then the default value is 0. (default to 0)

  • :max_items (Integer)

    The maximum number of items to return in the list. If not supplied then the default value is 100. (default to 100)

Returns:



219
220
221
222
# File 'lib/alfresco_api/api/versions_api.rb', line 219

def list_version_history(node_id, opts = {})
  data, _status_code, _headers = list_version_history_with_http_info(node_id, opts)
  return data
end

#list_version_history_with_http_info(node_id, opts = {}) ⇒ Array<(VersionPaging, Fixnum, Hash)>

List version history Note: this endpoint is available in Alfresco 5.2 and newer versions. Gets the version history as an ordered list of versions for the specified nodeId. The list is ordered in descending modified order. So the most recent version is first and the original version is last in the list.

Parameters:

  • node_id

    The identifier of a node.

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

    the optional parameters

Options Hash (opts):

  • :include (Array<String>)

    Returns additional information about the version node. The following optional fields can be requested: * properties * aspectNames

  • :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.

  • :skip_count (Integer)

    The number of entities that exist in the collection before those included in this list. If not supplied then the default value is 0.

  • :max_items (Integer)

    The maximum number of items to return in the list. If not supplied then the default value is 100.

Returns:

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

    VersionPaging data, response status code and response headers



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/alfresco_api/api/versions_api.rb', line 233

def list_version_history_with_http_info(node_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: VersionsApi.list_version_history ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling VersionsApi.list_version_history"
  end
  if @api_client.config.client_side_validation && !opts[:'skip_count'].nil? && opts[:'skip_count'] < 0
    fail ArgumentError, 'invalid value for "opts[:"skip_count"]" when calling VersionsApi.list_version_history, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_items'].nil? && opts[:'max_items'] < 1
    fail ArgumentError, 'invalid value for "opts[:"max_items"]" when calling VersionsApi.list_version_history, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = "/nodes/{nodeId}/versions".sub('{' + 'nodeId' + '}', node_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'skipCount'] = opts[:'skip_count'] if !opts[:'skip_count'].nil?
  query_params[:'maxItems'] = opts[:'max_items'] if !opts[:'max_items'].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 => 'VersionPaging')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VersionsApi#list_version_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#revert_version(node_id, version_id, revert_body, opts = {}) ⇒ VersionEntry

Revert a version Note: this endpoint is available in Alfresco 5.2 and newer versions. Attempts to revert the version identified by versionId and nodeId to the live node. If the node is successfully reverted then the content and metadata for that versioned node will be promoted to the live node and a new version will appear in the version history.

Parameters:

  • node_id

    The identifier of a node.

  • version_id

    The identifier of a version, ie. version label, within the version history of a node.

  • revert_body

    Optionally, specify a version comment and whether this should be a major version, or not.

  • 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:



293
294
295
296
# File 'lib/alfresco_api/api/versions_api.rb', line 293

def revert_version(node_id, version_id, revert_body, opts = {})
  data, _status_code, _headers = revert_version_with_http_info(node_id, version_id, revert_body, opts)
  return data
end

#revert_version_with_http_info(node_id, version_id, revert_body, opts = {}) ⇒ Array<(VersionEntry, Fixnum, Hash)>

Revert a version Note: this endpoint is available in Alfresco 5.2 and newer versions. Attempts to revert the version identified by versionId and nodeId to the live node. If the node is successfully reverted then the content and metadata for that versioned node will be promoted to the live node and a new version will appear in the version history.

Parameters:

  • node_id

    The identifier of a node.

  • version_id

    The identifier of a version, ie. version label, within the version history of a node.

  • revert_body

    Optionally, specify a version comment and whether this should be a major version, or not.

  • 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<(VersionEntry, Fixnum, Hash)>)

    VersionEntry data, response status code and response headers



306
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
349
350
351
352
353
# File 'lib/alfresco_api/api/versions_api.rb', line 306

def revert_version_with_http_info(node_id, version_id, revert_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: VersionsApi.revert_version ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling VersionsApi.revert_version"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling VersionsApi.revert_version"
  end
  # verify the required parameter 'revert_body' is set
  if @api_client.config.client_side_validation && revert_body.nil?
    fail ArgumentError, "Missing the required parameter 'revert_body' when calling VersionsApi.revert_version"
  end
  # resource path
  local_var_path = "/nodes/{nodeId}/versions/{versionId}/revert".sub('{' + 'nodeId' + '}', node_id.to_s).sub('{' + 'versionId' + '}', version_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 = @api_client.object_to_http_body(revert_body)
  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 => 'VersionEntry')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VersionsApi#revert_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end