* Get list of authorized users * @param {number} limit Fetching limit * @param {'user__username' * | '-user__username' * | 'created' | 'created' * | 'expiration,user__username' * | '-expiration,user__username' * } order Fetching order * @returns {Promise }
(limit = 10, order = '-created')
| 43 | * @returns {Promise<AuthorizationUser[]>} |
| 44 | */ |
| 45 | async getUsers(limit = 10, order = '-created') { |
| 46 | try { |
| 47 | const { data } = await axios.post( |
| 48 | `https://www.tradingview.com/pine_perm/list_users/?limit=${limit}&order_by=${order}`, |
| 49 | `pine_id=${this.pineId.replace(/;/g, '%3B')}`, |
| 50 | { |
| 51 | headers: { |
| 52 | origin: 'https://www.tradingview.com', |
| 53 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 54 | cookie: genAuthCookies(this.sessionId, this.signature), |
| 55 | }, |
| 56 | }, |
| 57 | ); |
| 58 | |
| 59 | return data.results; |
| 60 | } catch (e) { |
| 61 | throw new Error(e.response.data.detail || 'Wrong credentials or pineId'); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Adds an user to the authorized list |
no test coverage detected