Skip to content

Commit

Permalink
Fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
Siegrift committed Nov 25, 2023
1 parent 17fd8e5 commit 71a5068
Showing 1 changed file with 89 additions and 14 deletions.
103 changes: 89 additions & 14 deletions src/processing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,115 @@ The pre/post processing is only supported for Node.js environments and uses inte

## Documentation

The processing module exports two main functions:
The processing module exports a multiple functions related to processing (both version 1 and 2). The most important
functions are:

<!-- NOTE: These are copied over from "processing.d.ts" from "dist" file. -->

```ts
/**
* Pre-processes API call parameters based on the provided endpoint's processing specifications.
* Pre-processes endpoint parameters based on the provided endpoint's processing specifications.
*
* @param preProcessingSpecifications The v1 pre-processing specifications.
* @param endpointParameters The parameters to be pre-processed.
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
*
* @returns A promise that resolves to the pre-processed parameters.
*/
export declare const preProcessEndpointParametersV1: (
preProcessingSpecifications: ProcessingSpecifications | undefined,
endpointParameters: EndpointParameters,
processingOptions?: GoAsyncOptions
) => Promise<EndpointParameters>;

/**
* Post-processes the response based on the provided endpoint's processing specifications. The response is usually the
* API call response, but this logic depends on how the processing is used by the target service. For example, Airnode
* allows skipping API calls in which case the response is the result of pre-processing.
*
* @param response The response to be post-processed.
* @param postProcessingSpecifications The v1 post-processing specifications.
* @param endpointParameters The endpoint parameters.
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
*
* @returns A promise that resolves to the post-processed response.
*/
export declare const postProcessResponseV1: (
response: unknown,
postProcessingSpecifications: ProcessingSpecifications | undefined,
endpointParameters: EndpointParameters,
processingOptions?: GoAsyncOptions
) => Promise<unknown>;

/**
* Pre-processes endpoint parameters based on the provided endpoint's processing specifications.
*
* @param preProcessingSpecificationV2 The v2 pre-processing specification.
* @param endpointParameters The parameters to be pre-processed.
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
*
* @returns A promise that resolves to the pre-processed parameters.
*/
export declare const preProcessEndpointParametersV2: (
preProcessingSpecificationV2: ProcessingSpecificationV2 | undefined,
endpointParameters: EndpointParameters,
processingOptions?: GoAsyncOptions
) => Promise<PreProcessingV2Response>;

/**
* Post-processes the response based on the provided endpoint's processing specifications. The response is usually the
* API call response, but this logic depends on how the processing is used by the target service. For example, Airnode
* allows skipping API calls in which case the response is the result of pre-processing.
*
* @param response The response to be post-processed.
* @param postProcessingSpecificationV2 The v2 post-processing specification.
* @param endpointParameters The endpoint parameters.
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
*
* @returns A promise that resolves to the post-processed response.
*/
export declare const postProcessResponseV2: (
response: unknown,
postProcessingSpecificationV2: ProcessingSpecificationV2 | undefined,
endpointParameters: EndpointParameters,
processingOptions?: GoAsyncOptions
) => Promise<PostProcessingV2Response>;

/**
* Pre-processes endpoint parameters based on the provided endpoint's processing specifications. Internally it
* determines what processing implementation should be used.
*
* @param endpoint The endpoint containing processing specifications.
* @param apiCallParameters The parameters to be pre-processed.
* @param endpointParameters The parameters to be pre-processed.
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
*
* @returns A promise that resolves to the pre-processed parameters.
*/
export declare const preProcessApiCallParameters: (
export declare const preProcessEndpointParameters: (
endpoint: Endpoint,
apiCallParameters: ApiCallParameters,
endpointParameters: EndpointParameters,
processingOptions?: GoAsyncOptions
) => Promise<ApiCallParameters>;
) => Promise<PreProcessingV2Response>;

/**
* Post-processes the API call response based on the provided endpoint's processing specifications.
* Post-processes the response based on the provided endpoint's processing specifications. The response is usually the
* API call response, but this logic depends on how the processing is used by the target service. For example, Airnode
* allows skipping API calls in which case the response is the result of pre-processing.
*
* @param apiCallResponse The raw response obtained from the API call.
* This function determines what processing version should be used and provides a common interface. This is useful for
* services that want to use processing and don't care which processing version is used.
*
* @param response The response to be post-processed.
* @param endpoint The endpoint containing processing specifications.
* @param apiCallParameters The parameters used in the API call.
* @param endpointParameters The endpoint parameters.
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
*
* @returns A promise that resolves to the post-processed API call response.
* @returns A promise that resolves to the post-processed response.
*/
export declare const postProcessApiCallResponse: (
apiCallResponse: unknown,
export declare const postProcessResponse: (
response: unknown,
endpoint: Endpoint,
apiCallParameters: ApiCallParameters,
endpointParameters: EndpointParameters,
processingOptions?: GoAsyncOptions
) => Promise<unknown>;
) => Promise<PostProcessingV2Response>;
```

0 comments on commit 71a5068

Please sign in to comment.