Module: Octokit::Client::Reactions

Included in:
Octokit::Client
Defined in:
lib/octokit/client/reactions.rb

Overview

Methods for the Reacions API

Instance Method Summary collapse

Instance Method Details

#commit_comment_reactions(repo, id, options = {}) ⇒ Array<Sawyer::Resource>

List reactions for a commit comment

Examples:

@client.commit_comment_reactions("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • id (Integer)

    The id of the commit comment

Returns:

  • (Array<Sawyer::Resource>)

    Array of Hashes representing the reactions.

See Also:



19
20
21
# File 'lib/octokit/client/reactions.rb', line 19

def commit_comment_reactions(repo, id, options = {})
  get "#{Repository.path repo}/comments/#{id}/reactions", options
end

#create_commit_comment_reaction(repo, id, reaction, options = {}) ⇒ <Sawyer::Resource>

Create a reaction for a commit comment

Examples:

@client.create_commit_comment_reactions("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • id (Integer)

    The id of the commit comment

  • reaction (String)

    The Reaction

Returns:

  • (<Sawyer::Resource>)

    Hash representing the reaction

See Also:



35
36
37
38
# File 'lib/octokit/client/reactions.rb', line 35

def create_commit_comment_reaction(repo, id, reaction, options = {})
  options = options.merge(content: reaction)
  post "#{Repository.path repo}/comments/#{id}/reactions", options
end

#create_issue_comment_reaction(repo, id, reaction, options = {}) ⇒ <Sawyer::Resource>

Create reaction for an issue comment

Examples:

@client.create_issue_comment_reaction("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • id (Integer)

    The Issue comment id

  • reaction (String)

    The Reaction

Returns:

  • (<Sawyer::Resource>)

    Hashes representing the reaction.

See Also:



100
101
102
103
# File 'lib/octokit/client/reactions.rb', line 100

def create_issue_comment_reaction(repo, id, reaction, options = {})
  options = options.merge(content: reaction)
  post "#{Repository.path repo}/issues/comments/#{id}/reactions", options
end

#create_issue_reaction(repo, number, reaction, options = {}) ⇒ <Sawyer::Resource>

Create reaction for an issue

Examples:

@client.create_issue_reaction("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • number (Integer)

    The Issue number

  • reaction (String)

    The Reaction

Returns:

  • (<Sawyer::Resource>)

    Hash representing the reaction.

See Also:



67
68
69
70
# File 'lib/octokit/client/reactions.rb', line 67

def create_issue_reaction(repo, number, reaction, options = {})
  options = options.merge(content: reaction)
  post "#{Repository.path repo}/issues/#{number}/reactions", options
end

#create_pull_request_review_comment_reaction(repo, id, reaction, options = {}) ⇒ <Sawyer::Resource>

Create reaction for a pull request review comment

Examples:

@client.create_pull_request_reiew_comment_reaction("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • id (Integer)

    The Issue comment id

  • reaction (String)

    The Reaction

Returns:

  • (<Sawyer::Resource>)

    Hash representing the reaction.

See Also:



133
134
135
136
# File 'lib/octokit/client/reactions.rb', line 133

def create_pull_request_review_comment_reaction(repo, id, reaction, options = {})
  options = options.merge(content: reaction)
  post "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
end

#create_release_reaction(repo, release_id, reaction, options = {}) ⇒ <Sawyer::Resource>

Create reaction for a release

Examples:

@client.create_release_reaction("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • id (Integer)

    The Release id

  • reaction (String)

    The Reaction

Returns:

  • (<Sawyer::Resource>)

    Hash representing the reaction.

See Also:



182
183
184
185
# File 'lib/octokit/client/reactions.rb', line 182

def create_release_reaction(repo, release_id, reaction, options = {})
  options = options.merge(content: reaction)
  post "#{Repository.path repo}/releases/#{release_id}/reactions", options
end

#delete_issue_reaction(repo, issue_id, reaction_id, options = {}) ⇒ Boolean

Delete a reaction

Examples:

@client.delete_issue_reaction("octokit/octokit.rb", 1, 2)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • issue_id (Integer)

    The Issue comment id

  • reaction_id (Integer)

    The Reaction id

Returns:

  • (Boolean)

    Return true if reaction was deleted, false otherwise.

See Also:



150
151
152
# File 'lib/octokit/client/reactions.rb', line 150

def delete_issue_reaction(repo, issue_id, reaction_id, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/issues/#{issue_id}/reactions/#{reaction_id}", options
end

#delete_release_reaction(repo, release_id, reaction_id, options = {}) ⇒ Boolean

Delete a reaction for a release

Examples:

@client.delete_release_reaction("octokit/octokit.rb", 1, 2)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • issue_id (Integer)

    The Release id

  • reaction_id (Integer)

    The Reaction id

Returns:

  • (Boolean)

    Return true if reaction was deleted, false otherwise.

See Also:



199
200
201
# File 'lib/octokit/client/reactions.rb', line 199

def delete_release_reaction(repo, release_id, reaction_id, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/releases/#{release_id}/reactions/#{reaction_id}", options
end

#issue_comment_reactions(repo, id, options = {}) ⇒ Array<Sawyer::Resource>

List reactions for an issue comment

Examples:

@client.issue_comment_reactions("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • id (Integer)

    The Issue comment id

Returns:

  • (Array<Sawyer::Resource>)

    Array of Hashes representing the reactions.

See Also:



83
84
85
# File 'lib/octokit/client/reactions.rb', line 83

def issue_comment_reactions(repo, id, options = {})
  get "#{Repository.path repo}/issues/comments/#{id}/reactions", options
end

#issue_reactions(repo, number, options = {}) ⇒ Array<Sawyer::Resource>

List reactions for an issue

Examples:

@client.issue_reactions("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • number (Integer)

    The Issue number

Returns:

  • (Array<Sawyer::Resource>)

    Array of Hashes representing the reactions.

See Also:



50
51
52
# File 'lib/octokit/client/reactions.rb', line 50

def issue_reactions(repo, number, options = {})
  get "#{Repository.path repo}/issues/#{number}/reactions", options
end

#pull_request_review_comment_reactions(repo, id, options = {}) ⇒ Array<Sawyer::Resource>

List reactions for a pull request review comment

Examples:

@client.pull_request_review_comment_reactions("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • id (Integer)

    The Issue comment id

Returns:

  • (Array<Sawyer::Resource>)

    Array of Hashes representing the reactions.

See Also:



116
117
118
# File 'lib/octokit/client/reactions.rb', line 116

def pull_request_review_comment_reactions(repo, id, options = {})
  get "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
end

#release_reactions(repo, release_id, options = {}) ⇒ Array<Sawyer::Resource>

List reactions for a release

Examples:

@client.release_reactions("octokit/octokit.rb", 1)

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • id (Integer)

    The Release id

Returns:

  • (Array<Sawyer::Resource>)

    Array of Hashes representing the reactions.

See Also:



165
166
167
# File 'lib/octokit/client/reactions.rb', line 165

def release_reactions(repo, release_id, options = {})
  get "#{Repository.path repo}/releases/#{release_id}/reactions", options
end