GitHub vendor logo

Vendor

GitHub

Product

GitHub

Method

REST

Category

CI/CD

Project Type

Adapter


View Repository
Adapter

Adapter for Integration to GitHub

Overview

This adapter is used to integrate the Itential Automation Platform (IAP) with the GitHub System. The API that was used to build the adapter for GitHub is usually available in the report directory of this adapter. The adapter utilizes the GitHub API to provide the integrations that are deemed pertinent to IAP. The ReadMe file is intended to provide information on this adapter it is generated from various other Markdown files.

Details

The GitHub adapter from Itential is used to integrate the Itential Automation Platform (IAP) with GitHub. With this adapter you have the ability to perform operations such as:

  • Manage projects and files in a repository

For further technical details on how to install and use this adapter, please click the Technical Documentation tab.

GitHub System

Table of Contents

Getting Started

These instructions will help you get a copy of the project on your local machine for development and testing. Reading this section is also helpful for deployments as it provides you with pertinent information on prerequisites and properties.

Helpful Background Information

There is Adapter documentation available on the Itential Documentation Site. This documentation includes information and examples that are helpful for:

Authentication
IAP Service Instance Configuration
Code Files
Endpoint Configuration (Action & Schema)
Mock Data
Adapter Generic Methods
Headers
Security
Linting and Testing
Build an Adapter
Troubleshooting an Adapter

Others will be added over time. Want to build a new adapter? Use the Itential Adapter Builder

Prerequisites

The following is a list of required packages for installation on the system the adapter will run on:

Node.js
npm
Git

The following list of packages are required for Itential opensource adapters or custom adapters that have been built utilizing the Itential Adapter Builder. You can install these packages by running npm install inside the adapter directory.

PackageDescription
@itentialopensource/adapter-utilsRuntime library classes for all adapters; includes request handling, connection, authentication throttling, and translation.
ajvRequired for validation of adapter properties to integrate with GitHub.
axiosUtilized by the node scripts that are included with the adapter; helps to build and extend the functionality.
commanderUtilized by the node scripts that are included with the adapter; helps to build and extend the functionality.
dns-lookup-promiseUtilized by the node scripts that are included with the adapter; helps to build and extend the functionality.
fs-extraUtilized by the node scripts that are included with the adapter; helps to build and extend the functionality.
mochaTesting library that is utilized by some of the node scripts that are included with the adapter.
mocha-paramTesting library that is utilized by some of the node scripts that are included with the adapter.
mongodbUtilized by the node scripts that are included with the adapter; helps to build and extend the functionality.
nycTesting coverage library that is utilized by some of the node scripts that are included with the adapter.
pingUtilized by the node scripts that are included with the adapter; helps to build and extend the functionality.
readline-syncUtilized by the node script that comes with the adapter; helps to test unit and integration functionality.
semverUtilized by the node scripts that are included with the adapter; helps to build and extend the functionality.
winstonUtilized by the node scripts that are included with the adapter; helps to build and extend the functionality.

If you are developing and testing a custom adapter, or have testing capabilities on an Itential opensource adapter, you will need to install these packages as well.

chai
eslint
eslint-config-airbnb-base
eslint-plugin-import
eslint-plugin-json
testdouble

How to Install

  1. Set up the name space location in your IAP node_modules.
cd /opt/pronghorn/current/node_modules (* could be in a different place)
if the @itentialopensource directory does not exist, create it:
    mkdir @itentialopensource
  1. Clone/unzip/tar the adapter into your IAP environment.
cd \@itentialopensource
git clone git@gitlab.com:\@itentialopensource/adapters/adapter-github
or
unzip adapter-github.zip
or
tar -xvf adapter-github.tar
  1. Run the adapter install script.
cd adapter-github
npm install
npm run lint:errors
npm run test
  1. Restart IAP
systemctl restart pronghorn
  1. Create an adapter service instance configuration in IAP Admin Essentials GUI

  2. Copy the properties from the sampleProperties.json and paste them into the service instance configuration in the inner/second properties field.

  3. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI

For an easier install of the adapter use npm run adapter:install, it will install the adapter in IAP. Please note that it can be dependent on where the adapter is installed and on the version of IAP so it is subject to fail. If using this, you can replace step 3-5 above with these:

  1. Install adapter dependencies and check the adapter.
cd adapter-github
npm run adapter:install
  1. Restart IAP
systemctl restart pronghorn
  1. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI

Testing

Mocha is generally used to test all Itential Opensource Adapters. There are unit tests as well as integration tests performed. Integration tests can generally be run as standalone using mock data and running the adapter in stub mode, or as integrated. When running integrated, every effort is made to prevent environmental failures, however there is still a possibility.

Unit Testing

Unit Testing includes testing basic adapter functionality as well as error conditions that are triggered in the adapter prior to any integration. There are two ways to run unit tests. The prefered method is to use the testRunner script; however, both methods are provided here.

node utils/testRunner --unit

npm run test:unit
npm run test:baseunit

To add new unit tests, edit the test/unit/adapterTestUnit.js file. The tests that are already in this file should provide guidance for adding additional tests.

Integration Testing - Standalone

Standalone Integration Testing requires mock data to be provided with the entities. If this data is not provided, standalone integration testing will fail. When the adapter is set to run in stub mode (setting the stub property to true), the adapter will run through its code up to the point of making the request. It will then retrieve the mock data and return that as if it had received that data as the response from GitHub. It will then translate the data so that the adapter can return the expected response to the rest of the Itential software. Standalone is the default integration test.

Similar to unit testing, there are two ways to run integration tests. Using the testRunner script is better because it prevents you from having to edit the test script; it will also resets information after testing is complete so that credentials are not saved in the file.

node utils/testRunner
  answer no at the first prompt

npm run test:integration

To add new integration tests, edit the test/integration/adapterTestIntegration.js file. The tests that are already in this file should provide guidance for adding additional tests.

Integration Testing

Integration Testing requires connectivity to GitHub. By using the testRunner script it prevents you from having to edit the integration test. It also resets the integration test after the test is complete so that credentials are not saved in the file.

Note: These tests have been written as a best effort to make them work in most environments. However, the Adapter Builder often does not have the necessary information that is required to set up valid integration tests. For example, the order of the requests can be very important and data is often required for creates and updates. Hence, integration tests may have to be enhanced before they will work (integrate) with GitHub. Even after tests have been set up properly, it is possible there are environmental constraints that could result in test failures. Some examples of possible environmental issues are customizations that have been made within GitHub which change order dependencies or required data.

node utils/testRunner
answer yes at the first prompt
answer all other questions on connectivity and credentials

Test should also be written to clean up after themselves. However, it is important to understand that in some cases this may not be possible. In addition, whenever exceptions occur, test execution may be stopped, which will prevent cleanup actions from running. It is recommended that tests be utilized in dev and test labs only.

Reminder: Do not check in code with actual credentials to systems.

Configuration

This section defines all the properties that are available for the adapter, including detailed information on what each property is for. If you are not using certain capabilities with this adapter, you do not need to define all of the properties. An example of how the properties for this adapter can be used with tests or IAP are provided in the sampleProperties.

Example Properties

  "properties": {
    "host": "api.github.com",
    "port": 443,
    "choosepath": "",
    "base_path": "",
    "version": "",
    "cache_location": "none",
    "encode_pathvars": true,
    "encode_queryvars": true,
    "save_metric": false,
    "stub": true,
    "protocol": "https",
    "authentication": {
      "auth_method": "basic user_password",
      "username": "username",
      "password": "access_token",
      "token": "statictoken",
      "token_timeout": 1800000,
      "token_cache": "local",
      "invalid_token_error": 401,
      "auth_field": "header.headers.Authorization",
      "auth_field_format": "Basic {b64}{username}:{password}{/b64}",
      "auth_logging": false,
      "client_id": "",
      "client_secret": "",
      "grant_type": "",
      "sensitive": [],
      "sso": {
        "protocol": "",
        "host": "",
        "port": 0
      },
      "multiStepAuthCalls": [
        {
          "name": "",
          "requestFields": {},
          "responseFields": {},
          "successfullResponseCode": 200
        }
      ]
    },
    "healthcheck": {
      "type": "startup",
      "frequency": 300000,
      "query_object": {},
      "addlHeaders": {}
    },
    "throttle": {
      "throttle_enabled": false,
      "number_pronghorns": 1,
      "sync_async": "sync",
      "max_in_queue": 1000,
      "concurrent_max": 1,
      "expire_timeout": 0,
      "avg_runtime": 200,
      "priorities": [
        {
          "value": 0,
          "percent": 100
        }
      ]
    },
    "request": {
      "number_redirects": 0,
      "number_retries": 3,
      "limit_retry_error": 401,
      "failover_codes": [],
      "attempt_timeout": 5000,
      "global_request": {
        "payload": {},
        "uriOptions": {},
        "addlHeaders": {
          "user-agent": "node.js"
        },
        "authData": {}
      },
      "healthcheck_on_timeout": true,
      "return_raw": false,
      "archiving": false,
      "return_request": false
    },
    "proxy": {
      "enabled": false,
      "host": "",
      "port": 1,
      "protocol": "http",
      "username": "",
      "password": ""
    },
    "ssl": {
      "ecdhCurve": "",
      "enabled": false,
      "accept_invalid_cert": true,
      "ca_file": "",
      "key_file": "",
      "cert_file": "",
      "secure_protocol": "",
      "ciphers": ""
    },
    "mongo": {
      "host": "",
      "port": 0,
      "database": "",
      "username": "",
      "password": "",
      "replSet": "",
      "db_ssl": {
        "enabled": false,
        "accept_invalid_cert": false,
        "ca_file": "",
        "key_file": "",
        "cert_file": ""
      }
    },
    "devicebroker": {
      "getDevice": [
        {
          "path": "/get/devices/{id}",
          "method": "GET",
          "query": {},
          "body": {},
          "headers": {},
          "handleFailure": "ignore",
          "requestFields": {
            "id": "name"
          },
          "responseDatakey": "",
          "responseFields": {
            "name": "host",
            "ostype": "os",
            "ostypePrefix": "system-",
            "ipaddress": "attributes.ipaddr",
            "port": "443"
          }
        }
      ],
      "getDevicesFiltered": [
        {
          "path": "/get/devices",
          "method": "GET",
          "pagination": {
            "offsetVar": "",
            "limitVar": "",
            "incrementBy": "limit",
            "requestLocation": "query"
          },
          "query": {},
          "body": {},
          "headers": {},
          "handleFailure": "ignore",
          "requestFields": {},
          "responseDatakey": "",
          "responseFields": {
            "name": "host",
            "ostype": "os",
            "ostypePrefix": "system-",
            "ipaddress": "attributes.ipaddr",
            "port": "443"
          }
        }
      ],
      "isAlive": [
        {
          "path": "/get/devices/{id}/status",
          "method": "GET",
          "query": {},
          "body": {},
          "headers": {},
          "handleFailure": "ignore",
          "requestFields": {
            "id": "name"
          },
          "responseDatakey": "",
          "responseFields": {
            "status": "status",
            "statusValue": "online"
          }
        }
      ],
      "getConfig": [
        {
          "path": "/get/devices/{id}/configPart1",
          "method": "GET",
          "query": {},
          "body": {},
          "headers": {},
          "handleFailure": "ignore",
          "requestFields": {
            "id": "name"
          },
          "responseDatakey": "",
          "responseFields": {}
        }
      ],
      "getCount": [
        {
          "path": "/get/devices",
          "method": "GET",
          "query": {},
          "body": {},
          "headers": {},
          "handleFailure": "ignore",
          "requestFields": {},
          "responseDatakey": "",
          "responseFields": {}
        }
      ]
    },
    "cache": {
      "enabled": false,
      "entities": [
        {
          "entityType": "",
          "frequency": 1440,
          "flushOnFail": false,
          "limit": 1000,
          "retryAttempts": 5,
          "sort": true,
          "populate": [
            {
              "path": "",
              "method": "GET",
              "pagination": {
                "offsetVar": "",
                "limitVar": "",
                "incrementBy": "limit",
                "requestLocation": "query"
              },
              "query": {},
              "body": {},
              "headers": {},
              "handleFailure": "ignore",
              "requestFields": {},
              "responseDatakey": "",
              "responseFields": {}
            }
          ],
          "cachedTasks": [
            {
              "name": "",
              "filterField": "",
              "filterLoc": ""
            }
          ]
        }
      ]
    }
  }

