From 2270fd1fdeacc28b47e670d04eb08090a5709510 Mon Sep 17 00:00:00 2001 From: Ryan Block Date: Mon, 19 Jun 2023 10:53:15 -0700 Subject: [PATCH 1/3] Add token support --- src/index.cjs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/index.cjs b/src/index.cjs index 17f7755..d91d25a 100644 --- a/src/index.cjs +++ b/src/index.cjs @@ -245,5 +245,31 @@ module.exports = { return write({ token, appID, path: 'team/leave', _staging }) }, - } + }, + + tokens: { + /** + * list an account's tokens + * @param {BaseParams} options + */ + async list ({ token, _staging }) { + return read({ token, scope: 'tokens', _staging }) + }, + + /** + * generate a new token + * @param {BaseParams & {tokenType?: string}} options + */ + async create ({ token, _staging, tokenType = 'personal_access', ttl }) { + return write({ token, scope: 'tokens', _staging }, { tokenType, ttl }) + }, + + /** + * revoke a token + * @param {BaseParams & {tokenID: string}} options + */ + async revoke ({ token, appID, tokenID, _staging }) { + return write({ token, appID, scope: 'tokens', path: `${tokenID}/delete`, _staging }) + }, + }, } From cc65424fe6b433026e5194df50d30380bf545665 Mon Sep 17 00:00:00 2001 From: Ryan Block Date: Mon, 19 Jun 2023 11:02:48 -0700 Subject: [PATCH 2/3] Update deps + scripts --- package.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a1553a9..d36cc0e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ ], "scripts": { "lint": "eslint src --ext .js,.cjs,.mjs --fix", - "test": "npm run lint && tape test/*-test.*js | tap-arc" + "test": "npm run lint && tape test/*-test.*js | tap-arc", + "rc": "npm version prerelease --preid RC" }, "repository": { "type": "git", @@ -28,13 +29,13 @@ "homepage": "https://github.com/beginner-corp/begin-api#readme", "dependencies": { "@begin/chunker": "^1.1.2", - "tiny-json-http": "^7.5.0", + "tiny-json-http": "^7.5.1", "zip-dir": "^2.0.0" }, "devDependencies": { "@architect/eslint-config": "^2.1.1", - "dotenv": "^16.0.3", - "eslint": "^8.35.0", + "dotenv": "^16.3.1", + "eslint": "^8.43.0", "tap-arc": "^0.3.5", "tape": "^5.6.3" }, From 9b3a6fadd231675265f7b8b49d4cffec9f7706d7 Mon Sep 17 00:00:00 2001 From: Ryan Block Date: Mon, 19 Jun 2023 11:02:53 -0700 Subject: [PATCH 3/3] 1.8.0-RC.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d36cc0e..38d4fe3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@begin/api", - "version": "1.7.0", + "version": "1.8.0-RC.0", "description": "Node.js client for api.begin.com", "type": "module", "module": "./src/index.mjs",