@timetac/js-client-library
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -32,1 +32,5 @@ export declare enum AbsenceDayType { | ||
} | ||
export declare enum TimeTrackingStatus { | ||
Running = 1, | ||
Stopped = 2 | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UserStatusOverviewStatus = exports.AbsenceTypeRequestType = exports.AbsenceDurationUnit = exports.AbsenceStatus = exports.AbsenceDayType = void 0; | ||
exports.TimeTrackingStatus = exports.UserStatusOverviewStatus = exports.AbsenceTypeRequestType = exports.AbsenceDurationUnit = exports.AbsenceStatus = exports.AbsenceDayType = void 0; | ||
var AbsenceDayType; | ||
@@ -40,2 +40,7 @@ (function (AbsenceDayType) { | ||
})(UserStatusOverviewStatus = exports.UserStatusOverviewStatus || (exports.UserStatusOverviewStatus = {})); | ||
var TimeTrackingStatus; | ||
(function (TimeTrackingStatus) { | ||
TimeTrackingStatus[TimeTrackingStatus["Running"] = 1] = "Running"; | ||
TimeTrackingStatus[TimeTrackingStatus["Stopped"] = 2] = "Stopped"; | ||
})(TimeTrackingStatus = exports.TimeTrackingStatus || (exports.TimeTrackingStatus = {})); | ||
//# sourceMappingURL=index.js.map |
@@ -35,3 +35,3 @@ import { AbsenceDaysEndpoint } from './absenceDays'; | ||
export { ServerCommunication } from './serverCommunication/types'; | ||
export { Task } from './tasks/types'; | ||
export { Task, TaskCreate } from './tasks/types'; | ||
export { TeamMember } from './teamMembers/types'; | ||
@@ -38,0 +38,0 @@ export { Team } from './teams/types'; |
import BaseApi from '../baseApi'; | ||
import { RequestParams } from '../utils/params/requestParams'; | ||
import { ReadRawResponse } from '../utils/response/readRawResponse'; | ||
import { Task } from './types'; | ||
import { Task, TaskCreate } from './types'; | ||
export declare class TasksEndpoint extends BaseApi { | ||
@@ -10,5 +10,5 @@ readonly resourceName = "tasks"; | ||
readById(id: number, requestParams?: RequestParams<Task> | Object): Promise<Task>; | ||
create(data: Task): Promise<Task>; | ||
create(data: TaskCreate): Promise<Task>; | ||
update(): Promise<Task>; | ||
delete(): Promise<Task>; | ||
} |
@@ -34,1 +34,3 @@ export declare type Task = { | ||
}; | ||
export interface TaskCreate extends Omit<Task, 'id' | 'node_path' | 'view_id'> { | ||
} |
import BaseApi from '../baseApi'; | ||
import { RequestParams } from '../utils/params/requestParams'; | ||
import { ResourceResponse } from '../utils/response/resourceResponse'; | ||
import { StartTimeTrackingData, StopTimeTrackingData, TimeTracking, TimeTrackingCreate } from './types'; | ||
@@ -12,4 +13,4 @@ export declare class TimeTrackingsEndpoint extends BaseApi { | ||
delete(id: number): Promise<TimeTracking>; | ||
start(data: StartTimeTrackingData): Promise<TimeTracking>; | ||
start(data: StartTimeTrackingData): Promise<ResourceResponse<TimeTracking>>; | ||
stop(data: StopTimeTrackingData): Promise<TimeTracking>; | ||
} |
@@ -41,3 +41,3 @@ "use strict"; | ||
const response = this._post(`${this.getResourceName()}/start`, data); | ||
return responseHandlers.required(response); | ||
return responseHandlers.toResourceResponse(response); | ||
} | ||
@@ -44,0 +44,0 @@ stop(data) { |
@@ -9,2 +9,3 @@ export declare class RequestParams<R extends Object> { | ||
eq<F extends keyof R & string>(field: F, value: R[F]): RequestParams<R>; | ||
neq<F extends keyof R & string>(field: F, value: R[F]): RequestParams<R>; | ||
gt<F extends keyof R & string>(field: F, value: R[F]): RequestParams<R>; | ||
@@ -11,0 +12,0 @@ gteq<F extends keyof R & string>(field: F, value: R[F]): RequestParams<R>; |
@@ -26,2 +26,7 @@ "use strict"; | ||
} | ||
neq(field, value) { | ||
this.criteria[`_op__${field}`] = 'neq'; | ||
this.criteria[field] = String(value); | ||
return this; | ||
} | ||
gt(field, value) { | ||
@@ -28,0 +33,0 @@ this.criteria[`_op__${field}`] = 'gt'; |
@@ -10,4 +10,5 @@ import { RawApiResponse } from './rawApiResponse'; | ||
deleted: DeletedEntry[]; | ||
affected?: Record<string, any[]>; | ||
apiResponse: RawApiResponse; | ||
}; | ||
export declare function createResourceResponse<T>(rawApiResponse: RawApiResponse): ResourceResponse<T>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
function createResourceResponse(rawApiResponse) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
const response = { | ||
@@ -11,3 +11,4 @@ success: (_a = rawApiResponse.Success) !== null && _a !== void 0 ? _a : false, | ||
results: (_b = rawApiResponse.Results) !== null && _b !== void 0 ? _b : [], | ||
deleted: (_c = rawApiResponse.Deleted) !== null && _c !== void 0 ? _c : [], | ||
affected: (_c = rawApiResponse.Affected) !== null && _c !== void 0 ? _c : [], | ||
deleted: (_d = rawApiResponse.Deleted) !== null && _d !== void 0 ? _d : [], | ||
}; | ||
@@ -14,0 +15,0 @@ return response; |
import { AxiosResponse } from 'axios'; | ||
import { ApiResponse } from './apiResponse'; | ||
import { ApiResponse, ApiResponseOnSuccess } from './apiResponse'; | ||
import { ResourceResponse } from './resourceResponse'; | ||
export declare type RequestPromise<T> = Promise<AxiosResponse<ApiResponse<T>>>; | ||
export declare function toApiResponse<T>(promise: RequestPromise<T>): Promise<import("./apiResponse").ApiResponseOnSuccess<T>>; | ||
export declare function toApiResponse<T>(promise: RequestPromise<T>): Promise<ApiResponseOnSuccess<T>>; | ||
export declare function required<T>(promise: RequestPromise<T[]>): Promise<T>; | ||
export declare function optional<T>(promise: RequestPromise<T[]>): Promise<T | undefined>; | ||
export declare function list<T>(promise: RequestPromise<T[]>): Promise<T[]>; | ||
export declare function toResourceResponse<T>(promise: RequestPromise<T[]>): Promise<ResourceResponse<T>>; |
@@ -12,3 +12,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.list = exports.optional = exports.required = exports.toApiResponse = void 0; | ||
exports.toResourceResponse = exports.list = exports.optional = exports.required = exports.toApiResponse = void 0; | ||
const rawApiResponse_1 = require("./rawApiResponse"); | ||
const resourceResponse_1 = require("./resourceResponse"); | ||
function toApiResponse(promise) { | ||
@@ -55,2 +57,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.list = list; | ||
function toResourceResponse(promise) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return resourceResponse_1.createResourceResponse(yield rawApiResponse_1.createRawApiResponse(promise)); | ||
}); | ||
} | ||
exports.toResourceResponse = toResourceResponse; | ||
//# sourceMappingURL=responseHandlers.js.map |
{ | ||
"name": "@timetac/js-client-library", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "TimeTac API JS client library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/TimeTac/js-client-library#readme", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168278
2386