Module: Octokit::Client::Apps

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

Overview

Methods for the Apps API

Instance Method Summary collapse

Instance Method Details

#add_repository_to_app_installation(installation, repo, options = {}) ⇒ Boolean Also known as: add_repo_to_installation

Add a single repository to an installation

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

  • repo (Integer)

    The id of the GitHub repository

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

    A customizable set of options

Returns:

  • (Boolean)

    Success

See Also:


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

def add_repository_to_app_installation(installation, repo, options = {})
  opts = ensure_api_media_type(:integrations, options)
  boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", opts
end

#add_repository_to_integration_installation(installation, repo, options = {}) ⇒ Object


171
172
173
174
175
176
177
178
179
# File 'lib/octokit/client/apps.rb', line 171

def add_repository_to_integration_installation(installation, repo, options = {})
  octokit_warn(
    "Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation "\
    "method is deprecated. Please update your call to use "\
    "Octokit::Client::Apps#add_repository_to_app_installation before the next major "\
    "Octokit version update."
  )
  add_repository_to_app_installation(installation, repo, options)
end

#app(options = {}) ⇒ Sawyer::Resource

Get the authenticated App

Parameters:

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

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    App information

See Also:


14
15
16
17
# File 'lib/octokit/client/apps.rb', line 14

def app(options = {})
  opts = ensure_api_media_type(:integrations, options)
  get "app", opts
end

#create_app_installation_access_token(installation, options = {}) ⇒ <Sawyer::Resource> Also known as: create_installation_access_token

Create a new installation token

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

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

    A customizable set of options

Returns:

  • (<Sawyer::Resource>)

    An installation token

See Also:


76
77
78
79
# File 'lib/octokit/client/apps.rb', line 76

def create_app_installation_access_token(installation, options = {})
  opts = ensure_api_media_type(:integrations, options)
  post "app/installations/#{installation}/access_tokens", opts
end

#create_integration_installation_access_token(installation, options = {}) ⇒ Object


82
83
84
85
86
87
88
89
90
# File 'lib/octokit/client/apps.rb', line 82

def create_integration_installation_access_token(installation, options = {})
  octokit_warn(
    "Deprecated: Octokit::Client::Apps#create_integration_installation_access_token "\
    "method is deprecated. Please update your call to use "\
    "Octokit::Client::Apps#create_app_installation_access_token before the next major "\
    "Octokit version update."
  )
  create_app_installation_access_token(installation, options)
end

#delete_installation(installation, options = {}) ⇒ Boolean

Delete an installation and uninstall a GitHub App

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

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

    A customizable set of options

Returns:

  • (Boolean)

    Success

See Also:


229
230
231
232
# File 'lib/octokit/client/apps.rb', line 229

def delete_installation(installation, options = {})
  opts = ensure_api_media_type(:uninstall_github_app, options)
  boolean_from_response :delete, "app/installations/#{installation}", opts
end

#find_app_installations(options = {}) ⇒ Array<Sawyer::Resource> Also known as: find_installations

Find all installations that belong to an App

Parameters:

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

    A customizable set of options

Returns:

  • (Array<Sawyer::Resource>)

    the total_count and an array of installations

See Also:


26
27
28
29
# File 'lib/octokit/client/apps.rb', line 26

def find_app_installations(options = {})
  opts = ensure_api_media_type(:integrations, options)
  paginate "app/installations", opts
end

#find_installation_repositories_for_user(installation, options = {}) ⇒ Sawyer::Resource

List repositories accessible to the user for an installation

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

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

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    the total_count and an array of repositories

See Also:


214
215
216
217
218
219
# File 'lib/octokit/client/apps.rb', line 214

def find_installation_repositories_for_user(installation, options = {})
  opts = ensure_api_media_type(:integrations, options)
  paginate("user/installations/#{installation}/repositories", opts) do |data, last_response|
    data.repositories.concat last_response.data.repositories
  end
end

#find_integration_installations(options = {}) ⇒ Object


32
33
34
35
36
37
38
39
40
# File 'lib/octokit/client/apps.rb', line 32

def find_integration_installations(options = {})
  octokit_warn(
    "Deprecated: Octokit::Client::Apps#find_integration_installations "\
    "method is deprecated. Please update your call to use "\
    "Octokit::Client::Apps#find_app_installations before the next major "\
    "Octokit version update."
  )
  find_app_installations(options)
