Skip to content

Commit

Permalink
add some integration endpoints
Browse files Browse the repository at this point in the history
merge installations into integrations section
  • Loading branch information
Joe Gallo committed Oct 4, 2016
1 parent 7a8a6cf commit ab46daa
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 19 deletions.
21 changes: 16 additions & 5 deletions doc/apidoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,15 +1129,15 @@ github.gitdata.updateReference({ ... });
*/

/**
* @api {post} /installations/:installation_id/access_tokens create
* @apiName create
* @apiDescription Create a new access token
* @apiGroup installations
* @api {post} /installations/:installation_id/access_tokens createInstallationToken
* @apiName createInstallationToken
* @apiDescription Create a new installation token. (In preview period. See README.)
* @apiGroup integrations
*
* @apiParam {Number} installation_id The id of the installation for this integration.
* @apiParam {Number} [user_id] The id of the user for whom the integration is acting on behalf of.
* @apiExample {js} ex:
github.installations.create({ ... });
github.integrations.createInstallationToken({ ... });
*/

/**
Expand All @@ -1152,6 +1152,17 @@ github.installations.create({ ... });
github.integrations.getInstallations({ ... });
*/

/**
* @api {post} /integration/identity/user getUserIdentity
* @apiName getUserIdentity
* @apiDescription Request identity of user. (In preview period. See README.)
* @apiGroup integrations
*
* @apiParam {String} [nonce]
* @apiExample {js} ex:
github.integrations.getUserIdentity({ ... });
*/

/**
* @api {post} /repos/:user/:repo/issues/:number/assignees addAssigneesToIssue
* @apiName addAssigneesToIssue
Expand Down
41 changes: 27 additions & 14 deletions lib/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,19 @@
"description": "Revoke an authorization for an application"
}
},

"installations": {
"create": {

"integrations": {
"get-installations": {
"url": "/integration/installations",
"method": "GET",
"params": {
"$page": null,
"$per_page": null
},
"description": "List the integration's installations. (In preview period. See README.)"
},

"create-installation-token": {
"url": "/installations/:installation_id/access_tokens",
"method": "POST",
"params": {
Expand All @@ -593,19 +603,22 @@
"description": "The id of the user for whom the integration is acting on behalf of."
}
},
"description": "Create a new access token"
}
},

"integrations": {
"get-installations": {
"url": "/integration/installations",
"method": "GET",
"description": "Create a new installation token. (In preview period. See README.)"
},

"get-user-identity": {
"url": "/integration/identity/user",
"method": "POST",
"params": {
"$page": null,
"$per_page": null
"nonce": {
"type": "String",
"required": false,
"validation": "",
"invalidmsg": "",
"description": ""
}
},
"description": "List the integration's installations. (In preview period. See README.)"
"description": "Request identity of user. (In preview period. See README.)"
}
},

Expand Down
27 changes: 27 additions & 0 deletions test/integrationsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ describe("[integrations]", function() {
});
});

it("should successfully execute POST /installations/:installation_id/access_tokens (createInstallationToken)", function(next) {
client.integrations.createInstallationToken(
{
installation_id: "Number",
user_id: "Number"
},
function(err, res) {
Assert.equal(err, null);
// other assertions go here
next();
}
);
});

it("should successfully execute GET /integration/installations (getInstallations)", function(next) {
client.integrations.getInstallations(
{
Expand All @@ -38,4 +52,17 @@ describe("[integrations]", function() {
}
);
});

it("should successfully execute POST /integration/identity/user (getUserIdentity)", function(next) {
client.integrations.getUserIdentity(
{
nonce: "String"
},
function(err, res) {
Assert.equal(err, null);
// other assertions go here
next();
}
);
});
});

0 comments on commit ab46daa

Please sign in to comment.