class AlfrescoAPI::CommentsApi
Attributes
Public Class Methods
# File lib/alfresco_api/api/comments_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create a comment Creates a comment on node nodeId. You specify the comment in a JSON body like this: “`JSON { "content": "This is a comment" } “` Note: You can create more than one comment by specifying a list of comments in the JSON body like this: “`JSON [ { "content": "This is a comment" }, { "content": "This is another comment" } ] “` If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: “`JSON { "list": { "pagination": { "count": 2, "hasMoreItems": false, "totalItems": 2, "skipCount": 0, "maxItems": 100 }, "entries": [ { "entry": { … } }, { "entry": { … } } ] } } “` @param node_id The identifier of a node. @param comment_body_create The comment text. Note that you can also provide a list of comments. @param [Hash] opts the optional parameters @option opts [Array<String>] :fields 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. @return [CommentEntry]
# File lib/alfresco_api/api/comments_api.rb, line 30 def create_comment(node_id, comment_body_create, opts = {}) data, _status_code, _headers = create_comment_with_http_info(node_id, comment_body_create, opts) return data end
Create a comment Creates a comment on node nodeId. You specify the comment in a JSON body like this: ```JSON { "content": "This is a comment" } ``` Note: You can create more than one comment by specifying a list of comments in the JSON body like this: ```JSON [ { "content": "This is a comment" }, { "content": "This is another comment" } ] ``` If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: ```JSON { "list": { "pagination": { "count": 2, "hasMoreItems": false, "totalItems": 2, "skipCount": 0, "maxItems": 100 }, "entries": [ { "entry": { … } }, { "entry": { … } } ] } } ``` @param node_id The identifier of a node. @param comment_body_create The comment text. Note that you can also provide a list of comments. @param [Hash] opts the optional parameters @option opts [Array<String>] :fields 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. @return [Array<(CommentEntry
, Fixnum, Hash)>] CommentEntry
data, response status code and response headers
# File lib/alfresco_api/api/comments_api.rb, line 42 def create_comment_with_http_info(node_id, comment_body_create, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CommentsApi.create_comment ..." 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 CommentsApi.create_comment" end # verify the required parameter 'comment_body_create' is set if @api_client.config.client_side_validation && comment_body_create.nil? fail ArgumentError, "Missing the required parameter 'comment_body_create' when calling CommentsApi.create_comment" end # resource path local_var_path = "/nodes/{nodeId}/comments".sub('{' + 'nodeId' + '}', node_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(comment_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 => 'CommentEntry') if @api_client.config.debugging @api_client.config.logger.debug "API called: CommentsApi#create_comment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete a comment Deletes the comment commentId from node nodeId. @param node_id The identifier of a node. @param comment_id The identifier of a comment. @param [Hash] opts the optional parameters @return [nil]
# File lib/alfresco_api/api/comments_api.rb, line 93 def delete_comment(node_id, comment_id, opts = {}) delete_comment_with_http_info(node_id, comment_id, opts) return nil end
Delete a comment Deletes the comment commentId from node nodeId. @param node_id The identifier of a node. @param comment_id The identifier of a comment. @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/alfresco_api/api/comments_api.rb, line 104 def delete_comment_with_http_info(node_id, comment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CommentsApi.delete_comment ..." 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 CommentsApi.delete_comment" end # verify the required parameter 'comment_id' is set if @api_client.config.client_side_validation && comment_id.nil? fail ArgumentError, "Missing the required parameter 'comment_id' when calling CommentsApi.delete_comment" end # resource path local_var_path = "/nodes/{nodeId}/comments/{commentId}".sub('{' + 'nodeId' + '}', node_id.to_s).sub('{' + 'commentId' + '}', comment_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: CommentsApi#delete_comment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List comments Gets a list of comments for the node nodeId, sorted chronologically with the newest comment first. @param node_id The identifier of a node. @param [Hash] opts the optional parameters @option opts [Integer] :skip_count 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) @option opts [Integer] :max_items The maximum number of items to return in the list. If not supplied then the default value is 100. (default to 100) @option opts [Array<String>] :fields 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. @return [CommentPaging]
# File lib/alfresco_api/api/comments_api.rb, line 155 def list_comments(node_id, opts = {}) data, _status_code, _headers = list_comments_with_http_info(node_id, opts) return data end
List comments Gets a list of comments for the node nodeId, sorted chronologically with the newest comment first. @param node_id The identifier of a node. @param [Hash] opts the optional parameters @option opts [Integer] :skip_count The number of entities that exist in the collection before those included in this list. If not supplied then the default value is 0. @option opts [Integer] :max_items The maximum number of items to return in the list. If not supplied then the default value is 100. @option opts [Array<String>] :fields 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. @return [Array<(CommentPaging
, Fixnum, Hash)>] CommentPaging
data, response status code and response headers
# File lib/alfresco_api/api/comments_api.rb, line 168 def list_comments_with_http_info(node_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CommentsApi.list_comments ..." 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 CommentsApi.list_comments" 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 CommentsApi.list_comments, 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 CommentsApi.list_comments, must be greater than or equal to 1.' end # resource path local_var_path = "/nodes/{nodeId}/comments".sub('{' + 'nodeId' + '}', node_id.to_s) # query parameters query_params = {} query_params[:'skipCount'] = opts[:'skip_count'] if !opts[:'skip_count'].nil? query_params[:'maxItems'] = opts[:'max_items'] if !opts[:'max_items'].nil? 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 => 'CommentPaging') if @api_client.config.debugging @api_client.config.logger.debug "API called: CommentsApi#list_comments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update a comment Updates an existing comment commentId on node nodeId. @param node_id The identifier of a node. @param comment_id The identifier of a comment. @param comment_body_update The JSON representing the comment to be updated. @param [Hash] opts the optional parameters @option opts [Array<String>] :fields 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. @return [CommentEntry]
# File lib/alfresco_api/api/comments_api.rb, line 227 def update_comment(node_id, comment_id, comment_body_update, opts = {}) data, _status_code, _headers = update_comment_with_http_info(node_id, comment_id, comment_body_update, opts) return data end
Update a comment Updates an existing comment commentId on node nodeId. @param node_id The identifier of a node. @param comment_id The identifier of a comment. @param comment_body_update The JSON representing the comment to be updated. @param [Hash] opts the optional parameters @option opts [Array<String>] :fields 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. @return [Array<(CommentEntry
, Fixnum, Hash)>] CommentEntry
data, response status code and response headers
# File lib/alfresco_api/api/comments_api.rb, line 240 def update_comment_with_http_info(node_id, comment_id, comment_body_update, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CommentsApi.update_comment ..." 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 CommentsApi.update_comment" end # verify the required parameter 'comment_id' is set if @api_client.config.client_side_validation && comment_id.nil? fail ArgumentError, "Missing the required parameter 'comment_id' when calling CommentsApi.update_comment" end # verify the required parameter 'comment_body_update' is set if @api_client.config.client_side_validation && comment_body_update.nil? fail ArgumentError, "Missing the required parameter 'comment_body_update' when calling CommentsApi.update_comment" end # resource path local_var_path = "/nodes/{nodeId}/comments/{commentId}".sub('{' + 'nodeId' + '}', node_id.to_s).sub('{' + 'commentId' + '}', comment_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(comment_body_update) auth_names = ['basicAuth'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CommentEntry') if @api_client.config.debugging @api_client.config.logger.debug "API called: CommentsApi#update_comment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end