gurl codegen

Generate code in various programming languages from a saved request.

Usage

gurl codegen [name] [flags]

Description

The codegen command converts a saved request into code for various languages. This helps you integrate API calls into your codebase without manual translation.

Flags

FlagShortDefaultDescription
--lang-lnoneTarget language: go, python, javascript, or curl
--clipboard-cfalseCopy output to clipboard instead of printing

Aliases

  • cg

Examples

Generate Go code

gurl codegen "my-request" --lang go

Generates Go code for the request.

Generate Python code

gurl codegen "api-users" --lang python

Generates Python requests library code.

Generate JavaScript code

gurl codegen "create-user" --lang javascript

Generates JavaScript fetch code.

Copy to clipboard

gurl codegen "my-request" --lang curl --clipboard

Generates curl command and copies to clipboard.

See also