Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strava node: adding getStreams operation #2582

Merged
merged 2 commits into from Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
71 changes: 70 additions & 1 deletion packages/nodes-base/nodes/Strava/ActivityDescription.ts
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
Expand Up @@ -130,6 +130,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