-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathmodel.tsp
executable file
·59 lines (44 loc) · 1.05 KB
/
model.tsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import "@typespec/http";
import "@typespec/versioning";
using TypeSpec.Versioning;
using Utils.Versioning;
namespace api.Utils.Model;
using TypeSpec.Http;
model DefaultSuccessResponse<Body, Status extends int16> {
@statusCode status: Status;
@body body: Body;
}
@doc("document created successfully")
model ApiCreatedOutput {
@doc("document id")
id: string;
@doc("conditional if document was created")
created: boolean;
}
@doc("pagination default response")
model ApiPaginationOutput<T> {
@doc("documents")
docs: T[];
@doc("current page")
page: int32 = 1;
@doc("limit per page")
limit: int32 = 10;
@doc("total items")
total: int64 = 1;
@doc("total pages")
totalPages?: int32 = 1;
}
model ApiPaginationInput {
@doc("pagination current page")
@query
page: int32 = 1;
@doc("pagination limit per page")
@query
limit: int32 = 10;
@doc("sort by property **property1:desc,property2:asc**")
@query
sort?: string = "createdAt:desc";
@doc("search by property **property1:value1|value2**")
@query
search?: string;
}