Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krasun/requestcodegen
A library to generate HTTP client example code in different programming languages.
https://github.com/krasun/requestcodegen
code-generation codegenerator curl http http-client typescript-library
Last synced: 14 days ago
JSON representation
A library to generate HTTP client example code in different programming languages.
- Host: GitHub
- URL: https://github.com/krasun/requestcodegen
- Owner: krasun
- License: mit
- Created: 2024-01-05T07:06:25.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-19T19:40:05.000Z (11 months ago)
- Last Synced: 2024-12-09T17:00:37.077Z (16 days ago)
- Topics: code-generation, codegenerator, curl, http, http-client, typescript-library
- Language: TypeScript
- Homepage:
- Size: 97.7 KB
- Stars: 18
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# requestcodegen
[![Build](https://github.com/krasun/requestcodegen/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/krasun/requestcode/actions/workflows/build.yml)
[![NPM package](https://img.shields.io/npm/v/requestcodegen.svg?branch=main)](https://www.npmjs.com/package/requestcodegen)`requestcodegen` is a library to generate HTTP client example code in different programming languages.
## Install
```shell
npm install requestcodegen --save
```## Use
Using the library is as easy as:
```typescript
import { generateCode } from "requestcodegen";const clojureCodeExample = generateCode(
{ url: "http://example.com", method: "POST" },
CodeTarget.Clojure
);
```## Build and publish (a manual for developers)
To build and publish the library:
1. Bump the version property in the `package.json` file.
2. Run `npm run prepare`.
3. Run `npm publish`.## Generate code
```shell
OPENAI_MODEL= OPENAI_BASE_URL="" OPENAI_API_KEY="OpenAI API key" npm run generate src/generators
```# Known usages
A few examples of how the library is used:
1. [ScreenshotOne](https://screenshotone.com) uses the library for generating code examples in the playground for the screenshot API.
If you use the library, please, don't hesitate to share how and in what project.
## License
`krasun/requestcodegen` is released under [the MIT license](LICENSE).