/** * @since 1.0.0 */ import * as Context from "effect/Context"; import * as Option from "effect/Option"; import { type Pipeable } from "effect/Pipeable"; import * as Predicate from "effect/Predicate"; import * as Record from "effect/Record"; import type * as Schema from "effect/Schema"; import * as AST from "effect/SchemaAST"; import type * as HttpApiEndpoint from "./HttpApiEndpoint.js"; import { HttpApiDecodeError } from "./HttpApiError.js"; import type * as HttpApiGroup from "./HttpApiGroup.js"; import type * as HttpApiMiddleware from "./HttpApiMiddleware.js"; import * as HttpApiSchema from "./HttpApiSchema.js"; import type { HttpMethod } from "./HttpMethod.js"; /** * @since 1.0.0 * @category type ids */ export declare const TypeId: unique symbol; /** * @since 1.0.0 * @category type ids */ export type TypeId = typeof TypeId; /** * @since 1.0.0 * @category guards */ export declare const isHttpApi: (u: unknown) => u is HttpApi.Any; /** * An `HttpApi` is a collection of `HttpApiEndpoint`s. You can use an `HttpApi` to * represent a portion of your domain. * * The endpoints can be implemented later using the `HttpApiBuilder.make` api. * * @since 1.0.0 * @category models */ export interface HttpApi extends Pipeable { new (_: never): {}; readonly [TypeId]: TypeId; readonly identifier: Id; readonly groups: Record.ReadonlyRecord; readonly annotations: Context.Context; readonly errorSchema: Schema.Schema; readonly middlewares: ReadonlySet; /** * Add a `HttpApiGroup` to the `HttpApi`. */ add(group: A): HttpApi; /** * Add another `HttpApi` to the `HttpApi`. */ addHttpApi(api: HttpApi): HttpApi, E | E2, R>; /** * Add an global error to the `HttpApi`. */ addError(schema: Schema.Schema, annotations?: { readonly status?: number | undefined; }): HttpApi; /** * Prefix all endpoints in the `HttpApi`. */ prefix(prefix: HttpApiEndpoint.PathSegment): HttpApi; /** * Add a middleware to a `HttpApi`. It will be applied to all endpoints in the * `HttpApi`. */ middleware(middleware: Context.Tag): HttpApi, R | I | HttpApiMiddleware.HttpApiMiddleware.ErrorContext>; /** * Annotate the `HttpApi`. */ annotate(tag: Context.Tag, value: S): HttpApi; /** * Annotate the `HttpApi` with a Context. */ annotateContext(context: Context.Context): HttpApi; } declare const Api_base: Context.TagClass; readonly context: Context.Context; }>; /** * @since 1.0.0 * @category tags */ export declare class Api extends Api_base { } /** * @since 1.0.0 * @category models */ export declare namespace HttpApi { /** * @since 1.0.0 * @category models */ interface Any { readonly [TypeId]: TypeId; } /** * @since 1.0.0 * @category models */ type AnyWithProps = HttpApi; } /** * An `HttpApi` is a collection of `HttpApiEndpoint`s. You can use an `HttpApi` to * represent a portion of your domain. * * The endpoints can be implemented later using the `HttpApiBuilder.make` api. * * @since 1.0.0 * @category constructors */ export declare const make: (identifier: Id) => HttpApi; /** * Extract metadata from an `HttpApi`, which can be used to generate documentation * or other tooling. * * See the `OpenApi` & `HttpApiClient` modules for examples of how to use this function. * * @since 1.0.0 * @category reflection */ export declare const reflect: (self: HttpApi, options: { readonly predicate?: Predicate.Predicate<{ readonly endpoint: HttpApiEndpoint.HttpApiEndpoint.AnyWithProps; readonly group: HttpApiGroup.HttpApiGroup.AnyWithProps; }>; readonly onGroup: (options: { readonly group: HttpApiGroup.HttpApiGroup.AnyWithProps; readonly mergedAnnotations: Context.Context; }) => void; readonly onEndpoint: (options: { readonly group: HttpApiGroup.HttpApiGroup.AnyWithProps; readonly endpoint: HttpApiEndpoint.HttpApiEndpoint; readonly mergedAnnotations: Context.Context; readonly middleware: ReadonlySet; readonly payloads: ReadonlyMap; readonly successes: ReadonlyMap; readonly description: Option.Option; }>; readonly errors: ReadonlyMap; readonly description: Option.Option; }>; }) => void; }) => void; declare const AdditionalSchemas_base: Context.TagClass; /** * Adds additional schemas to components/schemas. * The provided schemas must have a `identifier` annotation. * * @since 1.0.0 * @category tags */ export declare class AdditionalSchemas extends AdditionalSchemas_base { } export {}; //# sourceMappingURL=HttpApi.d.ts.map