Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with OpenAPI definition #73

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 69 additions & 33 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"requestBodies": {},
"responses": {
"SocketBadRequest": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
Expand All @@ -40,10 +39,10 @@
]
}
}
}
},
"description": "Bad request"
},
"SocketUnauthorized": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
Expand All @@ -69,10 +68,10 @@
]
}
}
}
},
"description": "Unauthorized"
},
"SocketForbidden": {
"description": "Insufficient max_quota for API method",
"content": {
"application/json": {
"schema": {
Expand All @@ -98,10 +97,10 @@
]
}
}
}
},
"description": "Insufficient max_quota for API method"
},
"SocketNotFoundResponse": {
"description": "Resource not found",
"content": {
"application/json": {
"schema": {
Expand All @@ -127,7 +126,8 @@
]
}
}
}
},
"description": "Resource not found"
},
"SocketTooManyRequestsResponse": {
"description": "Insufficient quota for API route",
Expand Down Expand Up @@ -5854,6 +5854,21 @@
"$ref": "#/components/schemas/SocketRefWeb"
}
}
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"enum": [
"pypi"
]
},
"value": {
"$ref": "#/components/schemas/SocketRefPyPI"
}
}
}
]
},
Expand Down Expand Up @@ -5962,6 +5977,26 @@
"required": [
"url"
]
},
"SocketRefPyPI": {
"type": "object",
"additionalProperties": false,
"properties": {
"package": {
"type": "string",
"default": ""
},
"version": {
"type": "string",
"default": ""
},
"file": {
"$ref": "#/components/schemas/SocketRefFile"
}
},
"required": [
"package"
]
}
},
"securitySchemes": {
Expand All @@ -5983,7 +6018,6 @@
"NPM"
],
"summary": "Get issues by package",
"description": "Get all the issues related with a particular npm package version.\nThis endpoint returns the issue type, location, and additional details related to each issue in the `props` attribute.\n\nYou can [see here](https://socket.dev/npm/issue) the full list of issues.\n\nThis endpoint consumes 1 unit of your quota.",
"operationId": "getIssuesByNPMPackage",
"parameters": [
{
Expand All @@ -6004,16 +6038,17 @@
}
}
],
"description": "Get all the issues related with a particular npm package version.\nThis endpoint returns the issue type, location, and additional details related to each issue in the `props` attribute.\n\nYou can [see here](https://socket.dev/npm/issue) the full list of issues.\n\nThis endpoint consumes 1 unit of your quota.",
"responses": {
"200": {
"description": "Socket issue lists",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SocketIssueList"
}
}
}
},
"description": "Socket issue lists"
},
"400": {
"$ref": "#/components/responses/SocketBadRequest"
Expand All @@ -6040,7 +6075,6 @@
"NPM"
],
"summary": "Get score by package",
"description": "Get all the scores and metrics by category that are used to evaluate the package version.\n\nThis endpoint consumes 1 unit of your quota.",
"operationId": "getScoreByNPMPackage",
"parameters": [
{
Expand All @@ -6061,16 +6095,17 @@
}
}
],
"description": "Get all the scores and metrics by category that are used to evaluate the package version.\n\nThis endpoint consumes 1 unit of your quota.",
"responses": {
"200": {
"description": "Socket package scores",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SocketPackageScore"
}
}
}
},
"description": "Socket package scores"
},
"400": {
"$ref": "#/components/responses/SocketBadRequest"
Expand All @@ -6097,7 +6132,6 @@
"Project report"
],
"summary": "Delete a report",
"description": "Delete a specific project report.\n\nThis endpoint consumes 10 units of your quota.",
"operationId": "deleteReport",
"parameters": [
{
Expand All @@ -6109,9 +6143,9 @@
}
}
],
"description": "Delete a specific project report.\n\nThis endpoint consumes 10 units of your quota.",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
Expand All @@ -6128,7 +6162,8 @@
]
}
}
}
},
"description": "Success"
},
"400": {
"$ref": "#/components/responses/SocketBadRequest"
Expand All @@ -6155,11 +6190,10 @@
"Project report"
],
"summary": "Get list of reports",
"description": "Get all your project reports.\n\nThis endpoint consumes 10 units of your quota.",
"operationId": "getReportList",
"description": "Get all your project reports.\n\nThis endpoint consumes 10 units of your quota.",
"responses": {
"200": {
"description": "List of project reports",
"content": {
"application/json": {
"schema": {
Expand All @@ -6184,7 +6218,8 @@
}
}
}
}
},
"description": "List of project reports"
},
"400": {
"$ref": "#/components/responses/SocketBadRequest"
Expand All @@ -6211,7 +6246,6 @@
"Project report"
],
"summary": "Create a report",
"description": "Upload a lockfile to get your project analyzed by Socket.\nYou can upload multiple lockfiles in the same request, but each filename must be unique.\n\nThe name of the file must be in the supported list.\n\nThe supported lockfiles (and filenames) are: `package.json` and `package-lock.json`.\n\nFor example, these are valid filenames: `package.json`, `folder/package.json` and `deep/nested/folder/package.json`.\n\nThis endpoint consumes 100 units of your quota.",
"operationId": "createReport",
"requestBody": {
"content": {
Expand All @@ -6234,11 +6268,12 @@
}
}
}
}
},
"required": false
},
"description": "Upload a lockfile to get your project analyzed by Socket.\nYou can upload multiple lockfiles in the same request, but each filename must be unique.\n\nThe name of the file must be in the supported list.\n\nThe supported lockfiles (and filenames) are: `package.json` and `package-lock.json`.\n\nFor example, these are valid filenames: `package.json`, `folder/package.json` and `deep/nested/folder/package.json`.\n\nThis endpoint consumes 100 units of your quota.",
"responses": {
"200": {
"description": "ID and URL of the project report",
"content": {
"application/json": {
"schema": {
Expand All @@ -6260,7 +6295,8 @@
]
}
}
}
},
"description": "ID and URL of the project report"
},
"400": {
"$ref": "#/components/responses/SocketBadRequest"
Expand All @@ -6284,7 +6320,6 @@
"Project report"
],
"summary": "View a report",
"description": "Get all the issues, packages, and scores related to an specific project report.\n\nThis endpoint consumes 10 units of your quota.",
"operationId": "getReport",
"parameters": [
{
Expand All @@ -6296,16 +6331,17 @@
}
}
],
"description": "Get all the issues, packages, and scores related to an specific project report.\n\nThis endpoint consumes 10 units of your quota.",
"responses": {
"200": {
"description": "Socket report",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SocketReport"
}
}
}
},
"description": "Socket report"
},
"400": {
"$ref": "#/components/responses/SocketBadRequest"
Expand All @@ -6332,14 +6368,14 @@
"Openapi"
],
"summary": "Returns the OpenAPI definition",
"description": "Retrieve the API specification in an Openapi JSON format.\n\nThis endpoint consumes 0 units of your quota.",
"operationId": "getOpenAPI",
"description": "Retrieve the API specification in an Openapi JSON format.\n\nThis endpoint consumes 0 units of your quota.",
"responses": {
"200": {
"description": "OpenAPI specification",
"content": {
"application/json": {}
}
},
"description": "OpenAPI specification"
},
"429": {
"$ref": "#/components/responses/SocketTooManyRequestsResponse"
Expand All @@ -6354,11 +6390,10 @@
"Quota"
],
"summary": "Get quota",
"description": "Get your current API quota. You can use this endpoint to prevent doing requests that might spend all your quota.\n\nThis endpoint consumes 0 units of your quota.",
"operationId": "getQuota",
"description": "Get your current API quota. You can use this endpoint to prevent doing requests that might spend all your quota.\n\nThis endpoint consumes 0 units of your quota.",
"responses": {
"200": {
"description": "Quota amount",
"content": {
"application/json": {
"schema": {
Expand All @@ -6376,7 +6411,8 @@
]
}
}
}
},
"description": "Quota amount"
},
"401": {
"$ref": "#/components/responses/SocketUnauthorized"
Expand Down
12 changes: 12 additions & 0 deletions types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1775,6 +1775,11 @@ export interface components {
/** @enum {string} */
type?: "web";
value?: components["schemas"]["SocketRefWeb"];
}> &
Partial<{
/** @enum {string} */
type?: "pypi";
value?: components["schemas"]["SocketRefPyPI"];
}>;
SocketRefTextRange: {
/** @default 0 */
Expand Down Expand Up @@ -1813,6 +1818,13 @@ export interface components {
url: string;
file?: components["schemas"]["SocketRefFile"];
};
SocketRefPyPI: {
/** @default */
package: string;
/** @default */
version?: string;
file?: components["schemas"]["SocketRefFile"];
};
};
responses: {
/** Bad request */
Expand Down