@cords/sdk 0.0.16 → 0.0.17
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/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +5 -14
- package/dist/index.mjs +5 -14
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -66,6 +66,7 @@ type SearchOptions = {
|
|
|
66
66
|
page?: number;
|
|
67
67
|
distance?: number;
|
|
68
68
|
pageSize?: number;
|
|
69
|
+
ids?: string[];
|
|
69
70
|
partner?: {
|
|
70
71
|
"211"?: boolean;
|
|
71
72
|
mentor?: boolean;
|
|
@@ -111,9 +112,6 @@ declare const CordsAPI: ({ apiKey, version, referer, baseUrl: customBaseUrl, }:
|
|
|
111
112
|
data: ResourceType[];
|
|
112
113
|
}>;
|
|
113
114
|
resource: (id: string) => Promise<ResourceType>;
|
|
114
|
-
resourceList: (ids: string[]) => Promise<{
|
|
115
|
-
data: ResourceType[];
|
|
116
|
-
}>;
|
|
117
115
|
nearestNeighbour: (id: string, options: {
|
|
118
116
|
lat: number;
|
|
119
117
|
lng: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ type SearchOptions = {
|
|
|
66
66
|
page?: number;
|
|
67
67
|
distance?: number;
|
|
68
68
|
pageSize?: number;
|
|
69
|
+
ids?: string[];
|
|
69
70
|
partner?: {
|
|
70
71
|
"211"?: boolean;
|
|
71
72
|
mentor?: boolean;
|
|
@@ -111,9 +112,6 @@ declare const CordsAPI: ({ apiKey, version, referer, baseUrl: customBaseUrl, }:
|
|
|
111
112
|
data: ResourceType[];
|
|
112
113
|
}>;
|
|
113
114
|
resource: (id: string) => Promise<ResourceType>;
|
|
114
|
-
resourceList: (ids: string[]) => Promise<{
|
|
115
|
-
data: ResourceType[];
|
|
116
|
-
}>;
|
|
117
115
|
nearestNeighbour: (id: string, options: {
|
|
118
116
|
lat: number;
|
|
119
117
|
lng: number;
|
package/dist/index.js
CHANGED
|
@@ -132,6 +132,11 @@ var CordsAPI = ({
|
|
|
132
132
|
params.append("filter[meta][TaxonomyCodes][]", code);
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
+
if (options.ids) {
|
|
136
|
+
options.ids.forEach((id, index) => {
|
|
137
|
+
params.append(`ids[${index}]`, id);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
135
140
|
const res = await request(`${url.toString()}?${params}`);
|
|
136
141
|
const data = await res.json();
|
|
137
142
|
return data;
|
|
@@ -156,19 +161,6 @@ var CordsAPI = ({
|
|
|
156
161
|
const data = await res.json();
|
|
157
162
|
return data;
|
|
158
163
|
};
|
|
159
|
-
const resourceList = async (ids) => {
|
|
160
|
-
if (ids.length === 0)
|
|
161
|
-
return {
|
|
162
|
-
data: []
|
|
163
|
-
};
|
|
164
|
-
const params = new URLSearchParams();
|
|
165
|
-
ids.forEach((id, index) => params.append(`ids[${index}]`, id));
|
|
166
|
-
const url = formatUrl("/resource/list");
|
|
167
|
-
url.search = params.toString();
|
|
168
|
-
const res = await request(url.toString());
|
|
169
|
-
const data = await res.json();
|
|
170
|
-
return data;
|
|
171
|
-
};
|
|
172
164
|
const nearestNeighbour = async (id, options) => {
|
|
173
165
|
const url = formatUrl(`/resource/${id}/nearest-neighbor`);
|
|
174
166
|
const params = new URLSearchParams({
|
|
@@ -189,7 +181,6 @@ var CordsAPI = ({
|
|
|
189
181
|
search,
|
|
190
182
|
related,
|
|
191
183
|
resource,
|
|
192
|
-
resourceList,
|
|
193
184
|
nearestNeighbour
|
|
194
185
|
};
|
|
195
186
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -109,6 +109,11 @@ var CordsAPI = ({
|
|
|
109
109
|
params.append("filter[meta][TaxonomyCodes][]", code);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
+
if (options.ids) {
|
|
113
|
+
options.ids.forEach((id, index) => {
|
|
114
|
+
params.append(`ids[${index}]`, id);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
112
117
|
const res = await request(`${url.toString()}?${params}`);
|
|
113
118
|
const data = await res.json();
|
|
114
119
|
return data;
|
|
@@ -133,19 +138,6 @@ var CordsAPI = ({
|
|
|
133
138
|
const data = await res.json();
|
|
134
139
|
return data;
|
|
135
140
|
};
|
|
136
|
-
const resourceList = async (ids) => {
|
|
137
|
-
if (ids.length === 0)
|
|
138
|
-
return {
|
|
139
|
-
data: []
|
|
140
|
-
};
|
|
141
|
-
const params = new URLSearchParams();
|
|
142
|
-
ids.forEach((id, index) => params.append(`ids[${index}]`, id));
|
|
143
|
-
const url = formatUrl("/resource/list");
|
|
144
|
-
url.search = params.toString();
|
|
145
|
-
const res = await request(url.toString());
|
|
146
|
-
const data = await res.json();
|
|
147
|
-
return data;
|
|
148
|
-
};
|
|
149
141
|
const nearestNeighbour = async (id, options) => {
|
|
150
142
|
const url = formatUrl(`/resource/${id}/nearest-neighbor`);
|
|
151
143
|
const params = new URLSearchParams({
|
|
@@ -166,7 +158,6 @@ var CordsAPI = ({
|
|
|
166
158
|
search,
|
|
167
159
|
related,
|
|
168
160
|
resource,
|
|
169
|
-
resourceList,
|
|
170
161
|
nearestNeighbour
|
|
171
162
|
};
|
|
172
163
|
};
|