@common-grants/core 0.1.0-alpha.12 → 0.1.0-alpha.13
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/lib/api.tsp
CHANGED
|
@@ -5,6 +5,7 @@ import "@typespec/openapi";
|
|
|
5
5
|
|
|
6
6
|
using TypeSpec.Http;
|
|
7
7
|
using TypeSpec.OpenAPI;
|
|
8
|
+
|
|
8
9
|
/** The base OpenAPI specification for a CommonGrants API
|
|
9
10
|
*
|
|
10
11
|
* In order for an API to be "compliant" with the CommonGrants protocol,
|
|
@@ -12,8 +13,8 @@ using TypeSpec.OpenAPI;
|
|
|
12
13
|
*/
|
|
13
14
|
@service(#{ title: "CommonGrants Base API" })
|
|
14
15
|
@tagMetadata(
|
|
15
|
-
"
|
|
16
|
-
#{ description: "Endpoints
|
|
16
|
+
"optional",
|
|
17
|
+
#{ description: "Endpoints that MAY be implemented by CommonGrants APIs" }
|
|
17
18
|
)
|
|
18
19
|
@tagMetadata(
|
|
19
20
|
"required",
|
|
@@ -22,8 +23,8 @@ using TypeSpec.OpenAPI;
|
|
|
22
23
|
}
|
|
23
24
|
)
|
|
24
25
|
@tagMetadata(
|
|
25
|
-
"
|
|
26
|
-
#{ description: "Endpoints
|
|
26
|
+
"Opportunities",
|
|
27
|
+
#{ description: "Endpoints related to funding opportunities" }
|
|
27
28
|
)
|
|
28
29
|
namespace CommonGrants.API;
|
|
29
30
|
|
package/lib/core/pagination.tsp
CHANGED
|
@@ -75,7 +75,7 @@ model Paginated<T> extends Success {
|
|
|
75
75
|
items: T[];
|
|
76
76
|
|
|
77
77
|
/** Details about the paginated results */
|
|
78
|
-
paginationInfo: Pagination.
|
|
78
|
+
paginationInfo: Pagination.PaginatedResultsInfo;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// ############################################################################
|
|
@@ -103,7 +103,7 @@ model Sorted<T> {
|
|
|
103
103
|
...Paginated<T>;
|
|
104
104
|
|
|
105
105
|
/** The sort order of the items */
|
|
106
|
-
sortInfo: Sorting.
|
|
106
|
+
sortInfo: Sorting.SortedResultsInfo;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// ############################################################################
|
|
@@ -137,5 +137,10 @@ model Filtered<ItemsT, FilterT> extends Success {
|
|
|
137
137
|
...Sorted<ItemsT>;
|
|
138
138
|
|
|
139
139
|
/** The filters applied to the response items */
|
|
140
|
-
filterInfo:
|
|
140
|
+
filterInfo: {
|
|
141
|
+
filters: FilterT;
|
|
142
|
+
|
|
143
|
+
/** Non-fatal errors that occurred during filtering */
|
|
144
|
+
errors?: string[];
|
|
145
|
+
};
|
|
141
146
|
}
|
|
@@ -82,6 +82,10 @@ interface Opportunities {
|
|
|
82
82
|
@post
|
|
83
83
|
@route("/search")
|
|
84
84
|
search<T extends Models.OpportunityBase = Models.OpportunityBase>(
|
|
85
|
+
/** Opportunity search query */
|
|
86
|
+
@example("Pre-school education")
|
|
87
|
+
search?: string,
|
|
88
|
+
|
|
85
89
|
/** Filters to apply to the opportunity search
|
|
86
90
|
*
|
|
87
91
|
* Multiple filter conditions will be combined with AND logic, so that
|
package/lib/core/sorting.tsp
CHANGED
|
@@ -57,16 +57,19 @@ model SortBodyParams {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/** Information about the sort order of the items returned */
|
|
60
|
-
model
|
|
61
|
-
/** The field
|
|
60
|
+
model SortedResultsInfo {
|
|
61
|
+
/** The field results are sorted by, or "custom" if an implementation-defined sort key is used */
|
|
62
62
|
@example("lastModifiedAt")
|
|
63
63
|
sortBy: string;
|
|
64
64
|
|
|
65
|
-
/** Implementation-defined sort key */
|
|
65
|
+
/** Implementation-defined sort key used to sort the results, if applicable */
|
|
66
66
|
@example("customField")
|
|
67
67
|
customSortBy?: string;
|
|
68
68
|
|
|
69
|
-
/** The order
|
|
69
|
+
/** The order in which the results are sorted, e.g. ascending or descending */
|
|
70
70
|
@example(SortOrder.asc)
|
|
71
|
-
sortOrder
|
|
71
|
+
sortOrder: SortOrder;
|
|
72
|
+
|
|
73
|
+
/** Non-fatal errors that occurred during sorting */
|
|
74
|
+
errors?: string[];
|
|
72
75
|
}
|