@algolia/client-analytics 5.0.0-alpha.8 → 5.0.0-alpha.80

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.
Files changed (146) hide show
  1. package/dist/builds/browser.d.ts +5 -5
  2. package/dist/builds/browser.d.ts.map +1 -1
  3. package/dist/builds/node.d.ts +5 -5
  4. package/dist/builds/node.d.ts.map +1 -1
  5. package/dist/{client-analytics.cjs.js → client-analytics.cjs} +922 -924
  6. package/dist/client-analytics.esm.browser.js +1105 -1153
  7. package/dist/client-analytics.esm.node.js +922 -922
  8. package/dist/client-analytics.umd.js +2 -2
  9. package/dist/model/averageClickEvent.d.ts +14 -14
  10. package/dist/model/averageClickEvent.d.ts.map +1 -1
  11. package/dist/model/clickPosition.d.ts +10 -10
  12. package/dist/model/clickPosition.d.ts.map +1 -1
  13. package/dist/model/clickThroughRateEvent.d.ts +18 -18
  14. package/dist/model/clickThroughRateEvent.d.ts.map +1 -1
  15. package/dist/model/clientMethodProps.d.ts +507 -507
  16. package/dist/model/clientMethodProps.d.ts.map +1 -1
  17. package/dist/model/conversionRateEvent.d.ts +18 -18
  18. package/dist/model/conversionRateEvent.d.ts.map +1 -1
  19. package/dist/model/direction.d.ts +1 -1
  20. package/dist/model/direction.d.ts.map +1 -1
  21. package/dist/model/errorBase.d.ts +6 -6
  22. package/dist/model/errorBase.d.ts.map +1 -1
  23. package/dist/model/getAverageClickPositionResponse.d.ts +15 -15
  24. package/dist/model/getAverageClickPositionResponse.d.ts.map +1 -1
  25. package/dist/model/getClickPositionsResponse.d.ts +7 -7
  26. package/dist/model/getClickPositionsResponse.d.ts.map +1 -1
  27. package/dist/model/getClickThroughRateResponse.d.ts +19 -19
  28. package/dist/model/getClickThroughRateResponse.d.ts.map +1 -1
  29. package/dist/model/getConversationRateResponse.d.ts +19 -19
  30. package/dist/model/getConversationRateResponse.d.ts.map +1 -1
  31. package/dist/model/getNoClickRateResponse.d.ts +19 -19
  32. package/dist/model/getNoClickRateResponse.d.ts.map +1 -1
  33. package/dist/model/getNoResultsRateResponse.d.ts +19 -19
  34. package/dist/model/getNoResultsRateResponse.d.ts.map +1 -1
  35. package/dist/model/getSearchesCountResponse.d.ts +11 -11
  36. package/dist/model/getSearchesCountResponse.d.ts.map +1 -1
  37. package/dist/model/getSearchesNoClicksResponse.d.ts +7 -7
  38. package/dist/model/getSearchesNoClicksResponse.d.ts.map +1 -1
  39. package/dist/model/getSearchesNoResultsResponse.d.ts +7 -7
  40. package/dist/model/getSearchesNoResultsResponse.d.ts.map +1 -1
  41. package/dist/model/getStatusResponse.d.ts +6 -6
  42. package/dist/model/getStatusResponse.d.ts.map +1 -1
  43. package/dist/model/getTopCountriesResponse.d.ts +7 -7
  44. package/dist/model/getTopCountriesResponse.d.ts.map +1 -1
  45. package/dist/model/getTopFilterAttribute.d.ts +10 -10
  46. package/dist/model/getTopFilterAttribute.d.ts.map +1 -1
  47. package/dist/model/getTopFilterAttributesResponse.d.ts +7 -7
  48. package/dist/model/getTopFilterAttributesResponse.d.ts.map +1 -1
  49. package/dist/model/getTopFilterForAttribute.d.ts +18 -18
  50. package/dist/model/getTopFilterForAttribute.d.ts.map +1 -1
  51. package/dist/model/getTopFilterForAttributeResponse.d.ts +7 -7
  52. package/dist/model/getTopFilterForAttributeResponse.d.ts.map +1 -1
  53. package/dist/model/getTopFiltersNoResultsResponse.d.ts +7 -7
  54. package/dist/model/getTopFiltersNoResultsResponse.d.ts.map +1 -1
  55. package/dist/model/getTopFiltersNoResultsValue.d.ts +14 -14
  56. package/dist/model/getTopFiltersNoResultsValue.d.ts.map +1 -1
  57. package/dist/model/getTopFiltersNoResultsValues.d.ts +11 -11
  58. package/dist/model/getTopFiltersNoResultsValues.d.ts.map +1 -1
  59. package/dist/model/getTopHitsResponse.d.ts +3 -3
  60. package/dist/model/getTopHitsResponse.d.ts.map +1 -1
  61. package/dist/model/getTopSearchesResponse.d.ts +3 -3
  62. package/dist/model/getTopSearchesResponse.d.ts.map +1 -1
  63. package/dist/model/getUsersCountResponse.d.ts +11 -11
  64. package/dist/model/getUsersCountResponse.d.ts.map +1 -1
  65. package/dist/model/index.d.ts +44 -44
  66. package/dist/model/noClickRateEvent.d.ts +18 -18
  67. package/dist/model/noClickRateEvent.d.ts.map +1 -1
  68. package/dist/model/noResultsRateEvent.d.ts +18 -18
  69. package/dist/model/noResultsRateEvent.d.ts.map +1 -1
  70. package/dist/model/orderBy.d.ts +4 -1
  71. package/dist/model/orderBy.d.ts.map +1 -1
  72. package/dist/model/searchEvent.d.ts +10 -10
  73. package/dist/model/searchEvent.d.ts.map +1 -1
  74. package/dist/model/searchNoClickEvent.d.ts +14 -14
  75. package/dist/model/searchNoClickEvent.d.ts.map +1 -1
  76. package/dist/model/searchNoResultEvent.d.ts +14 -14
  77. package/dist/model/searchNoResultEvent.d.ts.map +1 -1
  78. package/dist/model/topCountry.d.ts +10 -10
  79. package/dist/model/topCountry.d.ts.map +1 -1
  80. package/dist/model/topHit.d.ts +10 -10
  81. package/dist/model/topHit.d.ts.map +1 -1
  82. package/dist/model/topHitWithAnalytics.d.ts +30 -30
  83. package/dist/model/topHitWithAnalytics.d.ts.map +1 -1
  84. package/dist/model/topHitsResponse.d.ts +7 -7
  85. package/dist/model/topHitsResponse.d.ts.map +1 -1
  86. package/dist/model/topHitsResponseWithAnalytics.d.ts +7 -7
  87. package/dist/model/topHitsResponseWithAnalytics.d.ts.map +1 -1
  88. package/dist/model/topSearch.d.ts +14 -14
  89. package/dist/model/topSearch.d.ts.map +1 -1
  90. package/dist/model/topSearchWithAnalytics.d.ts +38 -38
  91. package/dist/model/topSearchWithAnalytics.d.ts.map +1 -1
  92. package/dist/model/topSearchesResponse.d.ts +7 -7
  93. package/dist/model/topSearchesResponse.d.ts.map +1 -1
  94. package/dist/model/topSearchesResponseWithAnalytics.d.ts +7 -7
  95. package/dist/model/topSearchesResponseWithAnalytics.d.ts.map +1 -1
  96. package/dist/model/userWithDate.d.ts +10 -10
  97. package/dist/model/userWithDate.d.ts.map +1 -1
  98. package/dist/src/analyticsClient.d.ts +318 -318
  99. package/dist/src/analyticsClient.d.ts.map +1 -1
  100. package/index.js +1 -1
  101. package/model/averageClickEvent.ts +4 -4
  102. package/model/clickPosition.ts +3 -3
  103. package/model/clickThroughRateEvent.ts +5 -5
  104. package/model/clientMethodProps.ts +92 -92
  105. package/model/conversionRateEvent.ts +5 -5
  106. package/model/direction.ts +1 -1
  107. package/model/errorBase.ts +1 -1
  108. package/model/getAverageClickPositionResponse.ts +4 -4
  109. package/model/getClickPositionsResponse.ts +2 -2
  110. package/model/getClickThroughRateResponse.ts +5 -5
  111. package/model/getConversationRateResponse.ts +5 -5
  112. package/model/getNoClickRateResponse.ts +5 -5
  113. package/model/getNoResultsRateResponse.ts +5 -5
  114. package/model/getSearchesCountResponse.ts +3 -3
  115. package/model/getSearchesNoClicksResponse.ts +2 -2
  116. package/model/getSearchesNoResultsResponse.ts +2 -2
  117. package/model/getStatusResponse.ts +2 -2
  118. package/model/getTopCountriesResponse.ts +2 -2
  119. package/model/getTopFilterAttribute.ts +3 -3
  120. package/model/getTopFilterAttributesResponse.ts +2 -2
  121. package/model/getTopFilterForAttribute.ts +5 -5
  122. package/model/getTopFilterForAttributeResponse.ts +2 -2
  123. package/model/getTopFiltersNoResultsResponse.ts +2 -2
  124. package/model/getTopFiltersNoResultsValue.ts +4 -4
  125. package/model/getTopFiltersNoResultsValues.ts +3 -3
  126. package/model/getTopHitsResponse.ts +1 -1
  127. package/model/getTopSearchesResponse.ts +1 -1
  128. package/model/getUsersCountResponse.ts +3 -3
  129. package/model/index.ts +1 -1
  130. package/model/noClickRateEvent.ts +5 -5
  131. package/model/noResultsRateEvent.ts +5 -5
  132. package/model/orderBy.ts +4 -1
  133. package/model/searchEvent.ts +3 -3
  134. package/model/searchNoClickEvent.ts +4 -4
  135. package/model/searchNoResultEvent.ts +4 -4
  136. package/model/topCountry.ts +3 -3
  137. package/model/topHit.ts +3 -3
  138. package/model/topHitWithAnalytics.ts +8 -8
  139. package/model/topHitsResponse.ts +2 -2
  140. package/model/topHitsResponseWithAnalytics.ts +2 -2
  141. package/model/topSearch.ts +4 -4
  142. package/model/topSearchWithAnalytics.ts +10 -10
  143. package/model/topSearchesResponse.ts +2 -2
  144. package/model/topSearchesResponseWithAnalytics.ts +2 -2
  145. package/model/userWithDate.ts +3 -3
  146. package/package.json +30 -13
