@gtsc/api-models
Advanced tools
Comparing version 0.0.3-next.24 to 0.0.3-next.25
@@ -8,5 +8,5 @@ export * from "./models/config/IBaseRestClientConfig"; | ||
export * from "./models/protocol/IHttpResponse"; | ||
export * from "./models/protocol/IHttpServerRequest"; | ||
export * from "./models/responses/errors/IBadRequestErrorResponse"; | ||
export * from "./models/responses/errors/IConflictResponse"; | ||
export * from "./models/responses/errors/IErrorResponse"; | ||
export * from "./models/responses/errors/IForbiddenResponse"; | ||
@@ -20,2 +20,3 @@ export * from "./models/responses/errors/INotFoundResponse"; | ||
export * from "./models/responses/success/IOkResponse"; | ||
export * from "./models/requests/INoContentRequest"; | ||
export * from "./models/routes/IBaseRoute"; | ||
@@ -22,0 +23,0 @@ export * from "./models/routes/IRestRoute"; |
@@ -1,2 +0,2 @@ | ||
import type { HttpMethods, IHttpRequestHeaders } from "@gtsc/web"; | ||
import type { IHttpRequestHeaders } from "@gtsc/web"; | ||
import type { IHttpRequestPathParams } from "./IHttpRequestPathParams"; | ||
@@ -9,10 +9,2 @@ import type { IHttpRequestQuery } from "./IHttpRequestQuery"; | ||
/** | ||
* The request method. | ||
*/ | ||
method?: HttpMethods; | ||
/** | ||
* The request url. | ||
*/ | ||
url?: string; | ||
/** | ||
* Incoming Http Headers. | ||
@@ -19,0 +11,0 @@ */ |
import type { IServiceRequestContext } from "@gtsc/services"; | ||
import type { IHttpRequest } from "./IHttpRequest"; | ||
import type { IHttpServerRequest } from "./IHttpServerRequest"; | ||
/** | ||
@@ -10,3 +10,3 @@ * Context data from the HTTP request. | ||
*/ | ||
rawRequest: IHttpRequest; | ||
serverRequest: IHttpServerRequest; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { HttpStatusCodes, IHttpRequestHeaders } from "@gtsc/web"; | ||
import type { HttpStatusCode, IHttpRequestHeaders } from "@gtsc/web"; | ||
/** | ||
@@ -9,3 +9,3 @@ * Model for the standard parameters for an http response. | ||
*/ | ||
statusCode?: HttpStatusCodes; | ||
statusCode?: HttpStatusCode; | ||
/** | ||
@@ -12,0 +12,0 @@ * Response headers. |
@@ -1,5 +0,10 @@ | ||
import type { IErrorResponse } from "./IErrorResponse"; | ||
import type { IError } from "@gtsc/core"; | ||
/** | ||
* Something went wrong with the request see the error field for more details. | ||
*/ | ||
export type IBadRequestResponse = IErrorResponse; | ||
export interface IBadRequestResponse { | ||
/** | ||
* The body which contains the error. | ||
*/ | ||
body: IError; | ||
} |
@@ -1,10 +0,15 @@ | ||
import type { IErrorResponse } from "./IErrorResponse"; | ||
import type { IError } from "@gtsc/core"; | ||
/** | ||
* The request resulted in a conflicting operation, see the error field for more details. | ||
*/ | ||
export interface IConflictResponse extends IErrorResponse { | ||
export interface IConflictResponse { | ||
/** | ||
* The conflicting items. | ||
* The body which contains the error. | ||
*/ | ||
conflicts: string[]; | ||
body: IError & { | ||
/** | ||
* The conflicting items. | ||
*/ | ||
conflicts: string[]; | ||
}; | ||
} |
@@ -1,5 +0,10 @@ | ||
import type { IErrorResponse } from "./IErrorResponse"; | ||
import type { IError } from "@gtsc/core"; | ||
/** | ||
* The operation that you tried to perform is not possible, see the error field for more details. | ||
*/ | ||
export type IForbiddenResponse = IErrorResponse; | ||
export interface IForbiddenResponse { | ||
/** | ||
* The body which contains the error. | ||
*/ | ||
body: IError; | ||
} |
@@ -1,10 +0,15 @@ | ||
import type { IErrorResponse } from "./IErrorResponse"; | ||
import type { IError } from "@gtsc/core"; | ||
/** | ||
* The resource you tried to access does not exist, see the error field for more details. | ||
*/ | ||
export interface INotFoundResponse extends IErrorResponse { | ||
export interface INotFoundResponse { | ||
/** | ||
* The id if the item that was not found. | ||
* The body which contains the error. | ||
*/ | ||
notFoundId?: string; | ||
body: IError & { | ||
/** | ||
* The id if the item that was not found. | ||
*/ | ||
notFoundId?: string; | ||
}; | ||
} |
@@ -1,5 +0,10 @@ | ||
import type { IErrorResponse } from "./IErrorResponse"; | ||
import type { IError } from "@gtsc/core"; | ||
/** | ||
* You are not authorized to use the API or no credentials were supplied. | ||
*/ | ||
export type IUnauthorizedResponse = IErrorResponse; | ||
export interface IUnauthorizedResponse { | ||
/** | ||
* The body which contains the error. | ||
*/ | ||
body: IError; | ||
} |
@@ -1,10 +0,15 @@ | ||
import type { IErrorResponse } from "./IErrorResponse"; | ||
import type { IError } from "@gtsc/core"; | ||
/** | ||
* The operation could not be processed, see the error field for more details. | ||
*/ | ||
export interface IUnprocessableEntityResponse extends IErrorResponse { | ||
export interface IUnprocessableEntityResponse { | ||
/** | ||
* The id which caused the unprocessable entity response. | ||
* The body which contains the error. | ||
*/ | ||
existingId?: string; | ||
body: IError & { | ||
/** | ||
* The id which caused the unprocessable entity response. | ||
*/ | ||
existingId?: string; | ||
}; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { HttpStatusCodes } from "@gtsc/web"; | ||
import type { HttpStatusCode } from "@gtsc/web"; | ||
/** | ||
@@ -9,3 +9,3 @@ * The rest request ended in accepted response. | ||
*/ | ||
statusCode: HttpStatusCodes; | ||
statusCode: HttpStatusCode; | ||
/** | ||
@@ -12,0 +12,0 @@ * Additional response headers. |
@@ -1,2 +0,2 @@ | ||
import type { HttpStatusCodes } from "@gtsc/web"; | ||
import type { HttpStatusCode } from "@gtsc/web"; | ||
/** | ||
@@ -9,3 +9,3 @@ * The rest request ended in created response. | ||
*/ | ||
statusCode: HttpStatusCodes; | ||
statusCode: HttpStatusCode; | ||
/** | ||
@@ -12,0 +12,0 @@ * Additional response headers. |
@@ -0,1 +1,2 @@ | ||
import type { HttpStatusCode } from "@gtsc/web"; | ||
/** | ||
@@ -5,2 +6,6 @@ * The rest request ended in success with no data. | ||
export interface INoContentResponse { | ||
/** | ||
* Response status code. | ||
*/ | ||
statusCode: HttpStatusCode; | ||
} |
@@ -0,1 +1,2 @@ | ||
import type { HttpStatusCode } from "@gtsc/web"; | ||
/** | ||
@@ -5,2 +6,6 @@ * The rest request ended in success with no data. | ||
export interface IOkResponse { | ||
/** | ||
* Response status code. | ||
*/ | ||
statusCode: HttpStatusCode; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { HttpMethods } from "@gtsc/web"; | ||
import type { HttpMethod } from "@gtsc/web"; | ||
import type { IBaseRoute } from "./IBaseRoute"; | ||
@@ -22,3 +22,3 @@ import type { IRestRouteResponseOptions } from "./IRestRouteResponseOptions"; | ||
*/ | ||
method: HttpMethods; | ||
method: HttpMethod; | ||
/** | ||
@@ -25,0 +25,0 @@ * The handler module. |
import type { IServiceRequestContext } from "@gtsc/services"; | ||
import type { IHttpRequest } from "../protocol/IHttpRequest"; | ||
import type { IHttpResponse } from "../protocol/IHttpResponse"; | ||
import type { IHttpServerRequest } from "../protocol/IHttpServerRequest"; | ||
import type { IRestRoute } from "../routes/IRestRoute"; | ||
@@ -14,4 +14,4 @@ /** | ||
*/ | ||
export type HttpRestRouteProcessor<T = never> = (request: IHttpRequest, response: IHttpResponse, route: IRestRoute | undefined, requestContext: IServiceRequestContext, state: { | ||
export type HttpRestRouteProcessor<T = never> = (request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestContext: IServiceRequestContext, state: { | ||
[id: string]: unknown; | ||
}, options?: T) => Promise<void>; |
@@ -1,2 +0,2 @@ | ||
import type { HttpMethods } from "@gtsc/web"; | ||
import type { HttpMethod } from "@gtsc/web"; | ||
/** | ||
@@ -20,3 +20,3 @@ * Options for the web server. | ||
*/ | ||
methods?: HttpMethods[]; | ||
methods?: HttpMethod[]; | ||
/** | ||
@@ -23,0 +23,0 @@ * Any additional allowed headers. |
@@ -12,4 +12,9 @@ # @gtsc/api-models | ||
- [IHttpResponse](interfaces/IHttpResponse.md) | ||
- [IHttpServerRequest](interfaces/IHttpServerRequest.md) | ||
- [INoContentRequest](interfaces/INoContentRequest.md) | ||
- [IBadRequestResponse](interfaces/IBadRequestResponse.md) | ||
- [IConflictResponse](interfaces/IConflictResponse.md) | ||
- [IForbiddenResponse](interfaces/IForbiddenResponse.md) | ||
- [INotFoundResponse](interfaces/INotFoundResponse.md) | ||
- [IUnauthorizedResponse](interfaces/IUnauthorizedResponse.md) | ||
- [IUnprocessableEntityResponse](interfaces/IUnprocessableEntityResponse.md) | ||
@@ -33,7 +38,3 @@ - [IAcceptedResponse](interfaces/IAcceptedResponse.md) | ||
- [IBadRequestResponse](type-aliases/IBadRequestResponse.md) | ||
- [IErrorResponse](type-aliases/IErrorResponse.md) | ||
- [IForbiddenResponse](type-aliases/IForbiddenResponse.md) | ||
- [IUnauthorizedResponse](type-aliases/IUnauthorizedResponse.md) | ||
- [HttpRestRouteProcessor](type-aliases/HttpRestRouteProcessor.md) | ||
- [HealthStatus](type-aliases/HealthStatus.md) |
@@ -13,3 +13,3 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
> **statusCode**: `HttpStatusCodes` | ||
> **statusCode**: `HttpStatusCode` | ||
@@ -16,0 +16,0 @@ Response status code. |
@@ -9,88 +9,16 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
## Extends | ||
- [`IErrorResponse`](../type-aliases/IErrorResponse.md) | ||
## Properties | ||
### name | ||
### body | ||
> **name**: `string` | ||
> **body**: `IError` & `object` | ||
The name for the error. | ||
The body which contains the error. | ||
#### Inherited from | ||
#### Type declaration | ||
`IErrorResponse.name` | ||
##### conflicts | ||
*** | ||
### message | ||
> **message**: `string` | ||
The message for the error. | ||
#### Inherited from | ||
`IErrorResponse.message` | ||
*** | ||
### source? | ||
> `optional` **source**: `string` | ||
The source of the error. | ||
#### Inherited from | ||
`IErrorResponse.source` | ||
*** | ||
### properties? | ||
> `optional` **properties**: `object` | ||
Any additional information for the error. | ||
#### Index signature | ||
\[`id`: `string`\]: `unknown` | ||
#### Inherited from | ||
`IErrorResponse.properties` | ||
*** | ||
### stack? | ||
> `optional` **stack**: `string` | ||
The stack trace for the error. | ||
#### Inherited from | ||
`IErrorResponse.stack` | ||
*** | ||
### inner? | ||
> `optional` **inner**: `IError` | ||
The inner error if there was one. | ||
#### Inherited from | ||
`IErrorResponse.inner` | ||
*** | ||
### conflicts | ||
> **conflicts**: `string`[] | ||
The conflicting items. |
@@ -13,3 +13,3 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
> **statusCode**: `HttpStatusCodes` | ||
> **statusCode**: `HttpStatusCode` | ||
@@ -16,0 +16,0 @@ Response status code. |
@@ -9,2 +9,7 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
## Extended by | ||
- [`IHttpServerRequest`](IHttpServerRequest.md) | ||
- [`INoContentRequest`](INoContentRequest.md) | ||
## Type parameters | ||
@@ -16,18 +21,2 @@ | ||
### method? | ||
> `optional` **method**: `HttpMethods` | ||
The request method. | ||
*** | ||
### url? | ||
> `optional` **url**: `string` | ||
The request url. | ||
*** | ||
### headers? | ||
@@ -34,0 +23,0 @@ |
@@ -39,6 +39,6 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
### rawRequest | ||
### serverRequest | ||
> **rawRequest**: [`IHttpRequest`](IHttpRequest.md)\<`any`\> | ||
> **serverRequest**: [`IHttpServerRequest`](IHttpServerRequest.md)\<`any`\> | ||
The raw HTTP request. |
@@ -17,3 +17,3 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
> `optional` **statusCode**: `HttpStatusCodes` | ||
> `optional` **statusCode**: `HttpStatusCode` | ||
@@ -20,0 +20,0 @@ Response status code. |
@@ -29,3 +29,3 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
> `optional` **bootstrap**(`requestContext`): `Promise`\<`void`\> | ||
> `optional` **bootstrap**(`requestContext`?): `Promise`\<`void`\> | ||
@@ -36,3 +36,3 @@ Bootstrap the service by creating and initializing any resources it needs. | ||
• **requestContext**: `IServiceRequestContext` | ||
• **requestContext?**: `IServiceRequestContext` | ||
@@ -39,0 +39,0 @@ The request context for bootstrapping. |
@@ -8,1 +8,9 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
The rest request ended in success with no data. | ||
## Properties | ||
### statusCode | ||
> **statusCode**: `HttpStatusCode` | ||
Response status code. |
@@ -9,88 +9,16 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
## Extends | ||
- [`IErrorResponse`](../type-aliases/IErrorResponse.md) | ||
## Properties | ||
### name | ||
### body | ||
> **name**: `string` | ||
> **body**: `IError` & `object` | ||
The name for the error. | ||
The body which contains the error. | ||
#### Inherited from | ||
#### Type declaration | ||
`IErrorResponse.name` | ||
##### notFoundId? | ||
*** | ||
### message | ||
> **message**: `string` | ||
The message for the error. | ||
#### Inherited from | ||
`IErrorResponse.message` | ||
*** | ||
### source? | ||
> `optional` **source**: `string` | ||
The source of the error. | ||
#### Inherited from | ||
`IErrorResponse.source` | ||
*** | ||
### properties? | ||
> `optional` **properties**: `object` | ||
Any additional information for the error. | ||
#### Index signature | ||
\[`id`: `string`\]: `unknown` | ||
#### Inherited from | ||
`IErrorResponse.properties` | ||
*** | ||
### stack? | ||
> `optional` **stack**: `string` | ||
The stack trace for the error. | ||
#### Inherited from | ||
`IErrorResponse.stack` | ||
*** | ||
### inner? | ||
> `optional` **inner**: `IError` | ||
The inner error if there was one. | ||
#### Inherited from | ||
`IErrorResponse.inner` | ||
*** | ||
### notFoundId? | ||
> `optional` **notFoundId**: `string` | ||
The id if the item that was not found. |
@@ -8,1 +8,9 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
The rest request ended in success with no data. | ||
## Properties | ||
### statusCode | ||
> **statusCode**: `HttpStatusCode` | ||
Response status code. |
@@ -75,3 +75,3 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
> **method**: `HttpMethods` | ||
> **method**: `HttpMethod` | ||
@@ -78,0 +78,0 @@ The http method. |
@@ -9,88 +9,16 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
## Extends | ||
- [`IErrorResponse`](../type-aliases/IErrorResponse.md) | ||
## Properties | ||
### name | ||
### body | ||
> **name**: `string` | ||
> **body**: `IError` & `object` | ||
The name for the error. | ||
The body which contains the error. | ||
#### Inherited from | ||
#### Type declaration | ||
`IErrorResponse.name` | ||
##### existingId? | ||
*** | ||
### message | ||
> **message**: `string` | ||
The message for the error. | ||
#### Inherited from | ||
`IErrorResponse.message` | ||
*** | ||
### source? | ||
> `optional` **source**: `string` | ||
The source of the error. | ||
#### Inherited from | ||
`IErrorResponse.source` | ||
*** | ||
### properties? | ||
> `optional` **properties**: `object` | ||
Any additional information for the error. | ||
#### Index signature | ||
\[`id`: `string`\]: `unknown` | ||
#### Inherited from | ||
`IErrorResponse.properties` | ||
*** | ||
### stack? | ||
> `optional` **stack**: `string` | ||
The stack trace for the error. | ||
#### Inherited from | ||
`IErrorResponse.stack` | ||
*** | ||
### inner? | ||
> `optional` **inner**: `IError` | ||
The inner error if there was one. | ||
#### Inherited from | ||
`IErrorResponse.inner` | ||
*** | ||
### existingId? | ||
> `optional` **existingId**: `string` | ||
The id which caused the unprocessable entity response. |
@@ -41,3 +41,3 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
> `optional` **methods**: `HttpMethods`[] | ||
> `optional` **methods**: `HttpMethod`[] | ||
@@ -44,0 +44,0 @@ The methods that the server accepts. |
@@ -17,3 +17,3 @@ [**@gtsc/api-models**](../overview.md) • **Docs** | ||
• **request**: [`IHttpRequest`](../interfaces/IHttpRequest.md) | ||
• **request**: [`IHttpServerRequest`](../interfaces/IHttpServerRequest.md) | ||
@@ -20,0 +20,0 @@ The request to handle. |
{ | ||
"name": "@gtsc/api-models", | ||
"version": "0.0.3-next.24", | ||
"version": "0.0.3-next.25", | ||
"description": "Contains models and classes for use with APIs", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51768
73
649