feat(Strava Node): Add "Get Streams" operation (#2582)

* Strava node: adding getStreams operation

* Changed the keys to use multiOptions

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
Luis Cipriani 2022-04-01 18:24:47 +02:00 committed by GitHub
parent 5f44b0dad5
commit 6bbb4df059
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 1 deletions

View file

@ -46,6 +46,11 @@ export const activityOperations: INodeProperties[] = [
value: 'getLaps',
description: 'Get all activity laps',
},
{
name: 'Get Streams',
value: 'getStreams',
description: 'Get activity streams',
},
{
name: 'Get Zones',
value: 'getZones',
@ -316,6 +321,7 @@ export const activityFields: INodeProperties[] = [
'getLaps',
'getKudos',
'getZones',
'getStreams',
],
},
},
@ -369,7 +375,70 @@ export const activityFields: INodeProperties[] = [
default: 50,
description: 'How many results to return.',
},
{
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: {
resource: [
'activity',
],
operation: [
'getStreams',
],
},
},
required: true,
default: [],
description: 'Desired stream types to return',
},
/* -------------------------------------------------------------------------- */
/* activity:getAll */
/* -------------------------------------------------------------------------- */

View file

@ -129,6 +129,15 @@ export class Strava implements INodeType {
responseData = responseData.splice(0, limit);
}
}
//https://developers.strava.com/docs/reference/#api-Streams-getActivityStreams
if (operation === 'getStreams') {
const activityId = this.getNodeParameter('activityId', i) as string;
const keys = this.getNodeParameter('keys', i) as string[];
qs.keys = keys.toString();
qs.key_by_type = true;
responseData = await stravaApiRequest.call(this, 'GET', `/activities/${activityId}/streams`, {}, qs);
}
//https://developers.mailerlite.com/reference#subscribers
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i) as boolean;