@@ -1,930 +1,930 @@
1
1
  import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';
2
2
  import { createHttpRequester } from '@algolia/requester-node-http';
3
3
 
4
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
5
- const apiClientVersion = '5.0.0-alpha.8';
6
- const REGIONS = ['de', 'us'];
7
- function getDefaultHosts(region) {
8
- const url = !region
9
- ? 'analytics.algolia.com'
10
- : 'analytics.{region}.algolia.com'.replace('{region}', region);
11
- return [{ url, accept: 'readWrite', protocol: 'https' }];
12
- }
13
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
14
- function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
15
- const auth = createAuth(appIdOption, apiKeyOption, authMode);
16
- const transporter = createTransporter({
17
- hosts: getDefaultHosts(regionOption),
18
- ...options,
19
- algoliaAgent: getAlgoliaAgent({
20
- algoliaAgents,
21
- client: 'Analytics',
22
- version: apiClientVersion,
23
- }),
24
- baseHeaders: {
25
- 'content-type': 'text/plain',
26
- ...auth.headers(),
27
- ...options.baseHeaders,
28
- },
29
- baseQueryParameters: {
30
- ...auth.queryParameters(),
31
- ...options.baseQueryParameters,
32
- },
33
- });
34
- return {
35
- transporter,
36
- /**
37
- * The `appId` currently in use.
38
- */
39
- appId: appIdOption,
40
- /**
41
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
42
- */
43
- clearCache() {
44
- return Promise.all([
45
- transporter.requestsCache.clear(),
46
- transporter.responsesCache.clear(),
47
- ]).then(() => undefined);
48
- },
49
- /**
50
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
51
- */
52
- get _ua() {
53
- return transporter.algoliaAgent.value;
54
- },
55
- /**
56
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
57
- *
58
- * @param segment - The algolia agent (user-agent) segment to add.
59
- * @param version - The version of the agent.
60
- */
61
- addAlgoliaAgent(segment, version) {
62
- transporter.algoliaAgent.add({ segment, version });
63
- },
64
- /**
65
- * This method allow you to send requests to the Algolia REST API.
66
- *
67
- * @summary Send requests to the Algolia REST API.
68
- * @param del - The del object.
69
- * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
70
- * @param del.parameters - Query parameters to be applied to the current query.
71
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
72
- */
73
- del({ path, parameters }, requestOptions) {
74
- if (!path) {
75
- throw new Error('Parameter `path` is required when calling `del`.');
76
- }
77
- const requestPath = '/1{path}'.replace('{path}', path);
78
- const headers = {};
79
- const queryParameters = parameters ? parameters : {};
80
- const request = {
81
- method: 'DELETE',
82
- path: requestPath,
83
- queryParameters,
84
- headers,
85
- };
86
- return transporter.request(request, requestOptions);
87
- },
88
- /**
89
- * This method allow you to send requests to the Algolia REST API.
90
- *
91
- * @summary Send requests to the Algolia REST API.
92
- * @param get - The get object.
93
- * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
94
- * @param get.parameters - Query parameters to be applied to the current query.
95
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
96
- */
97
- get({ path, parameters }, requestOptions) {
98
- if (!path) {
99
- throw new Error('Parameter `path` is required when calling `get`.');
100
- }
101
- const requestPath = '/1{path}'.replace('{path}', path);
102
- const headers = {};
103
- const queryParameters = parameters ? parameters : {};
104
- const request = {
105
- method: 'GET',
106
- path: requestPath,
107
- queryParameters,
108
- headers,
109
- };
110
- return transporter.request(request, requestOptions);
111
- },
112
- /**
113
- * Returns the average click position. The endpoint returns a value for the complete given time range, as well as a value per day.
114
- *
115
- * @summary Get average click position.
116
- * @param getAverageClickPosition - The getAverageClickPosition object.
117
- * @param getAverageClickPosition.index - The index name to target.
118
- * @param getAverageClickPosition.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
119
- * @param getAverageClickPosition.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
120
- * @param getAverageClickPosition.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
121
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
122
- */
123
- getAverageClickPosition({ index, startDate, endDate, tags }, requestOptions) {
124
- if (!index) {
125
- throw new Error('Parameter `index` is required when calling `getAverageClickPosition`.');
126
- }
127
- const requestPath = '/2/clicks/averageClickPosition';
128
- const headers = {};
129
- const queryParameters = {};
130
- if (index !== undefined) {
131
- queryParameters.index = index.toString();
132
- }
133
- if (startDate !== undefined) {
134
- queryParameters.startDate = startDate.toString();
135
- }
136
- if (endDate !== undefined) {
137
- queryParameters.endDate = endDate.toString();
138
- }
139
- if (tags !== undefined) {
140
- queryParameters.tags = tags.toString();
141
- }
142
- const request = {
143
- method: 'GET',
144
- path: requestPath,
145
- queryParameters,
146
- headers,
147
- };
148
- return transporter.request(request, requestOptions);
149
- },
150
- /**
151
- * Returns the distribution of clicks per range of positions. If the groups all have a count of 0, it means Algolia didnt receive any click events for the queries with the clickAnalytics search parameter set to true. The count is 0 until Algolia receives at least one click event.
152
- *
153
- * @summary Get clicks per positions.
154
- * @param getClickPositions - The getClickPositions object.
155
- * @param getClickPositions.index - The index name to target.
156
- * @param getClickPositions.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
157
- * @param getClickPositions.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
158
- * @param getClickPositions.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
159
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
160
- */
161
- getClickPositions({ index, startDate, endDate, tags }, requestOptions) {
162
- if (!index) {
163
- throw new Error('Parameter `index` is required when calling `getClickPositions`.');
164
- }
165
- const requestPath = '/2/clicks/positions';
166
- const headers = {};
167
- const queryParameters = {};
168
- if (index !== undefined) {
169
- queryParameters.index = index.toString();
170
- }
171
- if (startDate !== undefined) {
172
- queryParameters.startDate = startDate.toString();
173
- }
174
- if (endDate !== undefined) {
175
- queryParameters.endDate = endDate.toString();
176
- }
177
- if (tags !== undefined) {
178
- queryParameters.tags = tags.toString();
179
- }
180
- const request = {
181
- method: 'GET',
182
- path: requestPath,
183
- queryParameters,
184
- headers,
185
- };
186
- return transporter.request(request, requestOptions);
187
- },
188
- /**
189
- * Returns a click-through rate (CTR). The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of clicks and searches used to compute the rates.
190
- *
191
- * @summary Get click-through rate (CTR).
192
- * @param getClickThroughRate - The getClickThroughRate object.
193
- * @param getClickThroughRate.index - The index name to target.
194
- * @param getClickThroughRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
195
- * @param getClickThroughRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
196
- * @param getClickThroughRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
197
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
198
- */
199
- getClickThroughRate({ index, startDate, endDate, tags }, requestOptions) {
200
- if (!index) {
201
- throw new Error('Parameter `index` is required when calling `getClickThroughRate`.');
202
- }
203
- const requestPath = '/2/clicks/clickThroughRate';
204
- const headers = {};
205
- const queryParameters = {};
206
- if (index !== undefined) {
207
- queryParameters.index = index.toString();
208
- }
209
- if (startDate !== undefined) {
210
- queryParameters.startDate = startDate.toString();
211
- }
212
- if (endDate !== undefined) {
213
- queryParameters.endDate = endDate.toString();
214
- }
215
- if (tags !== undefined) {
216
- queryParameters.tags = tags.toString();
217
- }
218
- const request = {
219
- method: 'GET',
220
- path: requestPath,
221
- queryParameters,
222
- headers,
223
- };
224
- return transporter.request(request, requestOptions);
225
- },
226
- /**
227
- * Returns a conversion rate (CR). The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of conversion and searches used to compute the rates.
228
- *
229
- * @summary Get conversion rate (CR).
230
- * @param getConversationRate - The getConversationRate object.
231
- * @param getConversationRate.index - The index name to target.
232
- * @param getConversationRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
233
- * @param getConversationRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
234
- * @param getConversationRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
235
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
236
- */
237
- getConversationRate({ index, startDate, endDate, tags }, requestOptions) {
238
- if (!index) {
239
- throw new Error('Parameter `index` is required when calling `getConversationRate`.');
240
- }
241
- const requestPath = '/2/conversions/conversionRate';
242
- const headers = {};
243
- const queryParameters = {};
244
- if (index !== undefined) {
245
- queryParameters.index = index.toString();
246
- }
247
- if (startDate !== undefined) {
248
- queryParameters.startDate = startDate.toString();
249
- }
250
- if (endDate !== undefined) {
251
- queryParameters.endDate = endDate.toString();
252
- }
253
- if (tags !== undefined) {
254
- queryParameters.tags = tags.toString();
255
- }
256
- const request = {
257
- method: 'GET',
258
- path: requestPath,
259
- queryParameters,
260
- headers,
261
- };
262
- return transporter.request(request, requestOptions);
263
- },
264
- /**
265
- * Returns the rate at which searches didn\'t lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks.
266
- *
267
- * @summary Get no click rate.
268
- * @param getNoClickRate - The getNoClickRate object.
269
- * @param getNoClickRate.index - The index name to target.
270
- * @param getNoClickRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
271
- * @param getNoClickRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
272
- * @param getNoClickRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
273
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
274
- */
275
- getNoClickRate({ index, startDate, endDate, tags }, requestOptions) {
276
- if (!index) {
277
- throw new Error('Parameter `index` is required when calling `getNoClickRate`.');
278
- }
279
- const requestPath = '/2/searches/noClickRate';
280
- const headers = {};
281
- const queryParameters = {};
282
- if (index !== undefined) {
283
- queryParameters.index = index.toString();
284
- }
285
- if (startDate !== undefined) {
286
- queryParameters.startDate = startDate.toString();
287
- }
288
- if (endDate !== undefined) {
289
- queryParameters.endDate = endDate.toString();
290
- }
291
- if (tags !== undefined) {
292
- queryParameters.tags = tags.toString();
293
- }
294
- const request = {
295
- method: 'GET',
296
- path: requestPath,
297
- queryParameters,
298
- headers,
299
- };
300
- return transporter.request(request, requestOptions);
301
- },
302
- /**
303
- * Returns the rate at which searches didn\'t return any results. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without results used to compute the rates.
304
- *
305
- * @summary Get no results rate.
306
- * @param getNoResultsRate - The getNoResultsRate object.
307
- * @param getNoResultsRate.index - The index name to target.
308
- * @param getNoResultsRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
309
- * @param getNoResultsRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
310
- * @param getNoResultsRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
311
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
312
- */
313
- getNoResultsRate({ index, startDate, endDate, tags }, requestOptions) {
314
- if (!index) {
315
- throw new Error('Parameter `index` is required when calling `getNoResultsRate`.');
316
- }
317
- const requestPath = '/2/searches/noResultRate';
318
- const headers = {};
319
- const queryParameters = {};
320
- if (index !== undefined) {
321
- queryParameters.index = index.toString();
322
- }
323
- if (startDate !== undefined) {
324
- queryParameters.startDate = startDate.toString();
325
- }
326
- if (endDate !== undefined) {
327
- queryParameters.endDate = endDate.toString();
328
- }
329
- if (tags !== undefined) {
330
- queryParameters.tags = tags.toString();
331
- }
332
- const request = {
333
- method: 'GET',
334
- path: requestPath,
335
- queryParameters,
336
- headers,
337
- };
338
- return transporter.request(request, requestOptions);
339
- },
340
- /**
341
- * Returns the number of searches across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day.
342
- *
343
- * @summary Get searches count.
344
- * @param getSearchesCount - The getSearchesCount object.
345
- * @param getSearchesCount.index - The index name to target.
346
- * @param getSearchesCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
347
- * @param getSearchesCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
348
- * @param getSearchesCount.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
349
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
350
- */
351
- getSearchesCount({ index, startDate, endDate, tags }, requestOptions) {
352
- if (!index) {
353
- throw new Error('Parameter `index` is required when calling `getSearchesCount`.');
354
- }
355
- const requestPath = '/2/searches/count';
356
- const headers = {};
357
- const queryParameters = {};
358
- if (index !== undefined) {
359
- queryParameters.index = index.toString();
360
- }
361
- if (startDate !== undefined) {
362
- queryParameters.startDate = startDate.toString();
363
- }
364
- if (endDate !== undefined) {
365
- queryParameters.endDate = endDate.toString();
366
- }
367
- if (tags !== undefined) {
368
- queryParameters.tags = tags.toString();
369
- }
370
- const request = {
371
- method: 'GET',
372
- path: requestPath,
373
- queryParameters,
374
- headers,
375
- };
376
- return transporter.request(request, requestOptions);
377
- },
378
- /**
379
- * Returns top searches that didn\'t lead to any clicks. Limited to the 1000 most frequent ones. For each search, also returns the average number of found hits.
380
- *
381
- * @summary Get top searches with no clicks.
382
- * @param getSearchesNoClicks - The getSearchesNoClicks object.
383
- * @param getSearchesNoClicks.index - The index name to target.
384
- * @param getSearchesNoClicks.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
385
- * @param getSearchesNoClicks.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
386
- * @param getSearchesNoClicks.limit - Number of records to return. Limit is the size of the page.
387
- * @param getSearchesNoClicks.offset - Position of the starting record. Used for paging. 0 is the first record.
388
- * @param getSearchesNoClicks.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
389
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
390
- */
391
- getSearchesNoClicks({ index, startDate, endDate, limit, offset, tags, }, requestOptions) {
392
- if (!index) {
393
- throw new Error('Parameter `index` is required when calling `getSearchesNoClicks`.');
394
- }
395
- const requestPath = '/2/searches/noClicks';
396
- const headers = {};
397
- const queryParameters = {};
398
- if (index !== undefined) {
399
- queryParameters.index = index.toString();
400
- }
401
- if (startDate !== undefined) {
402
- queryParameters.startDate = startDate.toString();
403
- }
404
- if (endDate !== undefined) {
405
- queryParameters.endDate = endDate.toString();
406
- }
407
- if (limit !== undefined) {
408
- queryParameters.limit = limit.toString();
409
- }
410
- if (offset !== undefined) {
411
- queryParameters.offset = offset.toString();
412
- }
413
- if (tags !== undefined) {
414
- queryParameters.tags = tags.toString();
415
- }
416
- const request = {
417
- method: 'GET',
418
- path: requestPath,
419
- queryParameters,
420
- headers,
421
- };
422
- return transporter.request(request, requestOptions);
423
- },
424
- /**
425
- * Returns top searches that didn\'t return any results. Limited to the 1000 most frequent ones.
426
- *
427
- * @summary Get top searches with no results.
428
- * @param getSearchesNoResults - The getSearchesNoResults object.
429
- * @param getSearchesNoResults.index - The index name to target.
430
- * @param getSearchesNoResults.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
431
- * @param getSearchesNoResults.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
432
- * @param getSearchesNoResults.limit - Number of records to return. Limit is the size of the page.
433
- * @param getSearchesNoResults.offset - Position of the starting record. Used for paging. 0 is the first record.
434
- * @param getSearchesNoResults.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
435
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
436
- */
437
- getSearchesNoResults({ index, startDate, endDate, limit, offset, tags, }, requestOptions) {
438
- if (!index) {
439
- throw new Error('Parameter `index` is required when calling `getSearchesNoResults`.');
440
- }
441
- const requestPath = '/2/searches/noResults';
442
- const headers = {};
443
- const queryParameters = {};
444
- if (index !== undefined) {
445
- queryParameters.index = index.toString();
446
- }
447
- if (startDate !== undefined) {
448
- queryParameters.startDate = startDate.toString();
449
- }
450
- if (endDate !== undefined) {
451
- queryParameters.endDate = endDate.toString();
452
- }
453
- if (limit !== undefined) {
454
- queryParameters.limit = limit.toString();
455
- }
456
- if (offset !== undefined) {
457
- queryParameters.offset = offset.toString();
458
- }
459
- if (tags !== undefined) {
460
- queryParameters.tags = tags.toString();
461
- }
462
- const request = {
463
- method: 'GET',
464
- path: requestPath,
465
- queryParameters,
466
- headers,
467
- };
468
- return transporter.request(request, requestOptions);
469
- },
470
- /**
471
- * Returns the latest update time of the analytics API for a given index. If the index has been recently created and/or no search has been performed yet the updated time will be null.
472
- *
473
- * @summary Get Analytics API status.
474
- * @param getStatus - The getStatus object.
475
- * @param getStatus.index - The index name to target.
476
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
477
- */
478
- getStatus({ index }, requestOptions) {
479
- if (!index) {
480
- throw new Error('Parameter `index` is required when calling `getStatus`.');
481
- }
482
- const requestPath = '/2/status';
483
- const headers = {};
484
- const queryParameters = {};
485
- if (index !== undefined) {
486
- queryParameters.index = index.toString();
487
- }
488
- const request = {
489
- method: 'GET',
490
- path: requestPath,
491
- queryParameters,
492
- headers,
493
- };
494
- return transporter.request(request, requestOptions);
495
- },
496
- /**
497
- * Returns top countries. Limited to the 1000 most frequent ones.
498
- *
499
- * @summary Get top countries.
500
- * @param getTopCountries - The getTopCountries object.
501
- * @param getTopCountries.index - The index name to target.
502
- * @param getTopCountries.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
503
- * @param getTopCountries.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
504
- * @param getTopCountries.limit - Number of records to return. Limit is the size of the page.
505
- * @param getTopCountries.offset - Position of the starting record. Used for paging. 0 is the first record.
506
- * @param getTopCountries.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
507
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
508
- */
509
- getTopCountries({ index, startDate, endDate, limit, offset, tags }, requestOptions) {
510
- if (!index) {
511
- throw new Error('Parameter `index` is required when calling `getTopCountries`.');
512
- }
513
- const requestPath = '/2/countries';
514
- const headers = {};
515
- const queryParameters = {};
516
- if (index !== undefined) {
517
- queryParameters.index = index.toString();
518
- }
519
- if (startDate !== undefined) {
520
- queryParameters.startDate = startDate.toString();
521
- }
522
- if (endDate !== undefined) {
523
- queryParameters.endDate = endDate.toString();
524
- }
525
- if (limit !== undefined) {
526
- queryParameters.limit = limit.toString();
527
- }
528
- if (offset !== undefined) {
529
- queryParameters.offset = offset.toString();
530
- }
531
- if (tags !== undefined) {
532
- queryParameters.tags = tags.toString();
533
- }
534
- const request = {
535
- method: 'GET',
536
- path: requestPath,
537
- queryParameters,
538
- headers,
539
- };
540
- return transporter.request(request, requestOptions);
541
- },
542
- /**
543
- * Returns top filter attributes. Limited to the 1000 most used filters.
544
- *
545
- * @summary Get top filter attributes.
546
- * @param getTopFilterAttributes - The getTopFilterAttributes object.
547
- * @param getTopFilterAttributes.index - The index name to target.
548
- * @param getTopFilterAttributes.search - The query term to search for. Must match the exact user input.
549
- * @param getTopFilterAttributes.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
550
- * @param getTopFilterAttributes.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
551
- * @param getTopFilterAttributes.limit - Number of records to return. Limit is the size of the page.
552
- * @param getTopFilterAttributes.offset - Position of the starting record. Used for paging. 0 is the first record.
553
- * @param getTopFilterAttributes.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
554
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
555
- */
556
- getTopFilterAttributes({ index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
557
- if (!index) {
558
- throw new Error('Parameter `index` is required when calling `getTopFilterAttributes`.');
559
- }
560
- const requestPath = '/2/filters';
561
- const headers = {};
562
- const queryParameters = {};
563
- if (index !== undefined) {
564
- queryParameters.index = index.toString();
565
- }
566
- if (search !== undefined) {
567
- queryParameters.search = search.toString();
568
- }
569
- if (startDate !== undefined) {
570
- queryParameters.startDate = startDate.toString();
571
- }
572
- if (endDate !== undefined) {
573
- queryParameters.endDate = endDate.toString();
574
- }
575
- if (limit !== undefined) {
576
- queryParameters.limit = limit.toString();
577
- }
578
- if (offset !== undefined) {
579
- queryParameters.offset = offset.toString();
580
- }
581
- if (tags !== undefined) {
582
- queryParameters.tags = tags.toString();
583
- }
584
- const request = {
585
- method: 'GET',
586
- path: requestPath,
587
- queryParameters,
588
- headers,
589
- };
590
- return transporter.request(request, requestOptions);
591
- },
592
- /**
593
- * Returns top filters for the given attribute. Limited to the 1000 most used filters.
594
- *
595
- * @summary Get top filters for the an attribute.
596
- * @param getTopFilterForAttribute - The getTopFilterForAttribute object.
597
- * @param getTopFilterForAttribute.attribute - The exact name of the attribute.
598
- * @param getTopFilterForAttribute.index - The index name to target.
599
- * @param getTopFilterForAttribute.search - The query term to search for. Must match the exact user input.
600
- * @param getTopFilterForAttribute.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
601
- * @param getTopFilterForAttribute.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
602
- * @param getTopFilterForAttribute.limit - Number of records to return. Limit is the size of the page.
603
- * @param getTopFilterForAttribute.offset - Position of the starting record. Used for paging. 0 is the first record.
604
- * @param getTopFilterForAttribute.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
605
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
606
- */
607
- getTopFilterForAttribute({ attribute, index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
608
- if (!attribute) {
609
- throw new Error('Parameter `attribute` is required when calling `getTopFilterForAttribute`.');
610
- }
611
- if (!index) {
612
- throw new Error('Parameter `index` is required when calling `getTopFilterForAttribute`.');
613
- }
614
- const requestPath = '/2/filters/{attribute}'.replace('{attribute}', encodeURIComponent(attribute));
615
- const headers = {};
616
- const queryParameters = {};
617
- if (index !== undefined) {
618
- queryParameters.index = index.toString();
619
- }
620
- if (search !== undefined) {
621
- queryParameters.search = search.toString();
622
- }
623
- if (startDate !== undefined) {
624
- queryParameters.startDate = startDate.toString();
625
- }
626
- if (endDate !== undefined) {
627
- queryParameters.endDate = endDate.toString();
628
- }
629
- if (limit !== undefined) {
630
- queryParameters.limit = limit.toString();
631
- }
632
- if (offset !== undefined) {
633
- queryParameters.offset = offset.toString();
634
- }
635
- if (tags !== undefined) {
636
- queryParameters.tags = tags.toString();
637
- }
638
- const request = {
639
- method: 'GET',
640
- path: requestPath,
641
- queryParameters,
642
- headers,
643
- };
644
- return transporter.request(request, requestOptions);
645
- },
646
- /**
647
- * Returns top filters with no results. Limited to the 1000 most used filters.
648
- *
649
- * @summary Get top filters for a no result search.
650
- * @param getTopFiltersNoResults - The getTopFiltersNoResults object.
651
- * @param getTopFiltersNoResults.index - The index name to target.
652
- * @param getTopFiltersNoResults.search - The query term to search for. Must match the exact user input.
653
- * @param getTopFiltersNoResults.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
654
- * @param getTopFiltersNoResults.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
655
- * @param getTopFiltersNoResults.limit - Number of records to return. Limit is the size of the page.
656
- * @param getTopFiltersNoResults.offset - Position of the starting record. Used for paging. 0 is the first record.
657
- * @param getTopFiltersNoResults.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
658
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
659
- */
660
- getTopFiltersNoResults({ index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
661
- if (!index) {
662
- throw new Error('Parameter `index` is required when calling `getTopFiltersNoResults`.');
663
- }
664
- const requestPath = '/2/filters/noResults';
665
- const headers = {};
666
- const queryParameters = {};
667
- if (index !== undefined) {
668
- queryParameters.index = index.toString();
669
- }
670
- if (search !== undefined) {
671
- queryParameters.search = search.toString();
672
- }
673
- if (startDate !== undefined) {
674
- queryParameters.startDate = startDate.toString();
675
- }
676
- if (endDate !== undefined) {
677
- queryParameters.endDate = endDate.toString();
678
- }
679
- if (limit !== undefined) {
680
- queryParameters.limit = limit.toString();
681
- }
682
- if (offset !== undefined) {
683
- queryParameters.offset = offset.toString();
684
- }
685
- if (tags !== undefined) {
686
- queryParameters.tags = tags.toString();
687
- }
688
- const request = {
689
- method: 'GET',
690
- path: requestPath,
691
- queryParameters,
692
- headers,
693
- };
694
- return transporter.request(request, requestOptions);
695
- },
696
- /**
697
- * Returns top hits. Limited to the 1000 most frequent ones.
698
- *
699
- * @summary Get top hits.
700
- * @param getTopHits - The getTopHits object.
701
- * @param getTopHits.index - The index name to target.
702
- * @param getTopHits.search - The query term to search for. Must match the exact user input.
703
- * @param getTopHits.clickAnalytics - Whether to include the click-through and conversion rates for a search.
704
- * @param getTopHits.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
705
- * @param getTopHits.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
706
- * @param getTopHits.limit - Number of records to return. Limit is the size of the page.
707
- * @param getTopHits.offset - Position of the starting record. Used for paging. 0 is the first record.
708
- * @param getTopHits.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
709
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
710
- */
711
- getTopHits({ index, search, clickAnalytics, startDate, endDate, limit, offset, tags, }, requestOptions) {
712
- if (!index) {
713
- throw new Error('Parameter `index` is required when calling `getTopHits`.');
714
- }
715
- const requestPath = '/2/hits';
716
- const headers = {};
717
- const queryParameters = {};
718
- if (index !== undefined) {
719
- queryParameters.index = index.toString();
720
- }
721
- if (search !== undefined) {
722
- queryParameters.search = search.toString();
723
- }
724
- if (clickAnalytics !== undefined) {
725
- queryParameters.clickAnalytics = clickAnalytics.toString();
726
- }
727
- if (startDate !== undefined) {
728
- queryParameters.startDate = startDate.toString();
729
- }
730
- if (endDate !== undefined) {
731
- queryParameters.endDate = endDate.toString();
732
- }
733
- if (limit !== undefined) {
734
- queryParameters.limit = limit.toString();
735
- }
736
- if (offset !== undefined) {
737
- queryParameters.offset = offset.toString();
738
- }
739
- if (tags !== undefined) {
740
- queryParameters.tags = tags.toString();
741
- }
742
- const request = {
743
- method: 'GET',
744
- path: requestPath,
745
- queryParameters,
746
- headers,
747
- };
748
- return transporter.request(request, requestOptions);
749
- },
750
- /**
751
- * Returns top searches. Limited to the 1000 most frequent ones. For each search, also returns the average number of hits returned.
752
- *
753
- * @summary Get top searches.
754
- * @param getTopSearches - The getTopSearches object.
755
- * @param getTopSearches.index - The index name to target.
756
- * @param getTopSearches.clickAnalytics - Whether to include the click-through and conversion rates for a search.
757
- * @param getTopSearches.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
758
- * @param getTopSearches.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
759
- * @param getTopSearches.orderBy - Reorder the results.
760
- * @param getTopSearches.direction - The sorting of the result.
761
- * @param getTopSearches.limit - Number of records to return. Limit is the size of the page.
762
- * @param getTopSearches.offset - Position of the starting record. Used for paging. 0 is the first record.
763
- * @param getTopSearches.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
764
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
765
- */
766
- getTopSearches({ index, clickAnalytics, startDate, endDate, orderBy, direction, limit, offset, tags, }, requestOptions) {
767
- if (!index) {
768
- throw new Error('Parameter `index` is required when calling `getTopSearches`.');
769
- }
770
- const requestPath = '/2/searches';
771
- const headers = {};
772
- const queryParameters = {};
773
- if (index !== undefined) {
774
- queryParameters.index = index.toString();
775
- }
776
- if (clickAnalytics !== undefined) {
777
- queryParameters.clickAnalytics = clickAnalytics.toString();
778
- }
779
- if (startDate !== undefined) {
780
- queryParameters.startDate = startDate.toString();
781
- }
782
- if (endDate !== undefined) {
783
- queryParameters.endDate = endDate.toString();
784
- }
785
- if (orderBy !== undefined) {
786
- queryParameters.orderBy = orderBy.toString();
787
- }
788
- if (direction !== undefined) {
789
- queryParameters.direction = direction.toString();
790
- }
791
- if (limit !== undefined) {
792
- queryParameters.limit = limit.toString();
793
- }
794
- if (offset !== undefined) {
795
- queryParameters.offset = offset.toString();
796
- }
797
- if (tags !== undefined) {
798
- queryParameters.tags = tags.toString();
799
- }
800
- const request = {
801
- method: 'GET',
802
- path: requestPath,
803
- queryParameters,
804
- headers,
805
- };
806
- return transporter.request(request, requestOptions);
807
- },
808
- /**
809
- * Returns the distinct count of users across the given time range. The endpoint returns a value for the complete given time range, as well as a value per day.
810
- *
811
- * @summary Get users count.
812
- * @param getUsersCount - The getUsersCount object.
813
- * @param getUsersCount.index - The index name to target.
814
- * @param getUsersCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
815
- * @param getUsersCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze.
816
- * @param getUsersCount.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded.
817
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
818
- */
819
- getUsersCount({ index, startDate, endDate, tags }, requestOptions) {
820
- if (!index) {
821
- throw new Error('Parameter `index` is required when calling `getUsersCount`.');
822
- }
823
- const requestPath = '/2/users/count';
824
- const headers = {};
825
- const queryParameters = {};
826
- if (index !== undefined) {
827
- queryParameters.index = index.toString();
828
- }
829
- if (startDate !== undefined) {
830
- queryParameters.startDate = startDate.toString();
831
- }
832
- if (endDate !== undefined) {
833
- queryParameters.endDate = endDate.toString();
834
- }
835
- if (tags !== undefined) {
836
- queryParameters.tags = tags.toString();
837
- }
838
- const request = {
839
- method: 'GET',
840
- path: requestPath,
841
- queryParameters,
842
- headers,
843
- };
844
- return transporter.request(request, requestOptions);
845
- },
846
- /**
847
- * This method allow you to send requests to the Algolia REST API.
848
- *
849
- * @summary Send requests to the Algolia REST API.
850
- * @param post - The post object.
851
- * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
852
- * @param post.parameters - Query parameters to be applied to the current query.
853
- * @param post.body - The parameters to send with the custom request.
854
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
855
- */
856
- post({ path, parameters, body }, requestOptions) {
857
- if (!path) {
858
- throw new Error('Parameter `path` is required when calling `post`.');
859
- }
860
- const requestPath = '/1{path}'.replace('{path}', path);
861
- const headers = {};
862
- const queryParameters = parameters ? parameters : {};
863
- const request = {
864
- method: 'POST',
865
- path: requestPath,
866
- queryParameters,
867
- headers,
868
- data: body ? body : {},
869
- };
870
- return transporter.request(request, requestOptions);
871
- },
872
- /**
873
- * This method allow you to send requests to the Algolia REST API.
874
- *
875
- * @summary Send requests to the Algolia REST API.
876
- * @param put - The put object.
877
- * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
878
- * @param put.parameters - Query parameters to be applied to the current query.
879
- * @param put.body - The parameters to send with the custom request.
880
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
881
- */
882
- put({ path, parameters, body }, requestOptions) {
883
- if (!path) {
884
- throw new Error('Parameter `path` is required when calling `put`.');
885
- }
886
- const requestPath = '/1{path}'.replace('{path}', path);
887
- const headers = {};
888
- const queryParameters = parameters ? parameters : {};
889
- const request = {
890
- method: 'PUT',
891
- path: requestPath,
892
- queryParameters,
893
- headers,
894
- data: body ? body : {},
895
- };
896
- return transporter.request(request, requestOptions);
897
- },
898
- };
4
+ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
5
+ const apiClientVersion = '5.0.0-alpha.80';
6
+ const REGIONS = ['de', 'us'];
7
+ function getDefaultHosts(region) {
8
+ const url = !region
9
+ ? 'analytics.algolia.com'
10
+ : 'analytics.{region}.algolia.com'.replace('{region}', region);
11
+ return [{ url, accept: 'readWrite', protocol: 'https' }];
12
+ }
13
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
14
+ function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
15
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
16
+ const transporter = createTransporter({
17
+ hosts: getDefaultHosts(regionOption),
18
+ ...options,
19
+ algoliaAgent: getAlgoliaAgent({
20
+ algoliaAgents,
21
+ client: 'Analytics',
22
+ version: apiClientVersion,
23
+ }),
24
+ baseHeaders: {
25
+ 'content-type': 'text/plain',
26
+ ...auth.headers(),
27
+ ...options.baseHeaders,
28
+ },
29
+ baseQueryParameters: {
30
+ ...auth.queryParameters(),
31
+ ...options.baseQueryParameters,
32
+ },
33
+ });
34
+ return {
35
+ transporter,
36
+ /**
37
+ * The `appId` currently in use.
38
+ */
39
+ appId: appIdOption,
40
+ /**
41
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
42
+ */
43
+ clearCache() {
44
+ return Promise.all([
45
+ transporter.requestsCache.clear(),
46
+ transporter.responsesCache.clear(),
47
+ ]).then(() => undefined);
48
+ },
49
+ /**
50
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
51
+ */
52
+ get _ua() {
53
+ return transporter.algoliaAgent.value;
54
+ },
55
+ /**
56
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
57
+ *
58
+ * @param segment - The algolia agent (user-agent) segment to add.
59
+ * @param version - The version of the agent.
60
+ */
61
+ addAlgoliaAgent(segment, version) {
62
+ transporter.algoliaAgent.add({ segment, version });
63
+ },
64
+ /**
65
+ * This method allow you to send requests to the Algolia REST API.
66
+ *
67
+ * @summary Send requests to the Algolia REST API.
68
+ * @param del - The del object.
69
+ * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
70
+ * @param del.parameters - Query parameters to apply to the current query.
71
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
72
+ */
73
+ del({ path, parameters }, requestOptions) {
74
+ if (!path) {
75
+ throw new Error('Parameter `path` is required when calling `del`.');
76
+ }
77
+ const requestPath = '/1{path}'.replace('{path}', path);
78
+ const headers = {};
79
+ const queryParameters = parameters ? parameters : {};
80
+ const request = {
81
+ method: 'DELETE',
82
+ path: requestPath,
83
+ queryParameters,
84
+ headers,
85
+ };
86
+ return transporter.request(request, requestOptions);
87
+ },
88
+ /**
89
+ * This method allow you to send requests to the Algolia REST API.
90
+ *
91
+ * @summary Send requests to the Algolia REST API.
92
+ * @param get - The get object.
93
+ * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
94
+ * @param get.parameters - Query parameters to apply to the current query.
95
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
96
+ */
97
+ get({ path, parameters }, requestOptions) {
98
+ if (!path) {
99
+ throw new Error('Parameter `path` is required when calling `get`.');
100
+ }
101
+ const requestPath = '/1{path}'.replace('{path}', path);
102
+ const headers = {};
103
+ const queryParameters = parameters ? parameters : {};
104
+ const request = {
105
+ method: 'GET',
106
+ path: requestPath,
107
+ queryParameters,
108
+ headers,
109
+ };
110
+ return transporter.request(request, requestOptions);
111
+ },
112
+ /**
113
+ * Return the average click position for the complete time range and for individual days. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn\'t receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`.
114
+ *
115
+ * @summary Get average click position.
116
+ * @param getAverageClickPosition - The getAverageClickPosition object.
117
+ * @param getAverageClickPosition.index - Index name to target.
118
+ * @param getAverageClickPosition.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
119
+ * @param getAverageClickPosition.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
120
+ * @param getAverageClickPosition.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
121
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
122
+ */
123
+ getAverageClickPosition({ index, startDate, endDate, tags }, requestOptions) {
124
+ if (!index) {
125
+ throw new Error('Parameter `index` is required when calling `getAverageClickPosition`.');
126
+ }
127
+ const requestPath = '/2/clicks/averageClickPosition';
128
+ const headers = {};
129
+ const queryParameters = {};
130
+ if (index !== undefined) {
131
+ queryParameters.index = index.toString();
132
+ }
133
+ if (startDate !== undefined) {
134
+ queryParameters.startDate = startDate.toString();
135
+ }
136
+ if (endDate !== undefined) {
137
+ queryParameters.endDate = endDate.toString();
138
+ }
139
+ if (tags !== undefined) {
140
+ queryParameters.tags = tags.toString();
141
+ }
142
+ const request = {
143
+ method: 'GET',
144
+ path: requestPath,
145
+ queryParameters,
146
+ headers,
147
+ };
148
+ return transporter.request(request, requestOptions);
149
+ },
150
+ /**
151
+ * Show the number of clicks events and their associated position in the search results. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn\'t receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`.
152
+ *
153
+ * @summary Get click positions.
154
+ * @param getClickPositions - The getClickPositions object.
155
+ * @param getClickPositions.index - Index name to target.
156
+ * @param getClickPositions.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
157
+ * @param getClickPositions.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
158
+ * @param getClickPositions.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
159
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
160
+ */
161
+ getClickPositions({ index, startDate, endDate, tags }, requestOptions) {
162
+ if (!index) {
163
+ throw new Error('Parameter `index` is required when calling `getClickPositions`.');
164
+ }
165
+ const requestPath = '/2/clicks/positions';
166
+ const headers = {};
167
+ const queryParameters = {};
168
+ if (index !== undefined) {
169
+ queryParameters.index = index.toString();
170
+ }
171
+ if (startDate !== undefined) {
172
+ queryParameters.startDate = startDate.toString();
173
+ }
174
+ if (endDate !== undefined) {
175
+ queryParameters.endDate = endDate.toString();
176
+ }
177
+ if (tags !== undefined) {
178
+ queryParameters.tags = tags.toString();
179
+ }
180
+ const request = {
181
+ method: 'GET',
182
+ path: requestPath,
183
+ queryParameters,
184
+ headers,
185
+ };
186
+ return transporter.request(request, requestOptions);
187
+ },
188
+ /**
189
+ * Returns a [click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate).
190
+ *
191
+ * @summary Get click-through rate (CTR).
192
+ * @param getClickThroughRate - The getClickThroughRate object.
193
+ * @param getClickThroughRate.index - Index name to target.
194
+ * @param getClickThroughRate.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
195
+ * @param getClickThroughRate.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
196
+ * @param getClickThroughRate.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
197
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
198
+ */
199
+ getClickThroughRate({ index, startDate, endDate, tags }, requestOptions) {
200
+ if (!index) {
201
+ throw new Error('Parameter `index` is required when calling `getClickThroughRate`.');
202
+ }
203
+ const requestPath = '/2/clicks/clickThroughRate';
204
+ const headers = {};
205
+ const queryParameters = {};
206
+ if (index !== undefined) {
207
+ queryParameters.index = index.toString();
208
+ }
209
+ if (startDate !== undefined) {
210
+ queryParameters.startDate = startDate.toString();
211
+ }
212
+ if (endDate !== undefined) {
213
+ queryParameters.endDate = endDate.toString();
214
+ }
215
+ if (tags !== undefined) {
216
+ queryParameters.tags = tags.toString();
217
+ }
218
+ const request = {
219
+ method: 'GET',
220
+ path: requestPath,
221
+ queryParameters,
222
+ headers,
223
+ };
224
+ return transporter.request(request, requestOptions);
225
+ },
226
+ /**
227
+ * Return a [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate).
228
+ *
229
+ * @summary Get conversion rate (CR).
230
+ * @param getConversationRate - The getConversationRate object.
231
+ * @param getConversationRate.index - Index name to target.
232
+ * @param getConversationRate.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
233
+ * @param getConversationRate.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
234
+ * @param getConversationRate.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
235
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
236
+ */
237
+ getConversationRate({ index, startDate, endDate, tags }, requestOptions) {
238
+ if (!index) {
239
+ throw new Error('Parameter `index` is required when calling `getConversationRate`.');
240
+ }
241
+ const requestPath = '/2/conversions/conversionRate';
242
+ const headers = {};
243
+ const queryParameters = {};
244
+ if (index !== undefined) {
245
+ queryParameters.index = index.toString();
246
+ }
247
+ if (startDate !== undefined) {
248
+ queryParameters.startDate = startDate.toString();
249
+ }
250
+ if (endDate !== undefined) {
251
+ queryParameters.endDate = endDate.toString();
252
+ }
253
+ if (tags !== undefined) {
254
+ queryParameters.tags = tags.toString();
255
+ }
256
+ const request = {
257
+ method: 'GET',
258
+ path: requestPath,
259
+ queryParameters,
260
+ headers,
261
+ };
262
+ return transporter.request(request, requestOptions);
263
+ },
264
+ /**
265
+ * Returns the rate at which searches don\'t lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks.
266
+ *
267
+ * @summary Get no click rate.
268
+ * @param getNoClickRate - The getNoClickRate object.
269
+ * @param getNoClickRate.index - Index name to target.
270
+ * @param getNoClickRate.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
271
+ * @param getNoClickRate.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
272
+ * @param getNoClickRate.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
273
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
274
+ */
275
+ getNoClickRate({ index, startDate, endDate, tags }, requestOptions) {
276
+ if (!index) {
277
+ throw new Error('Parameter `index` is required when calling `getNoClickRate`.');
278
+ }
279
+ const requestPath = '/2/searches/noClickRate';
280
+ const headers = {};
281
+ const queryParameters = {};
282
+ if (index !== undefined) {
283
+ queryParameters.index = index.toString();
284
+ }
285
+ if (startDate !== undefined) {
286
+ queryParameters.startDate = startDate.toString();
287
+ }
288
+ if (endDate !== undefined) {
289
+ queryParameters.endDate = endDate.toString();
290
+ }
291
+ if (tags !== undefined) {
292
+ queryParameters.tags = tags.toString();
293
+ }
294
+ const request = {
295
+ method: 'GET',
296
+ path: requestPath,
297
+ queryParameters,
298
+ headers,
299
+ };
300
+ return transporter.request(request, requestOptions);
301
+ },
302
+ /**
303
+ * Returns the rate at which searches didn\'t return any results.
304
+ *
305
+ * @summary Get no results rate.
306
+ * @param getNoResultsRate - The getNoResultsRate object.
307
+ * @param getNoResultsRate.index - Index name to target.
308
+ * @param getNoResultsRate.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
309
+ * @param getNoResultsRate.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
310
+ * @param getNoResultsRate.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
311
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
312
+ */
313
+ getNoResultsRate({ index, startDate, endDate, tags }, requestOptions) {
314
+ if (!index) {
315
+ throw new Error('Parameter `index` is required when calling `getNoResultsRate`.');
316
+ }
317
+ const requestPath = '/2/searches/noResultRate';
318
+ const headers = {};
319
+ const queryParameters = {};
320
+ if (index !== undefined) {
321
+ queryParameters.index = index.toString();
322
+ }
323
+ if (startDate !== undefined) {
324
+ queryParameters.startDate = startDate.toString();
325
+ }
326
+ if (endDate !== undefined) {
327
+ queryParameters.endDate = endDate.toString();
328
+ }
329
+ if (tags !== undefined) {
330
+ queryParameters.tags = tags.toString();
331
+ }
332
+ const request = {
333
+ method: 'GET',
334
+ path: requestPath,
335
+ queryParameters,
336
+ headers,
337
+ };
338
+ return transporter.request(request, requestOptions);
339
+ },
340
+ /**
341
+ * Returns the number of searches within a time range.
342
+ *
343
+ * @summary Get number of searches.
344
+ * @param getSearchesCount - The getSearchesCount object.
345
+ * @param getSearchesCount.index - Index name to target.
346
+ * @param getSearchesCount.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
347
+ * @param getSearchesCount.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
348
+ * @param getSearchesCount.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
349
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
350
+ */
351
+ getSearchesCount({ index, startDate, endDate, tags }, requestOptions) {
352
+ if (!index) {
353
+ throw new Error('Parameter `index` is required when calling `getSearchesCount`.');
354
+ }
355
+ const requestPath = '/2/searches/count';
356
+ const headers = {};
357
+ const queryParameters = {};
358
+ if (index !== undefined) {
359
+ queryParameters.index = index.toString();
360
+ }
361
+ if (startDate !== undefined) {
362
+ queryParameters.startDate = startDate.toString();
363
+ }
364
+ if (endDate !== undefined) {
365
+ queryParameters.endDate = endDate.toString();
366
+ }
367
+ if (tags !== undefined) {
368
+ queryParameters.tags = tags.toString();
369
+ }
370
+ const request = {
371
+ method: 'GET',
372
+ path: requestPath,
373
+ queryParameters,
374
+ headers,
375
+ };
376
+ return transporter.request(request, requestOptions);
377
+ },
378
+ /**
379
+ * Return the most popular of the last 1,000 searches that didn\'t lead to any clicks.
380
+ *
381
+ * @summary Get top searches with no clicks.
382
+ * @param getSearchesNoClicks - The getSearchesNoClicks object.
383
+ * @param getSearchesNoClicks.index - Index name to target.
384
+ * @param getSearchesNoClicks.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
385
+ * @param getSearchesNoClicks.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
386
+ * @param getSearchesNoClicks.limit - Number of records to return (page size).
387
+ * @param getSearchesNoClicks.offset - Position of the starting record. Used for paging. 0 is the first record.
388
+ * @param getSearchesNoClicks.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
389
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
390
+ */
391
+ getSearchesNoClicks({ index, startDate, endDate, limit, offset, tags, }, requestOptions) {
392
+ if (!index) {
393
+ throw new Error('Parameter `index` is required when calling `getSearchesNoClicks`.');
394
+ }
395
+ const requestPath = '/2/searches/noClicks';
396
+ const headers = {};
397
+ const queryParameters = {};
398
+ if (index !== undefined) {
399
+ queryParameters.index = index.toString();
400
+ }
401
+ if (startDate !== undefined) {
402
+ queryParameters.startDate = startDate.toString();
403
+ }
404
+ if (endDate !== undefined) {
405
+ queryParameters.endDate = endDate.toString();
406
+ }
407
+ if (limit !== undefined) {
408
+ queryParameters.limit = limit.toString();
409
+ }
410
+ if (offset !== undefined) {
411
+ queryParameters.offset = offset.toString();
412
+ }
413
+ if (tags !== undefined) {
414
+ queryParameters.tags = tags.toString();
415
+ }
416
+ const request = {
417
+ method: 'GET',
418
+ path: requestPath,
419
+ queryParameters,
420
+ headers,
421
+ };
422
+ return transporter.request(request, requestOptions);
423
+ },
424
+ /**
425
+ * Returns the most popular of the latest 1,000 searches that didn\'t return any results.
426
+ *
427
+ * @summary Get top searches with no results.
428
+ * @param getSearchesNoResults - The getSearchesNoResults object.
429
+ * @param getSearchesNoResults.index - Index name to target.
430
+ * @param getSearchesNoResults.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
431
+ * @param getSearchesNoResults.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
432
+ * @param getSearchesNoResults.limit - Number of records to return (page size).
433
+ * @param getSearchesNoResults.offset - Position of the starting record. Used for paging. 0 is the first record.
434
+ * @param getSearchesNoResults.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
435
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
436
+ */
437
+ getSearchesNoResults({ index, startDate, endDate, limit, offset, tags, }, requestOptions) {
438
+ if (!index) {
439
+ throw new Error('Parameter `index` is required when calling `getSearchesNoResults`.');
440
+ }
441
+ const requestPath = '/2/searches/noResults';
442
+ const headers = {};
443
+ const queryParameters = {};
444
+ if (index !== undefined) {
445
+ queryParameters.index = index.toString();
446
+ }
447
+ if (startDate !== undefined) {
448
+ queryParameters.startDate = startDate.toString();
449
+ }
450
+ if (endDate !== undefined) {
451
+ queryParameters.endDate = endDate.toString();
452
+ }
453
+ if (limit !== undefined) {
454
+ queryParameters.limit = limit.toString();
455
+ }
456
+ if (offset !== undefined) {
457
+ queryParameters.offset = offset.toString();
458
+ }
459
+ if (tags !== undefined) {
460
+ queryParameters.tags = tags.toString();
461
+ }
462
+ const request = {
463
+ method: 'GET',
464
+ path: requestPath,
465
+ queryParameters,
466
+ headers,
467
+ };
468
+ return transporter.request(request, requestOptions);
469
+ },
470
+ /**
471
+ * Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, `updatedAt` will be `null`. > **Note**: The Analytics API is updated every 5 minutes.
472
+ *
473
+ * @summary Get Analytics API status.
474
+ * @param getStatus - The getStatus object.
475
+ * @param getStatus.index - Index name to target.
476
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
477
+ */
478
+ getStatus({ index }, requestOptions) {
479
+ if (!index) {
480
+ throw new Error('Parameter `index` is required when calling `getStatus`.');
481
+ }
482
+ const requestPath = '/2/status';
483
+ const headers = {};
484
+ const queryParameters = {};
485
+ if (index !== undefined) {
486
+ queryParameters.index = index.toString();
487
+ }
488
+ const request = {
489
+ method: 'GET',
490
+ path: requestPath,
491
+ queryParameters,
492
+ headers,
493
+ };
494
+ return transporter.request(request, requestOptions);
495
+ },
496
+ /**
497
+ * Returns top countries. Limited to the 1,000 most frequent ones.
498
+ *
499
+ * @summary Get top countries.
500
+ * @param getTopCountries - The getTopCountries object.
501
+ * @param getTopCountries.index - Index name to target.
502
+ * @param getTopCountries.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
503
+ * @param getTopCountries.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
504
+ * @param getTopCountries.limit - Number of records to return (page size).
505
+ * @param getTopCountries.offset - Position of the starting record. Used for paging. 0 is the first record.
506
+ * @param getTopCountries.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
507
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
508
+ */
509
+ getTopCountries({ index, startDate, endDate, limit, offset, tags }, requestOptions) {
510
+ if (!index) {
511
+ throw new Error('Parameter `index` is required when calling `getTopCountries`.');
512
+ }
513
+ const requestPath = '/2/countries';
514
+ const headers = {};
515
+ const queryParameters = {};
516
+ if (index !== undefined) {
517
+ queryParameters.index = index.toString();
518
+ }
519
+ if (startDate !== undefined) {
520
+ queryParameters.startDate = startDate.toString();
521
+ }
522
+ if (endDate !== undefined) {
523
+ queryParameters.endDate = endDate.toString();
524
+ }
525
+ if (limit !== undefined) {
526
+ queryParameters.limit = limit.toString();
527
+ }
528
+ if (offset !== undefined) {
529
+ queryParameters.offset = offset.toString();
530
+ }
531
+ if (tags !== undefined) {
532
+ queryParameters.tags = tags.toString();
533
+ }
534
+ const request = {
535
+ method: 'GET',
536
+ path: requestPath,
537
+ queryParameters,
538
+ headers,
539
+ };
540
+ return transporter.request(request, requestOptions);
541
+ },
542
+ /**
543
+ * Return the most popular [filterable attributes](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters.
544
+ *
545
+ * @summary Get top filterable attributes.
546
+ * @param getTopFilterAttributes - The getTopFilterAttributes object.
547
+ * @param getTopFilterAttributes.index - Index name to target.
548
+ * @param getTopFilterAttributes.search - User query.
549
+ * @param getTopFilterAttributes.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
550
+ * @param getTopFilterAttributes.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
551
+ * @param getTopFilterAttributes.limit - Number of records to return (page size).
552
+ * @param getTopFilterAttributes.offset - Position of the starting record. Used for paging. 0 is the first record.
553
+ * @param getTopFilterAttributes.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
554
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
555
+ */
556
+ getTopFilterAttributes({ index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
557
+ if (!index) {
558
+ throw new Error('Parameter `index` is required when calling `getTopFilterAttributes`.');
559
+ }
560
+ const requestPath = '/2/filters';
561
+ const headers = {};
562
+ const queryParameters = {};
563
+ if (index !== undefined) {
564
+ queryParameters.index = index.toString();
565
+ }
566
+ if (search !== undefined) {
567
+ queryParameters.search = search.toString();
568
+ }
569
+ if (startDate !== undefined) {
570
+ queryParameters.startDate = startDate.toString();
571
+ }
572
+ if (endDate !== undefined) {
573
+ queryParameters.endDate = endDate.toString();
574
+ }
575
+ if (limit !== undefined) {
576
+ queryParameters.limit = limit.toString();
577
+ }
578
+ if (offset !== undefined) {
579
+ queryParameters.offset = offset.toString();
580
+ }
581
+ if (tags !== undefined) {
582
+ queryParameters.tags = tags.toString();
583
+ }
584
+ const request = {
585
+ method: 'GET',
586
+ path: requestPath,
587
+ queryParameters,
588
+ headers,
589
+ };
590
+ return transporter.request(request, requestOptions);
591
+ },
592
+ /**
593
+ * Returns the most popular filter values for an attribute in the 1,000 most recently used filters.
594
+ *
595
+ * @summary Get top filter values for an attribute.
596
+ * @param getTopFilterForAttribute - The getTopFilterForAttribute object.
597
+ * @param getTopFilterForAttribute.attribute - Attribute name.
598
+ * @param getTopFilterForAttribute.index - Index name to target.
599
+ * @param getTopFilterForAttribute.search - User query.
600
+ * @param getTopFilterForAttribute.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
601
+ * @param getTopFilterForAttribute.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
602
+ * @param getTopFilterForAttribute.limit - Number of records to return (page size).
603
+ * @param getTopFilterForAttribute.offset - Position of the starting record. Used for paging. 0 is the first record.
604
+ * @param getTopFilterForAttribute.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
605
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
606
+ */
607
+ getTopFilterForAttribute({ attribute, index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
608
+ if (!attribute) {
609
+ throw new Error('Parameter `attribute` is required when calling `getTopFilterForAttribute`.');
610
+ }
611
+ if (!index) {
612
+ throw new Error('Parameter `index` is required when calling `getTopFilterForAttribute`.');
613
+ }
614
+ const requestPath = '/2/filters/{attribute}'.replace('{attribute}', encodeURIComponent(attribute));
615
+ const headers = {};
616
+ const queryParameters = {};
617
+ if (index !== undefined) {
618
+ queryParameters.index = index.toString();
619
+ }
620
+ if (search !== undefined) {
621
+ queryParameters.search = search.toString();
622
+ }
623
+ if (startDate !== undefined) {
624
+ queryParameters.startDate = startDate.toString();
625
+ }
626
+ if (endDate !== undefined) {
627
+ queryParameters.endDate = endDate.toString();
628
+ }
629
+ if (limit !== undefined) {
630
+ queryParameters.limit = limit.toString();
631
+ }
632
+ if (offset !== undefined) {
633
+ queryParameters.offset = offset.toString();
634
+ }
635
+ if (tags !== undefined) {
636
+ queryParameters.tags = tags.toString();
637
+ }
638
+ const request = {
639
+ method: 'GET',
640
+ path: requestPath,
641
+ queryParameters,
642
+ headers,
643
+ };
644
+ return transporter.request(request, requestOptions);
645
+ },
646
+ /**
647
+ * Returns top filters for filter-enabled searches that don\'t return results. Limited to the 1,000 most recently used filters.
648
+ *
649
+ * @summary Get top filters for a no result search.
650
+ * @param getTopFiltersNoResults - The getTopFiltersNoResults object.
651
+ * @param getTopFiltersNoResults.index - Index name to target.
652
+ * @param getTopFiltersNoResults.search - User query.
653
+ * @param getTopFiltersNoResults.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
654
+ * @param getTopFiltersNoResults.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
655
+ * @param getTopFiltersNoResults.limit - Number of records to return (page size).
656
+ * @param getTopFiltersNoResults.offset - Position of the starting record. Used for paging. 0 is the first record.
657
+ * @param getTopFiltersNoResults.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
658
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
659
+ */
660
+ getTopFiltersNoResults({ index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
661
+ if (!index) {
662
+ throw new Error('Parameter `index` is required when calling `getTopFiltersNoResults`.');
663
+ }
664
+ const requestPath = '/2/filters/noResults';
665
+ const headers = {};
666
+ const queryParameters = {};
667
+ if (index !== undefined) {
668
+ queryParameters.index = index.toString();
669
+ }
670
+ if (search !== undefined) {
671
+ queryParameters.search = search.toString();
672
+ }
673
+ if (startDate !== undefined) {
674
+ queryParameters.startDate = startDate.toString();
675
+ }
676
+ if (endDate !== undefined) {
677
+ queryParameters.endDate = endDate.toString();
678
+ }
679
+ if (limit !== undefined) {
680
+ queryParameters.limit = limit.toString();
681
+ }
682
+ if (offset !== undefined) {
683
+ queryParameters.offset = offset.toString();
684
+ }
685
+ if (tags !== undefined) {
686
+ queryParameters.tags = tags.toString();
687
+ }
688
+ const request = {
689
+ method: 'GET',
690
+ path: requestPath,
691
+ queryParameters,
692
+ headers,
693
+ };
694
+ return transporter.request(request, requestOptions);
695
+ },
696
+ /**
697
+ * Return the most popular clicked results in the last 1,000 searches.
698
+ *
699
+ * @summary Get top hits.
700
+ * @param getTopHits - The getTopHits object.
701
+ * @param getTopHits.index - Index name to target.
702
+ * @param getTopHits.search - User query.
703
+ * @param getTopHits.clickAnalytics - Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search.
704
+ * @param getTopHits.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
705
+ * @param getTopHits.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
706
+ * @param getTopHits.limit - Number of records to return (page size).
707
+ * @param getTopHits.offset - Position of the starting record. Used for paging. 0 is the first record.
708
+ * @param getTopHits.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
709
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
710
+ */
711
+ getTopHits({ index, search, clickAnalytics, startDate, endDate, limit, offset, tags, }, requestOptions) {
712
+ if (!index) {
713
+ throw new Error('Parameter `index` is required when calling `getTopHits`.');
714
+ }
715
+ const requestPath = '/2/hits';
716
+ const headers = {};
717
+ const queryParameters = {};
718
+ if (index !== undefined) {
719
+ queryParameters.index = index.toString();
720
+ }
721
+ if (search !== undefined) {
722
+ queryParameters.search = search.toString();
723
+ }
724
+ if (clickAnalytics !== undefined) {
725
+ queryParameters.clickAnalytics = clickAnalytics.toString();
726
+ }
727
+ if (startDate !== undefined) {
728
+ queryParameters.startDate = startDate.toString();
729
+ }
730
+ if (endDate !== undefined) {
731
+ queryParameters.endDate = endDate.toString();
732
+ }
733
+ if (limit !== undefined) {
734
+ queryParameters.limit = limit.toString();
735
+ }
736
+ if (offset !== undefined) {
737
+ queryParameters.offset = offset.toString();
738
+ }
739
+ if (tags !== undefined) {
740
+ queryParameters.tags = tags.toString();
741
+ }
742
+ const request = {
743
+ method: 'GET',
744
+ path: requestPath,
745
+ queryParameters,
746
+ headers,
747
+ };
748
+ return transporter.request(request, requestOptions);
749
+ },
750
+ /**
751
+ * Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits.
752
+ *
753
+ * @summary Get top searches.
754
+ * @param getTopSearches - The getTopSearches object.
755
+ * @param getTopSearches.index - Index name to target.
756
+ * @param getTopSearches.clickAnalytics - Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search.
757
+ * @param getTopSearches.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
758
+ * @param getTopSearches.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
759
+ * @param getTopSearches.orderBy - Reorder the results.
760
+ * @param getTopSearches.direction - Sorting direction of the results: ascending or descending.
761
+ * @param getTopSearches.limit - Number of records to return (page size).
762
+ * @param getTopSearches.offset - Position of the starting record. Used for paging. 0 is the first record.
763
+ * @param getTopSearches.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
764
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
765
+ */
766
+ getTopSearches({ index, clickAnalytics, startDate, endDate, orderBy, direction, limit, offset, tags, }, requestOptions) {
767
+ if (!index) {
768
+ throw new Error('Parameter `index` is required when calling `getTopSearches`.');
769
+ }
770
+ const requestPath = '/2/searches';
771
+ const headers = {};
772
+ const queryParameters = {};
773
+ if (index !== undefined) {
774
+ queryParameters.index = index.toString();
775
+ }
776
+ if (clickAnalytics !== undefined) {
777
+ queryParameters.clickAnalytics = clickAnalytics.toString();
778
+ }
779
+ if (startDate !== undefined) {
780
+ queryParameters.startDate = startDate.toString();
781
+ }
782
+ if (endDate !== undefined) {
783
+ queryParameters.endDate = endDate.toString();
784
+ }
785
+ if (orderBy !== undefined) {
786
+ queryParameters.orderBy = orderBy.toString();
787
+ }
788
+ if (direction !== undefined) {
789
+ queryParameters.direction = direction.toString();
790
+ }
791
+ if (limit !== undefined) {
792
+ queryParameters.limit = limit.toString();
793
+ }
794
+ if (offset !== undefined) {
795
+ queryParameters.offset = offset.toString();
796
+ }
797
+ if (tags !== undefined) {
798
+ queryParameters.tags = tags.toString();
799
+ }
800
+ const request = {
801
+ method: 'GET',
802
+ path: requestPath,
803
+ queryParameters,
804
+ headers,
805
+ };
806
+ return transporter.request(request, requestOptions);
807
+ },
808
+ /**
809
+ * Return the count of unique users.
810
+ *
811
+ * @summary Get user count.
812
+ * @param getUsersCount - The getUsersCount object.
813
+ * @param getUsersCount.index - Index name to target.
814
+ * @param getUsersCount.startDate - Start date (a string in the format `YYYY-MM-DD`) of the period to analyze.
815
+ * @param getUsersCount.endDate - End date (a string in the format `YYYY-MM-DD`) of the period to analyze.
816
+ * @param getUsersCount.tags - Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded.
817
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
818
+ */
819
+ getUsersCount({ index, startDate, endDate, tags }, requestOptions) {
820
+ if (!index) {
821
+ throw new Error('Parameter `index` is required when calling `getUsersCount`.');
822
+ }
823
+ const requestPath = '/2/users/count';
824
+ const headers = {};
825
+ const queryParameters = {};
826
+ if (index !== undefined) {
827
+ queryParameters.index = index.toString();
828
+ }
829
+ if (startDate !== undefined) {
830
+ queryParameters.startDate = startDate.toString();
831
+ }
832
+ if (endDate !== undefined) {
833
+ queryParameters.endDate = endDate.toString();
834
+ }
835
+ if (tags !== undefined) {
836
+ queryParameters.tags = tags.toString();
837
+ }
838
+ const request = {
839
+ method: 'GET',
840
+ path: requestPath,
841
+ queryParameters,
842
+ headers,
843
+ };
844
+ return transporter.request(request, requestOptions);
845
+ },
846
+ /**
847
+ * This method allow you to send requests to the Algolia REST API.
848
+ *
849
+ * @summary Send requests to the Algolia REST API.
850
+ * @param post - The post object.
851
+ * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
852
+ * @param post.parameters - Query parameters to apply to the current query.
853
+ * @param post.body - Parameters to send with the custom request.
854
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
855
+ */
856
+ post({ path, parameters, body }, requestOptions) {
857
+ if (!path) {
858
+ throw new Error('Parameter `path` is required when calling `post`.');
859
+ }
860
+ const requestPath = '/1{path}'.replace('{path}', path);
861
+ const headers = {};
862
+ const queryParameters = parameters ? parameters : {};
863
+ const request = {
864
+ method: 'POST',
865
+ path: requestPath,
866
+ queryParameters,
867
+ headers,
868
+ data: body ? body : {},
869
+ };
870
+ return transporter.request(request, requestOptions);
871
+ },
872
+ /**
873
+ * This method allow you to send requests to the Algolia REST API.
874
+ *
875
+ * @summary Send requests to the Algolia REST API.
876
+ * @param put - The put object.
877
+ * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
878
+ * @param put.parameters - Query parameters to apply to the current query.
879
+ * @param put.body - Parameters to send with the custom request.
880
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
881
+ */
882
+ put({ path, parameters, body }, requestOptions) {
883
+ if (!path) {
884
+ throw new Error('Parameter `path` is required when calling `put`.');
885
+ }
886
+ const requestPath = '/1{path}'.replace('{path}', path);
887
+ const headers = {};
888
+ const queryParameters = parameters ? parameters : {};
889
+ const request = {
890
+ method: 'PUT',
891
+ path: requestPath,
892
+ queryParameters,
893
+ headers,
894
+ data: body ? body : {},
895
+ };
896
+ return transporter.request(request, requestOptions);
897
+ },
898
+ };
899
899
  }
900
900
 
901
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
902
- function analyticsClient(appId, apiKey, region, options) {
903
- if (!appId || typeof appId !== 'string') {
904
- throw new Error('`appId` is missing.');
905
- }
906
- if (!apiKey || typeof apiKey !== 'string') {
907
- throw new Error('`apiKey` is missing.');
908
- }
909
- if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
910
- throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
911
- }
912
- return createAnalyticsClient({
913
- appId,
914
- apiKey,
915
- region,
916
- timeouts: {
917
- connect: DEFAULT_CONNECT_TIMEOUT_NODE,
918
- read: DEFAULT_READ_TIMEOUT_NODE,
919
- write: DEFAULT_WRITE_TIMEOUT_NODE,
920
- },
921
- requester: createHttpRequester(),
922
- algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
923
- responsesCache: createNullCache(),
924
- requestsCache: createNullCache(),
925
- hostsCache: createMemoryCache(),
926
- ...options,
927
- });
901
+ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
902
+ function analyticsClient(appId, apiKey, region, options) {
903
+ if (!appId || typeof appId !== 'string') {
904
+ throw new Error('`appId` is missing.');
905
+ }
906
+ if (!apiKey || typeof apiKey !== 'string') {
907
+ throw new Error('`apiKey` is missing.');
908
+ }
909
+ if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
910
+ throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
911
+ }
912
+ return createAnalyticsClient({
913
+ appId,
914
+ apiKey,
915
+ region,
916
+ timeouts: {
917
+ connect: DEFAULT_CONNECT_TIMEOUT_NODE,
918
+ read: DEFAULT_READ_TIMEOUT_NODE,
919
+ write: DEFAULT_WRITE_TIMEOUT_NODE,
920
+ },
921
+ requester: createHttpRequester(),
922
+ algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
923
+ responsesCache: createNullCache(),
924
+ requestsCache: createNullCache(),
925
+ hostsCache: createMemoryCache(),
926
+ ...options,
927
+ });
928
928
  }
929
929
 
930
930
  export { analyticsClient, apiClientVersion };