code: function post(endpoint, data, auth = true, ignore) {
      return __awaiter(this, void 0, void 0, function* () {
          try {
              log_1.logger.debug(`[API] POST: ${endpoint}`, JSON.stringify(data));
              if (auth && !loggedIn())
                  yield login();
              let headers = getHeaders(auth);
              const result = yield new Promise((resolve, reject) => {
                  exports.client.post(exports.url + endpoint, { headers, data }, (result) => {
                      if (Buffer.isBuffer(result))
                          reject('Result was buffer (HTML, not JSON)');
                      else if (!success(result, ignore))
                          reject(result);
                      else
                          resolve(result);
                  }).on('error', (err) => reject(err));
              });
              log_1.logger.debug('[API] POST result:', result);
              return result;
          }
          catch (err) {
              console.error(err);
              log_1.logger.error(`[API] POST error (${endpoint}):`, err);
          }
      });
  }
docs: Do a POST request to an API endpoint.
  If it needs a token, login first (with defaults) to set auth headers.
  @todo Look at why some errors return HTML (caught as buffer) instead of JSON
  @param endpoint The API endpoint (including version) e.g. `chat.update`
  @param data     Payload for POST request to endpoint
  @param auth     Require auth headers for endpoint, default true
  @param ignore   Allows certain matching error messages to not count as errors