Connection Properties

These base properties are used to connect to GitHub upon the adapter initially coming up. It is important to set these properties appropriately.

PropertyDescription
hostRequired. A fully qualified domain name or IP address.
portRequired. Used to connect to the server.
base_pathOptional. Used to define part of a path that is consistent for all or most endpoints. It makes the URIs easier to use and maintain but can be overridden on individual calls. An example **base_path** might be `/rest/api`. Default is ``.
versionOptional. Used to set a global version for action endpoints. This makes it faster to update the adapter when endpoints change. As with the base-path, version can be overridden on individual endpoints. Default is ``.
cache_locationOptional. Used to define where the adapter cache is located. The cache is used to maintain an entity list to improve performance. Storage locally is lost when the adapter is restarted. Storage in Redis is preserved upon adapter restart. Default is none which means no caching of the entity list.
encode_pathvarsOptional. Used to tell the adapter to encode path variables or not. The default behavior is to encode them so this property can be used to stop that behavior.
encode_queryvarsOptional. Used to tell the adapter to encode query parameters or not. The default behavior is to encode them so this property can be used to stop that behavior.
save_metricOptional. Used to tell the adapter to save metric information (this does not impact metrics returned on calls). This allows the adapter to gather metrics over time. Metric data can be stored in a database or on the file system.
stubOptional. Indicates whether the stub should run instead of making calls to GitHub (very useful during basic testing). Default is false (which means connect to GitHub).
protocolOptional. Notifies the adapter whether to use HTTP or HTTPS. Default is HTTP.

A connectivity check tells IAP the adapter has loaded successfully.

Authentication Properties

The following properties are used to define the authentication process to GitHub.

Note: Depending on the method that is used to authenticate with GitHub, you may not need to set all of the authentication properties.

PropertyDescription
auth_methodRequired. Used to define the type of authentication currently supported. Authentication methods currently supported are: `basic user_password`, `static_token`, `request_token`, and `no_authentication`.
usernameUsed to authenticate with GitHub on every request or when pulling a token that will be used in subsequent requests.
passwordUsed to authenticate with GitHub on every request or when pulling a token that will be used in subsequent requests.
tokenDefines a static token that can be used on all requests. Only used with `static_token` as an authentication method (auth\_method).
invalid_token_errorDefines the HTTP error that is received when the token is invalid. Notifies the adapter to pull a new token and retry the request. Default is 401.
token_timeoutDefines how long a token is valid. Measured in milliseconds. Once a dynamic token is no longer valid, the adapter has to pull a new token. If the token_timeout is set to -1, the adapter will pull a token on every request to GitHub. If the timeout_token is 0, the adapter will use the expiration from the token response to determine when the token is no longer valid.
token_cacheUsed to determine where the token should be stored (local memory or in Redis).
auth_fieldDefines the request field the authentication (e.g., token are basic auth credentials) needs to be placed in order for the calls to work.
auth_field_formatDefines the format of the auth\_field. See examples below. Items enclosed in {} inform the adapter to perofrm an action prior to sending the data. It may be to replace the item with a value or it may be to encode the item.
auth_loggingSetting this true will add some additional logs but this should only be done when trying to debug an issue as certain credential information may be logged out when this is true.
client_idProvide a client id when needed, this is common on some types of OAuth.
client_secretProvide a client secret when needed, this is common on some types of OAuth.
grant_typeProvide a grant type when needed, this is common on some types of OAuth.

Examples of authentication field format

"{token}"
"Token {token}"
"{username}:{password}"
"Basic {b64}{username}:{password}{/b64}"

Healthcheck Properties

The healthcheck properties defines the API that runs the healthcheck to tell the adapter that it can reach GitHub. There are currently three types of healthchecks.

  • None - Not recommended. Adapter will not run a healthcheck. Consequently, unable to determine before making a request if the adapter can reach GitHub.
  • Startup - Adapter will check for connectivity when the adapter initially comes up, but it will not check afterwards.
  • Intermittent - Adapter will check connectivity to GitHub at a frequency defined in the frequency property.
PropertyDescription
typeRequired. The type of health check to run.
frequencyRequired if intermittent. Defines how often the health check should run. Measured in milliseconds. Default is 300000.
query_objectQuery parameters to be added to the adapter healthcheck call.

Request Properties

The request section defines properties to help handle requests.

PropertyDescription
number_redirectsOptional. Tells the adapter that the request may be redirected and gives it a maximum number of redirects to allow before returning an error. Default is 0 - no redirects.
number_retriesTells the adapter how many times to retry a request that has either aborted or reached a limit error before giving up and returning an error.
limit_retry_errorOptional. Can be either an integer or an array. Indicates the http error status number to define that no capacity was available and, after waiting a short interval, the adapter can retry the request. If an array is provvided, the array can contain integers or strings. Strings in the array are used to define ranges (e.g. "502-506"). Default is [0].
failover_codesAn array of error codes for which the adapter will send back a failover flag to IAP so that the Platform can attempt the action in another adapter.
attempt_timeoutOptional. Tells how long the adapter should wait before aborting the attempt. On abort, the adapter will do one of two things: 1) return the error; or 2) if **healthcheck\_on\_timeout** is set to true, it will abort the request and run a Healthcheck until it re-establishes connectivity to GitHub, and then will re-attempt the request that aborted. Default is 5000 milliseconds.
global_requestOptional. This is information that the adapter can include in all requests to the other system. This is easier to define and maintain than adding this information in either the code (adapter.js) or the action files.
global_request -> payloadOptional. Defines any information that should be included on all requests sent to the other system that have a payload/body.
global_request -> uriOptionsOptional. Defines any information that should be sent as untranslated query options (e.g. page, size) on all requests to the other system.
global_request -> addlHeadersOptioonal. Defines any headers that should be sent on all requests to the other system.
global_request -> authDataOptional. Defines any additional authentication data used to authentice with the other system. This authData needs to be consistent on every request.
healthcheck_on_timeoutRequired. Defines if the adapter should run a health check on timeout. If set to true, the adapter will abort the request and run a health check until it re-establishes connectivity and then it will re-attempt the request.
return_rawOptional. Tells the adapter whether the raw response should be returned as well as the IAP response. This is helpful when running integration tests to save mock data. It does add overhead to the response object so it is not ideal from production.
archivingOptional flag. Default is false. It archives the request, the results and the various times (wait time, GitHub time and overall time) in the `adapterid_results` collection in MongoDB. Although archiving might be desirable, be sure to develop a strategy before enabling this capability. Consider how much to archive and what strategy to use for cleaning up the collection in the database so that it does not become too large, especially if the responses are large.
return_requestOptional flag. Default is false. Will return the actual request that is made including headers. This should only be used during debugging issues as there could be credentials in the actual request.

SSL Properties

The SSL section defines the properties utilized for ssl authentication with GitHub. SSL can work two different ways: set the accept\_invalid\_certs flag to true (only recommended for lab environments), or provide a ca\_file.

