-
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.
* feat: add lever sdk with posting endpoint * feat: add opportunites (offers) + postings list * feat: add contacts & tags * test: add test * chore: update pnpm.lock
- Loading branch information
1 parent
bbbcb76
commit d9b85fc
Showing
9 changed files
with
2,047 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,58 @@ | ||
{ | ||
"name": "@opensdks/sdk-lever", | ||
"version": "0.0.1", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "./types/index.d.ts", | ||
"import": "./esm/index.js", | ||
"require": "./cjs/index.js" | ||
}, | ||
"./*.oas.types": "./*.oas.types.js", | ||
"./*.oas.json": "./*.oas.json", | ||
"./*": { | ||
"types": "./types/*.d.ts", | ||
"import": "./esm/*.js", | ||
"require": "./cjs/*.js" | ||
} | ||
}, | ||
"main": "./cjs/index.js", | ||
"module": "./esm/index.js", | ||
"types": "./types/index.d.ts", | ||
"files": [ | ||
"types", | ||
"esm", | ||
"cjs", | ||
"src", | ||
"*.ts", | ||
"*.d.ts", | ||
"*.oas.json", | ||
"!**/*.spec.ts", | ||
"!*.orig.oas.json" | ||
], | ||
"scripts": { | ||
"build": "concurrently npm:build:*", | ||
"build:cjs": "tsc -p ./tsconfig.build.json --declaration false --declarationMap false --module CommonJS --moduleResolution Node10 --outDir ./cjs", | ||
"build:cjs-pkgjson": "mkdir -p ./cjs && echo '{\"type\": \"commonjs\"}' > ./cjs/package.json", | ||
"build:esm": "tsc -p ./tsconfig.build.json --declaration false --declarationMap false --outDir ./esm", | ||
"build:types": "tsc -p ./tsconfig.build.json --emitDeclarationOnly --outDir ./types", | ||
"clean": "rm -rf ./esm ./cjs ./types", | ||
"generate": "run-s generate:*", | ||
"generate:json": "npx tsx ./src/lever.oas.ts | prettier --parser json > ./lever.oas.json", | ||
"generate:types": "node ../../packages/cli/generateFromOas.js ./lever.oas.json", | ||
"version": "pnpm version" | ||
}, | ||
"dependencies": { | ||
"@opensdks/runtime": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@opensdks/runtime": "workspace:*", | ||
"@opensdks/util-zod": "workspace:*", | ||
"concurrently": "^8.2.2", | ||
"openapi-typescript": "6.7.1", | ||
"prettier": "^3.1.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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,73 @@ | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
/* eslint-disable jest/no-standalone-expect */ | ||
import {initSDK} from '@opensdks/runtime' | ||
import leverSdkDef from './index.js' | ||
|
||
const apiKey = process.env['LEVER_API_KEY']! | ||
const maybeTest = apiKey ? test : test.skip | ||
|
||
maybeTest('get postings from lever', async () => { | ||
const lever = initSDK(leverSdkDef, { | ||
headers: { | ||
authorization: `Bearer ${apiKey}`, | ||
}, | ||
}) | ||
|
||
const res = await lever.GET('/postings/{id}', { | ||
params: { | ||
path: { | ||
id: 'test', | ||
}, | ||
}, | ||
}) | ||
expect(res.response?.status).toEqual(200) | ||
expect(res.data).not.toBeUndefined() | ||
}) | ||
|
||
maybeTest('get opportunities from lever', async () => { | ||
const lever = initSDK(leverSdkDef, { | ||
headers: { | ||
authorization: `Bearer ${apiKey}`, | ||
}, | ||
}) | ||
|
||
const res = await lever.GET('/opportunities/{id}', { | ||
params: { | ||
path: { | ||
id: 'test', | ||
}, | ||
}, | ||
}) | ||
expect(res.response?.status).toEqual(200) | ||
expect(res.data).not.toBeUndefined() | ||
}) | ||
|
||
maybeTest('get contact from lever', async () => { | ||
const lever = initSDK(leverSdkDef, { | ||
headers: { | ||
authorization: `Bearer ${apiKey}`, | ||
}, | ||
}) | ||
|
||
const res = await lever.GET('/contacts/{id}', { | ||
params: { | ||
path: { | ||
id: 'test', | ||
}, | ||
}, | ||
}) | ||
expect(res.response?.status).toEqual(200) | ||
expect(res.data).not.toBeUndefined() | ||
}) | ||
|
||
maybeTest('get tags from lever', async () => { | ||
const lever = initSDK(leverSdkDef, { | ||
headers: { | ||
authorization: `Bearer ${apiKey}`, | ||
}, | ||
}) | ||
|
||
const res = await lever.GET('/tags') | ||
expect(res.response?.status).toEqual(200) | ||
expect(res.data).not.toBeUndefined() | ||
}) |
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,29 @@ | ||
import type {ClientOptions} from '@opensdks/runtime' | ||
import {initSDK, type SdkDefinition, type SDKTypes} from '@opensdks/runtime' | ||
import type leverTypes from '../lever.oas.types.js' | ||
import {default as leverOasMeta} from './lever.oas.meta.js' | ||
|
||
export {leverTypes} | ||
|
||
export type LeverSDKTypes = SDKTypes< | ||
leverTypes, | ||
Omit<ClientOptions, 'headers'> & { | ||
headers: { | ||
authorization: `Bearer ${string}` | ||
[k: string]: string | undefined | ||
} | ||
} | ||
> | ||
|
||
export const leverSdkDef = { | ||
types: {} as LeverSDKTypes, | ||
oasMeta: leverOasMeta, | ||
} satisfies SdkDefinition<LeverSDKTypes> | ||
|
||
export function initLeverSDK(opts: LeverSDKTypes['options']) { | ||
return initSDK(leverSdkDef, opts) | ||
} | ||
|
||
export type LeverSDK = ReturnType<typeof initLeverSDK> | ||
|
||
export default leverSdkDef |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.