@stackone/ai
Version:
Tools for agents to perform actions on your SaaS
65 lines (63 loc) • 1.85 kB
TypeScript
import { ExecuteConfig, ExecuteOptions, JsonDict } from "../types.js";
//#region src/modules/requestBuilder.d.ts
/**
* Builds and executes HTTP requests
*/
declare class RequestBuilder {
private method;
private url;
private bodyType;
private params;
private headers;
constructor(config: ExecuteConfig, headers?: Record<string, string>);
/**
* Set headers for the request
*/
setHeaders(headers: Record<string, string>): RequestBuilder;
/**
* Get the current headers
*/
getHeaders(): Record<string, string>;
/**
* Prepare headers for the API request
*/
prepareHeaders(): Record<string, string>;
/**
* Prepare URL and parameters for the API request
*/
prepareRequestParams(params: JsonDict): [string, JsonDict, JsonDict];
/**
* Build the fetch options for the request
*/
buildFetchOptions(bodyParams: JsonDict): RequestInit;
/**
* Validates parameter keys to prevent injection attacks
*/
private validateParameterKey;
/**
* Safely serializes values to strings with special type handling
*/
private serializeValue;
/**
* Serialize an object into deep object query parameters with security protections
* Converts {filter: {updated_after: "2020-01-01", job_id: "123"}}
* to filter[updated_after]=2020-01-01&filter[job_id]=123
*/
private serializeDeepObject;
/**
* Check if a parameter should use deep object serialization
* Applies to all plain object parameters (excludes special types and arrays)
*/
private shouldUseDeepObjectSerialization;
/**
* Builds all query parameters with optimized batching
*/
private buildQueryParameters;
/**
* Execute the request
*/
execute(params: JsonDict, options?: ExecuteOptions): Promise<JsonDict>;
}
//#endregion
export { RequestBuilder };
//# sourceMappingURL=requestBuilder.d.ts.map