npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

postman-collection-code-generators

v0.0.2

Published

Repository for generating code from Postman Collection.

Readme

Manage all of your organization's APIs in Postman, with the industry's most complete API development environment.

Supercharge your API workflow.
Modern software is built on APIs. Postman helps you develop APIs faster.

postman-collection-code-generators

This library converts Postman Collection into client SDK of the chosen language.

Every sdk generator has two identifiers: language and variant.

  • language of sdk generator is the language in which client SDK is generated.
  • variant of sdk generator is the main library name which is used in the generated SDK.

| Language | Variant | | -------- | ------- | | Nodejs | Request |

Table of contents

Getting Started

To get started on your local machine.

$ git clone https://github.com/postmanlabs/postman-code-generators.git

Prerequisite

To run any of the postman-collection-code-generators, ensure that you have NodeJS >= v12. A copy of the NodeJS installable can be downloaded [here] (https://nodejs.org/en/download/package-manager. )

Usage

Using postman-collection-code-generators as a Library

There are three functions that are exposed in postman-collection-code-generators: getLanguageList, getSDKOptions & generate.

getLanguageList

let sdkgen = require('pathToSdkgen');

console.log(sdkgen.getLanguageList());
// [ 
//   {
//     name: 'nodejs-request',
//     language: 'nodejs',
//     variant: 'request'
//   } 
//   ...
// ]

getSDKOptions

General Options

This function takes in two optional parameters and returns an Array.

  • language - language key from the language list returned from getLanguageList function
  • variant - variant key provided by getLanguageList function

A typical option has the following properties:

  • name - Display name
  • id - unique ID of the option
  • type - Data type of the option. (Allowed data types: boolean, string)
  • default - Default value. The value that is used if this option is not specified while creating SDK snippet.
  • availableOptions - List of available options.
  • required - Boolean to denote if its a required option
  • description - User-friendly description.
let sdkgen = require('pathToSdkgen');

console.log(sdkgen.getSDKOptions());
// [
//   {
//     name: 'SDK Language',
//     id: 'language',
//     availableOptions: 'Use getSDKOptions method to get list of available sdkgens',
//     type: 'String',
//     default: '',
//     required: true,
//     description: 'Specifies Language for SDK generation'
//   },
//   {
//     name: 'SDK language variant',
//     id: 'variant',
//     availableOptions: 'any',
//     default: '',
//     type: 'String',
//     required: true,
//     description: 'Specifies Language variant for SDK generation'
//   }
//   ...
// ]
let sdkgen = require('pathToSdkgen');

console.log(sdkgen.getSDKOptions('nodejs', 'request'));
// [
//   {
//     name: 'Set response return method',
//     id: 'returnMethod',
//     availableOptions: [ 'Callback', 'Promise' ],
//     type: 'String',
//     default: 'Callback',
//     required: false,
//     description: 'Set response return method got http response.'
//   },
//   {
//     name: 'SDK output type',
//     id: 'outputType',
//     availableOptions: [ 'File', 'String' ],
//     type: 'String',
//     default: 'String',
//     required: false,
//     description: 'Specifies Type of Output for the generated SDK'
//   },
//   {
//     name: 'SDK output file name',
//     id: 'outputFilePath',
//     availableOptions: null,
//     type: 'String',
//     default: '/home/wolf/development/postman-collection-code-generators/test/unit',
//     required: false,
//     description: 'Specifies output path for generated SDK'
//   }
//   ...
// ]

generate

Collection / Output

let sdkgen = require('pathToSdkgen');

sdkgen.generate({
  type: 'string',
  source: 'https://www.getpostman.com/collections/c8aa0d9bd381c73c5ac3'
}, {
  language: 'Nodejs',
  variant: 'request',
}, (err, snippet) => {
  if (err) return console.log(err);
  console.log(snippet);
});

Development

Installing dependencies

This command will install all the dependencies in production mode.

$ npm install

To install dev dependencies also for all sdkgen run:

$ npm run deepinstall

Testing

To run common repo test as well as tests for all sdkgens

$ npm test

To run structure and individual tests on a single sdkgen

$ npm test <sdken-name>;
# Here "sdkgen-name" is the folder name of the sdkgen inside sdkgen folder

License

This software is licensed under Apache-2.0. Copyright Postman, Inc. See the LICENSE.md file for more information.