Skip to content

Commit

Permalink
feat(Strava Node): Add "Get Streams" operation (#2582)
Browse files Browse the repository at this point in the history
* Strava node: adding getStreams operation

* Changed the keys to use multiOptions

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
  • Loading branch information
lfcipriani and Joffcom authored Apr 1, 2022
1 parent 5f44b0d commit 6bbb4df
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
71 changes: 70 additions & 1 deletion packages/nodes-base/nodes/Strava/ActivityDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -316,6 +321,7 @@ export const activityFields: INodeProperties[] = [
'getLaps',
'getKudos',
'getZones',
'getStreams',
],
},
},
Expand Down Expand Up @@ -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 */
/* -------------------------------------------------------------------------- */
Expand Down
9 changes: 9 additions & 0 deletions packages/nodes-base/nodes/Strava/Strava.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6bbb4df

Please sign in to comment.