diff --git a/README.md b/README.md index 0236256..2f7eafb 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,5 @@ This project stores [Plugins](https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web - [gapier](./plugins/gapier) - [Webpilot](./plugins/webpilot) - [FastGPT](./plugins/fastgpt) +- [NPM Registry Search API](./plugins/npmsearch) diff --git a/plugins/npmsearch/README.md b/plugins/npmsearch/README.md new file mode 100644 index 0000000..a4a0ee9 --- /dev/null +++ b/plugins/npmsearch/README.md @@ -0,0 +1,27 @@ +# NPM Registry Search API + +> Search for packages in the NPM registry. + +## Schema +[openapi.json](./openapi.json) + +## Servers + +`https://registry.npmjs.org` + +## Operations + +1. searchPackages +> Search for packages in the NPM registry +2. getPackageDetails +> Get details of a specific package + +## Authentication + +type: none + +## Preview + +![Preview](./preview.jpg) + + diff --git a/plugins/npmsearch/openapi.json b/plugins/npmsearch/openapi.json new file mode 100644 index 0000000..bd71b95 --- /dev/null +++ b/plugins/npmsearch/openapi.json @@ -0,0 +1,214 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "NPM Registry Search API", + "version": "1.0.0" + }, + "servers": [ + { + "url": "https://registry.npmjs.org" + } + ], + "paths": { + "/-/v1/search": { + "get": { + "operationId": "searchPackages", + "x-openai-isConsequential": false, + "summary": "Search for packages in the NPM registry", + "parameters": [ + { + "name": "text", + "in": "query", + "schema": { + "type": "string" + }, + "description": "Full-text search to apply" + }, + { + "name": "size", + "in": "query", + "schema": { + "type": "integer" + }, + "description": "Number of results to return" + }, + { + "name": "from", + "in": "query", + "schema": { + "type": "integer" + }, + "description": "Offset to return results from" + }, + { + "name": "quality", + "in": "query", + "schema": { + "type": "number", + "format": "float" + }, + "description": "Effect of quality on search results" + }, + { + "name": "popularity", + "in": "query", + "schema": { + "type": "number", + "format": "float" + }, + "description": "Effect of popularity on search results" + }, + { + "name": "maintenance", + "in": "query", + "schema": { + "type": "number", + "format": "float" + }, + "description": "Effect of maintenance on search results" + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "objects": { + "type": "array", + "items": { + "type": "object", + "properties": { + "package": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "keywords": { + "type": "array", + "items": { + "type": "string" + } + }, + "date": { + "type": "string", + "format": "date-time" + }, + "links": { + "type": "object", + "properties": { + "npm": { + "type": "string", + "format": "uri" + }, + "homepage": { + "type": "string", + "format": "uri" + }, + "repository": { + "type": "string", + "format": "uri" + }, + "bugs": { + "type": "string", + "format": "uri" + } + } + }, + "publisher": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + } + } + }, + "maintainers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "email": { + "type": "string", + "format": "email" + } + } + } + } + } + } + } + } + }, + "total": { + "type": "integer" + }, + "time": { + "type": "string", + "format": "date-time" + } + } + } + } + } + }, + "400": { + "description": "Bad request" + } + } + } + }, + "/{packageName}/latest": { + "get": { + "operationId": "getPackageDetails", + "summary": "Get details of a specific package", + "parameters": [ + { + "name": "packageName", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "The name of the package" + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "text/html": { + "schema": { + "type": "string", + "description": "HTML content of the package details" + } + } + } + }, + "400": { + "description": "Bad request" + }, + "404": { + "description": "Package not found" + } + } + } + } + } +} diff --git a/plugins/npmsearch/preview.jpg b/plugins/npmsearch/preview.jpg new file mode 100644 index 0000000..1912bf0 Binary files /dev/null and b/plugins/npmsearch/preview.jpg differ