111 lines
4.0 KiB
JavaScript
111 lines
4.0 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.RunnerSelfService = void 0;
|
|
const request_1 = require("../core/request");
|
|
class RunnerSelfService {
|
|
/**
|
|
* Get
|
|
* Lists all information about yourself. <br> Please provide your runner jwt(that code we gave you during registration) for auth. <br> If you lost your jwt/personalized link please contact support.
|
|
* @param jwt
|
|
* @returns ResponseSelfServiceRunner
|
|
* @throws ApiError
|
|
*/
|
|
static async runnerSelfServiceControllerGet(jwt) {
|
|
const result = await request_1.request({
|
|
method: 'GET',
|
|
path: `/api/runners/me/${jwt}`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get scans
|
|
* Lists all your (runner) scans. <br> Please provide your runner jwt(that code we gave you during registration) for auth. <br> If you lost your jwt/personalized link please contact support.
|
|
* @param jwt
|
|
* @returns ResponseSelfServiceScan
|
|
* @throws ApiError
|
|
*/
|
|
static async runnerSelfServiceControllerGetScans(jwt) {
|
|
const result = await request_1.request({
|
|
method: 'GET',
|
|
path: `/api/runners/me/${jwt}/scans`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get station me
|
|
* Lists basic information about the station whose token got provided. <br> This includes it's associated track.
|
|
* @returns ResponseScanStation
|
|
* @throws ApiError
|
|
*/
|
|
static async runnerSelfServiceControllerGetStationMe() {
|
|
const result = await request_1.request({
|
|
method: 'GET',
|
|
path: `/api/stations/me`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Request new token
|
|
* Use this endpoint to reuqest a new selfservice token/link to be sent to your mail address (rate limited to one mail every 24hrs).
|
|
* @param mail
|
|
* @returns any Successful response
|
|
* @throws ApiError
|
|
*/
|
|
static async runnerSelfServiceControllerRequestNewToken(mail) {
|
|
const result = await request_1.request({
|
|
method: 'POST',
|
|
path: `/api/runners/forgot`,
|
|
query: {
|
|
'mail': mail,
|
|
},
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Register runner
|
|
* Create a new selfservice runner in the citizen org. <br> This endpoint shoud be used to allow "everyday citizen" to register themselves. <br> You have to provide a mail address, b/c the future we'll implement email verification.
|
|
* @param requestBody CreateSelfServiceCitizenRunner
|
|
* @returns ResponseSelfServiceRunner
|
|
* @throws ApiError
|
|
*/
|
|
static async runnerSelfServiceControllerRegisterRunner(requestBody) {
|
|
const result = await request_1.request({
|
|
method: 'POST',
|
|
path: `/api/runners/register`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Register organization runner
|
|
* Create a new selfservice runner in a provided org. <br> The orgs get provided and authorized via api tokens that can be optained via the /organizations endpoint.
|
|
* @param token
|
|
* @param requestBody CreateSelfServiceRunner
|
|
* @returns ResponseSelfServiceRunner
|
|
* @throws ApiError
|
|
*/
|
|
static async runnerSelfServiceControllerRegisterOrganizationRunner(token, requestBody) {
|
|
const result = await request_1.request({
|
|
method: 'POST',
|
|
path: `/api/runners/register/${token}`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get selfservice org
|
|
* Get the basic info and teams for a org.
|
|
* @param token
|
|
* @returns ResponseSelfServiceOrganisation
|
|
* @throws ApiError
|
|
*/
|
|
static async runnerSelfServiceControllerGetSelfserviceOrg(token) {
|
|
const result = await request_1.request({
|
|
method: 'GET',
|
|
path: `/api/organizations/selfservice/${token}`,
|
|
});
|
|
return result.body;
|
|
}
|
|
}
|
|
exports.RunnerSelfService = RunnerSelfService;
|