end

#find_organization_installation(organization, options = {}) ⇒ Sawyer::Resource

Enables an app to find the organization's installation information.

Parameters:

  • organization (String)

    Organization GitHub login

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

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    Installation information

See Also:


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

def find_organization_installation(organization, options = {})
  opts = ensure_api_media_type(:integrations, options)
  get "#{Organization.path(organization)}/installation", opts
end

#find_repository_installation(repo, options = {}) ⇒ Sawyer::Resource

Enables an app to find the repository's installation information.

Parameters:

  • repo (String)

    A GitHub repository

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

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    Installation information

See Also:


113
114
115
116
# File 'lib/octokit/client/apps.rb', line 113

def find_repository_installation(repo, options = {})
  opts = ensure_api_media_type(:integrations, options)
  get "#{Repository.path(repo)}/installation", opts
end

#find_user_installation(user, options = {}) ⇒ Sawyer::Resource

Enables an app to find the user's installation information.

Parameters:

  • user (String)

    GitHub user login

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

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    Installation information

See Also:


126
127
128
129
# File 'lib/octokit/client/apps.rb', line 126

def find_user_installation(user, options = {})
  opts = ensure_api_media_type(:integrations, options)
  get "#{User.path(user)}/installation", opts
end

#find_user_installations(options = {}) ⇒ Sawyer::Resource

Find all installations that are accessible to the authenticated user

Parameters:

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

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    the total_count and an array of installations

See Also:


49
50
51
52
53
54
# File 'lib/octokit/client/apps.rb', line 49

def find_user_installations(options = {})
  opts = ensure_api_media_type(:integrations, options)
  paginate("user/installations", opts) do |data, last_response|
    data.installations.concat last_response.data.installations
  end
end

#installation(id, options = {}) ⇒ Sawyer::Resource

Get a single installation

Parameters:

  • id (Integer)

    Installation id

Returns:

  • (Sawyer::Resource)

    Installation information

See Also:


63
64
65
66
# File 'lib/octokit/client/apps.rb', line 63

def installation(id, options = {})
  opts = ensure_api_media_type(:integrations, options)
  get "app/installations/#{id}", opts
end

#list_app_installation_repositories(options = {}) ⇒ Sawyer::Resource Also known as: list_installation_repos

List repositories that are accessible to the authenticated installation

Parameters:

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

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    the total_count and an array of repositories

See Also:


138
139
140
141
142
143
# File 'lib/octokit/client/apps.rb', line 138

def list_app_installation_repositories(options = {})
  opts = ensure_api_media_type(:integrations, options)
  paginate("installation/repositories", opts) do |data, last_response|
    data.repositories.concat last_response.data.repositories
  end
end

#list_integration_installation_repositories(options = {}) ⇒ Object


146
147
148
149
150
151
152
153
154
# File 'lib/octokit/client/apps.rb', line 146

def list_integration_installation_repositories(options = {})
  octokit_warn(
    "Deprecated: Octokit::Client::Apps#list_integration_installation_repositories "\
    "method is deprecated. Please update your call to use "\
    "Octokit::Client::Apps#list_app_installation_repositories before the next major "\
    "Octokit version update."
  )
  list_app_installation_repositories(options)
end

#remove_repository_from_app_installation(installation, repo, options = {}) ⇒ Boolean Also known as: remove_repo_from_installation

Remove a single repository to an installation

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

  • repo (Integer)

    The id of the GitHub repository

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

    A customizable set of options

Returns:

  • (Boolean)

    Success

See Also:


190
191
192
193
# File 'lib/octokit/client/apps.rb', line 190

def remove_repository_from_app_installation(installation, repo, options = {})
  opts = ensure_api_media_type(:integrations, options)
  boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", opts
end

#remove_repository_from_integration_installation(installation, repo, options = {}) ⇒ Object


196
197
198
199
200
201
202
203
204
# File 'lib/octokit/client/apps.rb', line 196

def remove_repository_from_integration_installation(installation, repo, options = {})
  octokit_warn(
    "Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation "\
    "method is deprecated. Please update your call to use "\
    "Octokit::Client::Apps#remove_repository_from_app_installation before the next major "\
    "Octokit version update."
  )
  remove_repository_from_app_installation(installation, repo, options)
end