PropertyDescription
enabledIf SSL is required, set to true.
accept_invalid_certsDefines if the adapter should accept invalid certificates (only recommended for lab environments). Required if SSL is enabled. Default is false.
ca_fileDefines the path name to the CA file used for SSL. If SSL is enabled and the accept invalid certifications is false, then ca_file is required.
key_fileDefines the path name to the Key file used for SSL. The key_file may be needed for some systems but it is not required for SSL.
cert_fileDefines the path name to the Certificate file used for SSL. The cert_file may be needed for some systems but it is not required for SSL.
secure_protocolDefines the protocol (e.g., SSLv3_method) to use on the SSL request.
ciphersRequired if SSL enabled. Specifies a list of SSL ciphers to use.
ecdhCurveDuring testing on some Node 8 environments, you need to set `ecdhCurve` to auto. If you do not, you will receive PROTO errors when attempting the calls. This is the only usage of this property and to our knowledge it only impacts Node 8 and 9.

Throttle Properties

The throttle section is used when requests to GitHub must be queued (throttled). All of the properties in this section are optional.

PropertyDescription
throttle_enabledDefault is false. Defines if the adapter should use throttling or not.
number_pronghornsDefault is 1. Defines if throttling is done in a single Itential instance or whether requests are being throttled across multiple Itential instances (minimum = 1, maximum = 20). Throttling in a single Itential instance uses an in-memory queue so there is less overhead. Throttling across multiple Itential instances requires placing the request and queue information into a shared resource (e.g. database) so that each instance can determine what is running and what is next to run. Throttling across multiple instances requires additional I/O overhead.
sync-asyncThis property is not used at the current time (it is for future expansion of the throttling engine).
max_in_queueRepresents the maximum number of requests the adapter should allow into the queue before rejecting requests (minimum = 1, maximum = 5000). This is not a limit on what the adapter can handle but more about timely responses to requests. The default is currently 1000.
concurrent_maxDefines the number of requests the adapter can send to GitHub at one time (minimum = 1, maximum = 1000). The default is 1 meaning each request must be sent to GitHub in a serial manner.
expire_timeoutDefault is 0. Defines a graceful timeout of the request session. After a request has completed, the adapter will wait additional time prior to sending the next request. Measured in milliseconds (minimum = 0, maximum = 60000).
average_runtimeRepresents the approximate average of how long it takes GitHub to handle each request. Measured in milliseconds (minimum = 50, maximum = 60000). Default is 200. This metric has performance implications. If the runtime number is set too low, it puts extra burden on the CPU and memory as the requests will continually try to run. If the runtime number is set too high, requests may wait longer than they need to before running. The number does not need to be exact but your throttling strategy depends heavily on this number being within reason. If averages range from 50 to 250 milliseconds you might pick an average run-time somewhere in the middle so that when GitHub performance is exceptional you might run a little slower than you might like, but when it is poor you still run efficiently.
prioritiesAn array of priorities and how to handle them in relation to the throttle queue. Array of objects that include priority value and percent of queue to put the item ex { value: 1, percent: 10 }

Proxy Properties

The proxy section defines the properties to utilize when GitHub is behind a proxy server.

PropertyDescription
enabledRequired. Default is false. If GitHub is behind a proxy server, set enabled flag to true.
hostHost information for the proxy server. Required if `enabled` is true.
portPort information for the proxy server. Required if `enabled` is true.
protocolThe protocol (i.e., http, https, etc.) used to connect to the proxy. Default is http.
usernameIf there is authentication for the proxy, provide the username here.
passwordIf there is authentication for the proxy, provide the password here.

Mongo Properties

The mongo section defines the properties used to connect to a Mongo database. Mongo can be used for throttling as well as to persist metric data. If not provided, metrics will be stored in the file system.

PropertyDescription
hostOptional. Host information for the mongo server.
portOptional. Port information for the mongo server.
databaseOptional. The database for the adapter to use for its data.
usernameOptional. If credentials are required to access mongo, this is the user to login as.
passwordOptional. If credentials are required to access mongo, this is the password to login with.
replSetOptional. If the database is set up to use replica sets, define it here so it can be added to the database connection.
db_sslOptional. Contains information for SSL connectivity to the database.
db_ssl -> enabledIf SSL is required, set to true.
db_ssl -> accept_invalid_certDefines if the adapter should accept invalid certificates (only recommended for lab environments). Required if SSL is enabled. Default is false.
db_ssl -> ca_fileDefines the path name to the CA file used for SSL. If SSL is enabled and the accept invalid certifications is false, then ca_file is required.
db_ssl -> key_fileDefines the path name to the Key file used for SSL. The key_file may be needed for some systems but it is not required for SSL.
db_ssl -> cert_fileDefines the path name to the Certificate file used for SSL. The cert_file may be needed for some systems but it is not required for SSL.

Device Broker Properties

The device broker section defines the properties used integrate GitHub to the device broker. Each broker call is represented and has an array of calls that can be used to build the response. This describes the calls and then the fields which are available in the calls.

PropertyDescription
getDeviceThe array of calls used to get device details for the broker
getDevicesFilteredThe array of calls used to get devices for the broker
isAliveThe array of calls used to get device status for the broker
getConfigThe array of calls used to get device configuration for the broker
getCountThe array of calls used to get device configuration for the broker
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> pathThe path, not including the base_path and version, for making this call
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> methodThe rest method for making this call
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> queryQuery object containing and query parameters and their values for this call
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> bodyBody object containing the payload for this call
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> headersHeader object containing the headers for this call.
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> handleFailureTells the adapter whether to "fail" or "ignore" failures if they occur.
isAlive -> statusValueTells the adapter what value to look for in the status field to determine if the device is alive.
getDevice/getDevicesFiltered/isAlive/getConfig -> requestFieldsObject containing fields the adapter should send on the request and where it should get the data. The where can be from a response to a getDevicesFiltered or a static value.
getDevice/getDevicesFiltered/isAlive/getConfig -> responseFieldsObject containing fields the adapter should set to send back to iap and where the value should come from in the response or request data.

Using this Adapter

The adapter.js file contains the calls the adapter makes available to the rest of the Itential Platform. The API detailed for these calls should be available through JSDOC. The following is a brief summary of the calls.

Generic Adapter Calls

These are adapter methods that IAP or you might use. There are some other methods not shown here that might be used for internal adapter functionality.

Method SignatureDescriptionWorkflow?
connect()This call is run when the Adapter is first loaded by he Itential Platform. It validates the properties have been provided correctly.No
healthCheck(callback)This call ensures that the adapter can communicate with Adapter for GitHub System. The actual call that is used is defined in the adapter properties and .system entities action.json file.No
refreshProperties(properties)This call provides the adapter the ability to accept property changes without having to restart the adapter.No
encryptProperty(property, technique, callback)This call will take the provided property and technique, and return the property encrypted with the technique. This allows the property to be used in the adapterProps section for the credential password so that the password does not have to be in clear text. The adapter will decrypt the property as needed for communications with Adapter for GitHub System.No
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback)This call provides the ability to update the adapter configuration from IAP - includes actions, schema, mockdata and other configurations.Yes
iapSuspendAdapter(mode, callback)This call provides the ability to suspend the adapter and either have requests rejected or put into a queue to be processed after the adapter is resumed.Yes
iapUnsuspendAdapter(callback)This call provides the ability to resume a suspended adapter. Any requests in queue will be processed before new requests.Yes
iapGetAdapterQueue(callback)This call will return the requests that are waiting in the queue if throttling is enabled.Yes
iapFindAdapterPath(apiPath, callback)This call provides the ability to see if a particular API path is supported by the adapter.Yes
iapTroubleshootAdapter(props, persistFlag, adapter, callback)This call can be used to check on the performance of the adapter - it checks connectivity, healthcheck and basic get calls.Yes
iapRunAdapterHealthcheck(adapter, callback)This call will return the results of a healthcheck.Yes
iapRunAdapterConnectivity(callback)This call will return the results of a connectivity check.Yes
iapRunAdapterBasicGet(callback)This call will return the results of running basic get API calls.Yes
iapMoveAdapterEntitiesToDB(callback)This call will push the adapter configuration from the entities directory into the Adapter or IAP Database.Yes
iapDeactivateTasks(tasks, callback)This call provides the ability to remove tasks from the adapter.Yes
iapActivateTasks(tasks, callback)This call provides the ability to add deactivated tasks back into the adapter.Yes
iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback)This is an expanded Generic Call. The metadata object allows us to provide many new capabilities within the generic request.Yes
genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback)This call allows you to provide the path to have the adapter call. It is an easy way to incorporate paths that have not been built into the adapter yet.Yes
genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback)This call is the same as the genericAdapterRequest only it does not add a base_path or version to the call.Yes
iapRunAdapterLint(callback)Runs lint on the addapter and provides the information back.Yes
iapRunAdapterTests(callback)Runs baseunit and unit tests on the adapter and provides the information back.Yes
iapGetAdapterInventory(callback)This call provides some inventory related information about the adapter.Yes

Adapter Cache Calls

These are adapter methods that are used for adapter caching. If configured, the adapter will cache based on the interval provided. However, you can force a population of the cache manually as well.

Method SignatureDescriptionWorkflow?
iapPopulateEntityCache(entityTypes, callback)This call populates the adapter cache.Yes
iapRetrieveEntitiesCache(entityType, options, callback)This call retrieves the specific items from the adapter cache.Yes

Adapter Broker Calls

These are adapter methods that are used to integrate to IAP Brokers. This adapter currently supports the following broker calls.

Method SignatureDescriptionWorkflow?
hasEntities(entityType, entityList, callback)This call is utilized by the IAP Device Broker to determine if the adapter has a specific entity and item of the entity.No
getDevice(deviceName, callback)This call returns the details of the requested device.No
getDevicesFiltered(options, callback)This call returns the list of devices that match the criteria provided in the options filter.No
isAlive(deviceName, callback)This call returns whether the device status is activeNo
getConfig(deviceName, format, callback)This call returns the configuration for the selected device.No
iapGetDeviceCount(callback)This call returns the count of devices.No

Specific Adapter Calls

