@twin.org/api-models 0.0.1-next.7 → 0.0.1-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/index.d.ts +3 -0
- package/dist/types/models/routes/IRestRoute.d.ts +4 -10
- package/dist/types/models/routes/IRestRouteExample.d.ts +13 -0
- package/dist/types/models/routes/IRestRouteRequestExample.d.ts +10 -0
- package/dist/types/models/routes/IRestRouteResponseExample.d.ts +10 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/index.md +3 -0
- package/docs/reference/interfaces/IRestRoute.md +1 -1
- package/docs/reference/interfaces/IRestRouteExample.md +24 -0
- package/docs/reference/interfaces/IRestRouteRequestExample.md +43 -0
- package/docs/reference/interfaces/IRestRouteResponseExample.md +43 -0
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -27,7 +27,10 @@ export * from "./models/responses/success/IOkResponse";
|
|
|
27
27
|
export * from "./models/routes/IBaseRoute";
|
|
28
28
|
export * from "./models/routes/IRestRoute";
|
|
29
29
|
export * from "./models/routes/IRestRouteEntryPoint";
|
|
30
|
+
export * from "./models/routes/IRestRouteExample";
|
|
31
|
+
export * from "./models/routes/IRestRouteRequestExample";
|
|
30
32
|
export * from "./models/routes/IRestRouteResponseAttachmentOptions";
|
|
33
|
+
export * from "./models/routes/IRestRouteResponseExample";
|
|
31
34
|
export * from "./models/routes/IRestRouteResponseOptions";
|
|
32
35
|
export * from "./models/routes/ISocketRoute";
|
|
33
36
|
export * from "./models/routes/ITag";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { HttpMethod } from "@twin.org/web";
|
|
2
2
|
import type { IBaseRoute } from "./IBaseRoute";
|
|
3
|
+
import type { IRestRouteRequestExample } from "./IRestRouteRequestExample";
|
|
4
|
+
import type { IRestRouteResponseExample } from "./IRestRouteResponseExample";
|
|
3
5
|
import type { IRestRouteResponseOptions } from "./IRestRouteResponseOptions";
|
|
4
6
|
import type { IHttpRequest } from "../protocol/IHttpRequest";
|
|
5
7
|
import type { IHttpRequestContext } from "../protocol/IHttpRequestContext";
|
|
@@ -47,11 +49,7 @@ export interface IRestRoute<T extends IHttpRequest = any, U extends IHttpRespons
|
|
|
47
49
|
/**
|
|
48
50
|
* Example objects for the request.
|
|
49
51
|
*/
|
|
50
|
-
examples?:
|
|
51
|
-
id: string;
|
|
52
|
-
description?: string;
|
|
53
|
-
request: T;
|
|
54
|
-
}[];
|
|
52
|
+
examples?: IRestRouteRequestExample<T>[];
|
|
55
53
|
};
|
|
56
54
|
/**
|
|
57
55
|
* The type of the response object.
|
|
@@ -68,11 +66,7 @@ export interface IRestRoute<T extends IHttpRequest = any, U extends IHttpRespons
|
|
|
68
66
|
/**
|
|
69
67
|
* Example objects of the response.
|
|
70
68
|
*/
|
|
71
|
-
examples?:
|
|
72
|
-
id: string;
|
|
73
|
-
description?: string;
|
|
74
|
-
response: U;
|
|
75
|
-
}[];
|
|
69
|
+
examples?: IRestRouteResponseExample<U>[];
|
|
76
70
|
}[];
|
|
77
71
|
/**
|
|
78
72
|
* Exclude the route from being included in the spec file.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IRestRouteExample } from "./IRestRouteExample";
|
|
2
|
+
/**
|
|
3
|
+
* Interface which defines a REST route request example.
|
|
4
|
+
*/
|
|
5
|
+
export interface IRestRouteRequestExample<T> extends IRestRouteExample {
|
|
6
|
+
/**
|
|
7
|
+
* The example request object.
|
|
8
|
+
*/
|
|
9
|
+
request: T;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IRestRouteExample } from "./IRestRouteExample";
|
|
2
|
+
/**
|
|
3
|
+
* Interface which defines a REST route response example.
|
|
4
|
+
*/
|
|
5
|
+
export interface IRestRouteResponseExample<T> extends IRestRouteExample {
|
|
6
|
+
/**
|
|
7
|
+
* The example response object.
|
|
8
|
+
*/
|
|
9
|
+
response: T;
|
|
10
|
+
}
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
- [IBaseRoute](interfaces/IBaseRoute.md)
|
|
35
35
|
- [IRestRoute](interfaces/IRestRoute.md)
|
|
36
36
|
- [IRestRouteEntryPoint](interfaces/IRestRouteEntryPoint.md)
|
|
37
|
+
- [IRestRouteExample](interfaces/IRestRouteExample.md)
|
|
38
|
+
- [IRestRouteRequestExample](interfaces/IRestRouteRequestExample.md)
|
|
37
39
|
- [IRestRouteResponseAttachmentOptions](interfaces/IRestRouteResponseAttachmentOptions.md)
|
|
40
|
+
- [IRestRouteResponseExample](interfaces/IRestRouteResponseExample.md)
|
|
38
41
|
- [IRestRouteResponseOptions](interfaces/IRestRouteResponseOptions.md)
|
|
39
42
|
- [ISocketRoute](interfaces/ISocketRoute.md)
|
|
40
43
|
- [ITag](interfaces/ITag.md)
|
|
@@ -116,7 +116,7 @@ The mime type of the request, defaults to "application/json" if there is a body.
|
|
|
116
116
|
|
|
117
117
|
#### examples?
|
|
118
118
|
|
|
119
|
-
> `optional` **examples**: `
|
|
119
|
+
> `optional` **examples**: [`IRestRouteRequestExample`](IRestRouteRequestExample.md)\<`T`\>[]
|
|
120
120
|
|
|
121
121
|
Example objects for the request.
|
|
122
122
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Interface: IRestRouteExample
|
|
2
|
+
|
|
3
|
+
Interface which defines a REST route example.
|
|
4
|
+
|
|
5
|
+
## Extended by
|
|
6
|
+
|
|
7
|
+
- [`IRestRouteRequestExample`](IRestRouteRequestExample.md)
|
|
8
|
+
- [`IRestRouteResponseExample`](IRestRouteResponseExample.md)
|
|
9
|
+
|
|
10
|
+
## Properties
|
|
11
|
+
|
|
12
|
+
### id
|
|
13
|
+
|
|
14
|
+
> **id**: `string`
|
|
15
|
+
|
|
16
|
+
Example objects for the request.
|
|
17
|
+
|
|
18
|
+
***
|
|
19
|
+
|
|
20
|
+
### description?
|
|
21
|
+
|
|
22
|
+
> `optional` **description**: `string`
|
|
23
|
+
|
|
24
|
+
Description of the example.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Interface: IRestRouteRequestExample\<T\>
|
|
2
|
+
|
|
3
|
+
Interface which defines a REST route request example.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- [`IRestRouteExample`](IRestRouteExample.md)
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
• **T**
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
### id
|
|
16
|
+
|
|
17
|
+
> **id**: `string`
|
|
18
|
+
|
|
19
|
+
Example objects for the request.
|
|
20
|
+
|
|
21
|
+
#### Inherited from
|
|
22
|
+
|
|
23
|
+
[`IRestRouteExample`](IRestRouteExample.md).[`id`](IRestRouteExample.md#id)
|
|
24
|
+
|
|
25
|
+
***
|
|
26
|
+
|
|
27
|
+
### description?
|
|
28
|
+
|
|
29
|
+
> `optional` **description**: `string`
|
|
30
|
+
|
|
31
|
+
Description of the example.
|
|
32
|
+
|
|
33
|
+
#### Inherited from
|
|
34
|
+
|
|
35
|
+
[`IRestRouteExample`](IRestRouteExample.md).[`description`](IRestRouteExample.md#description)
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### request
|
|
40
|
+
|
|
41
|
+
> **request**: `T`
|
|
42
|
+
|
|
43
|
+
The example request object.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Interface: IRestRouteResponseExample\<T\>
|
|
2
|
+
|
|
3
|
+
Interface which defines a REST route response example.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- [`IRestRouteExample`](IRestRouteExample.md)
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
• **T**
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
### id
|
|
16
|
+
|
|
17
|
+
> **id**: `string`
|
|
18
|
+
|
|
19
|
+
Example objects for the request.
|
|
20
|
+
|
|
21
|
+
#### Inherited from
|
|
22
|
+
|
|
23
|
+
[`IRestRouteExample`](IRestRouteExample.md).[`id`](IRestRouteExample.md#id)
|
|
24
|
+
|
|
25
|
+
***
|
|
26
|
+
|
|
27
|
+
### description?
|
|
28
|
+
|
|
29
|
+
> `optional` **description**: `string`
|
|
30
|
+
|
|
31
|
+
Description of the example.
|
|
32
|
+
|
|
33
|
+
#### Inherited from
|
|
34
|
+
|
|
35
|
+
[`IRestRouteExample`](IRestRouteExample.md).[`description`](IRestRouteExample.md#description)
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### response
|
|
40
|
+
|
|
41
|
+
> **response**: `T`
|
|
42
|
+
|
|
43
|
+
The example response object.
|