UNPKG

@salesforce/agents

Version:

Client side APIs for working with Salesforce agents

31 lines (30 loc) 1.07 kB
import { Connection } from '@salesforce/core'; import nock from 'nock'; type HttpHeaders = { [name: string]: string; }; /** * A class to act as an in-between the library's request, and the orgs response * * if `SF_MOCK_DIR` is set it will read from the directory, resolving files as API responses with nock * * if it is NOT set, it will hit the endpoint and use real server responses */ export declare class MaybeMock { private connection; private mockDir; private scopes; private logger; constructor(connection: Connection); /** * Will either use mocked responses, or the real server response, as the library/APIs become more feature complete, * there will be fewer mocks and more real responses * * @param {"GET" | "POST" | "DELETE"} method * @param {string} url * @param {nock.RequestBodyMatcher} body * @returns {Promise<T>} */ request<T extends nock.Body>(method: 'GET' | 'POST' | 'DELETE', url: string, body?: nock.RequestBodyMatcher, headers?: HttpHeaders): Promise<T>; } export {};