import { Router } from 'express';
import * as API from '@unito/integration-api';
import { GetBlobContext, GetItemContext, GetCollectionContext, CreateBlobContext, CreateItemContext, UpdateItemContext, DeleteItemContext, GetCredentialAccountContext, ParseWebhooksContext, UpdateWebhookSubscriptionsContext, AcknowledgeWebhooksContext } from './resources/context.js';
/**
 * Handler called to get an individual item.
 *
 * @param context {@link GetItemContext}
 * @returns The requested {@link API.Item}.
 */
export type GetItemHandler = (context: GetItemContext<any, any>) => Promise<API.Item>;
/**
 * Handler called to retrieve a collection of items.
 *
 * @param context {@link GetCollectionContext}
 * @return An {@link API.Collection} containing requested items and a link to the next page, if applicable.
 */
export type GetCollectionHandler = (context: GetCollectionContext<any, any>) => Promise<API.Collection>;
/**
 * Handler called to create an item.
 *
 * @param context {@link CreateBlobContext}
 * @returns An {@link API.Item} containing a path to the created item.
 */
export type CreateBlobHandler = (context: CreateBlobContext<any, any>) => Promise<API.Item>;
/**
 * Handler called to create an item.
 *
 * @param context {@link CreateItemContext}
 * @returns An {@link API.ItemSummary} containing a path to the created item.
 */
export type CreateItemHandler = (context: CreateItemContext<any, any, any>) => Promise<API.ItemSummary>;
/**
 * Handler called to update an item.
 *
 * @param context {@link UpdateItemContext}
 * @returns The updated {@link API.Item}.
 */
export type UpdateItemHandler = (context: UpdateItemContext<any, any, any>) => Promise<API.Item>;
/**
 * Handler called to delete an item.
 *
 * @param context {@link DeleteItemContext}
 */
export type DeleteItemHandler = (context: DeleteItemContext<any, any>) => Promise<void>;
/**
 * Handler called to get a Binary Large Object.
 *
 * @param context {@link BlobItemContext}
 * @returns A {@link ReadableStream} of the Blob.
 */
export type GetBlobHandler = (context: GetBlobContext<any, any>) => Promise<ReadableStream<Uint8Array>>;
/**
 * Handler called to retrieve the account details associated with the credentials.
 *
 * @param context {@link GetCredentialAccountContext}
 * @returns The {@link API.CredentialAccount} associated with the credentials.
 */
export type GetCredentialAccountHandler = (context: GetCredentialAccountContext<any, any>) => Promise<API.CredentialAccount>;
/**
 * Handler called to parse the content of an incoming webhook.
 *
 * @param context {@link ParseWebhooksContext}
 * @returns The parsed content of the webhook as a {@link API.WebhookParseResponsePayload}.
 */
export type ParseWebhooksHandler = (context: ParseWebhooksContext<any, any, any>) => Promise<API.WebhookParseResponsePayload>;
/**
 * Handler called to subscribe or unsubscribe to a particular webhook.
 *
 * @param context {@link UpdateWebhookSubscriptionsContext}
 */
export type UpdateWebhookSubscriptionsHandler = (context: UpdateWebhookSubscriptionsContext<any, any, any>) => Promise<void>;
/**
 * Handler called to acknowledge the reception of a webhook.
 *
 * @param context {@link AcknowledgeWebhooksContext}
 * @returns The {@link API.WebhookAcknowledgeResponsePayload} to be sent back to the webhook provider.
 */
export type AcknowledgeWebhooksHandler = (context: AcknowledgeWebhooksContext<any, any, any>) => Promise<API.WebhookAcknowledgeResponsePayload>;
/**
 * Defines the implementation of the operations available for a given `Item`.
 * - In some cases (e.g. defining the `root` or {@link https://dev.unito.io/docs/connectors/apiSpecification/credentialAccount | me}
 *   handlers), only a {@link GetItemHandler | getItem} handler is necessary.
 * - In most cases, you will want to define {@link GetCollectionHandler | getCollection},
 *   most likely {@link GetItemHandler | getItem}, and any other handlers relevant to the item.
 *
 * The `ItemHandlers` object can contain any of the following:
 * - {@link GetItemHandler | getItem}: A handler called to get an individual item.
 * - {@link GetCollectionHandler | getCollection}: A handler called to retrieve a collection of items.
 * - {@link CreateItemHandler | createItem}: A handler called to create an item.
 * - {@link UpdateItemHandler | updateItem}: A handler called to update an item.
 * - {@link DeleteItemHandler | deleteItem}: A handler called to delete an item.
 */
export type ItemHandlers = {
    getItem?: GetItemHandler;
    getCollection?: GetCollectionHandler;
    createBlob?: CreateBlobHandler;
    createItem?: CreateItemHandler;
    updateItem?: UpdateItemHandler;
    deleteItem?: DeleteItemHandler;
};
export type BlobHandlers = {
    getBlob: GetBlobHandler;
    createBlob?: CreateBlobHandler;
};
export type CredentialAccountHandlers = {
    getCredentialAccount: GetCredentialAccountHandler;
};
export type ParseWebhookHandlers = {
    parseWebhooks: ParseWebhooksHandler;
};
export type WebhookSubscriptionHandlers = {
    updateWebhookSubscriptions: UpdateWebhookSubscriptionsHandler;
};
export type AcknowledgeWebhookHandlers = {
    acknowledgeWebhooks: AcknowledgeWebhooksHandler;
};
export type HandlersInput = ItemHandlers | BlobHandlers | CredentialAccountHandlers | ParseWebhookHandlers | WebhookSubscriptionHandlers | AcknowledgeWebhookHandlers;
export declare class Handler {
    private path;
    private pathWithIdentifier;
    private handlers;
    constructor(inputPath: string, handlers: HandlersInput);
    generate(): Router;
}
