Skip to content

Commit

Permalink
feat: Add docs with example
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Dec 2, 2023
1 parent 11696c2 commit 50991cd
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"unicorn/prefer-string-starts-ends-with": "warn",
"unicorn/prefer-string-trim-start-end": "warn",
"unicorn/prefer-switch": "warn",
"unicorn/prefer-top-level-await": "warn",
"unicorn/prefer-top-level-await": "off",
"unicorn/prefer-type-error": "warn",
"unicorn/relative-url-style": "warn",
"unicorn/require-array-join-separator": "warn",
Expand Down
16 changes: 16 additions & 0 deletions docs/example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {createClient} from '@opensdks/core'
import type {githubTypes} from '@opensdks/sdk-github'

const github = createClient<githubTypes['paths']>({
baseUrl: 'https://api.github.com',
headers: {
authorization: `Bearer ${process.env['GITHUB_TOKEN']}`,
'X-GitHub-Api-Version': '2022-11-28',
},
})

void github
.GET('/orgs/{org}/actions/secrets', {params: {path: {org: 'usevenice'}}})
.then((r) => {
console.log(r.data)
})
12 changes: 12 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@opensdks/docs",
"dependencies": {
"@opensdks/core": "workspace:*",
"@opensdks/sdk-discord": "workspace*",
"@opensdks/sdk-github": "workspace*",
"@opensdks/sdk-openai": "workspace*",
"@opensdks/sdk-plaid": "workspace*",
"@opensdks/sdk-slack": "workspace*",
"@opensdks/sdk-venice": "workspace*"
}
}
7 changes: 7 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["./*.ts"]
}
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ packages:
- 'packages/*'
- 'packages/sdks/*'
- 'packages/utils/*'
- 'docs'
6 changes: 2 additions & 4 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// TODO: Get all the tsconfigs to extend this one
// in particular the root /tsconfig.json and /apps/web/tsconfig.json

{
"extends": "@tsconfig/strictest/tsconfig.json",
"compilerOptions": {
Expand All @@ -24,10 +23,9 @@
// for the foreseeable future
// @see https://github.com/egoist/tsup/issues/885
"declarationMap": true,
// This is a hack because otherwise when running code that imports from the
// web module we get package not found issues. (such as `generate` call in the sdk)
"paths": {
"@/*": ["./apps/web/*"]
"@opensdks/core": ["./packages/core/src"],
"@opensdks/core/*": ["./packages/core/src/*"]
}
},
"exclude": ["node_modules"]
Expand Down

0 comments on commit 50991cd

Please sign in to comment.