@cords/sdk 0.0.15 → 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 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;
@@ -81,8 +82,8 @@ type SearchOptions = {
81
82
  };
82
83
  calculateProvinceFromSearchString?: boolean;
83
84
  calculateCityFromSearchString?: boolean;
84
- meta: {
85
- taxonomy: TaxonomyCodeType[];
85
+ meta?: {
86
+ taxonomy?: TaxonomyCodeType[];
86
87
  };
87
88
  };
88
89
  type CordsError = {
@@ -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;
@@ -81,8 +82,8 @@ type SearchOptions = {
81
82
  };
82
83
  calculateProvinceFromSearchString?: boolean;
83
84
  calculateCityFromSearchString?: boolean;
84
- meta: {
85
- taxonomy: TaxonomyCodeType[];
85
+ meta?: {
86
+ taxonomy?: TaxonomyCodeType[];
86
87
  };
87
88
  };
88
89
  type CordsError = {
@@ -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
@@ -92,6 +92,7 @@ var CordsAPI = ({
92
92
  "calculateCityFromSearchString",
93
93
  "calculateProvinceFromSearchString"
94
94
  ]);
95
+ var _a2;
95
96
  const url = formatUrl("/search");
96
97
  const params = new URLSearchParams({
97
98
  q
@@ -126,9 +127,14 @@ var CordsAPI = ({
126
127
  );
127
128
  }
128
129
  }
129
- if (options.meta.taxonomy) {
130
+ if ((_a2 = options == null ? void 0 : options.meta) == null ? void 0 : _a2.taxonomy) {
130
131
  options.meta.taxonomy.forEach((code) => {
131
- params.append("filter[meta][TaxonomyCodes]", code);
132
+ params.append("filter[meta][TaxonomyCodes][]", code);
133
+ });
134
+ }
135
+ if (options.ids) {
136
+ options.ids.forEach((id, index) => {
137
+ params.append(`ids[${index}]`, id);
132
138
  });
133
139
  }
134
140
  const res = await request(`${url.toString()}?${params}`);
@@ -155,19 +161,6 @@ var CordsAPI = ({
155
161
  const data = await res.json();
156
162
  return data;
157
163
  };
158
- const resourceList = async (ids) => {
159
- if (ids.length === 0)
160
- return {
161
- data: []
162
- };
163
- const params = new URLSearchParams();
164
- ids.forEach((id, index) => params.append(`ids[${index}]`, id));
165
- const url = formatUrl("/resource/list");
166
- url.search = params.toString();
167
- const res = await request(url.toString());
168
- const data = await res.json();
169
- return data;
170
- };
171
164
  const nearestNeighbour = async (id, options) => {
172
165
  const url = formatUrl(`/resource/${id}/nearest-neighbor`);
173
166
  const params = new URLSearchParams({
@@ -188,7 +181,6 @@ var CordsAPI = ({
188
181
  search,
189
182
  related,
190
183
  resource,
191
- resourceList,
192
184
  nearestNeighbour
193
185
  };
194
186
  };
package/dist/index.mjs CHANGED
@@ -69,6 +69,7 @@ var CordsAPI = ({
69
69
  "calculateCityFromSearchString",
70
70
  "calculateProvinceFromSearchString"
71
71
  ]);
72
+ var _a2;
72
73
  const url = formatUrl("/search");
73
74
  const params = new URLSearchParams({
74
75
  q
@@ -103,9 +104,14 @@ var CordsAPI = ({
103
104
  );
104
105
  }
105
106
  }
106
- if (options.meta.taxonomy) {
107
+ if ((_a2 = options == null ? void 0 : options.meta) == null ? void 0 : _a2.taxonomy) {
107
108
  options.meta.taxonomy.forEach((code) => {
108
- params.append("filter[meta][TaxonomyCodes]", code);
109
+ params.append("filter[meta][TaxonomyCodes][]", code);
110
+ });
111
+ }
112
+ if (options.ids) {
113
+ options.ids.forEach((id, index) => {
114
+ params.append(`ids[${index}]`, id);
109
115
  });
110
116
  }
111
117
  const res = await request(`${url.toString()}?${params}`);
@@ -132,19 +138,6 @@ var CordsAPI = ({
132
138
  const data = await res.json();
133
139
  return data;
134
140
  };
135
- const resourceList = async (ids) => {
136
- if (ids.length === 0)
137
- return {
138
- data: []
139
- };
140
- const params = new URLSearchParams();
141
- ids.forEach((id, index) => params.append(`ids[${index}]`, id));
142
- const url = formatUrl("/resource/list");
143
- url.search = params.toString();
144
- const res = await request(url.toString());
145
- const data = await res.json();
146
- return data;
147
- };
148
141
  const nearestNeighbour = async (id, options) => {
149
142
  const url = formatUrl(`/resource/${id}/nearest-neighbor`);
150
143
  const params = new URLSearchParams({
@@ -165,7 +158,6 @@ var CordsAPI = ({
165
158
  search,
166
159
  related,
167
160
  resource,
168
- resourceList,
169
161
  nearestNeighbour
170
162
  };
171
163
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./dist/index.js",
4
4
  "module": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.ts",
6
- "version": "0.0.15",
6
+ "version": "0.0.17",
7
7
  "private": false,
8
8
  "publishConfig": {
9
9
  "access": "public"