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

TimetrackingsTrackingRecord not implemented correctly #56

Open
JanHolger opened this issue Jul 17, 2023 · 1 comment
Open

TimetrackingsTrackingRecord not implemented correctly #56

JanHolger opened this issue Jul 17, 2023 · 1 comment

Comments

@JanHolger
Copy link

JanHolger commented Jul 17, 2023

Hi,
first of all thank you for building this amazing client. While trying to create a timesheet I faced the following issue.

Currently TimetrackingsTrackingRecord is implemented like this:

interface TimetrackingsTrackingRecord {
    type: "duration" | "range";
    date: string;
    duration: string;
}

but this only allows for the duration type.

There are 2 ways to approach this issue

  1. Implement 2 interfaces and use a union type
interface TimetrackingsTrackingDurationRecord {
    type: "duration";
    date: string;
    duration: string;
}
interface TimetrackingsTrackingRangeRecord {
    type: "range";
    start: string;
    end: string;
}
interface TimetrackingsCreate {
    ...
    tracking: TimetrackingsTrackingDurationRecord | TimetrackingsTrackingRangeRecord;
    ...
}
  1. Make duration and date optional and also add the start and end properties as optional
interface TimetrackingsTrackingRecord {
    type: "duration" | "range";
    date: string;
    duration?: string;
    start?: string;
    end?: string;
}
@mathewmeconry
Copy link
Owner

Hey
I would go with option 1 so we have proper the correct fields with the type.
I am open for pull requests because I probably won't be able to update the lib in the next 3 weeks :(

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

No branches or pull requests

2 participants