* Removes an user to the authorized list * @param {string} username User's username * @returns {Promise<'ok' | null>}
(username)
| 136 | * @returns {Promise<'ok' | null>} |
| 137 | */ |
| 138 | async removeUser(username) { |
| 139 | try { |
| 140 | const { data } = await axios.post( |
| 141 | 'https://www.tradingview.com/pine_perm/remove/', |
| 142 | `pine_id=${this.pineId.replace(/;/g, '%3B')}&username_recip=${username}`, |
| 143 | { |
| 144 | headers: { |
| 145 | origin: 'https://www.tradingview.com', |
| 146 | 'Content-Type': 'application/x-www-form-urlencoded', |
| 147 | cookie: genAuthCookies(this.sessionId, this.signature), |
| 148 | }, |
| 149 | }, |
| 150 | ); |
| 151 | |
| 152 | return data.status; |
| 153 | } catch (e) { |
| 154 | throw new Error(e.response.data.detail || 'Wrong credentials or pineId'); |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | module.exports = PinePermManager; |
no test coverage detected