MCPcopy Create free account
hub / github.com/chain/Core / accessTokens

Function accessTokens

sdk/node/src/api/accessTokens.js:31–83  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

29 * @module AccessTokensApi
30 */
31const accessTokens = (client) => {
32 return {
33 /**
34 * Create a new access token.
35 *
36 * @param {Object} params - Parameters for access token creation.
37 * @param {String} params.id - User specified, unique identifier.
38 * @param {String} params.type - DEPRECATED. Do not use in 1.2 or later. Either 'client' or 'network'.
39 * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired.
40 * @returns {Promise<AccessToken>} Newly created access token.
41 */
42 create: (params, cb) =>
43 shared.create(client, '/create-access-token', params, {skipArray: true, cb}),
44
45 /**
46 * Get one page of access tokens sorted by descending creation time,
47 * optionally filtered by type.
48 *
49 * @param {Object} params={} - Filter and pagination information.
50 * @param {String} params.type - Type of access tokens to return.
51 * @param {Number} params.pageSize - Number of items to return in result set.
52 * @param {pageCallback} [callback] - Optional callback. Use instead of Promise return value as desired.
53 * @returns {Promise<Page<AccessToken>>} Requested page of results.
54 */
55 query: (params, cb) => shared.query(client, 'accessTokens', '/list-access-tokens', params, {cb}),
56
57 /**
58 * Request all access tokens matching the specified query, calling the
59 * supplied processor callback with each item individually.
60 *
61 * @param {Object} params={} - Filter and pagination information.
62 * @param {String} params.type - Type of access tokens to return.
63 * @param {Number} params.pageSize - Number of items to return in result set.
64 * @param {QueryProcessor<AccessToken>} processor - Processing callback.
65 * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired.
66 * @returns {Promise} A promise resolved upon processing of all items, or
67 * rejected on error.
68 */
69 queryAll: (params, processor, cb) => shared.queryAll(client, 'accessTokens', params, processor, cb),
70
71 /**
72 * Delete the specified access token.
73 *
74 * @param {String} id - Access token ID.
75 * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired.
76 * @returns {Promise<Object>} Success message or error.
77 */
78 delete: (id, cb) => shared.tryCallback(
79 client.request('/delete-access-token', {id: id}),
80 cb
81 ),
82 }
83}
84
85module.exports = accessTokens

Callers

nothing calls this directly

Calls 3

queryMethod · 0.80
createMethod · 0.65
requestMethod · 0.45

Tested by

no test coverage detected