1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-08 21:42:24 +03:00

Implement tracking of referrals (#659)

* Implement tracking of referrals

This also modifies (or fixes) auto-joining.
This commit is contained in:
Luke Barnard
2017-01-31 11:13:05 +00:00
committed by GitHub
parent 9c99e78099
commit 878e5593ba
3 changed files with 65 additions and 18 deletions

View File

@@ -12,4 +12,32 @@ export default class RtsClient {
json: true,
});
}
/**
* Track a referral with the Riot Team Server. This should be called once a referred
* user has been successfully registered.
* @param {string} referrer the user ID of one who referred the user to Riot.
* @param {string} user_id the user ID of the user being referred.
* @param {string} user_email the email address linked to `user_id`.
* @returns {Promise} a promise that resolves to [$response, $body], where $response
* is the response object created by the request lib and $body is the object parsed
* from the JSON response body. $body should be { team_token: 'sometoken' } upon
* success.
*/
trackReferral(referrer, user_id, user_email) {
return request({
url: this._url + '/register',
json: true,
body: {referrer, user_id, user_email},
method: 'POST',
});
}
getTeam(team_token) {
return request({
url: this._url + '/teamConfiguration',
json: true,
qs: {team_token},
});
}
}