Skip to content

Commit

Permalink
updated users api to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dsumer committed Oct 10, 2023
1 parent 8b5e133 commit b5e1a52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/clockodo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ export class Clockodo {

const { id, ...remainingParams } = params;

return this.api.get("/users/" + id, remainingParams);
return this.api.get("/v2/users/" + id, remainingParams);
}

async getUsers(params?: Params): Promise<UsersReturnType> {
return this.api.get("/users", params);
return this.api.get("/v2/users", params);
}

async getUserReport<
Expand Down Expand Up @@ -446,7 +446,7 @@ export class Clockodo {
): Promise<AddUserReturnType> {
REQUIRED.checkRequired(params, REQUIRED.ADD_USER);

return this.api.post("/users", params);
return this.api.post("/v2/users", params);
}

async startClock(
Expand Down Expand Up @@ -554,7 +554,7 @@ export class Clockodo {

const { id } = params;

return this.api.put("/users/" + id, params);
return this.api.put("/v2/users/" + id, params);
}

async deactivateCustomer(
Expand Down Expand Up @@ -587,14 +587,14 @@ export class Clockodo {
return this.api.delete("/services/" + id, params);
}

async deactivateUser(
params: Params<Pick<User, typeof REQUIRED.DEACTIVATE_USER[number]>>
async deleteUser(
params: Params<Pick<User, typeof REQUIRED.DELETE_USER[number]>>
): Promise<UserReturnType> {
REQUIRED.checkRequired(params, REQUIRED.DEACTIVATE_USER);
REQUIRED.checkRequired(params, REQUIRED.DELETE_USER);

const { id } = params;

return this.api.delete("/users/" + id, params);
return this.api.delete("/v2/users/" + id, params);
}

async deleteAbsence(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/requiredParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const CHANGE_CLOCK_DURATION = [
export const DEACTIVATE_CUSTOMER = ["id"] as const;
export const DEACTIVATE_PROJECT = ["id"] as const;
export const DEACTIVATE_SERVICE = ["id"] as const;
export const DEACTIVATE_USER = ["id"] as const;
export const DELETE_USER = ["id"] as const;
export const DELETE_ENTRY = ["id"] as const;
export const DELETE_ENTRY_GROUP = ["timeSince", "timeUntil"] as const;
export const DELETE_ABSENCE = ["id"] as const;
Expand Down

0 comments on commit b5e1a52

Please sign in to comment.