Class: SlackWebApi::StarsController
- Inherits:
-
BaseController
- Object
- BaseController
- SlackWebApi::StarsController
- Defined in:
- lib/slack_web_api/controllers/stars_controller.rb
Overview
StarsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#stars_add(token, channel: nil, file: nil, file_comment: nil, timestamp: nil) ⇒ ApiResponse
Adds a star to an item.
-
#stars_list(token: nil, count: nil, page: nil, cursor: nil, limit: nil) ⇒ ApiResponse
Lists stars for a user.
-
#stars_remove(token, channel: nil, file: nil, file_comment: nil, timestamp: nil) ⇒ ApiResponse
Removes a star from an item.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from SlackWebApi::BaseController
Instance Method Details
#stars_add(token, channel: nil, file: nil, file_comment: nil, timestamp: nil) ⇒ ApiResponse
Adds a star to an item. scope: stars:write channel where the message to add star to was posted (used with timestamp). to. add star to.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/slack_web_api/controllers/stars_controller.rb', line 21 def stars_add(token, channel: nil, file: nil, file_comment: nil, timestamp: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/stars.add', Server::DEFAULT) .header_param(new_parameter(token, key: 'token') .is_required(true)) .form_param(new_parameter(channel, key: 'channel')) .form_param(new_parameter(file, key: 'file')) .form_param(new_parameter(file_comment, key: 'file_comment')) .form_param(new_parameter(, key: 'timestamp')) .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('slackAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StarsAddSchema.method(:from_hash)) .is_api_response(true) .local_error('default', 'Typical error response', StarsAddErrorSchemaException)) .execute end |
#stars_list(token: nil, count: nil, page: nil, cursor: nil, limit: nil) ⇒ ApiResponse
Lists stars for a user. scope: stars:read cursor equal to the next_cursor attribute returned by the previous request’s response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first “page” of the collection. See [pagination](/docs/pagination) for more details. return. Fewer than the requested number of items may be returned, even if the end of the list hasn’t been reached.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/slack_web_api/controllers/stars_controller.rb', line 63 def stars_list(token: nil, count: nil, page: nil, cursor: nil, limit: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stars.list', Server::DEFAULT) .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type')) .query_param(new_parameter(token, key: 'token')) .query_param(new_parameter(count, key: 'count')) .query_param(new_parameter(page, key: 'page')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(limit, key: 'limit')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('slackAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StarsListSchema.method(:from_hash)) .is_api_response(true) .local_error('default', 'Typical error response', StarsListErrorSchemaException)) .execute end |
#stars_remove(token, channel: nil, file: nil, file_comment: nil, timestamp: nil) ⇒ ApiResponse
Removes a star from an item. scope: stars:write or channel where the message to remove star from was posted (used with timestamp). star from. remove star from.
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 |
# File 'lib/slack_web_api/controllers/stars_controller.rb', line 102 def stars_remove(token, channel: nil, file: nil, file_comment: nil, timestamp: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/stars.remove', Server::DEFAULT) .header_param(new_parameter(token, key: 'token') .is_required(true)) .form_param(new_parameter(channel, key: 'channel')) .form_param(new_parameter(file, key: 'file')) .form_param(new_parameter(file_comment, key: 'file_comment')) .form_param(new_parameter(, key: 'timestamp')) .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('slackAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StarsRemoveSchema.method(:from_hash)) .is_api_response(true) .local_error('default', 'Typical error response', StarsRemoveErrorSchemaException)) .execute end |