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
22
# File 'lib/octokit/client/reactions.rb', line 19

def commit_comment_reactions(repo, id, options = {})
  options = ensure_api_media_type(:reactions, 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:



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

def create_commit_comment_reaction(repo, id, reaction, options = {})
  options = ensure_api_media_type(:reactions, 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:



103
104
105
106
# File 'lib/octokit/client/reactions.rb', line 103

def create_issue_comment_reaction(repo, id, reaction, options = {})
  options = ensure_api_media_type(:reactions, 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:



69
70
71
72
# File 'lib/octokit/client/reactions.rb', line 69

def create_issue_reaction(repo, number, reaction, options = {})
  options = ensure_api_media_type(:reactions, 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:



137
138
139
140
# File 'lib/octokit/client/reactions.rb', line 137

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

#delete_reaction(id, options = {}) ⇒ Boolean

Delete a reaction

Examples:

@client.delete_reaction(1)

Parameters:

  • id (Integer)

    Reaction id

Returns:

  • (Boolean)

    Return true if reaction was deleted, false otherwise.

See Also:



152
153
154
155
# File 'lib/octokit/client/reactions.rb', line 152

def delete_reaction(id, options = {})
  options = ensure_api_media_type(:reactions, options)
  boolean_from_response :delete, "reactions/#{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:



85
86
87
88
# File 'lib/octokit/client/reactions.rb', line 85

def issue_comment_reactions(repo, id, options = {})
  options = ensure_api_media_type(:reactions, 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:



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

def issue_reactions(repo, number, options = {})
  options = ensure_api_media_type(:reactions, 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:



119
120
121
122
# File 'lib/octokit/client/reactions.rb', line 119

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