2018-05-28 12:35:17 +02:00
|
|
|
import { apiUrl, createRequest } from '../utils'
|
2018-05-01 19:29:21 +02:00
|
|
|
|
2018-06-07 14:45:43 +02:00
|
|
|
export default class FitTrackeeApi {
|
2018-05-01 19:29:21 +02:00
|
|
|
|
|
|
|
static addActivity(formData) {
|
2018-05-28 12:35:17 +02:00
|
|
|
const params = {
|
|
|
|
url: `${apiUrl}activities`,
|
2018-05-01 19:29:21 +02:00
|
|
|
method: 'POST',
|
|
|
|
body: formData,
|
2018-05-28 12:35:17 +02:00
|
|
|
}
|
|
|
|
return createRequest(params)
|
2018-05-01 19:29:21 +02:00
|
|
|
}
|
|
|
|
|
2018-05-08 18:20:41 +02:00
|
|
|
static addActivityWithoutGpx(data) {
|
2018-05-28 12:35:17 +02:00
|
|
|
const params = {
|
|
|
|
url: `${apiUrl}activities/no_gpx`,
|
2018-05-08 18:20:41 +02:00
|
|
|
method: 'POST',
|
2018-05-28 12:35:17 +02:00
|
|
|
body: data,
|
|
|
|
type: 'application/json',
|
|
|
|
}
|
|
|
|
return createRequest(params)
|
2018-05-08 18:20:41 +02:00
|
|
|
}
|
|
|
|
|
2018-05-03 21:42:54 +02:00
|
|
|
static getActivityGpx(activityId) {
|
2018-05-28 12:35:17 +02:00
|
|
|
const params = {
|
|
|
|
url: `${apiUrl}activities/${activityId}/gpx`,
|
2018-05-03 21:42:54 +02:00
|
|
|
method: 'GET',
|
2018-05-28 12:35:17 +02:00
|
|
|
}
|
|
|
|
return createRequest(params)
|
2018-05-03 21:42:54 +02:00
|
|
|
}
|
|
|
|
|
2018-05-28 15:33:56 +02:00
|
|
|
static getActivityChartData(activityId) {
|
|
|
|
const params = {
|
|
|
|
url: `${apiUrl}activities/${activityId}/chart_data`,
|
|
|
|
method: 'GET',
|
|
|
|
}
|
|
|
|
return createRequest(params)
|
|
|
|
}
|
|
|
|
|
2018-05-01 19:29:21 +02:00
|
|
|
}
|