Specific adapter calls are built based on the API of the GitHub System. The Adapter Builder creates the proper method comments for generating JS-DOC for the adapter. This is the best way to get information on the calls.

Method SignatureDescriptionPathWorkflow?
getEmojis(callback)Lists all the emojis available to use on GitHub.{base_path}/{version}/emojis?{query}Yes
getEvents(callback)List public events.{base_path}/{version}/events?{query}Yes
getFeeds(callback)List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user.{base_path}/{version}/feeds?{query}Yes
getGists(since, callback)List the authenticated user's gists or if called anonymously, this will return all public gists.{base_path}/{version}/gists?{query}Yes
postGists(body, callback)Create a gist.{base_path}/{version}/gists?{query}Yes
getGistsPublic(since, callback)List all public gists.{base_path}/{version}/gists/public?{query}Yes
getGistsStarred(since, callback)List the authenticated user's starred gists.{base_path}/{version}/gists/starred?{query}Yes
deleteGistsId(id, callback)Delete a gist.{base_path}/{version}/gists/{pathv1}?{query}Yes
getGistsId(id, callback)Get a single gist.{base_path}/{version}/gists/{pathv1}?{query}Yes
patchGistsId(id, body, callback)Edit a gist.{base_path}/{version}/gists/{pathv1}?{query}Yes
getGistsIdComments(id, callback)List comments on a gist.{base_path}/{version}/gists/{pathv1}/comments?{query}Yes
postGistsIdComments(id, body, callback)Create a commen{base_path}/{version}/gists/{pathv1}/comments?{query}Yes
deleteGistsIdCommentsCommentId(id, commentId, callback)Delete a comment.{base_path}/{version}/gists/{pathv1}/comments/{pathv2}?{query}Yes
getGistsIdCommentsCommentId(id, commentId, callback)Get a single comment.{base_path}/{version}/gists/{pathv1}/comments/{pathv2}?{query}Yes
patchGistsIdCommentsCommentId(id, commentId, body, callback)Edit a comment.{base_path}/{version}/gists/{pathv1}/comments/{pathv2}?{query}Yes
postGistsIdForks(id, callback)Fork a gist.{base_path}/{version}/gists/{pathv1}/forks?{query}Yes
deleteGistsIdStar(id, callback)Unstar a gist.{base_path}/{version}/gists/{pathv1}/star?{query}Yes
getGistsIdStar(id, callback)Check if a gist is starred.{base_path}/{version}/gists/{pathv1}/star?{query}Yes
putGistsIdStar(id, callback)Star a gist.{base_path}/{version}/gists/{pathv1}/star?{query}Yes
getGitignoreTemplates(callback)Listing available templates. List all templates available to pass as an option when creating a repository.{base_path}/{version}/gitignore/templates?{query}Yes
getGitignoreTemplatesLanguage(language, callback)Get a single template.{base_path}/{version}/gitignore/templates/{pathv1}?{query}Yes
getIssues(filter = 'assigned', state = 'open', labels, sort = 'created', direction = 'asc', since, callback)List issues. List all issues across all the authenticated user's visible repositories.{base_path}/{version}/issues?{query}Yes
getLegacyIssuesSearchOwnerRepositoryStateKeyword(keyword, state = 'open', owner, repository, callback)Find issues by state and keyword.{base_path}/{version}/legacy/issues/search/{pathv1}/{pathv2}/{pathv3}/{pathv4}?{query}Yes
getLegacyReposSearchKeyword(keyword, order = 'desc', language, startPage, sort = 'updated', callback)Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter.{base_path}/{version}/legacy/repos/search/{pathv1}?{query}Yes
getLegacyUserEmailEmail(email, callback)This API call is added for compatibility reasons only.{base_path}/{version}/legacy/user/email/{pathv1}?{query}Yes
getLegacyUserSearchKeyword(keyword, order = 'desc', startPage, sort = 'updated', callback)Find users by keyword.{base_path}/{version}/legacy/user/search/{pathv1}?{query}Yes
postMarkdown(body, callback)Render an arbitrary Markdown document{base_path}/{version}/markdown?{query}Yes
postMarkdownRaw(callback)Render a Markdown document in raw mode{base_path}/{version}/markdown/raw?{query}Yes
getMeta(callback)This gives some information about GitHub.com, the service.{base_path}/{version}/meta?{query}Yes
getNetworksOwnerRepoEvents(owner, repo, callback)List public events for a network of repositories.{base_path}/{version}/networks/{pathv1}/{pathv2}/events?{query}Yes
getNotifications(all, participating, since, callback)List your notifications. List all notifications for the current user, grouped by repository.{base_path}/{version}/notifications?{query}Yes
putNotifications(body, callback)Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com.{base_path}/{version}/notifications?{query}Yes
getNotificationsThreadsId(id, callback)View a single thread.{base_path}/{version}/notifications/threads/{pathv1}?{query}Yes
patchNotificationsThreadsId(id, callback)Mark a thread as read{base_path}/{version}/notifications/threads/{pathv1}?{query}Yes
deleteNotificationsThreadsIdSubscription(id, callback)Delete a Thread Subscription.{base_path}/{version}/notifications/threads/{pathv1}/subscription?{query}Yes
getNotificationsThreadsIdSubscription(id, callback)Get a Thread Subscription.{base_path}/{version}/notifications/threads/{pathv1}/subscription?{query}Yes
putNotificationsThreadsIdSubscription(id, body, callback)Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned).{base_path}/{version}/notifications/threads/{pathv1}/subscription?{query}Yes
getOrgsOrg(org, callback)Get an Organization.{base_path}/{version}/orgs/{pathv1}?{query}Yes
patchOrgsOrg(org, body, callback)Edit an Organization.{base_path}/{version}/orgs/{pathv1}?{query}Yes
getOrgsOrgEvents(org, callback)List public events for an organization.{base_path}/{version}/orgs/{pathv1}/events?{query}Yes
getOrgsOrgIssues(org, filter = 'assigned', state = 'open', labels, sort = 'created', direction = 'asc', since, callback)List issues. List all issues for a given organization for the authenticated user.{base_path}/{version}/orgs/{pathv1}/issues?{query}Yes
getOrgsOrgMembers(org, callback)Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list.{base_path}/{version}/orgs/{pathv1}/members?{query}Yes
deleteOrgsOrgMembersUsername(org, username, callback)Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories.{base_path}/{version}/orgs/{pathv1}/members/{pathv2}?{query}Yes
getOrgsOrgMembersUsername(org, username, callback)Check if a user is, publicly or privately, a member of the organization.{base_path}/{version}/orgs/{pathv1}/members/{pathv2}?{query}Yes
getOrgsOrgPublicMembers(org, callback)Public members list. Members of an organization can choose to have their membership publicized or not.{base_path}/{version}/orgs/{pathv1}/public_members?{query}Yes
deleteOrgsOrgPublicMembersUsername(org, username, callback)Conceal a user's membership.{base_path}/{version}/orgs/{pathv1}/public_members/{pathv2}?{query}Yes
getOrgsOrgPublicMembersUsername(org, username, callback)Check public membership.{base_path}/{version}/orgs/{pathv1}/public_members/{pathv2}?{query}Yes
putOrgsOrgPublicMembersUsername(org, username, callback)Publicize a user's membership.{base_path}/{version}/orgs/{pathv1}/public_members/{pathv2}?{query}Yes
getOrgsOrgRepos(org, type = 'all', callback)List repositories for the specified org.{base_path}/{version}/orgs/{pathv1}/repos?{query}Yes
postOrgsOrgRepos(org, body, callback)Create a new repository for the authenticated user. OAuth users must supply repo scope.{base_path}/{version}/orgs/{pathv1}/repos?{query}Yes
getOrgsOrgTeams(org, callback)List teams.{base_path}/{version}/orgs/{pathv1}/teams?{query}Yes
postOrgsOrgTeams(org, body, callback)Create team. In order to create a team, the authenticated user must be an owner of organization.{base_path}/{version}/orgs/{pathv1}/teams?{query}Yes
getRateLimit(callback)Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit.{base_path}/{version}/rate_limit?{query}Yes
deleteReposOwnerRepo(owner, repo, callback)Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required.{base_path}/{version}/repos/{pathv1}/{pathv2}?{query}Yes
getReposOwnerRepo(owner, repo, callback)Get repository.{base_path}/{version}/repos/{pathv1}/{pathv2}?{query}Yes
patchReposOwnerRepo(owner, repo, body, callback)Edit repository.{base_path}/{version}/repos/{pathv1}/{pathv2}?{query}Yes
getReposOwnerRepoAssignees(owner, repo, callback)List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned.{base_path}/{version}/repos/{pathv1}/{pathv2}/assignees?{query}Yes
getReposOwnerRepoAssigneesAssignee(owner, repo, assignee, callback)Check assignee. You may also check to see if a particular user is an assignee for a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/assignees/{pathv3}?{query}Yes
getReposOwnerRepoBranches(owner, repo, callback)Get list of branches{base_path}/{version}/repos/{pathv1}/{pathv2}/branches?{query}Yes
getReposOwnerRepoBranchesBranch(owner, repo, branch, callback)Get Branch{base_path}/{version}/repos/{pathv1}/{pathv2}/branches/{pathv3}?{query}Yes
getReposOwnerRepoCollaborators(owner, repo, callback)List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list.{base_path}/{version}/repos/{pathv1}/{pathv2}/collaborators?{query}Yes
deleteReposOwnerRepoCollaboratorsUser(owner, repo, user, callback)Remove collaborator.{base_path}/{version}/repos/{pathv1}/{pathv2}/collaborators/{pathv3}?{query}Yes
getReposOwnerRepoCollaboratorsUser(owner, repo, user, callback)Check if user is a collaborator{base_path}/{version}/repos/{pathv1}/{pathv2}/collaborators/{pathv3}?{query}Yes
putReposOwnerRepoCollaboratorsUser(owner, repo, user, callback)Add collaborator.{base_path}/{version}/repos/{pathv1}/{pathv2}/collaborators/{pathv3}?{query}Yes
getReposOwnerRepoComments(owner, repo, callback)List commit comments for a repository. Comments are ordered by ascending ID.{base_path}/{version}/repos/{pathv1}/{pathv2}/comments?{query}Yes
deleteReposOwnerRepoCommentsCommentId(owner, repo, commentId, callback)Delete a commit comment{base_path}/{version}/repos/{pathv1}/{pathv2}/comments/{pathv3}?{query}Yes
getReposOwnerRepoCommentsCommentId(owner, repo, commentId, callback)Get a single commit comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/comments/{pathv3}?{query}Yes
patchReposOwnerRepoCommentsCommentId(owner, repo, commentId, body, callback)Update a commit comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/comments/{pathv3}?{query}Yes
getReposOwnerRepoCommits(owner, repo, since, sha, pathParam, author, until, callback)List commits on a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/commits?{query}Yes
getReposOwnerRepoCommitsRefStatus(owner, repo, ref, callback)Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json{base_path}/{version}/repos/{pathv1}/{pathv2}/commits/{pathv3}/status?{query}Yes
getReposOwnerRepoCommitsShaCode(owner, repo, shaCode, callback)Get a single commit.{base_path}/{version}/repos/{pathv1}/{pathv2}/commits/{pathv3}?{query}Yes
getReposOwnerRepoCommitsShaCodeComments(owner, repo, shaCode, callback)List comments for a single commitList comments for a single commit.{base_path}/{version}/repos/{pathv1}/{pathv2}/commits/{pathv3}/comments?{query}Yes
postReposOwnerRepoCommitsShaCodeComments(owner, repo, shaCode, body, callback)Create a commit comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/commits/{pathv3}/comments?{query}Yes
getReposOwnerRepoCompareBaseIdHeadId(owner, repo, baseId, headId, callback)Compare two commits{base_path}/{version}/repos/{pathv1}/{pathv2}/compare/{pathv3}...{pathv4}?{query}Yes
deleteReposOwnerRepoContentsPath(owner, repo, pathParam, body, callback)Delete a file. This method deletes a file in a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/contents/{pathv3}?{query}Yes
getReposOwnerRepoContentsPath(owner, repo, pathParam, pathParamQuery, ref, callback)Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/"{base_path}/{version}/repos/{pathv1}/{pathv2}/contents/{pathv3}?{query}Yes
putReposOwnerRepoContentsPath(owner, repo, pathParam, body, callback)Create a file.{base_path}/{version}/repos/{pathv1}/{pathv2}/contents/{pathv3}?{query}Yes
getReposOwnerRepoContributors(owner, repo, anon, callback)Get list of contributors.{base_path}/{version}/repos/{pathv1}/{pathv2}/contributors?{query}Yes
getReposOwnerRepoDeployments(owner, repo, callback)Users with pull access can view deployments for a repository{base_path}/{version}/repos/{pathv1}/{pathv2}/deployments?{query}Yes
postReposOwnerRepoDeployments(owner, repo, body, callback)Users with push access can create a deployment for a given ref{base_path}/{version}/repos/{pathv1}/{pathv2}/deployments?{query}Yes
getReposOwnerRepoDeploymentsIdStatuses(owner, repo, id, callback)Users with pull access can view deployment statuses for a deployment{base_path}/{version}/repos/{pathv1}/{pathv2}/deployments/{pathv3}/statuses?{query}Yes
postReposOwnerRepoDeploymentsIdStatuses(owner, repo, id, body, callback)Create a Deployment Status Users with push access can create deployment statuses for a given deployment:{base_path}/{version}/repos/{pathv1}/{pathv2}/deployments/{pathv3}/statuses?{query}Yes
getReposOwnerRepoDownloads(owner, repo, callback)Deprecated. List downloads for a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/downloads?{query}Yes
deleteReposOwnerRepoDownloadsDownloadId(owner, repo, downloadId, callback)Deprecated. Delete a download.{base_path}/{version}/repos/{pathv1}/{pathv2}/downloads/{pathv3}?{query}Yes
getReposOwnerRepoDownloadsDownloadId(owner, repo, downloadId, callback)Deprecated. Get a single download.{base_path}/{version}/repos/{pathv1}/{pathv2}/downloads/{pathv3}?{query}Yes
getReposOwnerRepoEvents(owner, repo, callback)Get list of repository events.{base_path}/{version}/repos/{pathv1}/{pathv2}/events?{query}Yes
getReposOwnerRepoForks(owner, repo, sort = 'newes', callback)List forks.{base_path}/{version}/repos/{pathv1}/{pathv2}/forks?{query}Yes
postReposOwnerRepoForks(owner, repo, body, callback)Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support.{base_path}/{version}/repos/{pathv1}/{pathv2}/forks?{query}Yes
postReposOwnerRepoGitBlobs(owner, repo, body, callback)Create a Blob.{base_path}/{version}/repos/{pathv1}/{pathv2}/git/blobs?{query}Yes
getReposOwnerRepoGitBlobsShaCode(owner, repo, shaCode, callback)Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it.{base_path}/{version}/repos/{pathv1}/{pathv2}/git/blobs/{pathv3}?{query}Yes
postReposOwnerRepoGitCommits(owner, repo, body, callback)Create a Commit.{base_path}/{version}/repos/{pathv1}/{pathv2}/git/commits?{query}Yes
getReposOwnerRepoGitCommitsShaCode(owner, repo, shaCode, callback)Get a Commit.{base_path}/{version}/repos/{pathv1}/{pathv2}/git/commits/{pathv3}?{query}Yes
getReposOwnerRepoGitRefs(owner, repo, callback)Get all References{base_path}/{version}/repos/{pathv1}/{pathv2}/git/refs?{query}Yes
postReposOwnerRepoGitRefs(owner, repo, body, callback)Create a Reference{base_path}/{version}/repos/{pathv1}/{pathv2}/git/refs?{query}Yes
deleteReposOwnerRepoGitRefsRef(owner, repo, ref, callback)Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0{base_path}/{version}/repos/{pathv1}/{pathv2}/git/refs/{pathv3}?{query}Yes
getReposOwnerRepoGitMatchingRefs(owner, repo, ref, callback)Get all Matching References{base_path}/{version}/repos/{pathv1}/{pathv2}/git/matching-refs/{pathv3}?{query}Yes
getReposOwnerRepoGitRefsRef(owner, repo, ref, callback)Get a Reference{base_path}/{version}/repos/{pathv1}/{pathv2}/git/refs/{pathv3}?{query}Yes
patchReposOwnerRepoGitRefsRef(owner, repo, ref, body, callback)Update a Reference{base_path}/{version}/repos/{pathv1}/{pathv2}/git/refs/{pathv3}?{query}Yes
postReposOwnerRepoGitTags(owner, repo, body, callback)Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary.{base_path}/{version}/repos/{pathv1}/{pathv2}/git/tags?{query}Yes
getReposOwnerRepoGitTagsShaCode(owner, repo, shaCode, callback)Get a Tag.{base_path}/{version}/repos/{pathv1}/{pathv2}/git/tags/{pathv3}?{query}Yes
postReposOwnerRepoGitTrees(owner, repo, body, callback)Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out.{base_path}/{version}/repos/{pathv1}/{pathv2}/git/trees?{query}Yes
getReposOwnerRepoGitTreesShaCode(owner, repo, shaCode, recursive, callback)Get a Tree.{base_path}/{version}/repos/{pathv1}/{pathv2}/git/trees/{pathv3}?{query}Yes
getReposOwnerRepoHooks(owner, repo, callback)Get list of hooks.{base_path}/{version}/repos/{pathv1}/{pathv2}/hooks?{query}Yes
postReposOwnerRepoHooks(owner, repo, body, callback)Create a hook.{base_path}/{version}/repos/{pathv1}/{pathv2}/hooks?{query}Yes
deleteReposOwnerRepoHooksHookId(owner, repo, hookId, callback)Delete a hook.{base_path}/{version}/repos/{pathv1}/{pathv2}/hooks/{pathv3}?{query}Yes
getReposOwnerRepoHooksHookId(owner, repo, hookId, callback)Get single hook.{base_path}/{version}/repos/{pathv1}/{pathv2}/hooks/{pathv3}?{query}Yes
patchReposOwnerRepoHooksHookId(owner, repo, hookId, body, callback)Edit a hook.{base_path}/{version}/repos/{pathv1}/{pathv2}/hooks/{pathv3}?{query}Yes
postReposOwnerRepoHooksHookIdTests(owner, repo, hookId, callback)Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes{base_path}/{version}/repos/{pathv1}/{pathv2}/hooks/{pathv3}/tests?{query}Yes
getReposOwnerRepoIssues(owner, repo, filter = 'assigned', state = 'open', labels, sort = 'created', direction = 'asc', since, callback)List issues for a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues?{query}Yes
postReposOwnerRepoIssues(owner, repo, body, callback)Create an issue. Any user with pull access to a repository can create an issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues?{query}Yes
getReposOwnerRepoIssuesComments(owner, repo, direction, sort = 'created', since, callback)List comments in a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/comments?{query}Yes
deleteReposOwnerRepoIssuesCommentsCommentId(owner, repo, commentId, callback)Delete a comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/comments/{pathv3}?{query}Yes
getReposOwnerRepoIssuesCommentsCommentId(owner, repo, commentId, callback)Get a single comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/comments/{pathv3}?{query}Yes
patchReposOwnerRepoIssuesCommentsCommentId(owner, repo, commentId, body, callback)Edit a comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/comments/{pathv3}?{query}Yes
getReposOwnerRepoIssuesEvents(owner, repo, callback)List issue events for a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/events?{query}Yes
getReposOwnerRepoIssuesEventsEventId(owner, repo, eventId, callback)Get a single event.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/events/{pathv3}?{query}Yes
getReposOwnerRepoIssuesNumber(owner, repo, number, callback)Get a single issue{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}?{query}Yes
patchReposOwnerRepoIssuesNumber(owner, repo, number, body, callback)Edit an issue. Issue owners and users with push access can edit an issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}?{query}Yes
getReposOwnerRepoIssuesNumberComments(owner, repo, number, callback)List comments on an issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}/comments?{query}Yes
postReposOwnerRepoIssuesNumberComments(owner, repo, number, body, callback)Create a comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}/comments?{query}Yes
getReposOwnerRepoIssuesNumberEvents(owner, repo, number, callback)List events for an issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}/events?{query}Yes
deleteReposOwnerRepoIssuesNumberLabels(owner, repo, number, callback)Remove all labels from an issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}/labels?{query}Yes
getReposOwnerRepoIssuesNumberLabels(owner, repo, number, callback)List labels on an issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}/labels?{query}Yes
postReposOwnerRepoIssuesNumberLabels(owner, repo, number, body, callback)Add labels to an issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}/labels?{query}Yes
putReposOwnerRepoIssuesNumberLabels(owner, repo, number, body, callback)Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}/labels?{query}Yes
deleteReposOwnerRepoIssuesNumberLabelsName(owner, repo, number, name, callback)Remove a label from an issue.{base_path}/{version}/repos/{pathv1}/{pathv2}/issues/{pathv3}/labels/{pathv4}?{query}Yes
getReposOwnerRepoKeys(owner, repo, callback)Get list of keys.{base_path}/{version}/repos/{pathv1}/{pathv2}/keys?{query}Yes
postReposOwnerRepoKeys(owner, repo, body, callback)Create a key.{base_path}/{version}/repos/{pathv1}/{pathv2}/keys?{query}Yes
deleteReposOwnerRepoKeysKeyId(owner, repo, keyId, callback)Delete a key.{base_path}/{version}/repos/{pathv1}/{pathv2}/keys/{pathv3}?{query}Yes
getReposOwnerRepoKeysKeyId(owner, repo, keyId, callback)Get a key{base_path}/{version}/repos/{pathv1}/{pathv2}/keys/{pathv3}?{query}Yes
getReposOwnerRepoLabels(owner, repo, callback)List all labels for this repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/labels?{query}Yes
postReposOwnerRepoLabels(owner, repo, body, callback)Create a label.{base_path}/{version}/repos/{pathv1}/{pathv2}/labels?{query}Yes
deleteReposOwnerRepoLabelsName(owner, repo, name, callback)Delete a label.{base_path}/{version}/repos/{pathv1}/{pathv2}/labels/{pathv3}?{query}Yes
getReposOwnerRepoLabelsName(owner, repo, name, callback)Get a single label.{base_path}/{version}/repos/{pathv1}/{pathv2}/labels/{pathv3}?{query}Yes
patchReposOwnerRepoLabelsName(owner, repo, name, body, callback)Update a label.{base_path}/{version}/repos/{pathv1}/{pathv2}/labels/{pathv3}?{query}Yes
getReposOwnerRepoLanguages(owner, repo, callback)List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language.{base_path}/{version}/repos/{pathv1}/{pathv2}/languages?{query}Yes
postReposOwnerRepoMerges(owner, repo, body, callback)Perform a merge.{base_path}/{version}/repos/{pathv1}/{pathv2}/merges?{query}Yes
getReposOwnerRepoMilestones(owner, repo, state = 'open', direction, sort = 'due_date', callback)List milestones for a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/milestones?{query}Yes
postReposOwnerRepoMilestones(owner, repo, body, callback)Create a milestone.{base_path}/{version}/repos/{pathv1}/{pathv2}/milestones?{query}Yes
deleteReposOwnerRepoMilestonesNumber(owner, repo, number, callback)Delete a milestone.{base_path}/{version}/repos/{pathv1}/{pathv2}/milestones/{pathv3}?{query}Yes
getReposOwnerRepoMilestonesNumber(owner, repo, number, callback)Get a single milestone.{base_path}/{version}/repos/{pathv1}/{pathv2}/milestones/{pathv3}?{query}Yes
patchReposOwnerRepoMilestonesNumber(owner, repo, number, body, callback)Update a milestone.{base_path}/{version}/repos/{pathv1}/{pathv2}/milestones/{pathv3}?{query}Yes
getReposOwnerRepoMilestonesNumberLabels(owner, repo, number, callback)Get labels for every issue in a milestone.{base_path}/{version}/repos/{pathv1}/{pathv2}/milestones/{pathv3}/labels?{query}Yes
getReposOwnerRepoNotifications(owner, repo, all, participating, since, callback)List your notifications in a repository List all notifications for the current user.{base_path}/{version}/repos/{pathv1}/{pathv2}/notifications?{query}Yes
putReposOwnerRepoNotifications(owner, repo, body, callback)Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com.{base_path}/{version}/repos/{pathv1}/{pathv2}/notifications?{query}Yes
getReposOwnerRepoPulls(owner, repo, state = 'open', head, base, callback)List pull requests.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls?{query}Yes
postReposOwnerRepoPulls(owner, repo, body, callback)Create a pull request.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls?{query}Yes
getReposOwnerRepoPullsComments(owner, repo, direction, sort = 'created', since, callback)List comments in a repository. By default, Review Comments are ordered by ascending ID.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/comments?{query}Yes
deleteReposOwnerRepoPullsCommentsCommentId(owner, repo, commentId, callback)Delete a comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/comments/{pathv3}?{query}Yes
getReposOwnerRepoPullsCommentsCommentId(owner, repo, commentId, callback)Get a single comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/comments/{pathv3}?{query}Yes
patchReposOwnerRepoPullsCommentsCommentId(owner, repo, commentId, body, callback)Edit a comment.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/comments/{pathv3}?{query}Yes
getReposOwnerRepoPullsNumber(owner, repo, number, callback)Get a single pull request.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/{pathv3}?{query}Yes
patchReposOwnerRepoPullsNumber(owner, repo, number, body, callback)Update a pull request.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/{pathv3}?{query}Yes
getReposOwnerRepoPullsNumberComments(owner, repo, number, callback)List comments on a pull request.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/{pathv3}/comments?{query}Yes
postReposOwnerRepoPullsNumberComments(owner, repo, number, body, callback)Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this:
    body
       Required string
    in_reply_to
       Required number - Comment id to reply to.</td>
