{"id":15014122,"url":"https://github.com/midnqp/pcolib","last_synced_at":"2026-01-25T17:02:08.748Z","repository":{"id":44941208,"uuid":"491177279","full_name":"midnqp/pcolib","owner":"midnqp","description":"Easily fetch request payloads and response data from Postman collections.","archived":false,"fork":false,"pushed_at":"2022-07-13T05:15:16.000Z","size":276,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T00:39:41.251Z","etag":null,"topics":["postman","postman-collection"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/midnqp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-11T15:50:42.000Z","updated_at":"2023-12-18T19:09:38.000Z","dependencies_parsed_at":"2022-09-26T21:10:43.678Z","dependency_job_id":null,"html_url":"https://github.com/midnqp/pcolib","commit_stats":null,"previous_names":["midnqp/postman-collection-interface-library"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/midnqp/pcolib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnqp%2Fpcolib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnqp%2Fpcolib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnqp%2Fpcolib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnqp%2Fpcolib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/midnqp","download_url":"https://codeload.github.com/midnqp/pcolib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midnqp%2Fpcolib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28755561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T16:32:25.380Z","status":"ssl_error","status_checked_at":"2026-01-25T16:32:09.189Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postman","postman-collection"],"created_at":"2024-09-24T19:45:13.221Z","updated_at":"2026-01-25T17:02:08.726Z","avatar_url":"https://github.com/midnqp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![pcolib-logo](https://user-images.githubusercontent.com/50658760/178645554-c5cecc80-fa33-49bd-b975-10445d8a2648.png)\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-brightgreen.svg?style=for-the-badge\"\u003e\n\u003c/a\u003e\n    \u0026emsp;\n    \u003cimg src=\"https://img.shields.io/github/languages/code-size/midnqp/postman-collection-interface-library?style=for-the-badge\"\u003e\n    \u0026emsp;\n    \u003cimg src=\"https://img.shields.io/tokei/lines/github.com/midnqp/postman-collection-interface-library?style=for-the-badge\"\u003e\n    \u0026emsp;\n    \u003cimg src=\"https://img.shields.io/npm/v/postman-collection-interface?style=for-the-badge\u0026logo=npm\"\u003e\n\u003c/p\u003e\n\n\n## API\n\n#### Run a request\nThe argument `example` of method `Pcolib.prototype.run()` is optional. If omitted, the data present in original request is used.\n```ts\nimport collection from './postman.json' assert {type: 'json'}\nimport Pcolib from 'postman-collection-interface'\n\nconst pcolib = new Pcolib({ collection })\npcolib.run('folder-name', 'request-name', 'example-name')\n```\n\n#### Specify by method-chaining\n```ts\npcolib.get('folder', 'req').example('ex').run()\n\npcolib.get('folder').request('req').example('ex').run()\n```\n\n#### Specify request data\n```ts\npcolib.get('public-api', 'user login').body({ name: 'muhammad' }).run()\n\npcolib.get('public-api')\n\t.request('user login')\n\t.body({ name: 'muhammad' })\n\t.headers({ etag: 'etag-token' })\n\t.run()\n```\n\n#### Get request data\n```ts\nconst {body, query, headers, params} = pcolib.get('public-api', 'user login', 'dev: ok')\n```\n\n#### URL\nPcolib parses and looks out for query parameters and path variables. If these data are specified by user, then they're used to make the request.\nIf a URL in postman is as: `/user/{{user_id}}/repositories/{{repo_id}}`, then:\n```ts\npcolib.get('user code repo')\n\t.request('get single repo')\n\t.headers({ authorization: 'Bearer xyz' })\n\t.params({ user_id: 'f7kla9-09kda', repo_id: '345678' })\n```\n\n#### Stateful requests\nPcolib instances can be a mock for a user. Often useful in end-to-end testing. If `global` payload is specified, all requests from the instance will contain the payload.\n```ts\nconst admin = new Pcolib({\n\tcollection,\n\tglobal: { headers: { authorization: 'Bearer admin' } }\n})\nconst shop = new Pcolib({\n\tcollection,\n\tglobal: { headers: { authorization: 'Bearer shop' } }\n})\nconst user = new Pcolib({\n\tcollection,\n\tglobal: { headers: { authorization: 'Bearer user' } }\n})\n\nuser.get('cart', 'checkout').run()\nshop.get('order', 'list').run()\nadmin.get('analytics', 'past orders').query({ pastDays: 30 }).run()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidnqp%2Fpcolib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmidnqp%2Fpcolib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidnqp%2Fpcolib/lists"}