2 * Access tokens are `name:secret-token` pairs that are granted authorization for accessing Chain Core features.
4 * @typedef {Object} AccessToken
7 * @property {String} id
8 * User specified, unique identifier.
10 * @property {String} token
11 * Only returned in the response from {@link AccessTokensApi~create}.
13 * @property {String} created_at
14 * Timestamp of token creation, RFC3339 formatted.
18 * API for interacting with {@link AccessToken access tokens}.
20 * @module AccessTokensApi
22 const accessTokensApi = (connection) => {
25 * Create a new access token.
27 * @param {Object} params - Access Token Object.
28 * @param {String} params.id - User specified, unique identifier.
29 * @param {String} params.type - type of token.
30 * @returns {Promise<AccessToken>} Newly created access token.
32 create: (params) => connection.request('/create-access-token', params),
35 * Get all access tokens.
37 * @returns {Promise<Array<AccessToken>>} All access tokens.
39 list: () => connection.request('/list-access-tokens', {}),
42 * Delete the target access token.
44 * @param {String} id- The to be deleted token id.
46 delete: (id) => connection.request('/delete-access-token', {id}),
49 * Check the target access token.
51 * @param {Object} params - Parameters for access token check.
52 * @param {String} params.id - The to be deleted token id.
53 * @param {String} params.secret, secret of token, the second part of the colon division for token.
55 check: (params) => connection.request('/check-access-token', params),
59 export default accessTokensApi