### Start a source import example Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/SourceImport%3Astart_source_import Usage example for initiating a source import with repository details and authentication credentials. ```ruby @client.start_source_import("octokit/octokit.rb", "http://svn.mycompany.com/svn/myproject", { :vcs => "subversion", :vcs_username" => "octocat", :vcs_password => "secret" }) ``` -------------------------------- ### GET /setup/api/settings Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Asettings Retrieves information about the Enterprise installation settings. ```APIDOC ## GET /setup/api/settings ### Description Get information about the Enterprise installation settings. Note: This API will be deprecated in GitHub Enterprise Server 3.15.0. ### Method GET ### Endpoint /setup/api/settings ### Response #### Success Response (200) - **settings** (Sawyer::Resource) - The settings for the Enterprise installation #### Response Example { "settings": { ... } } ``` -------------------------------- ### POST /manage/v1/config/apply Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient Starts the configuration process for the Enterprise installation. ```APIDOC ## POST /manage/v1/config/apply ### Description Start a configuration process. ### Method POST ### Endpoint /manage/v1/config/apply ``` -------------------------------- ### POST /setup/api/configure - Start Configuration Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole Initiates the configuration process for a new Enterprise installation. ```APIDOC ## POST /setup/api/configure ### Description Starts a configuration process. ### Method POST ### Endpoint /setup/api/configure ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **nil** - Indicates the configuration process has started. #### Response Example ```json null ``` ``` -------------------------------- ### GET /installation/repositories Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps Lists repositories that are accessible to the authenticated installation. ```APIDOC ## GET /installation/repositories ### Description Lists repositories that are accessible to the authenticated installation. ### Method GET ### Endpoint `/installation/repositories` ### Parameters #### Query Parameters - **options** (Hash) - Optional - A customizable set of options for pagination and filtering. ### Response #### Success Response (200) - **Sawyer::Resource** - Contains `total_count` and an array of `repositories`. ``` -------------------------------- ### GET /app/installations Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps Lists all installations that belong to an App. ```APIDOC ## GET /app/installations ### Description Lists all installations that belong to an App. ### Method GET ### Endpoint `/app/installations` ### Parameters #### Query Parameters - **options** (Hash) - Optional - A customizable set of options for pagination and filtering. ### Response #### Success Response (200) - **Array** - Contains `total_count` and an array of installations. ``` -------------------------------- ### GET /user/installations Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Alist_user_installations Lists all installations that are accessible to the authenticated user. This method is useful for understanding which applications the user has installed and can grant access to. ```APIDOC ## GET /user/installations ### Description List all installations that are accessible to the authenticated user. ### Method GET ### Endpoint /user/installations ### Parameters #### Query Parameters - **options** (Hash) - Optional - A customizable set of options for the request. This can include pagination parameters. ### Request Example ```ruby Octokit.list_user_installations # or with options Octokit.list_user_installations(per_page: 100) ``` ### Response #### Success Response (200) - **total_count** (Integer) - The total number of installations. - **installations** (Array) - An array of installation objects. #### Response Example ```json { "total_count": 2, "installations": [ { "id": 123, "account": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/icons/icon-demo.svg", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "repository_selection": "all", "access_tokens_url": "https://api.github.com/installations/123/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", "html_url": "https://github.com/settings/installations/123", "app_id": 456, "target_type": "user" } ] } ``` ### See Also - https://docs.github.com/en/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token ``` -------------------------------- ### GET /repos/:repo/installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Afind_repository_installation Enables an app to find the repository’s installation information. ```APIDOC ## GET /repos/:repo/installation ### Description Enables an app to find the repository’s installation information. ### Method GET ### Endpoint /repos/:repo/installation ### Parameters #### Path Parameters - **repo** (String) - Required - A GitHub repository #### Query Parameters - **options** (Hash) - Optional - A customizable set of options ### Response #### Success Response (200) - **Sawyer::Resource** - Installation information ``` -------------------------------- ### GET /user/installations/:installation/repositories Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Afind_installation_repositories_for_user Lists repositories accessible to the user for a given GitHub App installation. This method is paginated. ```APIDOC ## GET /user/installations/:installation/repositories ### Description List repositories accessible to the user for an installation. ### Method GET ### Endpoint /user/installations/:installation/repositories ### Parameters #### Path Parameters - **installation** (Integer) - Required - The id of a GitHub App Installation #### Query Parameters - **options** (Hash) - Optional - A customizable set of options ### Response #### Success Response (200) - **total_count** (Integer) - The total number of repositories. - **repositories** (Array of Sawyer::Resource) - An array of repository objects. ### Request Example ```ruby # Assuming 'client' is an authenticated Octokit client instance installation_id = 12345 repositories = client.find_installation_repositories_for_user(installation_id) ``` ### Response Example ```json { "total_count": 2, "repositories": [ { "id": 123456789, "name": "my-repo", "full_name": "owner/my-repo", "private": false, "html_url": "https://github.com/owner/my-repo" // ... other repository details } ] } ``` ``` -------------------------------- ### GET /settings Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient%3Asettings Retrieves information about the current GitHub Enterprise installation settings. ```APIDOC ## GET /settings ### Description Retrieves configuration information about the GitHub Enterprise installation. ### Method GET ### Endpoint /settings ### Response #### Success Response (200) - **nil** - Returns information about the Enterprise installation. ``` -------------------------------- ### Get Single App Installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps Retrieves detailed information for a single GitHub App installation. Requires the installation ID. ```ruby def installation(id, options = {}) get "#{id}", options end ``` -------------------------------- ### GET /manage/v1/config/settings Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient Retrieves information about the Enterprise installation. ```APIDOC ## GET /manage/v1/config/settings ### Description Get information about the Enterprise installation. ### Method GET ### Endpoint /manage/v1/config/settings ``` -------------------------------- ### GET /:user/installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Afind_user_installation Retrieves the installation information for a given GitHub user associated with an app. ```APIDOC ## GET /:user/installation ### Description Enables an app to find the user’s installation information. ### Method GET ### Endpoint /:user/installation ### Parameters #### Path Parameters - **user** (String) - Required - GitHub user login #### Query Parameters - **options** (Hash) - Optional - A customizable set of options ### Response #### Success Response (200) - **Sawyer::Resource** - Installation information ### Request Example ```json { "user": "octocat", "options": {} } ``` ### Response Example ```json { "installation_id": 12345, "account": { "login": "octocat", "id": 123456, "node_id": "MDQ6VXNlcjEyMzQ1Ng==", "avatar_url": "https://avatars.githubusercontent.com/u/123456?v=4", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "repository_selection": "all", "access_to_all_repositories": true, "permissions": { "contents": "read", "metadata": "read", "single_file": "read" }, "repository_url": "https://api.github.com/repositories/123456789/installation", "html_url": "https://github.com/settings/installations/12345", "events_url": "https://api.github.com/repositories/123456789/installation/events", "account_url": "https://api.github.com/user/installations/12345" } ``` ``` -------------------------------- ### GET /user/installations Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Alist_user_installations Lists the GitHub App installations for the authenticated user. ```APIDOC ## GET /user/installations ### Description Lists the GitHub App installations for the authenticated user. ### Method GET ### Endpoint /user/installations ``` -------------------------------- ### GET /setup/api/configcheck Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Aconfig_status Retrieves the configuration status of the GitHub Enterprise installation. ```APIDOC ## GET /setup/api/configcheck ### Description Get information about the Enterprise installation. Note: This API will be deprecated in GitHub Enterprise Server 3.15.0. ### Method GET ### Endpoint /setup/api/configcheck ### Response #### Success Response (200) - **Sawyer::Resource** - The installation information ``` -------------------------------- ### GET /app/installations/:id Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Ainstallation Retrieves a single installation for the authenticated app. ```APIDOC ## GET /app/installations/:id ### Description Get a single installation for the authenticated app. ### Method GET ### Endpoint `/app/installations/:id` ### Parameters #### Path Parameters - **id** (Integer) - Required - Installation id ### Response #### Success Response (200) - **Sawyer::Resource** - Installation information ### Request Example ```json { "example": "No request body example provided" } ``` ### Response Example ```json { "example": "No response body example provided" } ``` ``` -------------------------------- ### GET /{organization}/installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps Enables an app to find the organization’s installation information. ```APIDOC ## GET /{organization}/installation ### Description Enables an app to find the organization’s installation information. ### Method GET ### Endpoint `/{organization}/installation` ### Parameters #### Path Parameters - **organization** (string) - Required - Organization GitHub login. #### Request Body - **options** (object) - Optional - A customizable set of options. ### Response #### Success Response (200) - **id** (integer) - The installation ID. - **account** (object) - Information about the account. #### Response Example ```json { "id": 1, "account": { "login": "github", "id": 1, "type": "Organization" } } ``` ``` -------------------------------- ### List App Installations - Ruby Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Alist_app_installations Use this method to list all installations that belong to an App. It accepts a customizable set of options and returns an array of Sawyer::Resource objects representing the installations. ```ruby def list_app_installations(options = {}) paginate 'app/installations', options end ``` -------------------------------- ### POST /app/installations/:installation/access_tokens Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Acreate_app_installation_access_token Creates a new installation token for a GitHub App. This token can be used to authenticate as the installation. ```APIDOC ## POST /app/installations/:installation/access_tokens ### Description Creates a new installation token for a GitHub App. This token can be used to authenticate as the installation. ### Method POST ### Endpoint /app/installations/:installation/access_tokens ### Parameters #### Path Parameters - **installation** (Integer) - Required - The id of a GitHub App Installation #### Query Parameters None #### Request Body - **options** (Hash) - Optional - A customizable set of options ### Request Example ```json { "installation": 12345, "options": { "repositories": ["octocat/Hello-World"] } } ``` ### Response #### Success Response (200) - **token** (String) - The generated installation access token. - **expires_at** (String) - The expiration date and time of the token. #### Response Example ```json { "token": "gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "expires_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Find Installation Repositories for User Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps Lists repositories accessible to the user for a given GitHub App installation. Uses pagination to retrieve all repositories. Requires the installation ID. ```ruby def find_installation_repositories_for_user(installation, options = {}) paginate "user/installations/#{installation}/repositories", options do |data, last_response| data.repositories.concat last_response.data.repositories end end ``` -------------------------------- ### Octokit::Client::Apps#installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Ainstallation Retrieves information about an app installation. ```APIDOC ## GET /app/installations/{installation_id} ### Description Retrieves details about a specific app installation. ### Method GET ### Endpoint /app/installations/:installation_id ### Parameters #### Path Parameters - **installation_id** (integer) - Required - The unique identifier of the installation. ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the installation. - **account** (object) - Information about the account associated with the installation. - **repository_selection** (string) - Indicates how repositories are selected for the installation. - **access_tokens_url** (string) - URL to access installation tokens. - **repositories_url** (string) - URL to access repositories for the installation. - **html_url** (string) - URL to the installation in the GitHub UI. - **app_id** (integer) - The ID of the associated GitHub App. - **target_id** (integer) - The ID of the account or organization the installation is for. - **target_type** (string) - The type of the target (e.g., 'User', 'Organization'). #### Response Example ```json { "id": 12345, "account": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/icons/icon- 72x72.png", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false }, "repository_selection": "all", "access_tokens_url": "https://api.github.com/installations/12345/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", "html_url": "https://github.com/settings/installations/12345", "app_id": 1, "target_id": 1, "target_type": "User" } ``` ``` -------------------------------- ### List User Installations in Octokit Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Alist_user_installations Retrieves installations accessible to the authenticated user. Uses pagination to aggregate installation data. ```ruby def list_user_installations(options = {}) paginate('user/installations', options) do |data, last_response| data.installations.concat last_response.data.installations end end ``` -------------------------------- ### List App Installation Repositories Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Alist_app_installation_repositories Lists repositories accessible to an authenticated GitHub App installation. Uses pagination to retrieve all repositories. ```ruby def list_app_installation_repositories(options = {}) paginate('installation/repositories', options) do |data, last_response| data.repositories.concat last_response.data.repositories end end ``` -------------------------------- ### POST /setup/api/upgrade - Upgrade Enterprise Installation Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole Upgrades an existing Enterprise installation with a new license file. ```APIDOC ## POST /setup/api/upgrade ### Description Upgrades an Enterprise installation. ### Method POST ### Endpoint /setup/api/upgrade ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **license** (String) - Required - The path to your .ghl license file. ### Request Example ```json { "license": "/path/to/your/new_license.ghl" } ``` ### Response #### Success Response (200) - **nil** - Indicates the upgrade process was initiated successfully. #### Response Example ```json null ``` ``` -------------------------------- ### Create App Installation Access Token Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps Generates a new installation access token for a GitHub App. Requires the installation ID and accepts an options hash. ```ruby def create_app_installation_access_token(installation, options = {}) post "/app/installations/#{installation}/access_tokens", options end ``` -------------------------------- ### Get GitHub App Installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Ainstallation Retrieves information about a specific GitHub App installation using its ID. Requires the installation ID as an integer. ```ruby def installation(id, options = {}) get "app/installations/#{id}", options end ``` -------------------------------- ### Start Configuration for ManageGHESClient Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient%3Astart_configuration Use this method to initiate a configuration process for the ManageGHESClient. It returns nil upon successful execution. ```ruby Octokit::ManageGHESClient#start_configuration ``` -------------------------------- ### POST /setup/api/start - Upload License Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole Uploads a license for the first time to an Enterprise installation. This is typically the first step in setting up a new instance. ```APIDOC ## POST /setup/api/start ### Description Uploads a license for the first time. ### Method POST ### Endpoint /setup/api/start ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **license** (String) - Required - The path to your .ghl license file. - **settings** (Hash) - Optional - A hash configuration of the initial settings. ### Request Example ```json { "license": "/path/to/your/license.ghl", "settings": { "hostname": "your-enterprise.com", "contact": "admin@your-enterprise.com" } } ``` ### Response #### Success Response (200) - **nil** - Indicates the license was uploaded successfully. #### Response Example ```json null ``` ``` -------------------------------- ### Find Organization Installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Afind_organization_installation Retrieves installation information for a given organization login. Requires an authenticated GitHub App. ```ruby # File 'lib/octokit/client/apps.rb', line 77 def find_organization_installation(organization, options = {}) get "#{Organization.path(organization)}/installation", options end ``` -------------------------------- ### Octokit::ManageGHESClient#start_configuration Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient%3Astart_configuration Starts a configuration process for GitHub Enterprise Server. This method is part of the ManageGHESClient and is used to initiate server configuration. ```APIDOC ## POST /api/v3/admin/configuration/start ### Description Starts a configuration process for GitHub Enterprise Server. ### Method POST ### Endpoint /api/v3/admin/configuration/start ### Parameters #### Request Body This endpoint does not require a request body. ### Response #### Success Response (200) - **nil** (nil) - Indicates that the configuration process has started successfully. #### Response Example ```json null ``` ``` -------------------------------- ### POST /setup/api/configure Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Astart_configuration Starts the configuration process for the GitHub Enterprise Server Management Console. This API is deprecated and will be removed in future versions. Use the ManageGHES client instead. ```APIDOC ## POST /setup/api/configure ### Description Starts the configuration process for the GitHub Enterprise Server Management Console. This method is deprecated and users should migrate to the ManageGHES client. ### Method POST ### Endpoint /setup/api/configure ### Parameters #### Request Body - **password_hash** (object) - Required - The hashed password for configuration. ### Request Example ```json { "password_hash": { "password": "your_hashed_password" } } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating configuration has started. #### Response Example ```json { "message": "Configuration process initiated." } ``` ``` -------------------------------- ### POST /setup/api/start - Upload License Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Aupload_license Uploads a license for the first time to a GitHub Enterprise Server instance. Note: This API is deprecated and will be removed in future versions. Use the ManageGHES client instead. ```APIDOC ## POST /setup/api/start ### Description Uploads a license for the first time to a GitHub Enterprise Server instance. ### Method POST ### Endpoint /setup/api/start ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **license** (File) - Required - The path to your .ghl license file. - **settings** (Hash) - Optional - A hash configuration of the initial settings. ### Request Example ```json { "license": "/path/to/your/license.ghl", "settings": { "hostname": "your-ghe-hostname", "ip_address": "192.168.1.1", "subnet_mask": "255.255.255.0", "gateway": "192.168.1.254" } } ``` ### Response #### Success Response (200) - **nil** (nil) - Indicates successful upload. #### Response Example ```json null ``` ### Error Handling - **400 Bad Request**: Invalid license file or settings. - **401 Unauthorized**: Authentication failed. - **409 Conflict**: License already exists. ``` -------------------------------- ### Octokit::EnterpriseManagementConsoleClient::ManagementConsole#start_configuration Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Astart_configuration This method is used to initiate a configuration process for the GitHub Enterprise Management Console. ```APIDOC ## Octokit::EnterpriseManagementConsoleClient::ManagementConsole#start_configuration ### Description Start a configuration process. ### Method POST (Assumed, as it initiates a process) ### Endpoint /api/v3/admin/console/configure (Assumed based on typical REST API patterns for configuration) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None specified in the provided text. ### Request Example ```json { "message": "No request body example provided" } ``` ### Response #### Success Response (200) - **nil** (Object) - Indicates the configuration process has started successfully. #### Response Example ```json null ``` ``` -------------------------------- ### GET /setup/api/maintenance Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole Retrieves the current maintenance status of the Enterprise installation. ```APIDOC ## GET /setup/api/maintenance ### Description Get information about the Enterprise maintenance status. ### Method GET ### Endpoint /setup/api/maintenance ### Response #### Success Response (200) - **status** (Object) - The maintenance status. ``` -------------------------------- ### Start Configuration Process Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient Initiates the configuration process for the GitHub Enterprise Server. ```APIDOC ## POST /start_configuration ### Description Start a configuration process for the Enterprise install. ### Method POST ### Endpoint /start_configuration ``` -------------------------------- ### Start Configuration in Octokit Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Astart_configuration Initiates the configuration process via the management console API. Note that this method is deprecated as of GitHub Enterprise Server 3.15.0. ```ruby def start_configuration octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.') post '/setup/api/configure', password_hash end ``` -------------------------------- ### POST /manage/v1/config/init Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient%3Aupload_license Uploads a license file to the GitHub Enterprise Server instance for the first time. ```APIDOC ## POST /manage/v1/config/init ### Description Uploads a license for the first time to the GitHub Enterprise Server instance. ### Method POST ### Endpoint /manage/v1/config/init ### Parameters #### Request Body - **license** (String) - Required - The path to your .ghl license file. ### Response #### Success Response (200) - **nil** - Returns nil upon successful upload. ``` -------------------------------- ### Start Enterprise Management Console Configuration Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Astart_configuration Use this method to initiate the configuration process for GitHub Enterprise Server management console. It returns nil upon successful initiation. ```ruby Octokit::EnterpriseManagementConsoleClient::ManagementConsole.start_configuration ``` -------------------------------- ### GET /setup/api/settings/authorized-keys Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole Fetches the list of authorized SSH keys on the Enterprise installation. ```APIDOC ## GET /setup/api/settings/authorized-keys ### Description Fetch the authorized SSH keys on the Enterprise install. ### Method GET ### Endpoint /setup/api/settings/authorized-keys ### Response #### Success Response (200) - **keys** (Array) - An array of authorized SSH keys. ``` -------------------------------- ### Initialize Octokit Client and Check Token Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/OauthApplications%3Acheck_token Demonstrates how to initialize an Octokit client with credentials and check the validity of a GitHub OAuth access token. ```ruby client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret') client.check_token('deadbeef1234567890deadbeef987654321') ``` -------------------------------- ### GET /app/users/:username/installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Afind_user_installation Retrieves the installation for a specific user on a GitHub App. ```APIDOC ## GET /app/users/:username/installation ### Description Retrieves the installation for a specific user on a GitHub App. ### Method GET ### Endpoint /app/users/:username/installation ### Parameters #### Path Parameters - **username** (string) - Required - The handle for the GitHub user account. ``` -------------------------------- ### Create a check suite usage example Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Checks%3Acreate_check_suite Demonstrates how to invoke the create_check_suite method and access the returned resource properties. ```ruby check_suite = @client.create_check_suite("octocat/Hello-World", "7638417db6d59f3c431d3e1f261cc637155684cd") check_suite.head_sha # => "7638417db6d59f3c431d3e1f261cc637155684cd" check_suite.status # => "queued" ``` -------------------------------- ### ManageGHESClient Initialization Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient Initializes a new instance of ManageGHESClient, accepting an options hash for configuration. ```APIDOC ## POST /websites/rubydoc_info_gems_octokit ### Description Initializes a new instance of ManageGHESClient. ### Method POST ### Endpoint /websites/rubydoc_info_gems_octokit ### Parameters #### Request Body - **options** (Hash) - Optional - Configuration options for the client. ``` -------------------------------- ### GET /orgs/:org/installation Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Afind_organization_installation Retrieves the installation information for a specific organization for the authenticated app. ```APIDOC ## GET /orgs/:org/installation ### Description Enables an app to find the organization’s installation information. ### Method GET ### Endpoint /orgs/:organization/installation ### Parameters #### Path Parameters - **organization** (String) - Required - Organization GitHub login #### Query Parameters - **options** (Hash) - Optional - A customizable set of options ### Response #### Success Response (200) - **Sawyer::Resource** - Installation information ``` -------------------------------- ### Octokit::Arguments#initialize Source: https://www.rubydoc.info/gems/octokit/Octokit/Arguments%3Ainitialize Documentation for the initialize method of the Octokit::Arguments class. ```APIDOC ## Octokit::Arguments#initialize ### Description Returns a new instance of Arguments. ### Method initialize ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### POST /setup/api/maintenance - Set Maintenance Status Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole Starts or stops the maintenance mode for the Enterprise installation. ```APIDOC ## POST /setup/api/maintenance ### Description Starts (or turns off) the Enterprise maintenance mode. ### Method POST ### Endpoint /setup/api/maintenance ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **maintenance** (Hash) - Required - A hash configuration of the maintenance settings. ### Request Example ```json { "maintenance": { "enabled": true, "when": "2023-10-27T10:00:00Z", "message": "System maintenance in progress." } } ``` ### Response #### Success Response (200) - **nil** - Indicates the maintenance status was updated. #### Response Example ```json null ``` ``` -------------------------------- ### Retrieve user installation information Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Afind_user_installation Use this method to fetch installation details for a given GitHub user login. Requires an authenticated GitHub App context. ```ruby def find_user_installation(user, options = {}) get "#{User.path(user)}/installation", options end ``` -------------------------------- ### Get Enterprise Installation Settings Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Asettings Retrieves information about the Enterprise installation. Note that the Management Console API will be deprecated in GitHub Enterprise Server 3.15.0; consider using the ManageGHES client instead. ```ruby def settings octokit_warn('The Management Console API will be deprecated in GitHub Enterprise Server 3.15.0, please use the ManageGHES client instead.') get '/setup/api/settings', password_hash end ``` -------------------------------- ### Get Configuration Status Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient Retrieves information about the current configuration status of the GitHub Enterprise Server installation. ```APIDOC ## GET /manage/v1/config/apply ### Description Get information about the Enterprise installation's configuration status. ### Method GET ### Endpoint /manage/v1/config/apply ``` -------------------------------- ### GET /app/installations/:installation_id/repositories Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Apps%3Afind_installation_repositories_for_user Retrieves the repositories accessible to the authenticated user for a specific GitHub App installation. ```APIDOC ## GET /app/installations/:installation_id/repositories ### Description List repositories that are accessible to the authenticated user for an installation. ### Method GET ### Endpoint /app/installations/:installation_id/repositories ### Parameters #### Path Parameters - **installation_id** (integer) - Required - The unique identifier of the installation. ``` -------------------------------- ### Get Code Scanning Default Configuration Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/CodeScanning Retrieves the default setup configuration for code scanning in a repository. ```ruby # File 'lib/octokit/client/code_scanning.rb', line 35 def get_code_scanning_default_config(repo, options = {}) get "#{Repository.path repo}/code-scanning/default-setup", options end ``` -------------------------------- ### Retrieve Code Scanning Default Configuration Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/CodeScanning%3Aget_code_scanning_default_config Fetches the CodeQL default setup configuration for a given repository. Requires a repository identifier as input. ```ruby def get_code_scanning_default_config(repo, options = {}) get "#{Repository.path repo}/code-scanning/default-setup", options end ``` -------------------------------- ### Add Team Member Examples Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Organizations%3Aadd_team_member Demonstrates basic usage and the use of preview headers for the add_team_member method. ```ruby @client.add_team_member(100000, 'pengwynn') ``` ```ruby # Opt-in to future behavior for this endpoint. Adds the member to the # team if they're already an org member. If not, the method will return # 422 and indicate the user should call the new Team Membership endpoint. @client.add_team_member \ 100000, 'pengwynn', :accept => "application/vnd.github.the-wasp-preview+json" ``` -------------------------------- ### Get Commits Between Dates - Octokit Ruby Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Commits%3Acommits_between Retrieves commits for a repository within a specified date range. Ensure the start date precedes the end date. The deprecated overload accepts a SHA or branch name to start from. ```ruby Octokit.commits_between('octokit/octokit.rb', '2012-10-01', '2012-11-01') ``` ```ruby def commits_between(*args) arguments = Octokit::RepoArguments.new(args) date = parse_date(arguments.shift) end_date = parse_date(arguments.shift) if date > end_date raise ArgumentError, "Start date #{date} does not precede #{end_date}" end params = arguments.options params.merge!(since: iso8601(date), until: iso8601(end_date)) sha_or_branch = arguments.pop params[:sha] = sha_or_branch if sha_or_branch commits(arguments.repo, params) end ``` -------------------------------- ### Start a source import Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/SourceImport Initiates a new source import to a GitHub repository from an external VCS URL. ```ruby @client.start_source_import("octokit/octokit.rb", "http://svn.mycompany.com/svn/myproject", { :vcs => "subversion", :vcs_username" => "octocat", :vcs_password => "secret" }) ``` ```ruby # File 'lib/octokit/client/source_import.rb', line 37 def start_source_import(*args) arguments = Octokit::RepoArguments.new(args) vcs_url = arguments.pop vcs = arguments.pop if vcs octokit_warn 'Octokit#start_source_import vcs parameter is now an option, please update your call before the next major Octokit version update.' arguments.options.merge!(vcs: vcs) end options = arguments.options.merge(vcs_url: vcs_url) put "#{Repository.path arguments.repo}/import", options end ``` -------------------------------- ### GET /repos/{owner}/{repo}/commits Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Commits%3Acommits_before Retrieves a list of commits for a given repository, with options to filter by date and starting point. ```APIDOC ## GET /repos/{owner}/{repo}/commits ### Description Retrieves a list of commits on a repository. This method allows fetching commits before a specific date or from a particular commit SHA or branch. ### Method GET ### Endpoint /repos/{owner}/{repo}/commits ### Parameters #### Query Parameters - **until** (String) - Required - ISO 8601 format date string. Commits will be returned up to this date. - **sha** (String) - Optional - Commit SHA or branch name from which to start the list. If not provided, commits are listed from the default branch. ### Request Example ```json { "example": "Octokit.commits_before('octokit/octokit.rb', '2012-10-01')" } ``` ### Response #### Success Response (200) - **commits** (Array) - An array of hashes representing commits. #### Response Example ```json { "example": "[ { \"sha\": \"...\", \"commit\": { \"author\": { \"name\": \"...\", \"email\": \"...\", \"date\": \"...\" }, \"message\": \"...\" }, \"html_url\": \"...\" }, ... ]" } ``` ``` -------------------------------- ### Check or Get Team Permissions for a Repository Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Organizations%3Ateam_permissions_for_repo Use these examples to check team permissions or retrieve the full repository object with permission details. ```ruby # Check whether the team has any permissions with the repository @client.team_permissions_for_repo("github", "justice-league", "octocat", "hello-world") ``` ```ruby # Get the full repository object including the permissions level and role for the team @client.team_permissions_for_repo("github", "justice-league", "octocat", "hello-world", :accept => 'application/vnd.github.v3.repository+json') ``` -------------------------------- ### Initialize Octokit Client Source: https://www.rubydoc.info/gems/octokit/Octokit/Client Initializes the client with provided options, falling back to module defaults. ```ruby def initialize(options = {}) # Use options passed in, but fall back to module defaults # # rubocop:disable Style/HashEachMethods # # This may look like a `.keys.each` which should be replaced with `#each_key`, but # this doesn't actually work, since `#keys` is just a method we've defined ourselves. # The class doesn't fulfill the whole `Enumerable` contract. Octokit::Configurable.keys.each do |key| # rubocop:enable Style/HashEachMethods value = options[key].nil? ? Octokit.instance_variable_get(:",@#{key}") : options[key] instance_variable_set(:",@#{key}", value) end login_from_netrc unless user_authenticated? || application_authenticated? end ``` -------------------------------- ### Get Comments for Octokit Repository Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Issues%3Aissues_comments Retrieves all comments for issues in the specified repository. No specific setup is required beyond initializing the Octokit client. ```ruby @client.issues_comments("octokit/octokit.rb") ``` -------------------------------- ### Get Response in FollowRedirects Middleware Source: https://www.rubydoc.info/gems/octokit/Octokit/Middleware/RedirectLimitReached%3Aresponse Accesses the stored response within the FollowRedirects middleware. No specific setup is required beyond the middleware's initialization. ```ruby def response @response end ``` -------------------------------- ### List Gitignore Templates Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Gitignore%3Agitignore_templates Call this method to get a list of available gitignore templates. No specific setup is required beyond initializing the Octokit client. ```ruby client.gitignore_templates ``` ```ruby def gitignore_templates(options = {}) get 'gitignore/templates', options end ``` -------------------------------- ### Get Commit Activity Stats for a Repository Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Stats Fetches the last year of commit activity data for a repository. The data is grouped by week, with each week starting on Sunday. ```ruby @client.commit_activity_stats('octokit/octokit.rb') ``` ```ruby # File 'lib/octokit/client/stats.rb', line 33 def commit_activity_stats(repo, options = {}) get_stats(repo, 'commit_activity', options) end ``` -------------------------------- ### Start GHES Configuration Source: https://www.rubydoc.info/gems/octokit/Octokit/ManageGHESClient%3Astart_configuration Initiates the configuration application process on a GitHub Enterprise Server instance. Requires an authenticated client. ```ruby def start_configuration conn = authenticated_client @last_response = conn.post('/manage/v1/config/apply') end ``` -------------------------------- ### GET /repos/:repo/compare/:start...:end Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Commits%3Acompare Compares two commits in a GitHub repository. When using auto_pagination, commits from all pages are concatenated into the commits attribute. ```APIDOC ## GET /repos/:repo/compare/:start...:end ### Description Compare two commits within a GitHub repository. ### Method GET ### Endpoint /repos/:repo/compare/:start...:end ### Parameters #### Path Parameters - **repo** (Integer, String, Hash, Repository) - Required - A GitHub repository - **start** (String) - Required - The sha of the starting commit - **endd** (String) - Required - The sha of the ending commit ### Response #### Success Response (200) - **Sawyer::Resource** - A hash representing the comparison ``` -------------------------------- ### Initialize Enterprise Management Console Client Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient%3Ainitialize Initializes the client using provided options, falling back to module defaults if options are not specified. This method iterates through configurable keys and sets instance variables accordingly. ```ruby def initialize(options = {}) # Use options passed in, but fall back to module defaults # rubocop:disable Style/HashEachMethods # # This may look like a `.keys.each` which should be replaced with `#each_key`, but # this doesn't actually work, since `#keys` is just a method we've defined ourselves. # The class doesn't fulfill the whole `Enumerable` contract. Octokit::Configurable.keys.each do |key| # rubocop:enable Style/HashEachMethods instance_variable_set(:'@' + key, options[key] || Octokit.instance_variable_get(:'@' + key)) end end ``` -------------------------------- ### Get GitHub Meta Information Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Meta Use this method to retrieve meta information about GitHub.com. No specific setup or imports are required beyond initializing the Octokit client. ```ruby @client.github_meta ``` ```ruby def meta(options = {}) get 'meta', options end ``` -------------------------------- ### Initialize Repository Instance Source: https://www.rubydoc.info/gems/octokit/Octokit/Repository Creates a new Repository instance from an Integer ID, a name/owner string, an existing Repository object, or a Hash. ```ruby # File 'lib/octokit/repository.rb', line 23 def initialize(repo) case repo when Integer @id = repo when NAME_WITH_OWNER_PATTERN @owner, @name = repo.split('/') when Repository @owner = repo.owner @name = repo.name when Hash @name = repo[:repo] || repo[:name] @owner = repo[:owner] || repo[:user] || repo[:username] else raise_invalid_repository!(repo) end validate_owner_and_name!(repo) if @owner && @name end ``` -------------------------------- ### Get GitHub User Information Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Users%3Auser Use this method to retrieve details for a specific GitHub user by their login name or ID. Requires the Octokit gem to be installed and initialized. ```ruby Octokit.user("sferik") ``` ```ruby def user(user = nil, options = {}) get User.path(user), options end ``` -------------------------------- ### List repository branches with Octokit Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Repositories%3Abranches Use these examples to retrieve a list of branches for a given repository. The first example uses the module method, while the second uses an authenticated client instance. ```ruby Octokit.branches('octokit/octokit.rb') ``` ```ruby @client.branches('octokit/octokit.rb') ``` -------------------------------- ### GET /setup/api/settings/authorized-keys Source: https://www.rubydoc.info/gems/octokit/Octokit/EnterpriseManagementConsoleClient/ManagementConsole%3Aauthorized_keys Fetches the authorized SSH keys on the Enterprise install. Note: This API is deprecated and will be removed in GitHub Enterprise Server 3.15.0. Use the ManageGHES client instead. ```APIDOC ## GET /setup/api/settings/authorized-keys ### Description Fetch the authorized SSH keys on the Enterprise install. ### Method GET ### Endpoint /setup/api/settings/authorized-keys ### Parameters #### Query Parameters - **password_hash** (string) - Required - The hash of the password for authentication. ### Response #### Success Response (200) - **authorized_keys** (array of Sawyer::Resource) - An array of authorized SSH keys. #### Response Example ```json { "authorized_keys": [ { "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ...". "id": 1, "created_at": "2023-01-01T12:00:00Z", "title": "My SSH Key" } ] } ``` ``` -------------------------------- ### GET /repos/:owner/:repo/stats/commit_activity Source: https://www.rubydoc.info/gems/octokit/Octokit/Client/Stats%3Acommit_activity_stats Retrieves the last year of commit activity for a GitHub repository, grouped by week. Each week starts on Sunday and includes the number of commits per day. ```APIDOC ## GET /repos/:owner/:repo/stats/commit_activity ### Description Get commit activity for a GitHub repository. ### Method GET ### Endpoint /repos/:owner/:repo/stats/commit_activity ### Parameters #### Path Parameters - **owner** (string) - Required - The owner of the repository. - **repo** (string) - Required - The name of the repository. #### Query Parameters None #### Request Body None ### Request Example ```ruby @client.commit_activity_stats('octokit/octokit.rb') ``` ### Response #### Success Response (200) - **Array** - The last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. #### Response Example ```json [ { "week": 1647772800, "total": 100, "days": [0, 0, 0, 0, 0, 0, 0] } ] ``` ### See Also - https://developer.github.com/v3/repos/statistics/#get-the-last-year-of-commit-activity-data ```