OSDN Git Service

add access tokens api
authorYongfeng LI <wliyongfeng@gmail.com>
Mon, 14 May 2018 11:41:31 +0000 (19:41 +0800)
committerYongfeng LI <wliyongfeng@gmail.com>
Mon, 14 May 2018 11:41:31 +0000 (19:41 +0800)
src/api/accessTokens.js [new file with mode: 0644]
src/client.js

diff --git a/src/api/accessTokens.js b/src/api/accessTokens.js
new file mode 100644 (file)
index 0000000..a68c420
--- /dev/null
@@ -0,0 +1,9 @@
+const accessTokensApi = (connection) => {
+  return {
+    create: (id) => connection.request('/create-access-token', {id}),
+    list: () => connection.request('/list-access-tokens', {}),
+    delete: (id) => connection.request('/delete-access-token', {id})
+  }
+}
+
+export default accessTokensApi
index e8e5d14..2926fb8 100644 (file)
@@ -5,6 +5,7 @@ import keysApi from 'api/keys'
 import transactionApi from 'api/transactions'
 import balancesApi from 'api/balances'
 import unspentOutputsAPI from 'api/unspentOutputs'
+import accessTokensApi from 'api/accessTokens'
 
 class Client {
   constructor(baseUrl, token) {
@@ -16,6 +17,7 @@ class Client {
     this.transactions = new transactionApi(this.connection)
     this.balances = new balancesApi(this.connection)
     this.unspentOutputs = new unspentOutputsAPI(this.connection)
+    this.accessTokensApi = new accessTokensApi(this.connection)
   }
 }