@@ -29,6 +29,7 @@ export default function MinterOrg(options) {
29
29
} ;
30
30
31
31
/**
32
+ * POST `register`
32
33
* @param {Object } data
33
34
* @param {string } data.username
34
35
* @param {string } data.password
@@ -77,6 +78,7 @@ export default function MinterOrg(options) {
77
78
} ;
78
79
79
80
/**
81
+ * POST `login`
80
82
* @param username
81
83
* @param password
82
84
* @param {AxiosRequestConfig } [axiosConfig]
@@ -98,6 +100,7 @@ export default function MinterOrg(options) {
98
100
99
101
/**
100
102
* Requires auth
103
+ * GET `profile`
101
104
* @param {AxiosRequestConfig } [axiosConfig]
102
105
* @return {Promise<User> }
103
106
*/
@@ -108,6 +111,7 @@ export default function MinterOrg(options) {
108
111
109
112
/**
110
113
* Requires auth
114
+ * PUT `profile`
111
115
* @param profile
112
116
* @param {string } [profile.username]
113
117
* @param {string } [profile.name]
@@ -124,6 +128,8 @@ export default function MinterOrg(options) {
124
128
/**
125
129
* Update profile password and re encrypt stored mnemonics, return updated AddressList
126
130
* Requires auth
131
+ * GET `addresses/encrypted`
132
+ * POST `profile/password'`
127
133
* @param {string } oldPasswordToStore
128
134
* @param {string } newPasswordToStore
129
135
* @param {AxiosRequestConfig } [axiosConfig]
@@ -152,6 +158,7 @@ export default function MinterOrg(options) {
152
158
153
159
/**
154
160
* Requires auth
161
+ * POST `profile/avatar`
155
162
* @param {Blob|File } avatar - image, max 0.5 MB, max 500x500
156
163
* @param {AxiosRequestConfig } [axiosConfig]
157
164
* @return {Promise<UserAvatar> }
@@ -167,6 +174,7 @@ export default function MinterOrg(options) {
167
174
168
175
/**
169
176
* Requires auth
177
+ * DELETE `profile/avatar`
170
178
* @param {AxiosRequestConfig } [axiosConfig]
171
179
* @return {Promise<UserAvatar> }
172
180
*/
@@ -177,6 +185,7 @@ export default function MinterOrg(options) {
177
185
/**
178
186
* Get profile address by id without encrypted data
179
187
* Requires auth
188
+ * GET `addresses/{id}`
180
189
* @param {number } id
181
190
* @param {AxiosRequestConfig } [axiosConfig]
182
191
* @return {Promise<Address> }
@@ -189,6 +198,7 @@ export default function MinterOrg(options) {
189
198
/**
190
199
* Get profile address by id with encrypted data
191
200
* Requires auth
201
+ * GET `addresses/{id}/encrypted`
192
202
* @param {number } id
193
203
* @param {AxiosRequestConfig } [axiosConfig]
194
204
* @return {Promise<Address> }
@@ -200,6 +210,7 @@ export default function MinterOrg(options) {
200
210
201
211
/**
202
212
* Requires auth
213
+ * POST `addresses`
203
214
* @param {Address } address
204
215
* @param {AxiosRequestConfig } [axiosConfig]
205
216
* @return {Promise }
@@ -210,6 +221,7 @@ export default function MinterOrg(options) {
210
221
211
222
/**
212
223
* Requires auth
224
+ * PUT `addresses/{id}`
213
225
* @param {number } id
214
226
* @param {Address } address
215
227
* @param {AxiosRequestConfig } [axiosConfig]
@@ -221,6 +233,7 @@ export default function MinterOrg(options) {
221
233
222
234
/**
223
235
* Requires auth
236
+ * DELETE `addresses/{id}`
224
237
* @param {number } id
225
238
* @param {AxiosRequestConfig } [axiosConfig]
226
239
* @return {Promise }
@@ -232,6 +245,7 @@ export default function MinterOrg(options) {
232
245
/**
233
246
* Get addresses saved in profile without encrypted data
234
247
* Requires auth
248
+ * GET `addresses`
235
249
* @param {AxiosRequestConfig } [axiosConfig]
236
250
* @return {Promise<Array<Address>> }
237
251
*/
@@ -241,8 +255,10 @@ export default function MinterOrg(options) {
241
255
} ;
242
256
243
257
/**
258
+ *
244
259
* Get addresses saved in profile with encrypted data
245
260
* Requires auth
261
+ * GET `addresses/encrypted`
246
262
* @param {AxiosRequestConfig } [axiosConfig]
247
263
* @return {Promise<Array<Address>> }
248
264
*/
@@ -252,20 +268,68 @@ export default function MinterOrg(options) {
252
268
} ;
253
269
254
270
/**
271
+ * GET `info/by/addresses`
272
+ * @param {string } address
273
+ * @param {AxiosRequestConfig } [axiosConfig]
274
+ * @return {Promise<UserInfo> }
275
+ */
276
+ this . getAddressInfo = function getAddressListInfo ( address , axiosConfig ) {
277
+ return instance
278
+ . get ( `info/by/address/${ address } ` , {
279
+ ...axiosConfig ,
280
+ } )
281
+ . then ( ( response ) => response . data . data ) ;
282
+ } ;
283
+
284
+ /**
285
+ * GET `info/by/addresses`
286
+ * @param {Array<string> } addressList
287
+ * @param {AxiosRequestConfig } [axiosConfig]
288
+ * @return {Promise<Array<UserInfo>> }
289
+ */
290
+ this . getAddressListInfo = function getAddressListInfo ( addressList , axiosConfig ) {
291
+ return instance
292
+ . get ( 'info/by/addresses?perPage=99999' , {
293
+ params : {
294
+ addresses : addressList ,
295
+ } ,
296
+ ...axiosConfig ,
297
+ } )
298
+ . then ( ( response ) => response . data . data ) ;
299
+ } ;
300
+
301
+ /**
302
+ * GET `info/address/by/contact`
255
303
* @param {Object } params
256
304
* @param {string } [params.username]
257
305
* @param {string } [params.email]
258
306
* @param {AxiosRequestConfig } [axiosConfig]
259
- * @return {Promise<Object > }
307
+ * @return {Promise<UserInfo > }
260
308
*/
261
- this . getAddressInfo = function getAddressInfo ( params , axiosConfig ) {
309
+ this . getAddressInfoByContact = function getAddressInfoByContact ( params , axiosConfig ) {
262
310
return instance
263
311
. get ( 'info/address/by/contact' , {
264
312
params,
265
313
...axiosConfig ,
266
314
} )
267
315
. then ( ( response ) => response . data . data ) ;
268
316
} ;
317
+
318
+ /**
319
+ * GET `info/by/username/{username}`
320
+ * @param {string } username
321
+ * @param {AxiosRequestConfig } [axiosConfig]
322
+ * @return {Promise<User> }
323
+ */
324
+ this . getUserInfo = function getAddressInfoByContact ( username , axiosConfig ) {
325
+ return instance
326
+ . get ( `info/by/username/${ username } ` , {
327
+ ...axiosConfig ,
328
+ } )
329
+ . then ( ( response ) => response . data . data ) ;
330
+ } ;
331
+
332
+
269
333
}
270
334
271
335
@@ -298,6 +362,12 @@ function makeFormData(data) {
298
362
* @property {Address } mainAddress
299
363
*/
300
364
365
+ /**
366
+ * @typedef {Object } UserInfo
367
+ * @property {string } address
368
+ * @property {User } user
369
+ */
370
+
301
371
/**
302
372
* @typedef {Object } UserAvatar
303
373
* @property {string } src
0 commit comments