Skip to content

Commit

Permalink
Add new APIs in caido sdks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytten committed Sep 3, 2024
1 parent 0603822 commit f1980f8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/quickjs-types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@caido/quickjs-types",
"version": "0.4.0",
"version": "0.5.0",
"description": "Typing for the QuickJS Engine",
"author": "Caido Labs Inc. <[email protected]>",
"license": "MIT",
Expand Down
38 changes: 38 additions & 0 deletions packages/quickjs-types/src/caido/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ declare module "caido:utils" {
response: Response;
};

/**
* An immutable saved Request and optional Response pair.
*/
export type RequestResponseOpt = {
request: Request;
response?: Response | undefined;
};

/**
* Information on the current page of paginated data.
*/
Expand Down Expand Up @@ -218,6 +226,13 @@ declare module "caido:utils" {
* sdk.console.log(`ID: ${page.items[1].request.getId()}`);
*/
query(): RequestsQuery;
/**
* Get a request by its unique {@link ID}.
*
* @example
* await sdk.requests.get("1");
*/
get(id: ID): Promise<RequestResponseOpt | undefined>;
/**
* Sends a request.
*
Expand Down Expand Up @@ -298,10 +313,33 @@ declare module "caido:utils" {
request: Request;
};

export type GetFindingInput = {
/**
* The name of the reporter.
*/
reporter?: string | undefined;
/**
* The associated {@link Request}.
*/
request: Request;
};

/**
* The SDK for the Findings service.
*/
export type FindingsSDK = {
/**
* Try to get a {@link Finding} for a request.
* Since a request can have multiple findings, this will return the first one found.
* You can also filter by reporter to get a specific finding.
*
* @example
* await sdk.findings.get({
* reporter: "Reporter",
* request,
* });
*/
get(input: GetFindingInput): Promise<Finding | undefined>;
/**
* Creates a new Finding.
*
Expand Down

0 comments on commit f1980f8

Please sign in to comment.