-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add seam cli code samples (#58)
* feat: add seam cli code samples * rename bash -> seam_cli * add req/res syntax * ci: Generate code * Update src/lib/code-sample/schema.ts Co-authored-by: Evan Sosenko <evan@getseam.com> * ci: Generate code * fix double quotes --------- Co-authored-by: Seam Bot <devops@getseam.com> Co-authored-by: Evan Sosenko <evan@getseam.com>
- Loading branch information
1 parent
67bbff4
commit f41c469
Showing
4 changed files
with
102 additions
and
1 deletion.
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
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,18 @@ | ||
import { kebabCase } from 'change-case' | ||
|
||
import { createJsonResponse } from './create-json-response.js' | ||
import type { CodeSampleDefinition, Context } from './schema.js' | ||
|
||
export const createSeamCliRequest = ( | ||
{ request }: CodeSampleDefinition, | ||
_context: Context, | ||
): string => { | ||
const parts = request.path.split('/') | ||
const requestParams = Object.entries(request.parameters) | ||
.map(([key, value]) => `--${key} ${JSON.stringify(value)}`) | ||
.join(' ') | ||
|
||
return `seam${parts.map((p) => kebabCase(p)).join(' ')} ${requestParams}` | ||
} | ||
|
||
export const createSeamCliResponse = createJsonResponse |
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
Binary file not shown.