Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 10
feat(api): add generic workos api gateway#142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
50e3b55ca3c9af619b5780054db95a5ad2b39c67aaadd7794aaaa66fff3b3e72d87eb70b23d79f2af84f37ef3b84912d24b843058a57f38d11e5ffb6e5c43eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -430,6 +430,88 @@ yargs(rawArgs) | ||
| ); | ||
| return yargs.demandCommand(1, 'Please specify an env subcommand').strict(); | ||
| }) | ||
| .command( | ||
| 'api [endpoint] [filter]', | ||
| 'Make authenticated requests to the WorkOS API', | ||
| (yargs) => | ||
| yargs | ||
| .options(insecureStorageOption) | ||
| .positional('endpoint', { | ||
| type: 'string', | ||
| describe: "API endpoint path (e.g. /users), or 'ls' to list endpoints", | ||
| }) | ||
| .positional('filter', { | ||
| type: 'string', | ||
| describe: 'Filter keyword (used with ls)', | ||
| }) | ||
| .option('method', { | ||
| alias: 'X', | ||
| type: 'string', | ||
| describe: 'HTTP method (default: GET, or POST if body provided)', | ||
| }) | ||
| .option('data', { | ||
| alias: 'd', | ||
| type: 'string', | ||
| describe: 'JSON request body', | ||
| }) | ||
| .option('file', { | ||
| type: 'string', | ||
| describe: 'Read request body from a file (or - for stdin)', | ||
| }) | ||
| .option('include', { | ||
| alias: 'i', | ||
| type: 'boolean', | ||
| default: false, | ||
| describe: 'Show response headers', | ||
| }) | ||
| .option('api-key', { | ||
| type: 'string', | ||
| describe: 'Override the API key', | ||
| }) | ||
| .option('dry-run', { | ||
| type: 'boolean', | ||
| default: false, | ||
| describe: 'Show the request without executing it', | ||
| }) | ||
| .option('yes', { | ||
| alias: 'y', | ||
| type: 'boolean', | ||
| default: false, | ||
| describe: 'Skip confirmation for mutating requests', | ||
| }) | ||
| .example('workos api ls', 'List all available endpoints') | ||
| .example('workos api ls users', 'List endpoints matching "users"') | ||
| .example('workos api /user_management/users', 'GET /user_management/users') | ||
| .example('workos api /organizations -d \'{"name":"Acme"}\'', 'POST with a JSON body') | ||
| .example('workos api /organizations/org_123 -X DELETE', 'DELETE an organization'), | ||
| async (argv) => { | ||
| await applyInsecureStorage(argv.insecureStorage as boolean | undefined); | ||
| const endpoint = argv.endpoint as string | undefined; | ||
| const filter = argv.filter as string | undefined; | ||
| const { runApiLs, runApiRequest, runApiInteractive } = await import('./commands/api/index.js'); | ||
| if (!endpoint) { | ||
| await runApiInteractive({ apiKey: argv.apiKey as string | undefined }); | ||
| return; | ||
| } | ||
| if (endpoint === 'ls') { | ||
| await runApiLs(filter); | ||
| return; | ||
| } | ||
| await runApiRequest(endpoint, { | ||
| method: argv.method, | ||
| data: argv.data, | ||
| file: argv.file, | ||
| include: argv.include, | ||
| apiKey: argv.apiKey, | ||
| dryRun: argv.dryRun, | ||
| yes: argv.yes, | ||
| }); | ||
| }, | ||
| ) | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| .command(['organization', 'org'], 'Manage WorkOS organizations (create, update, get, list, delete)', (yargs) => { | ||
| yargs.options({ | ||
| ...insecureStorageOption, | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.