Skip to content

Conversation

@MoralCode
Copy link
Contributor

@MoralCode MoralCode commented Jul 14, 2024

This PR facilitates production use of Webhooks to automatically synchronize data from Concept2 and supersedes #8, which I didn't have the ability to edit.

This commit contains several key contributions, largely from @pfredCL:

  1. Introduce some new types to allow for parsing of more detailed workout data (C2HeartRate, C2Intervals, C2Splits, C2Workout)
  2. Update C2Results to handle additional data on intervals, heart rate, workout results, and rest data available from other result related endpoints in the Concept2 API.
  3. Refactored and simplified file structure to combine all the auto-generated components of the typings into one file (types/index.dart)
  4. Temporarily commit the generated freezed types to the repo for local (i.e. as a path or git dependency) usage of the library (long term im not a fan of this and would like to transition away from this eventually, see Remove files generated by freezed package once c2logbook is published #5)
  5. Temporarily introduce some new (deprecated) data models (C2FullResults and C2DetailedResult) for backwards compatibility with existing usecases.
  6. Improve unit testing with more tests, as well as more realistic data samples taken from the Concept2 Docs

Deprecated functionality Migration Guide

In order to be safe from the removal of the deprecated features in this PR:

  1. Replace uses of C2FullResults with C2Results, which has been updated to support the additional fields that were introduced in C2FullResults
  2. Replace uses of the C2FullResults.date field with C2Results.endDate
  3. Remove uses of C2DetailedResult. Instead, either use methods on C2Logbook to fetch data or manually extract the JSON data from the data key of the JSON response from the Concept2 API and feed it into C2Results.fromJson() or another supported type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants