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

feat: add project activity query #100

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/calls/project/models/project-activity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as rt from 'runtypes';
import {
multipleValuesEnvelope,
resourceRef,
singleValueEnvelope,
} from '../../../utils';

const projectActivityRt = rt.Record({
id: rt.Number,
version: rt.Number,
url: rt.String,
activity: rt.Record({
id: rt.Number,
}),
project: rt.Record({
id: rt.Number,
}),
startDate: rt.String,
endDate: rt.String,
isClosed: rt.Boolean,
budgetHours: rt.Number,
budgetHourlyRateCurrency: rt.Number,
budgetFeeCurrency: rt.Number,
});

export type ProjectActivity = rt.Static<typeof projectActivityRt>;

export const listProjectActivityResponseRt =
multipleValuesEnvelope(projectActivityRt);
export const createProjectActivityResponseRt =
singleValueEnvelope(projectActivityRt);
25 changes: 25 additions & 0 deletions src/calls/project/project-activity/project-activity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@


import { serializeQuery, withRuntype } from "../../../utils";
import { TripletexBase } from "../../base";
import { listProjectActivityResponseRt } from "../models/project-activity";
import { ListProjectActivitiesInput } from "./types";

export class TripletexProjectActivity extends TripletexBase {

// create call functions similar to those in project.ts
list(input?: ListProjectActivitiesInput) {

const call = this.authenticatedCall() //
.args<{
input?: ListProjectActivitiesInput;
}>()
.path('/v2/project')
.query(args => (args.input ? serializeQuery(args.input) : {}))
.method('get')
.parseJson(withRuntype(listProjectActivityResponseRt))
.build();

return this.performRequest(sessionToken => call({ input, sessionToken }));

}

Check failure on line 25 in src/calls/project/project-activity/project-activity.ts

View workflow job for this annotation

GitHub Actions / build

'}' expected.
5 changes: 5 additions & 0 deletions src/calls/project/project-activity/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { DefaultTripletexInputs } from "../../../types";

export interface ListProjectActivitiesInput extends DefaultTripletexInputs {
id: string;
}
Loading