2022-08-17 08:50:24 -07:00
|
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
2020-10-22 01:17:39 -07:00
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
|
export const activityOperations: INodeProperties[] = [
|
2020-10-22 01:17:39 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Operation',
|
|
|
|
|
name: 'operation',
|
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
|
noDataExpression: true,
|
2020-10-22 01:17:39 -07:00
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
name: 'Create',
|
|
|
|
|
value: 'create',
|
|
|
|
|
description: 'Create a new activity',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Create an activity',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Get',
|
|
|
|
|
value: 'get',
|
|
|
|
|
description: 'Get an activity',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Get an activity',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Get Comments',
|
|
|
|
|
value: 'getComments',
|
|
|
|
|
description: 'Get all activity comments',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Get all activity comments',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
2020-10-22 01:19:17 -07:00
|
|
|
|
name: 'Get Kudos',
|
|
|
|
|
value: 'getKudos',
|
|
|
|
|
description: 'Get all activity kudos',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Get all activity kudos',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Get Laps',
|
|
|
|
|
value: 'getLaps',
|
|
|
|
|
description: 'Get all activity laps',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Get all activity laps',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
2022-09-07 07:51:14 -07:00
|
|
|
|
{
|
|
|
|
|
name: 'Get Many',
|
|
|
|
|
value: 'getAll',
|
2022-09-13 03:36:36 -07:00
|
|
|
|
description: 'Get many activities',
|
2022-09-08 08:10:13 -07:00
|
|
|
|
action: 'Get many activities',
|
2022-09-07 07:51:14 -07:00
|
|
|
|
},
|
2022-04-01 09:24:47 -07:00
|
|
|
|
{
|
|
|
|
|
name: 'Get Streams',
|
|
|
|
|
value: 'getStreams',
|
|
|
|
|
description: 'Get activity streams',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Get all activity streams',
|
2022-04-01 09:24:47 -07:00
|
|
|
|
},
|
2020-10-22 01:17:39 -07:00
|
|
|
|
{
|
|
|
|
|
name: 'Get Zones',
|
|
|
|
|
value: 'getZones',
|
|
|
|
|
description: 'Get all activity zones',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Get all activity zones',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Update',
|
|
|
|
|
value: 'update',
|
|
|
|
|
description: 'Update an activity',
|
2022-07-10 13:50:51 -07:00
|
|
|
|
action: 'Update an activity',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
default: 'create',
|
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
|
];
|
2020-10-22 01:17:39 -07:00
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
|
export const activityFields: INodeProperties[] = [
|
2020-10-22 01:19:17 -07:00
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* activity:create */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-10-22 01:17:39 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Name',
|
|
|
|
|
name: 'name',
|
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['create'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'The name of the activity',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Type',
|
|
|
|
|
name: 'type',
|
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['create'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'Type of activity. For example - Run, Ride etc.',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Start Date',
|
|
|
|
|
name: 'startDate',
|
|
|
|
|
type: 'dateTime',
|
2021-12-03 00:44:16 -08:00
|
|
|
|
default: '',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['create'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'ISO 8601 formatted date time',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Elapsed Time (Seconds)',
|
|
|
|
|
name: 'elapsedTime',
|
|
|
|
|
type: 'number',
|
2020-10-22 01:19:17 -07:00
|
|
|
|
required: true,
|
2020-10-22 01:17:39 -07:00
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['create'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
typeOptions: {
|
|
|
|
|
minValue: 0,
|
|
|
|
|
},
|
|
|
|
|
default: 0,
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'In seconds',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
|
name: 'additionalFields',
|
|
|
|
|
type: 'collection',
|
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
|
default: {},
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['create'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Commute',
|
|
|
|
|
name: 'commute',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
default: false,
|
2022-06-20 07:54:01 -07:00
|
|
|
|
description: 'Whether to mark as commute',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Description',
|
|
|
|
|
name: 'description',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Description of the activity',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Distance',
|
|
|
|
|
name: 'distance',
|
|
|
|
|
type: 'number',
|
|
|
|
|
typeOptions: {
|
|
|
|
|
minValue: 0,
|
|
|
|
|
},
|
|
|
|
|
default: 0,
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'In meters',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Trainer',
|
|
|
|
|
name: 'trainer',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
default: false,
|
2022-06-20 07:54:01 -07:00
|
|
|
|
description: 'Whether to mark as a trainer activity',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2020-10-22 01:19:17 -07:00
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* activity:update */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-10-22 01:17:39 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Activity ID',
|
|
|
|
|
name: 'activityId',
|
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['update'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'ID or email of activity',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
|
name: 'updateFields',
|
|
|
|
|
type: 'collection',
|
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
|
default: {},
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['update'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Commute',
|
|
|
|
|
name: 'commute',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
default: false,
|
2022-06-20 07:54:01 -07:00
|
|
|
|
description: 'Whether to mark as commute',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Description',
|
|
|
|
|
name: 'description',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Description of the activity',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Gear ID',
|
|
|
|
|
name: 'gear_id',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
2022-08-17 08:50:24 -07:00
|
|
|
|
description:
|
|
|
|
|
'Identifier for the gear associated with the activity. ‘none’ clears gear from activity.',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Name',
|
|
|
|
|
name: 'name',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'The name of the activity',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Type',
|
|
|
|
|
name: 'type',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'Type of activity. For example - Run, Ride etc.',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Trainer',
|
|
|
|
|
name: 'trainer',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
default: false,
|
2022-06-20 07:54:01 -07:00
|
|
|
|
description: 'Whether to mark as a trainer activity',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2020-10-22 01:19:17 -07:00
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* activity:get */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-10-22 01:17:39 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Activity ID',
|
|
|
|
|
name: 'activityId',
|
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['get'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'ID or email of activity',
|
|
|
|
|
},
|
2020-10-22 01:19:17 -07:00
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* activity */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-10-22 01:17:39 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Activity ID',
|
|
|
|
|
name: 'activityId',
|
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['getComments', 'getLaps', 'getKudos', 'getZones', 'getStreams'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'ID or email of activity',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Return All',
|
|
|
|
|
name: 'returnAll',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['getComments', 'getLaps', 'getKudos', 'getZones'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
default: false,
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Limit',
|
|
|
|
|
name: 'limit',
|
|
|
|
|
type: 'number',
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['getComments', 'getLaps', 'getKudos', 'getZones'],
|
|
|
|
|
returnAll: [false],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
typeOptions: {
|
|
|
|
|
minValue: 1,
|
|
|
|
|
maxValue: 100,
|
|
|
|
|
},
|
|
|
|
|
default: 50,
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Max number of results to return',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
2022-04-01 09:24:47 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Keys',
|
|
|
|
|
name: 'keys',
|
|
|
|
|
type: 'multiOptions',
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
name: 'Altitude',
|
|
|
|
|
value: 'altitude',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Cadence',
|
|
|
|
|
value: 'cadence',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Distance',
|
|
|
|
|
value: 'distance',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Gradient',
|
|
|
|
|
value: 'grade_smooth',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Heartrate',
|
|
|
|
|
value: 'heartrate',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Latitude / Longitude',
|
|
|
|
|
value: 'latlng',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Moving',
|
|
|
|
|
value: 'moving',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Temperature',
|
|
|
|
|
value: 'temp',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Time',
|
|
|
|
|
value: 'time',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Velocity',
|
|
|
|
|
value: 'velocity_smooth',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Watts',
|
|
|
|
|
value: 'watts',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['getStreams'],
|
2022-04-01 09:24:47 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
required: true,
|
|
|
|
|
default: [],
|
|
|
|
|
description: 'Desired stream types to return',
|
|
|
|
|
},
|
2020-10-22 01:19:17 -07:00
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* activity:getAll */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-10-22 01:17:39 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Return All',
|
|
|
|
|
name: 'returnAll',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['getAll'],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
default: false,
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Limit',
|
|
|
|
|
name: 'limit',
|
|
|
|
|
type: 'number',
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
|
resource: ['activity'],
|
|
|
|
|
operation: ['getAll'],
|
|
|
|
|
returnAll: [false],
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
typeOptions: {
|
|
|
|
|
minValue: 1,
|
|
|
|
|
maxValue: 100,
|
|
|
|
|
},
|
|
|
|
|
default: 50,
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Max number of results to return',
|
2020-10-22 01:17:39 -07:00
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
|
];
|