-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f1339e
commit a879391
Showing
10 changed files
with
331 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
configured_endpoints: 35 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-69265939ed1aa33d9890c86a334730210985961db56757efc28ff43696fbd1a7.yml | ||
configured_endpoints: 37 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-f1001da4ad3c1503330eebc1e61319a1a5db5e2da9fec98bc8682cb0967894d2.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
export { | ||
PayGroupRetrieveResponse, | ||
PayGroupListResponse, | ||
PayGroupListParams, | ||
PayGroupListResponsesSinglePage, | ||
PayGroups, | ||
} from './pay-groups'; | ||
export { Payroll } from './payroll'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import * as Core from '@tryfinch/finch-api/core'; | ||
import { APIResource } from '@tryfinch/finch-api/resource'; | ||
import { isRequestOptions } from '@tryfinch/finch-api/core'; | ||
import * as PayGroupsAPI from '@tryfinch/finch-api/resources/payroll/pay-groups'; | ||
import { SinglePage } from '@tryfinch/finch-api/pagination'; | ||
|
||
export class PayGroups extends APIResource { | ||
/** | ||
* Read information from a single pay group | ||
*/ | ||
retrieve(payGroupId: string, options?: Core.RequestOptions): Core.APIPromise<PayGroupRetrieveResponse> { | ||
return this._client.get(`/employer/pay-group/${payGroupId}`, options); | ||
} | ||
|
||
/** | ||
* Read company pay groups and frequencies | ||
*/ | ||
list( | ||
query?: PayGroupListParams, | ||
options?: Core.RequestOptions, | ||
): Core.PagePromise<PayGroupListResponsesSinglePage, PayGroupListResponse>; | ||
list( | ||
options?: Core.RequestOptions, | ||
): Core.PagePromise<PayGroupListResponsesSinglePage, PayGroupListResponse>; | ||
list( | ||
query: PayGroupListParams | Core.RequestOptions = {}, | ||
options?: Core.RequestOptions, | ||
): Core.PagePromise<PayGroupListResponsesSinglePage, PayGroupListResponse> { | ||
if (isRequestOptions(query)) { | ||
return this.list({}, query); | ||
} | ||
return this._client.getAPIList('/employer/pay-groups', PayGroupListResponsesSinglePage, { | ||
query, | ||
...options, | ||
}); | ||
} | ||
} | ||
|
||
export class PayGroupListResponsesSinglePage extends SinglePage<PayGroupListResponse> {} | ||
|
||
export interface PayGroupRetrieveResponse { | ||
/** | ||
* Finch id (uuidv4) for the pay group | ||
*/ | ||
id: string; | ||
|
||
individual_ids: Array<string>; | ||
|
||
/** | ||
* Name of the pay group | ||
*/ | ||
name: string; | ||
|
||
/** | ||
* List of pay frequencies associated with this pay group | ||
*/ | ||
pay_frequencies: Array< | ||
| 'annually' | ||
| 'semi_annually' | ||
| 'quarterly' | ||
| 'monthly' | ||
| 'semi_monthly' | ||
| 'bi_weekly' | ||
| 'weekly' | ||
| 'daily' | ||
| 'other' | ||
>; | ||
} | ||
|
||
export interface PayGroupListResponse { | ||
/** | ||
* Finch id (uuidv4) for the pay group | ||
*/ | ||
id?: string; | ||
|
||
/** | ||
* Name of the pay group | ||
*/ | ||
name?: string; | ||
|
||
/** | ||
* List of pay frequencies associated with this pay group | ||
*/ | ||
pay_frequencies?: Array< | ||
| 'annually' | ||
| 'semi_annually' | ||
| 'quarterly' | ||
| 'monthly' | ||
| 'semi_monthly' | ||
| 'bi_weekly' | ||
| 'weekly' | ||
| 'daily' | ||
| 'other' | ||
>; | ||
} | ||
|
||
export interface PayGroupListParams { | ||
individual_id?: string; | ||
|
||
pay_frequencies?: Array<string>; | ||
} | ||
|
||
export namespace PayGroups { | ||
export import PayGroupRetrieveResponse = PayGroupsAPI.PayGroupRetrieveResponse; | ||
export import PayGroupListResponse = PayGroupsAPI.PayGroupListResponse; | ||
export import PayGroupListResponsesSinglePage = PayGroupsAPI.PayGroupListResponsesSinglePage; | ||
export import PayGroupListParams = PayGroupsAPI.PayGroupListParams; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import { APIResource } from '@tryfinch/finch-api/resource'; | ||
import * as PayGroupsAPI from '@tryfinch/finch-api/resources/payroll/pay-groups'; | ||
|
||
export class Payroll extends APIResource { | ||
payGroups: PayGroupsAPI.PayGroups = new PayGroupsAPI.PayGroups(this._client); | ||
} | ||
|
||
export namespace Payroll { | ||
export import PayGroups = PayGroupsAPI.PayGroups; | ||
export import PayGroupRetrieveResponse = PayGroupsAPI.PayGroupRetrieveResponse; | ||
export import PayGroupListResponse = PayGroupsAPI.PayGroupListResponse; | ||
export import PayGroupListResponsesSinglePage = PayGroupsAPI.PayGroupListResponsesSinglePage; | ||
export import PayGroupListParams = PayGroupsAPI.PayGroupListParams; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
import Finch from '@tryfinch/finch-api'; | ||
import { Response } from 'node-fetch'; | ||
|
||
const finch = new Finch({ | ||
accessToken: 'My Access Token', | ||
clientId: '4ab15e51-11ad-49f4-acae-f343b7794375', | ||
clientSecret: 'My Client Secret', | ||
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', | ||
}); | ||
|
||
describe('resource payGroups', () => { | ||
test('retrieve', async () => { | ||
const responsePromise = finch.payroll.payGroups.retrieve('string'); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
test('retrieve: request options instead of params are passed correctly', async () => { | ||
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error | ||
await expect( | ||
finch.payroll.payGroups.retrieve('string', { path: '/_stainless_unknown_path' }), | ||
).rejects.toThrow(Finch.NotFoundError); | ||
}); | ||
|
||
test('list', async () => { | ||
const responsePromise = finch.payroll.payGroups.list(); | ||
const rawResponse = await responsePromise.asResponse(); | ||
expect(rawResponse).toBeInstanceOf(Response); | ||
const response = await responsePromise; | ||
expect(response).not.toBeInstanceOf(Response); | ||
const dataAndResponse = await responsePromise.withResponse(); | ||
expect(dataAndResponse.data).toBe(response); | ||
expect(dataAndResponse.response).toBe(rawResponse); | ||
}); | ||
|
||
test('list: request options instead of params are passed correctly', async () => { | ||
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error | ||
await expect(finch.payroll.payGroups.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( | ||
Finch.NotFoundError, | ||
); | ||
}); | ||
|
||
test('list: request options and params are passed correctly', async () => { | ||
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error | ||
await expect( | ||
finch.payroll.payGroups.list( | ||
{ | ||
individual_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', | ||
pay_frequencies: ['string', 'string', 'string'], | ||
}, | ||
{ path: '/_stainless_unknown_path' }, | ||
), | ||
).rejects.toThrow(Finch.NotFoundError); | ||
}); | ||
}); |
Oops, something went wrong.