Skip to content

Commit 95bb8af

Browse files
feat(api): api update
1 parent 8ca92e3 commit 95bb8af

File tree

6 files changed

+51
-7
lines changed

6 files changed

+51
-7
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-rankincodes%2Fwarp-hr-17b940414060481288221d15ba623ae2a68160a1abde282b216733181ceaa628.yml
3-
openapi_spec_hash: df1af360b4dcfb59793b9c9c1dcfd07b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-rankincodes%2Fwarp-hr-19dde65e367945e7a9d0ec732df6ffbe7d23ef2ea7fe88903351b52197632d93.yml
3+
openapi_spec_hash: b89ec84365c1220afc9c3a657b0228e4
44
config_hash: 599b918a4e5ce29219da642bbdf6e191

src/resources/time-off/policies.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ import { RequestOptions } from '../../internal/request-options';
77
import { path } from '../../internal/utils/path';
88

99
export class Policies extends APIResource {
10+
/**
11+
* Get a specific time off policy by id
12+
*/
1013
retrieve(id: string, options?: RequestOptions): APIPromise<PolicyRetrieveResponse> {
1114
return this._client.get(path`/v1/time_off/policies/${id}`, options);
1215
}
1316

17+
/**
18+
* Get the time off policies for your company
19+
*/
1420
list(
1521
query: PolicyListParams | null | undefined = {},
1622
options?: RequestOptions,
@@ -25,6 +31,9 @@ export class Policies extends APIResource {
2531
export type PolicyListResponsesCursorPage = CursorPage<PolicyListResponse>;
2632

2733
export interface PolicyRetrieveResponse {
34+
/**
35+
* a string starting with "top\_"
36+
*/
2837
id: string;
2938

3039
description: string | null;
@@ -43,6 +52,9 @@ export interface PolicyRetrieveResponse {
4352

4453
schedule: 'per_hour_worked' | 'monthly' | 'yearly' | 'unlimited';
4554

55+
/**
56+
* a string starting with "tot\_"
57+
*/
4658
timeOffTypeId: string;
4759

4860
timeOffTypeName: string;
@@ -51,6 +63,9 @@ export interface PolicyRetrieveResponse {
5163
}
5264

5365
export interface PolicyListResponse {
66+
/**
67+
* a string starting with "top\_"
68+
*/
5469
id: string;
5570

5671
description: string | null;
@@ -69,6 +84,9 @@ export interface PolicyListResponse {
6984

7085
schedule: 'per_hour_worked' | 'monthly' | 'yearly' | 'unlimited';
7186

87+
/**
88+
* a string starting with "tot\_"
89+
*/
7290
timeOffTypeId: string;
7391

7492
timeOffTypeName: string;

src/resources/time-off/time-off.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import { RequestOptions } from '../../internal/request-options';
1515
export class TimeOff extends APIResource {
1616
policies: PoliciesAPI.Policies = new PoliciesAPI.Policies(this._client);
1717

18+
/**
19+
* Time off assignments are mappings between workers and time off policies. Useful
20+
* for finding out which policies a worker is assigned to, or which workers are
21+
* assigned to a given policy.
22+
*/
1823
listAssignments(
1924
query: TimeOffListAssignmentsParams | null | undefined = {},
2025
options?: RequestOptions,
@@ -25,6 +30,9 @@ export class TimeOff extends APIResource {
2530
});
2631
}
2732

33+
/**
34+
* Get worker remaining time-off balances.
35+
*/
2836
listBalances(
2937
query: TimeOffListBalancesParams | null | undefined = {},
3038
options?: RequestOptions,
@@ -35,6 +43,9 @@ export class TimeOff extends APIResource {
3543
});
3644
}
3745

46+
/**
47+
* Get the time off requests that workers in your company have made.
48+
*/
3849
listRequests(
3950
query: TimeOffListRequestsParams | null | undefined = {},
4051
options?: RequestOptions,
@@ -60,6 +71,9 @@ export interface TimeOffListAssignmentsResponse {
6071
*/
6172
assignedAt: string;
6273

74+
/**
75+
* a string starting with "top\_"
76+
*/
6377
policyId: string;
6478

6579
/**
@@ -81,6 +95,9 @@ export interface TimeOffListBalancesResponse {
8195

8296
legacyWorkerId: string;
8397

98+
/**
99+
* a string starting with "top\_"
100+
*/
84101
policyId: string;
85102

86103
used: number;
@@ -110,6 +127,9 @@ export interface TimeOffListRequestsResponse {
110127

111128
status: 'pending' | 'approved' | 'denied';
112129

130+
/**
131+
* a string starting with "top\_"
132+
*/
113133
timeOffPolicyId: string;
114134

115135
/**

src/resources/workers.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ import { RequestOptions } from '../internal/request-options';
77
import { path } from '../internal/utils/path';
88

99
export class Workers extends APIResource {
10+
/**
11+
* Get a specific worker by id.
12+
*/
1013
retrieve(id: string, options?: RequestOptions): APIPromise<WorkerRetrieveResponse> {
1114
return this._client.get(path`/v1/workers/${id}`, options);
1215
}
1316

17+
/**
18+
* List all workers. Workers includ
19+
*/
1420
list(
1521
query: WorkerListParams | null | undefined = {},
1622
options?: RequestOptions,

tests/api-resources/time-off/policies.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const client = new WarpHr({
1010
describe('resource policies', () => {
1111
// Prism tests are disabled
1212
test.skip('retrieve', async () => {
13-
const responsePromise = client.timeOff.policies.retrieve('id');
13+
const responsePromise = client.timeOff.policies.retrieve('top_1234');
1414
const rawResponse = await responsePromise.asResponse();
1515
expect(rawResponse).toBeInstanceOf(Response);
1616
const response = await responsePromise;
@@ -37,7 +37,7 @@ describe('resource policies', () => {
3737
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
3838
await expect(
3939
client.timeOff.policies.list(
40-
{ afterId: 'afterId', beforeId: 'beforeId', limit: 'limit' },
40+
{ afterId: 'top_1234', beforeId: 'top_1234', limit: 'limit' },
4141
{ path: '/_stainless_unknown_path' },
4242
),
4343
).rejects.toThrow(WarpHr.NotFoundError);

tests/api-resources/time-off/time-off.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('resource timeOff', () => {
2929
afterId: 'afterId',
3030
beforeId: 'beforeId',
3131
limit: 'limit',
32-
policyIds: ['string'],
32+
policyIds: ['top_1234'],
3333
workerIds: ['wrk_1234'],
3434
},
3535
{ path: '/_stainless_unknown_path' },
@@ -59,7 +59,7 @@ describe('resource timeOff', () => {
5959
beforeId: 'beforeId',
6060
endDate: 'endDate',
6161
limit: 'limit',
62-
policyIds: ['string'],
62+
policyIds: ['top_1234'],
6363
startDate: 'startDate',
6464
workerIds: ['wrk_1234'],
6565
},
@@ -91,7 +91,7 @@ describe('resource timeOff', () => {
9191
endsBefore: 'endsBefore',
9292
endsOnOrAfter: 'endsOnOrAfter',
9393
limit: 'limit',
94-
policyIds: ['string'],
94+
policyIds: ['top_1234'],
9595
startsBefore: 'startsBefore',
9696
startsOnOrAfter: 'startsOnOrAfter',
9797
statuses: ['pending'],

0 commit comments

Comments
 (0)