import type { PaginationParams } from '../intermediate/pagination'; import type { PaginatedContainerPath } from '../parser/shape-paginated-container'; import type { AdapterAnnotation } from './adapter-annotation'; import type { NodeShapeDefinition, ParameterDefinition } from './definitions'; import type { MockPayload } from './mock-payload'; import type { StringMap } from './utils'; import type { LuvioGraphQLDSL } from './graphql'; export type HTTPStatusCode = 200 | 201 | 304 | 400 | 404 | 500; export interface ResourceReturnShapeDefinition { statusCode: HTTPStatusCode; returnShape: NodeShapeDefinition; } export interface BaseResource { /** The resource id */ id: string; /** The resource name */ name: string; /** The resource base URI shared by all the endpoints defined in the RAML file */ baseUri: string; /** The resource path. This path is relative to the base URI */ path: string; /** The HTTP verb used to invoke the resource (eg. "get", "patch", ...) */ method: string; /** The parameters used to construct the resource path */ urlParameters: ParameterDefinition[]; /** The parameters used to construct the query string */ queryParameters: ParameterDefinition[]; /** The HTTP request body shape */ bodyShape?: NodeShapeDefinition; /** The HTTP response body shape if any */ returnShapes: ResourceReturnShapeDefinition[]; returnShape?: NodeShapeDefinition; /** The keys used to query the store for a matching response shape */ keys?: StringMap; /** The (adapter) annotation data */ adapter?: AdapterAnnotation; /** The HTTP headers to send with the resource request */ headers: ParameterDefinition[]; /** The shape definition to generate resource config */ configShapeDefinition: NodeShapeDefinition; /** The flatten resource param definition for adapter to generate resource config */ flattenResourceParamDefinition?: NodeShapeDefinition; /** The endpoint id for this resource */ endPointId: string; /** Mock payloads for this resource */ mockPayloads: MockPayload[]; /** Describes resource's alternative behavior (only 'get' is currently supported) */ alternativeMethod?: 'get'; /** Pagination parameters for paginated resource */ paginationParams?: PaginationParams; paginationPath?: PaginatedContainerPath[]; /** Whether CreateResourceRequestFromRepresentation can be generated for this resource */ refresheable: boolean; } export type ResourceType = 'Rest' | 'GraphQL'; export interface RestResource extends BaseResource { resourceType: 'Rest'; } export interface GraphQLResource extends BaseResource { resourceType: 'GraphQL'; graphqlDSL: LuvioGraphQLDSL; } export type Resource = RestResource | GraphQLResource; export declare function isPurePost(resource: Resource): boolean; export declare const CONFIG_PROPERTY_URL_PARAMS = "urlParams"; export declare const CONFIG_PROPERTY_QUERY_PARAMS = "queryParams"; export declare const CONFIG_PROPERTY_BODY = "body"; export declare const CONFIG_PROPERTY_HEADERS = "headers";