<td style="padding:15px">{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/{pathv3}/comments?{query}</td>
<td style="padding:15px">Yes</td>
getReposOwnerRepoPullsNumberCommits(owner, repo, number, callback)List commits on a pull request.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/{pathv3}/commits?{query}Yes
getReposOwnerRepoPullsNumberFiles(owner, repo, number, callback)List pull requests files.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/{pathv3}/files?{query}Yes
getReposOwnerRepoPullsNumberMerge(owner, repo, number, callback)Get if a pull request has been merged.{base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/{pathv3}/merge?{query}Yes
putReposOwnerRepoPullsNumberMerge(owner, repo, number, body, callback)Merge a pull request (Merge Button's){base_path}/{version}/repos/{pathv1}/{pathv2}/pulls/{pathv3}/merge?{query}Yes
getReposOwnerRepoReadme(owner, repo, ref, callback)Get the README. This method returns the preferred README for a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/readme?{query}Yes
getReposOwnerRepoReleases(owner, repo, callback)Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only{base_path}/{version}/repos/{pathv1}/{pathv2}/releases?{query}Yes
postReposOwnerRepoReleases(owner, repo, body, callback)Create a release Users with push access to the repository can create a release.{base_path}/{version}/repos/{pathv1}/{pathv2}/releases?{query}Yes
deleteReposOwnerRepoReleasesAssetsId(owner, repo, id, callback)Delete a release asset{base_path}/{version}/repos/{pathv1}/{pathv2}/releases/assets/{pathv3}?{query}Yes
getReposOwnerRepoReleasesAssetsId(owner, repo, id, callback)Get a single release asset{base_path}/{version}/repos/{pathv1}/{pathv2}/releases/assets/{pathv3}?{query}Yes
patchReposOwnerRepoReleasesAssetsId(owner, repo, id, body, callback)Edit a release asset Users with push access to the repository can edit a release asset.{base_path}/{version}/repos/{pathv1}/{pathv2}/releases/assets/{pathv3}?{query}Yes
deleteReposOwnerRepoReleasesId(owner, repo, id, callback)Users with push access to the repository can delete a release.{base_path}/{version}/repos/{pathv1}/{pathv2}/releases/{pathv3}?{query}Yes
getReposOwnerRepoReleasesId(owner, repo, id, callback)Get a single release{base_path}/{version}/repos/{pathv1}/{pathv2}/releases/{pathv3}?{query}Yes
patchReposOwnerRepoReleasesId(owner, repo, id, body, callback)Users with push access to the repository can edit a release{base_path}/{version}/repos/{pathv1}/{pathv2}/releases/{pathv3}?{query}Yes
getReposOwnerRepoReleasesIdAssets(owner, repo, id, callback)List assets for a release{base_path}/{version}/repos/{pathv1}/{pathv2}/releases/{pathv3}/assets?{query}Yes
getReposOwnerRepoStargazers(owner, repo, callback)List Stargazers.{base_path}/{version}/repos/{pathv1}/{pathv2}/stargazers?{query}Yes
getReposOwnerRepoStatsCodeFrequency(owner, repo, callback)Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository.{base_path}/{version}/repos/{pathv1}/{pathv2}/stats/code_frequency?{query}Yes
getReposOwnerRepoStatsCommitActivity(owner, repo, callback)Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday.{base_path}/{version}/repos/{pathv1}/{pathv2}/stats/commit_activity?{query}Yes
getReposOwnerRepoStatsContributors(owner, repo, callback)Get contributors list with additions, deletions, and commit counts.{base_path}/{version}/repos/{pathv1}/{pathv2}/stats/contributors?{query}Yes
getReposOwnerRepoStatsParticipation(owner, repo, callback)Get the weekly commit count for the repo owner and everyone else.{base_path}/{version}/repos/{pathv1}/{pathv2}/stats/participation?{query}Yes
getReposOwnerRepoStatsPunchCard(owner, repo, callback)Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits

For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits.

{base_path}/{version}/repos/{pathv1}/{pathv2}/stats/punch_card?{query}Yes
getReposOwnerRepoStatusesRef(owner, repo, ref, callback)List Statuses for a specific Ref.{base_path}/{version}/repos/{pathv1}/{pathv2}/statuses/{pathv3}?{query}Yes
postReposOwnerRepoStatusesRef(owner, repo, ref, body, callback)Create a Status.{base_path}/{version}/repos/{pathv1}/{pathv2}/statuses/{pathv3}?{query}Yes
getReposOwnerRepoSubscribers(owner, repo, callback)List watchers.{base_path}/{version}/repos/{pathv1}/{pathv2}/subscribers?{query}Yes
deleteReposOwnerRepoSubscription(owner, repo, callback)Delete a Repository Subscription.{base_path}/{version}/repos/{pathv1}/{pathv2}/subscription?{query}Yes
getReposOwnerRepoSubscription(owner, repo, callback)Get a Repository Subscription.{base_path}/{version}/repos/{pathv1}/{pathv2}/subscription?{query}Yes
putReposOwnerRepoSubscription(owner, repo, body, callback)Set a Repository Subscription{base_path}/{version}/repos/{pathv1}/{pathv2}/subscription?{query}Yes
getReposOwnerRepoTags(owner, repo, callback)Get list of tags.{base_path}/{version}/repos/{pathv1}/{pathv2}/tags?{query}Yes
getReposOwnerRepoTeams(owner, repo, callback)Get list of teams{base_path}/{version}/repos/{pathv1}/{pathv2}/teams?{query}Yes
getReposOwnerRepoWatchers(owner, repo, callback)List Stargazers. New implementation.{base_path}/{version}/repos/{pathv1}/{pathv2}/watchers?{query}Yes
getReposOwnerRepoArchiveFormatPath(owner, repo, archiveFormat = 'tarball', pathParam, callback)Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly.{base_path}/{version}/repos/{pathv1}/{pathv2}/{pathv3}/{pathv4}?{query}Yes
getRepositories(since, callback)List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories.{base_path}/{version}/repositories?{query}Yes
getSearchCodeWithOptions(queryData, callback)Search code.{base_path}/{version}/search/code?{query}Yes
getSearchIssuesWithOptions(queryData, callback)Find issues by state and keyword. (This method returns up to 100 results per page.){base_path}/{version}/search/issues?{query}Yes
getSearchRepositories(order = 'desc', q, sort = 'stars', callback)Search repositories.{base_path}/{version}/search/repositories?{query}Yes
getSearchUsers(order = 'desc', q, sort = 'followers', callback)Search users.{base_path}/{version}/search/users?{query}Yes
deleteTeamsTeamId(teamId, callback)Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with.{base_path}/{version}/teams/{pathv1}?{query}Yes
getTeamsTeamId(teamId, callback)Get team.{base_path}/{version}/teams/{pathv1}?{query}Yes
patchTeamsTeamId(teamId, body, callback)Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with.{base_path}/{version}/teams/{pathv1}?{query}Yes
getTeamsTeamIdMembers(teamId, callback)List team members. In order to list members in a team, the authenticated user must be a member of the team.{base_path}/{version}/teams/{pathv1}/members?{query}Yes
deleteTeamsTeamIdMembersUsername(teamId, username, callback)The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships.

Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team.

{base_path}/{version}/teams/{pathv1}/members/{pathv2}?{query}Yes
getTeamsTeamIdMembersUsername(teamId, username, callback)The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships.

Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team.

{base_path}/{version}/teams/{pathv1}/members/{pathv2}?{query}Yes
putTeamsTeamIdMembersUsername(teamId, username, callback)The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams.

Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with.

{base_path}/{version}/teams/{pathv1}/members/{pathv2}?{query}Yes
deleteTeamsTeamIdMembershipsUsername(teamId, username, callback)Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team.{base_path}/{version}/teams/{pathv1}/memberships/{pathv2}?{query}Yes
getTeamsTeamIdMembershipsUsername(teamId, username, callback)Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization.{base_path}/{version}/teams/{pathv1}/memberships/{pathv2}?{query}Yes
putTeamsTeamIdMembershipsUsername(teamId, username, callback)Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with.

If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team.

If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's team...(description truncated)

{base_path}/{version}/teams/{pathv1}/memberships/{pathv2}?{query}Yes
getTeamsTeamIdRepos(teamId, callback)List team repos{base_path}/{version}/teams/{pathv1}/repos?{query}Yes
deleteTeamsTeamIdReposOwnerRepo(teamId, owner, repo, callback)In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team.{base_path}/{version}/teams/{pathv1}/repos/{pathv2}/{pathv3}?{query}Yes
getTeamsTeamIdReposOwnerRepo(teamId, owner, repo, callback)Check if a team manages a repository{base_path}/{version}/teams/{pathv1}/repos/{pathv2}/{pathv3}?{query}Yes
putTeamsTeamIdReposOwnerRepo(teamId, owner, repo, callback)In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization.{base_path}/{version}/teams/{pathv1}/repos/{pathv2}/{pathv3}?{query}Yes
getUser(callback)Get the authenticated user.{base_path}/{version}/user?{query}Yes
patchUser(body, callback)Update the authenticated user.{base_path}/{version}/user?{query}Yes
deleteUserEmails(body, callback)Delete email address(es). You can include a single email address or an array of addresses.{base_path}/{version}/user/emails?{query}Yes
getUserEmails(callback)List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format.{base_path}/{version}/user/emails?{query}Yes
postUserEmails(body, callback)Add email address(es). You can post a single email address or an array of addresses.{base_path}/{version}/user/emails?{query}Yes
getUserFollowers(callback)List the authenticated user's followers{base_path}/{version}/user/followers?{query}Yes
getUserFollowing(callback)List who the authenticated user is following.{base_path}/{version}/user/following?{query}Yes
deleteUserFollowingUsername(username, callback)Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.{base_path}/{version}/user/following/{pathv1}?{query}Yes
getUserFollowingUsername(username, callback)Check if you are following a user.{base_path}/{version}/user/following/{pathv1}?{query}Yes
putUserFollowingUsername(username, callback)Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.{base_path}/{version}/user/following/{pathv1}?{query}Yes
getUserIssues(filter = 'assigned', state = 'open', labels, sort = 'created', direction = 'asc', since, callback)List issues. List all issues across owned and member repositories for the authenticated user.{base_path}/{version}/user/issues?{query}Yes
getUserKeys(callback)List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes.{base_path}/{version}/user/keys?{query}Yes
postUserKeys(body, callback)Create a public key.{base_path}/{version}/user/keys?{query}Yes
deleteUserKeysKeyId(keyId, callback)Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope.{base_path}/{version}/user/keys/{pathv1}?{query}Yes
getUserKeysKeyId(keyId, callback)Get a single public key.{base_path}/{version}/user/keys/{pathv1}?{query}Yes
getUserOrgs(callback)List public and private organizations for the authenticated user.{base_path}/{version}/user/orgs?{query}Yes
getUserRepos(type = 'all', callback)List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately.{base_path}/{version}/user/repos?{query}Yes
postUserRepos(body, callback)Create a new repository for the authenticated user. OAuth users must supply repo scope.{base_path}/{version}/user/repos?{query}Yes
getUserStarred(direction, sort = 'created', callback)List repositories being starred by the authenticated user.{base_path}/{version}/user/starred?{query}Yes
deleteUserStarredOwnerRepo(owner, repo, callback)Unstar a repository{base_path}/{version}/user/starred/{pathv1}/{pathv2}?{query}Yes
getUserStarredOwnerRepo(owner, repo, callback)Check if you are starring a repository.{base_path}/{version}/user/starred/{pathv1}/{pathv2}?{query}Yes
putUserStarredOwnerRepo(owner, repo, callback)Star a repository.{base_path}/{version}/user/starred/{pathv1}/{pathv2}?{query}Yes
getUserSubscriptions(callback)List repositories being watched by the authenticated user.{base_path}/{version}/user/subscriptions?{query}Yes
deleteUserSubscriptionsOwnerRepo(owner, repo, callback)Stop watching a repository{base_path}/{version}/user/subscriptions/{pathv1}/{pathv2}?{query}Yes
getUserSubscriptionsOwnerRepo(owner, repo, callback)Check if you are watching a repository.{base_path}/{version}/user/subscriptions/{pathv1}/{pathv2}?{query}Yes
putUserSubscriptionsOwnerRepo(owner, repo, callback)Watch a repository.{base_path}/{version}/user/subscriptions/{pathv1}/{pathv2}?{query}Yes
getUserTeams(callback)List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth.{base_path}/{version}/user/teams?{query}Yes
getUsers(since, callback)Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users.{base_path}/{version}/users?{query}Yes
getUsersUsername(username, callback)Get a single user.{base_path}/{version}/users/{pathv1}?{query}Yes
getUsersUsernameEvents(username, callback)If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events.{base_path}/{version}/users/{pathv1}/events?{query}Yes
getUsersUsernameEventsOrgsOrg(username, org, callback)This is the user's organization dashboard. You must be authenticated as the user to view this.{base_path}/{version}/users/{pathv1}/events/orgs/{pathv2}?{query}Yes
getUsersUsernameFollowers(username, callback)List a user's followers{base_path}/{version}/users/{pathv1}/followers?{query}Yes
getUsersUsernameFollowingTargetUser(username, targetUser, callback)Check if one user follows another.{base_path}/{version}/users/{pathv1}/following/{pathv2}?{query}Yes
getUsersUsernameGists(username, since, callback)List a users gists.{base_path}/{version}/users/{pathv1}/gists?{query}Yes
getUsersUsernameKeys(username, callback)List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone.{base_path}/{version}/users/{pathv1}/keys?{query}Yes
getUsersUsernameOrgs(username, callback)List all public organizations for a user.{base_path}/{version}/users/{pathv1}/orgs?{query}Yes
getUsersUsernameReceivedEvents(username, callback)These are events that you'll only see public events.{base_path}/{version}/users/{pathv1}/received_events?{query}Yes
getUsersUsernameReceivedEventsPublic(username, callback)List public events that a user has received{base_path}/{version}/users/{pathv1}/received_events/public?{query}Yes
getUsersUsernameRepos(username, type = 'all', callback)List public repositories for the specified user.{base_path}/{version}/users/{pathv1}/repos?{query}Yes
getUsersUsernameStarred(username, callback)List repositories being starred by a user.{base_path}/{version}/users/{pathv1}/starred?{query}Yes
getUsersUsernameSubscriptions(username, callback)List repositories being watched by a user.{base_path}/{version}/users/{pathv1}/subscriptions?{query}Yes

Authentication

This document will go through the steps for authenticating the GitHub System adapter with the authentication methods we have worked with in the past. Properly configuring the properties for an adapter in IAP is critical for getting the adapter online. You can read more about adapter authentication HERE.

Basic Authentication

The GitHub System adapter requires Basic Authentication. If you change authentication methods, you should change this section accordingly and merge it back into the adapter repository.

STEPS

  1. Ensure you have access to a GitHub System server and that it is running
  2. Follow the steps in the README.md to import the adapter into IAP if you have not already done so
  3. Use the properties below for the properties.authentication field
    "authentication": {
    "auth_method": "basic user_password",
    "username": "<username>",
    "password": "<access_token>",
    "auth_field": "header.headers.Authorization",
    "auth_field_format": "Basic {b64}{username}:{password}{/b64}",
    "auth_logging": false
    }
  4. Restart the adapter. If your properties were set correctly, the adapter should go online.

Static Token Authentication

The GitHub System adapter authenticates with a static token.

STEPS

  1. Ensure you have access to a GitHub System server and that it is running
  2. Follow the steps in the README.md to import the adapter into IAP if you have not already done so
  3. Use the properties below for the properties.authentication field
    "authentication": {
    "auth_method": "static_token",
    "token": "<access_token>",
    "auth_field": "header.headers.Authorization",
    "auth_field_format": "token {token}",
    "auth_logging": false
    }

    you can leave all of the other properties in the authentication section, they will not be used when the auth_method is static_token.

  4. Restart the adapter. If your properties were set correctly, the adapter should go online.

Troubleshooting

  • Make sure you copied over the correct username and password.
  • Turn on debug level logs for the adapter in IAP Admin Essentials.
  • Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
  • Investigate the logs - in particular:
    • The FULL REQUEST log to make sure the proper headers are being sent with the request.
    • The FULL BODY log to make sure the payload is accurate.
    • The CALL RETURN log to see what the other system is telling us.
  • Credentials should be masked by the adapter so make sure you verify the username and password - including that there are erroneous spaces at the front or end.
  • Remember when you are done to turn auth_logging off as you do not want to log credentials.

Additional Information

Enhancements

Adding a Second Instance of an Adapter

You can add a second instance of this adapter without adding new code on the file system. To do this go into the IAP Admin Essentials and add a new service config for this adapter. The two instances of the adapter should have unique ids. In addition, they should point to different instances (unique host and port) of the other system.

Adding Adapter Calls

There are multiple ways to add calls to an existing adapter.

The easiest way would be to use the Adapter Builder update process. This process takes in a Swagger or OpenAPI document, allows you to select the calls you want to add and then generates a zip file that can be used to update the adapter. Once you have the zip file simply put it in the adapter directory and execute npm run adapter:update.

mv updatePackage.zip adapter-github
cd adapter-github
npm run adapter:update

If you do not have a Swagger or OpenAPI document, you can use a Postman Collection and convert that to an OpenAPI document using APIMatic and then follow the first process.

If you want to manually update the adapter that can also be done the key thing is to make sure you update all of the right files. Within the entities directory you will find 1 or more entities. You can create a new entity or add to an existing entity. Each entity has an action.json file, any new call will need to be put in the action.json file. It will also need to be added to the enum for the ph_request_type in the appropriate schema files. Once this configuration is complete you will need to add the call to the adapter.js file and, in order to make it available as a workflow task in IAP, it should also be added to the pronghorn.json file. You can optionally add it to the unit and integration test files. There is more information on how to work on each of these files in the Adapter Technical Resources on our Documentation Site.

Files to update
* entities/<entity>/action.json: add an action
* entities/<entity>/schema.json (or the schema defined on the action): add action to the enum for ph_request_type
* adapter.js: add the new method and make sure it calls the proper entity and action
* pronghorn.json: add the new method
* test/unit/adapterTestUnit.js (optional but best practice): add unit test(s) - function is there, any required parameters error when not passed in
* test/integration/adapterTestIntegration.js (optional but best practice): add integration test

Adding Adapter Properties

While changing adapter properties is done in the service instance configuration section of IAP, adding properties has to be done in the adapter. To add a property you should edit the propertiesSchema.json with the proper information for the property. In addition, you should modify the sampleProperties to have the new property in it.

Files to update
* propertiesSchema.json: add the new property and how it is defined
* sampleProperties: add the new property with a default value
* test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
* test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties

Changing Adapter Authentication

Often an adapter is built before knowing the authentication and authentication processes can also change over time. The adapter supports many different kinds of authentication but it does require configuration. Some forms of authentication can be defined entirely with the adapter properties but others require configuration.

Files to update
* entities/.system/action.json: change the getToken action as needed
* entities/.system/schemaTokenReq.json: add input parameters (external name is name in other system)
* entities/.system/schemaTokenResp.json: add response parameters (external name is name in other system)
* propertiesSchema.json: add any new property and how it is defined
* sampleProperties: add any new property with a default value
* test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
* test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties

Enhancing Adapter Integration Tests

The adapter integration tests are written to be able to test in either stub (standalone) mode or integrated to the other system. However, if integrating to the other system, you may need to provide better data than what the adapter provides by default as that data is likely to fail for create and update. To provide better data, edit the adapter integration test file. Make sure you do not remove the marker and keep custom code below the marker so you do not impact future migrations. Once the edits are complete, run the integration test as it instructs you to above. When you run integrated to the other system, you can also save mockdata for future use by changing the isSaveMockData flag to true.

Files to update
* test/integration/adapterTestIntegration.js: add better data for the create and update calls so that they will not fail.

As mentioned previously, for most of these changes as well as other possible changes, there is more information on how to work on an adapter in the Adapter Technical Resources on our Documentation Site.

Contributing

First off, thanks for taking the time to contribute!

The following is a set of rules for contributing.

Code of Conduct

This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to support@itential.com.

How to Contribute

Follow the contributing guide (here)[https://gitlab.com/itentialopensource/adapters/contributing-guide]

Helpful Links

Adapter Technical Resources

Node Scripts

There are several node scripts that now accompany the adapter. These scripts are provided to make several activities easier. Many of these scripts can have issues with different versions of IAP as they have dependencies on IAP and Mongo. If you have issues with the scripts please report them to the Itential Adapter Team. Each of these scripts are described below.

RunDescription
npm run adapter:installProvides an easier way to install the adapter.
npm run adapter:checkMigrateChecks whether your adapter can and should be migrated to the latest foundation.
npm run adapter:findPathCan be used to see if the adapter supports a particular API call.
npm run adapter:migrateProvides an easier way to update your adapter after you download the migration zip from Itential DevSite.
npm run adapter:updateProvides an easier way to update your adapter after you download the update zip from Itential DevSite.
npm run adapter:revertAllows you to revert after a migration or update if it resulted in issues.
npm run troubleshootProvides a way to troubleshoot the adapter - runs connectivity, healthcheck and basic get.
npm run connectivityProvides a connectivity check to the Servicenow system.
npm run healthcheckChecks whether the configured healthcheck call works to Servicenow.
npm run basicgetChecks whether the basic get calls works to Servicenow.

Troubleshoot

Run npm run troubleshoot to start the interactive troubleshooting process. The command allows you to verify and update connection, authentication as well as healthcheck configuration. After that it will test these properties by sending HTTP request to the endpoint. If the tests pass, it will persist these changes into IAP.

You also have the option to run individual commands to perform specific test:

  • npm run healthcheck will perform a healthcheck request of with current setting.
  • npm run basicget will perform some non-parameter GET request with current setting.
  • npm run connectivity will perform networking diagnostics of the adatper endpoint.

Connectivity Issues

  1. You can run the adapter troubleshooting script which will check connectivity, run the healthcheck and run basic get calls.
npm run troubleshoot
  1. Verify the adapter properties are set up correctly.
Go into the Itential Platform GUI and verify/update the properties
  1. Verify there is connectivity between the Itential Platform Server and GitHub Server.
ping the ip address of GitHub server
try telnet to the ip address port of GitHub
execute a curl command to the other system
  1. Verify the credentials provided for GitHub.
login to GitHub using the provided credentials
  1. Verify the API of the call utilized for GitHub Healthcheck.
Go into the Itential Platform GUI and verify/update the properties

Functional Issues

Adapter logs are located in /var/log/pronghorn. In older releases of the Itential Platform, there is a pronghorn.log file which contains logs for all of the Itential Platform. In newer versions, adapters can be configured to log into their own files.