@algolia/client-analytics 5.0.0-alpha.11 → 5.0.0-alpha.110

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 (216) hide show
  1. package/dist/builds/browser.d.ts +39 -5
  2. package/dist/builds/browser.d.ts.map +1 -1
  3. package/dist/builds/node.d.ts +39 -5
  4. package/dist/builds/node.d.ts.map +1 -1
  5. package/dist/{client-analytics.cjs.js → client-analytics.cjs} +1083 -924
  6. package/dist/client-analytics.esm.browser.js +1293 -1160
  7. package/dist/client-analytics.esm.node.js +1083 -922
  8. package/dist/client-analytics.umd.js +2 -2
  9. package/dist/model/clickPositionsInner.d.ts +14 -0
  10. package/dist/model/clickPositionsInner.d.ts.map +1 -0
  11. package/dist/model/clientMethodProps.d.ts +578 -507
  12. package/dist/model/clientMethodProps.d.ts.map +1 -1
  13. package/dist/model/currenciesValue.d.ts +14 -0
  14. package/dist/model/currenciesValue.d.ts.map +1 -0
  15. package/dist/model/dailyAddToCartRates.d.ts +19 -0
  16. package/dist/model/dailyAddToCartRates.d.ts.map +1 -0
  17. package/dist/model/dailyAverageClicks.d.ts +15 -0
  18. package/dist/model/dailyAverageClicks.d.ts.map +1 -0
  19. package/dist/model/dailyClickThroughRates.d.ts +19 -0
  20. package/dist/model/dailyClickThroughRates.d.ts.map +1 -0
  21. package/dist/model/dailyConversionRates.d.ts +19 -0
  22. package/dist/model/dailyConversionRates.d.ts.map +1 -0
  23. package/dist/model/dailyNoClickRates.d.ts +19 -0
  24. package/dist/model/dailyNoClickRates.d.ts.map +1 -0
  25. package/dist/model/dailyNoResultsRates.d.ts +19 -0
  26. package/dist/model/dailyNoResultsRates.d.ts.map +1 -0
  27. package/dist/model/dailyPurchaseRates.d.ts +19 -0
  28. package/dist/model/dailyPurchaseRates.d.ts.map +1 -0
  29. package/dist/model/dailyRevenue.d.ts +12 -0
  30. package/dist/model/dailyRevenue.d.ts.map +1 -0
  31. package/dist/model/dailySearches.d.ts +11 -0
  32. package/dist/model/dailySearches.d.ts.map +1 -0
  33. package/dist/model/dailySearchesNoClicks.d.ts +15 -0
  34. package/dist/model/dailySearchesNoClicks.d.ts.map +1 -0
  35. package/dist/model/dailySearchesNoResults.d.ts +15 -0
  36. package/dist/model/dailySearchesNoResults.d.ts.map +1 -0
  37. package/dist/model/dailyUsers.d.ts +11 -0
  38. package/dist/model/dailyUsers.d.ts.map +1 -0
  39. package/dist/model/direction.d.ts +1 -1
  40. package/dist/model/direction.d.ts.map +1 -1
  41. package/dist/model/errorBase.d.ts +6 -6
  42. package/dist/model/errorBase.d.ts.map +1 -1
  43. package/dist/model/getAddToCartRateResponse.d.ts +20 -0
  44. package/dist/model/getAddToCartRateResponse.d.ts.map +1 -0
  45. package/dist/model/getAverageClickPositionResponse.d.ts +15 -15
  46. package/dist/model/getAverageClickPositionResponse.d.ts.map +1 -1
  47. package/dist/model/getClickPositionsResponse.d.ts +7 -7
  48. package/dist/model/getClickPositionsResponse.d.ts.map +1 -1
  49. package/dist/model/getClickThroughRateResponse.d.ts +19 -19
  50. package/dist/model/getClickThroughRateResponse.d.ts.map +1 -1
  51. package/dist/model/getConversionRateResponse.d.ts +20 -0
  52. package/dist/model/getConversionRateResponse.d.ts.map +1 -0
  53. package/dist/model/getNoClickRateResponse.d.ts +19 -19
  54. package/dist/model/getNoClickRateResponse.d.ts.map +1 -1
  55. package/dist/model/getNoResultsRateResponse.d.ts +19 -19
  56. package/dist/model/getNoResultsRateResponse.d.ts.map +1 -1
  57. package/dist/model/getPurchaseRateResponse.d.ts +20 -0
  58. package/dist/model/getPurchaseRateResponse.d.ts.map +1 -0
  59. package/dist/model/getRevenue.d.ts +13 -0
  60. package/dist/model/getRevenue.d.ts.map +1 -0
  61. package/dist/model/getSearchesCountResponse.d.ts +11 -11
  62. package/dist/model/getSearchesCountResponse.d.ts.map +1 -1
  63. package/dist/model/getSearchesNoClicksResponse.d.ts +7 -7
  64. package/dist/model/getSearchesNoClicksResponse.d.ts.map +1 -1
  65. package/dist/model/getSearchesNoResultsResponse.d.ts +7 -7
  66. package/dist/model/getSearchesNoResultsResponse.d.ts.map +1 -1
  67. package/dist/model/getStatusResponse.d.ts +6 -6
  68. package/dist/model/getStatusResponse.d.ts.map +1 -1
  69. package/dist/model/getTopCountriesResponse.d.ts +7 -7
  70. package/dist/model/getTopCountriesResponse.d.ts.map +1 -1
  71. package/dist/model/getTopFilterAttribute.d.ts +10 -10
  72. package/dist/model/getTopFilterAttribute.d.ts.map +1 -1
  73. package/dist/model/getTopFilterAttributesResponse.d.ts +7 -7
  74. package/dist/model/getTopFilterAttributesResponse.d.ts.map +1 -1
  75. package/dist/model/getTopFilterForAttribute.d.ts +16 -18
  76. package/dist/model/getTopFilterForAttribute.d.ts.map +1 -1
  77. package/dist/model/getTopFilterForAttributeResponse.d.ts +7 -7
  78. package/dist/model/getTopFilterForAttributeResponse.d.ts.map +1 -1
  79. package/dist/model/getTopFiltersNoResultsResponse.d.ts +7 -7
  80. package/dist/model/getTopFiltersNoResultsResponse.d.ts.map +1 -1
  81. package/dist/model/getTopFiltersNoResultsValue.d.ts +12 -14
  82. package/dist/model/getTopFiltersNoResultsValue.d.ts.map +1 -1
  83. package/dist/model/getTopFiltersNoResultsValues.d.ts +11 -11
  84. package/dist/model/getTopFiltersNoResultsValues.d.ts.map +1 -1
  85. package/dist/model/getTopHitsResponse.d.ts +4 -3
  86. package/dist/model/getTopHitsResponse.d.ts.map +1 -1
  87. package/dist/model/getTopSearchesResponse.d.ts +4 -3
  88. package/dist/model/getTopSearchesResponse.d.ts.map +1 -1
  89. package/dist/model/getUsersCountResponse.d.ts +11 -11
  90. package/dist/model/getUsersCountResponse.d.ts.map +1 -1
  91. package/dist/model/index.d.ts +56 -44
  92. package/dist/model/index.d.ts.map +1 -1
  93. package/dist/model/operator.d.ts +5 -0
  94. package/dist/model/operator.d.ts.map +1 -0
  95. package/dist/model/orderBy.d.ts +4 -1
  96. package/dist/model/orderBy.d.ts.map +1 -1
  97. package/dist/model/topCountry.d.ts +10 -10
  98. package/dist/model/topCountry.d.ts.map +1 -1
  99. package/dist/model/topHit.d.ts +10 -10
  100. package/dist/model/topHit.d.ts.map +1 -1
  101. package/dist/model/topHitWithAnalytics.d.ts +30 -30
  102. package/dist/model/topHitWithAnalytics.d.ts.map +1 -1
  103. package/dist/model/topHitWithRevenueAnalytics.d.ts +52 -0
  104. package/dist/model/topHitWithRevenueAnalytics.d.ts.map +1 -0
  105. package/dist/model/topHitsResponse.d.ts +7 -7
  106. package/dist/model/topHitsResponse.d.ts.map +1 -1
  107. package/dist/model/topHitsResponseWithAnalytics.d.ts +7 -7
  108. package/dist/model/topHitsResponseWithAnalytics.d.ts.map +1 -1
  109. package/dist/model/topHitsResponseWithRevenueAnalytics.d.ts +8 -0
  110. package/dist/model/topHitsResponseWithRevenueAnalytics.d.ts.map +1 -0
  111. package/dist/model/topSearch.d.ts +14 -14
  112. package/dist/model/topSearch.d.ts.map +1 -1
  113. package/dist/model/topSearchWithAnalytics.d.ts +43 -38
  114. package/dist/model/topSearchWithAnalytics.d.ts.map +1 -1
  115. package/dist/model/topSearchWithRevenueAnalytics.d.ts +65 -0
  116. package/dist/model/topSearchWithRevenueAnalytics.d.ts.map +1 -0
  117. package/dist/model/topSearchesResponse.d.ts +7 -7
  118. package/dist/model/topSearchesResponse.d.ts.map +1 -1
  119. package/dist/model/topSearchesResponseWithAnalytics.d.ts +7 -7
  120. package/dist/model/topSearchesResponseWithAnalytics.d.ts.map +1 -1
  121. package/dist/model/topSearchesResponseWithRevenueAnalytics.d.ts +8 -0
  122. package/dist/model/topSearchesResponseWithRevenueAnalytics.d.ts.map +1 -0
  123. package/dist/src/analyticsClient.d.ts +391 -318
  124. package/dist/src/analyticsClient.d.ts.map +1 -1
  125. package/index.js +1 -1
  126. package/model/clickPositionsInner.ts +16 -0
  127. package/model/clientMethodProps.ts +211 -137
  128. package/model/currenciesValue.ts +16 -0
  129. package/model/dailyAddToCartRates.ts +23 -0
  130. package/model/dailyAverageClicks.ts +18 -0
  131. package/model/dailyClickThroughRates.ts +23 -0
  132. package/model/dailyConversionRates.ts +23 -0
  133. package/model/dailyNoClickRates.ts +23 -0
  134. package/model/dailyNoResultsRates.ts +23 -0
  135. package/model/dailyPurchaseRates.ts +23 -0
  136. package/model/dailyRevenue.ts +15 -0
  137. package/model/dailySearches.ts +13 -0
  138. package/model/dailySearchesNoClicks.ts +18 -0
  139. package/model/dailySearchesNoResults.ts +18 -0
  140. package/model/dailyUsers.ts +13 -0
  141. package/model/direction.ts +1 -1
  142. package/model/errorBase.ts +1 -1
  143. package/model/getAddToCartRateResponse.ts +25 -0
  144. package/model/getAverageClickPositionResponse.ts +7 -7
  145. package/model/getClickPositionsResponse.ts +4 -4
  146. package/model/getClickThroughRateResponse.ts +8 -8
  147. package/model/getConversionRateResponse.ts +25 -0
  148. package/model/getNoClickRateResponse.ts +7 -7
  149. package/model/getNoResultsRateResponse.ts +7 -7
  150. package/model/getPurchaseRateResponse.ts +25 -0
  151. package/model/getRevenue.ts +16 -0
  152. package/model/getSearchesCountResponse.ts +5 -5
  153. package/model/getSearchesNoClicksResponse.ts +4 -4
  154. package/model/getSearchesNoResultsResponse.ts +4 -4
  155. package/model/getStatusResponse.ts +3 -3
  156. package/model/getTopCountriesResponse.ts +2 -2
  157. package/model/getTopFilterAttribute.ts +3 -3
  158. package/model/getTopFilterAttributesResponse.ts +2 -2
  159. package/model/getTopFilterForAttribute.ts +7 -8
  160. package/model/getTopFilterForAttributeResponse.ts +2 -2
  161. package/model/getTopFiltersNoResultsResponse.ts +3 -3
  162. package/model/getTopFiltersNoResultsValue.ts +6 -7
  163. package/model/getTopFiltersNoResultsValues.ts +3 -3
  164. package/model/getTopHitsResponse.ts +6 -2
  165. package/model/getTopSearchesResponse.ts +4 -2
  166. package/model/getUsersCountResponse.ts +5 -5
  167. package/model/index.ts +24 -12
  168. package/model/operator.ts +6 -0
  169. package/model/orderBy.ts +4 -1
  170. package/model/topCountry.ts +3 -3
  171. package/model/topHit.ts +3 -3
  172. package/model/topHitWithAnalytics.ts +11 -11
  173. package/model/topHitWithRevenueAnalytics.ts +65 -0
  174. package/model/topHitsResponse.ts +2 -2
  175. package/model/topHitsResponseWithAnalytics.ts +2 -2
  176. package/model/topHitsResponseWithRevenueAnalytics.ts +10 -0
  177. package/model/topSearch.ts +4 -4
  178. package/model/topSearchWithAnalytics.ts +20 -13
  179. package/model/topSearchWithRevenueAnalytics.ts +81 -0
  180. package/model/topSearchesResponse.ts +2 -2
  181. package/model/topSearchesResponseWithAnalytics.ts +2 -2
  182. package/model/topSearchesResponseWithRevenueAnalytics.ts +10 -0
  183. package/package.json +10 -9
  184. package/dist/model/averageClickEvent.d.ts +0 -15
  185. package/dist/model/averageClickEvent.d.ts.map +0 -1
  186. package/dist/model/clickPosition.d.ts +0 -11
  187. package/dist/model/clickPosition.d.ts.map +0 -1
  188. package/dist/model/clickThroughRateEvent.d.ts +0 -19
  189. package/dist/model/clickThroughRateEvent.d.ts.map +0 -1
  190. package/dist/model/conversionRateEvent.d.ts +0 -19
  191. package/dist/model/conversionRateEvent.d.ts.map +0 -1
  192. package/dist/model/getConversationRateResponse.d.ts +0 -20
  193. package/dist/model/getConversationRateResponse.d.ts.map +0 -1
  194. package/dist/model/noClickRateEvent.d.ts +0 -19
  195. package/dist/model/noClickRateEvent.d.ts.map +0 -1
  196. package/dist/model/noResultsRateEvent.d.ts +0 -19
  197. package/dist/model/noResultsRateEvent.d.ts.map +0 -1
  198. package/dist/model/searchEvent.d.ts +0 -11
  199. package/dist/model/searchEvent.d.ts.map +0 -1
  200. package/dist/model/searchNoClickEvent.d.ts +0 -15
  201. package/dist/model/searchNoClickEvent.d.ts.map +0 -1
  202. package/dist/model/searchNoResultEvent.d.ts +0 -15
  203. package/dist/model/searchNoResultEvent.d.ts.map +0 -1
  204. package/dist/model/userWithDate.d.ts +0 -11
  205. package/dist/model/userWithDate.d.ts.map +0 -1
  206. package/model/averageClickEvent.ts +0 -18
  207. package/model/clickPosition.ts +0 -13
  208. package/model/clickThroughRateEvent.ts +0 -23
  209. package/model/conversionRateEvent.ts +0 -23
  210. package/model/getConversationRateResponse.ts +0 -25
  211. package/model/noClickRateEvent.ts +0 -23
  212. package/model/noResultsRateEvent.ts +0 -23
  213. package/model/searchEvent.ts +0 -13
  214. package/model/searchNoClickEvent.ts +0 -18
  215. package/model/searchNoResultEvent.ts +0 -18
  216. package/model/userWithDate.ts +0 -13
@@ -1,930 +1,1091 @@
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.11';
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 didn’t 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.110';
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
+ * @param customDelete - The customDelete object.
68
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
69
+ * @param customDelete.parameters - Query parameters to apply to the current query.
70
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
71
+ */
72
+ customDelete({ path, parameters }, requestOptions) {
73
+ if (!path) {
74
+ throw new Error('Parameter `path` is required when calling `customDelete`.');
75
+ }
76
+ const requestPath = '/{path}'.replace('{path}', path);
77
+ const headers = {};
78
+ const queryParameters = parameters ? parameters : {};
79
+ const request = {
80
+ method: 'DELETE',
81
+ path: requestPath,
82
+ queryParameters,
83
+ headers,
84
+ };
85
+ return transporter.request(request, requestOptions);
86
+ },
87
+ /**
88
+ * This method allow you to send requests to the Algolia REST API.
89
+ *
90
+ * @param customGet - The customGet object.
91
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
92
+ * @param customGet.parameters - Query parameters to apply to the current query.
93
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
94
+ */
95
+ customGet({ path, parameters }, requestOptions) {
96
+ if (!path) {
97
+ throw new Error('Parameter `path` is required when calling `customGet`.');
98
+ }
99
+ const requestPath = '/{path}'.replace('{path}', path);
100
+ const headers = {};
101
+ const queryParameters = parameters ? parameters : {};
102
+ const request = {
103
+ method: 'GET',
104
+ path: requestPath,
105
+ queryParameters,
106
+ headers,
107
+ };
108
+ return transporter.request(request, requestOptions);
109
+ },
110
+ /**
111
+ * This method allow you to send requests to the Algolia REST API.
112
+ *
113
+ * @param customPost - The customPost object.
114
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
115
+ * @param customPost.parameters - Query parameters to apply to the current query.
116
+ * @param customPost.body - Parameters to send with the custom request.
117
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
118
+ */
119
+ customPost({ path, parameters, body }, requestOptions) {
120
+ if (!path) {
121
+ throw new Error('Parameter `path` is required when calling `customPost`.');
122
+ }
123
+ const requestPath = '/{path}'.replace('{path}', path);
124
+ const headers = {};
125
+ const queryParameters = parameters ? parameters : {};
126
+ const request = {
127
+ method: 'POST',
128
+ path: requestPath,
129
+ queryParameters,
130
+ headers,
131
+ data: body ? body : {},
132
+ };
133
+ return transporter.request(request, requestOptions);
134
+ },
135
+ /**
136
+ * This method allow you to send requests to the Algolia REST API.
137
+ *
138
+ * @param customPut - The customPut object.
139
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
140
+ * @param customPut.parameters - Query parameters to apply to the current query.
141
+ * @param customPut.body - Parameters to send with the custom request.
142
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
143
+ */
144
+ customPut({ path, parameters, body }, requestOptions) {
145
+ if (!path) {
146
+ throw new Error('Parameter `path` is required when calling `customPut`.');
147
+ }
148
+ const requestPath = '/{path}'.replace('{path}', path);
149
+ const headers = {};
150
+ const queryParameters = parameters ? parameters : {};
151
+ const request = {
152
+ method: 'PUT',
153
+ path: requestPath,
154
+ queryParameters,
155
+ headers,
156
+ data: body ? body : {},
157
+ };
158
+ return transporter.request(request, requestOptions);
159
+ },
160
+ /**
161
+ * Retrieves the add-to-cart rate for all of your searches with at least one add-to-cart event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
162
+ *
163
+ * Required API Key ACLs:
164
+ * - analytics.
165
+ *
166
+ * @param getAddToCartRate - The getAddToCartRate object.
167
+ * @param getAddToCartRate.index - Index name.
168
+ * @param getAddToCartRate.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
169
+ * @param getAddToCartRate.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
170
+ * @param getAddToCartRate.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
171
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
172
+ */
173
+ getAddToCartRate({ index, startDate, endDate, tags }, requestOptions) {
174
+ if (!index) {
175
+ throw new Error('Parameter `index` is required when calling `getAddToCartRate`.');
176
+ }
177
+ const requestPath = '/2/conversions/addToCartRate';
178
+ const headers = {};
179
+ const queryParameters = {};
180
+ if (index !== undefined) {
181
+ queryParameters.index = index.toString();
182
+ }
183
+ if (startDate !== undefined) {
184
+ queryParameters.startDate = startDate.toString();
185
+ }
186
+ if (endDate !== undefined) {
187
+ queryParameters.endDate = endDate.toString();
188
+ }
189
+ if (tags !== undefined) {
190
+ queryParameters.tags = tags.toString();
191
+ }
192
+ const request = {
193
+ method: 'GET',
194
+ path: requestPath,
195
+ queryParameters,
196
+ headers,
197
+ };
198
+ return transporter.request(request, requestOptions);
199
+ },
200
+ /**
201
+ * Retrieves the average click position of your search results, including a daily breakdown. The average click position is the average of all clicked search results\' positions. For example, if users only ever click on the first result for any search, the average click position is 1. By default, the analyzed period includes the last eight days including the current day.
202
+ *
203
+ * Required API Key ACLs:
204
+ * - analytics.
205
+ *
206
+ * @param getAverageClickPosition - The getAverageClickPosition object.
207
+ * @param getAverageClickPosition.index - Index name.
208
+ * @param getAverageClickPosition.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
209
+ * @param getAverageClickPosition.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
210
+ * @param getAverageClickPosition.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
211
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
212
+ */
213
+ getAverageClickPosition({ index, startDate, endDate, tags }, requestOptions) {
214
+ if (!index) {
215
+ throw new Error('Parameter `index` is required when calling `getAverageClickPosition`.');
216
+ }
217
+ const requestPath = '/2/clicks/averageClickPosition';
218
+ const headers = {};
219
+ const queryParameters = {};
220
+ if (index !== undefined) {
221
+ queryParameters.index = index.toString();
222
+ }
223
+ if (startDate !== undefined) {
224
+ queryParameters.startDate = startDate.toString();
225
+ }
226
+ if (endDate !== undefined) {
227
+ queryParameters.endDate = endDate.toString();
228
+ }
229
+ if (tags !== undefined) {
230
+ queryParameters.tags = tags.toString();
231
+ }
232
+ const request = {
233
+ method: 'GET',
234
+ path: requestPath,
235
+ queryParameters,
236
+ headers,
237
+ };
238
+ return transporter.request(request, requestOptions);
239
+ },
240
+ /**
241
+ * Retrieves the positions in the search results and their associated number of clicks. This lets you check how many clicks the first, second, or tenth search results receive.
242
+ *
243
+ * Required API Key ACLs:
244
+ * - analytics.
245
+ *
246
+ * @param getClickPositions - The getClickPositions object.
247
+ * @param getClickPositions.index - Index name.
248
+ * @param getClickPositions.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
249
+ * @param getClickPositions.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
250
+ * @param getClickPositions.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
251
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
252
+ */
253
+ getClickPositions({ index, startDate, endDate, tags }, requestOptions) {
254
+ if (!index) {
255
+ throw new Error('Parameter `index` is required when calling `getClickPositions`.');
256
+ }
257
+ const requestPath = '/2/clicks/positions';
258
+ const headers = {};
259
+ const queryParameters = {};
260
+ if (index !== undefined) {
261
+ queryParameters.index = index.toString();
262
+ }
263
+ if (startDate !== undefined) {
264
+ queryParameters.startDate = startDate.toString();
265
+ }
266
+ if (endDate !== undefined) {
267
+ queryParameters.endDate = endDate.toString();
268
+ }
269
+ if (tags !== undefined) {
270
+ queryParameters.tags = tags.toString();
271
+ }
272
+ const request = {
273
+ method: 'GET',
274
+ path: requestPath,
275
+ queryParameters,
276
+ headers,
277
+ };
278
+ return transporter.request(request, requestOptions);
279
+ },
280
+ /**
281
+ * Retrieves the click-through rate for all of your searches with at least one click event, including a daily breakdown By default, the analyzed period includes the last eight days including the current day.
282
+ *
283
+ * Required API Key ACLs:
284
+ * - analytics.
285
+ *
286
+ * @param getClickThroughRate - The getClickThroughRate object.
287
+ * @param getClickThroughRate.index - Index name.
288
+ * @param getClickThroughRate.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
289
+ * @param getClickThroughRate.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
290
+ * @param getClickThroughRate.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
291
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
292
+ */
293
+ getClickThroughRate({ index, startDate, endDate, tags }, requestOptions) {
294
+ if (!index) {
295
+ throw new Error('Parameter `index` is required when calling `getClickThroughRate`.');
296
+ }
297
+ const requestPath = '/2/clicks/clickThroughRate';
298
+ const headers = {};
299
+ const queryParameters = {};
300
+ if (index !== undefined) {
301
+ queryParameters.index = index.toString();
302
+ }
303
+ if (startDate !== undefined) {
304
+ queryParameters.startDate = startDate.toString();
305
+ }
306
+ if (endDate !== undefined) {
307
+ queryParameters.endDate = endDate.toString();
308
+ }
309
+ if (tags !== undefined) {
310
+ queryParameters.tags = tags.toString();
311
+ }
312
+ const request = {
313
+ method: 'GET',
314
+ path: requestPath,
315
+ queryParameters,
316
+ headers,
317
+ };
318
+ return transporter.request(request, requestOptions);
319
+ },
320
+ /**
321
+ * Retrieves the conversion rate for all of your searches with at least one conversion event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
322
+ *
323
+ * Required API Key ACLs:
324
+ * - analytics.
325
+ *
326
+ * @param getConversionRate - The getConversionRate object.
327
+ * @param getConversionRate.index - Index name.
328
+ * @param getConversionRate.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
329
+ * @param getConversionRate.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
330
+ * @param getConversionRate.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
331
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
332
+ */
333
+ getConversionRate({ index, startDate, endDate, tags }, requestOptions) {
334
+ if (!index) {
335
+ throw new Error('Parameter `index` is required when calling `getConversionRate`.');
336
+ }
337
+ const requestPath = '/2/conversions/conversionRate';
338
+ const headers = {};
339
+ const queryParameters = {};
340
+ if (index !== undefined) {
341
+ queryParameters.index = index.toString();
342
+ }
343
+ if (startDate !== undefined) {
344
+ queryParameters.startDate = startDate.toString();
345
+ }
346
+ if (endDate !== undefined) {
347
+ queryParameters.endDate = endDate.toString();
348
+ }
349
+ if (tags !== undefined) {
350
+ queryParameters.tags = tags.toString();
351
+ }
352
+ const request = {
353
+ method: 'GET',
354
+ path: requestPath,
355
+ queryParameters,
356
+ headers,
357
+ };
358
+ return transporter.request(request, requestOptions);
359
+ },
360
+ /**
361
+ * Retrieves the fraction of searches that didn\'t lead to any click within a time range, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
362
+ *
363
+ * Required API Key ACLs:
364
+ * - analytics.
365
+ *
366
+ * @param getNoClickRate - The getNoClickRate object.
367
+ * @param getNoClickRate.index - Index name.
368
+ * @param getNoClickRate.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
369
+ * @param getNoClickRate.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
370
+ * @param getNoClickRate.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
371
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
372
+ */
373
+ getNoClickRate({ index, startDate, endDate, tags }, requestOptions) {
374
+ if (!index) {
375
+ throw new Error('Parameter `index` is required when calling `getNoClickRate`.');
376
+ }
377
+ const requestPath = '/2/searches/noClickRate';
378
+ const headers = {};
379
+ const queryParameters = {};
380
+ if (index !== undefined) {
381
+ queryParameters.index = index.toString();
382
+ }
383
+ if (startDate !== undefined) {
384
+ queryParameters.startDate = startDate.toString();
385
+ }
386
+ if (endDate !== undefined) {
387
+ queryParameters.endDate = endDate.toString();
388
+ }
389
+ if (tags !== undefined) {
390
+ queryParameters.tags = tags.toString();
391
+ }
392
+ const request = {
393
+ method: 'GET',
394
+ path: requestPath,
395
+ queryParameters,
396
+ headers,
397
+ };
398
+ return transporter.request(request, requestOptions);
399
+ },
400
+ /**
401
+ * Retrieves the fraction of searches that didn\'t return any results within a time range, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
402
+ *
403
+ * Required API Key ACLs:
404
+ * - analytics.
405
+ *
406
+ * @param getNoResultsRate - The getNoResultsRate object.
407
+ * @param getNoResultsRate.index - Index name.
408
+ * @param getNoResultsRate.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
409
+ * @param getNoResultsRate.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
410
+ * @param getNoResultsRate.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
411
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
412
+ */
413
+ getNoResultsRate({ index, startDate, endDate, tags }, requestOptions) {
414
+ if (!index) {
415
+ throw new Error('Parameter `index` is required when calling `getNoResultsRate`.');
416
+ }
417
+ const requestPath = '/2/searches/noResultRate';
418
+ const headers = {};
419
+ const queryParameters = {};
420
+ if (index !== undefined) {
421
+ queryParameters.index = index.toString();
422
+ }
423
+ if (startDate !== undefined) {
424
+ queryParameters.startDate = startDate.toString();
425
+ }
426
+ if (endDate !== undefined) {
427
+ queryParameters.endDate = endDate.toString();
428
+ }
429
+ if (tags !== undefined) {
430
+ queryParameters.tags = tags.toString();
431
+ }
432
+ const request = {
433
+ method: 'GET',
434
+ path: requestPath,
435
+ queryParameters,
436
+ headers,
437
+ };
438
+ return transporter.request(request, requestOptions);
439
+ },
440
+ /**
441
+ * Retrieves the purchase rate for all of your searches with at least one purchase event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
442
+ *
443
+ * Required API Key ACLs:
444
+ * - analytics.
445
+ *
446
+ * @param getPurchaseRate - The getPurchaseRate object.
447
+ * @param getPurchaseRate.index - Index name.
448
+ * @param getPurchaseRate.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
449
+ * @param getPurchaseRate.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
450
+ * @param getPurchaseRate.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
451
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
452
+ */
453
+ getPurchaseRate({ index, startDate, endDate, tags }, requestOptions) {
454
+ if (!index) {
455
+ throw new Error('Parameter `index` is required when calling `getPurchaseRate`.');
456
+ }
457
+ const requestPath = '/2/conversions/purchaseRate';
458
+ const headers = {};
459
+ const queryParameters = {};
460
+ if (index !== undefined) {
461
+ queryParameters.index = index.toString();
462
+ }
463
+ if (startDate !== undefined) {
464
+ queryParameters.startDate = startDate.toString();
465
+ }
466
+ if (endDate !== undefined) {
467
+ queryParameters.endDate = endDate.toString();
468
+ }
469
+ if (tags !== undefined) {
470
+ queryParameters.tags = tags.toString();
471
+ }
472
+ const request = {
473
+ method: 'GET',
474
+ path: requestPath,
475
+ queryParameters,
476
+ headers,
477
+ };
478
+ return transporter.request(request, requestOptions);
479
+ },
480
+ /**
481
+ * Retrieves revenue-related metrics, such as the total revenue or the average order value. To retrieve revenue-related metrics, sent purchase events. By default, the analyzed period includes the last eight days including the current day.
482
+ *
483
+ * Required API Key ACLs:
484
+ * - analytics.
485
+ *
486
+ * @param getRevenue - The getRevenue object.
487
+ * @param getRevenue.index - Index name.
488
+ * @param getRevenue.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
489
+ * @param getRevenue.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
490
+ * @param getRevenue.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
491
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
492
+ */
493
+ getRevenue({ index, startDate, endDate, tags }, requestOptions) {
494
+ if (!index) {
495
+ throw new Error('Parameter `index` is required when calling `getRevenue`.');
496
+ }
497
+ const requestPath = '/2/conversions/revenue';
498
+ const headers = {};
499
+ const queryParameters = {};
500
+ if (index !== undefined) {
501
+ queryParameters.index = index.toString();
502
+ }
503
+ if (startDate !== undefined) {
504
+ queryParameters.startDate = startDate.toString();
505
+ }
506
+ if (endDate !== undefined) {
507
+ queryParameters.endDate = endDate.toString();
508
+ }
509
+ if (tags !== undefined) {
510
+ queryParameters.tags = tags.toString();
511
+ }
512
+ const request = {
513
+ method: 'GET',
514
+ path: requestPath,
515
+ queryParameters,
516
+ headers,
517
+ };
518
+ return transporter.request(request, requestOptions);
519
+ },
520
+ /**
521
+ * Retrieves the number of searches within a time range, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
522
+ *
523
+ * Required API Key ACLs:
524
+ * - analytics.
525
+ *
526
+ * @param getSearchesCount - The getSearchesCount object.
527
+ * @param getSearchesCount.index - Index name.
528
+ * @param getSearchesCount.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
529
+ * @param getSearchesCount.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
530
+ * @param getSearchesCount.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
531
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
532
+ */
533
+ getSearchesCount({ index, startDate, endDate, tags }, requestOptions) {
534
+ if (!index) {
535
+ throw new Error('Parameter `index` is required when calling `getSearchesCount`.');
536
+ }
537
+ const requestPath = '/2/searches/count';
538
+ const headers = {};
539
+ const queryParameters = {};
540
+ if (index !== undefined) {
541
+ queryParameters.index = index.toString();
542
+ }
543
+ if (startDate !== undefined) {
544
+ queryParameters.startDate = startDate.toString();
545
+ }
546
+ if (endDate !== undefined) {
547
+ queryParameters.endDate = endDate.toString();
548
+ }
549
+ if (tags !== undefined) {
550
+ queryParameters.tags = tags.toString();
551
+ }
552
+ const request = {
553
+ method: 'GET',
554
+ path: requestPath,
555
+ queryParameters,
556
+ headers,
557
+ };
558
+ return transporter.request(request, requestOptions);
559
+ },
560
+ /**
561
+ * Retrieves the most popular searches that didn\'t lead to any clicks, from the 1,000 most frequent searches.
562
+ *
563
+ * Required API Key ACLs:
564
+ * - analytics.
565
+ *
566
+ * @param getSearchesNoClicks - The getSearchesNoClicks object.
567
+ * @param getSearchesNoClicks.index - Index name.
568
+ * @param getSearchesNoClicks.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
569
+ * @param getSearchesNoClicks.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
570
+ * @param getSearchesNoClicks.limit - Number of items to return.
571
+ * @param getSearchesNoClicks.offset - Position of the first item to return.
572
+ * @param getSearchesNoClicks.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
573
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
574
+ */
575
+ getSearchesNoClicks({ index, startDate, endDate, limit, offset, tags, }, requestOptions) {
576
+ if (!index) {
577
+ throw new Error('Parameter `index` is required when calling `getSearchesNoClicks`.');
578
+ }
579
+ const requestPath = '/2/searches/noClicks';
580
+ const headers = {};
581
+ const queryParameters = {};
582
+ if (index !== undefined) {
583
+ queryParameters.index = index.toString();
584
+ }
585
+ if (startDate !== undefined) {
586
+ queryParameters.startDate = startDate.toString();
587
+ }
588
+ if (endDate !== undefined) {
589
+ queryParameters.endDate = endDate.toString();
590
+ }
591
+ if (limit !== undefined) {
592
+ queryParameters.limit = limit.toString();
593
+ }
594
+ if (offset !== undefined) {
595
+ queryParameters.offset = offset.toString();
596
+ }
597
+ if (tags !== undefined) {
598
+ queryParameters.tags = tags.toString();
599
+ }
600
+ const request = {
601
+ method: 'GET',
602
+ path: requestPath,
603
+ queryParameters,
604
+ headers,
605
+ };
606
+ return transporter.request(request, requestOptions);
607
+ },
608
+ /**
609
+ * Retrieves the most popular searches that didn\'t return any results.
610
+ *
611
+ * Required API Key ACLs:
612
+ * - analytics.
613
+ *
614
+ * @param getSearchesNoResults - The getSearchesNoResults object.
615
+ * @param getSearchesNoResults.index - Index name.
616
+ * @param getSearchesNoResults.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
617
+ * @param getSearchesNoResults.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
618
+ * @param getSearchesNoResults.limit - Number of items to return.
619
+ * @param getSearchesNoResults.offset - Position of the first item to return.
620
+ * @param getSearchesNoResults.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
621
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
622
+ */
623
+ getSearchesNoResults({ index, startDate, endDate, limit, offset, tags, }, requestOptions) {
624
+ if (!index) {
625
+ throw new Error('Parameter `index` is required when calling `getSearchesNoResults`.');
626
+ }
627
+ const requestPath = '/2/searches/noResults';
628
+ const headers = {};
629
+ const queryParameters = {};
630
+ if (index !== undefined) {
631
+ queryParameters.index = index.toString();
632
+ }
633
+ if (startDate !== undefined) {
634
+ queryParameters.startDate = startDate.toString();
635
+ }
636
+ if (endDate !== undefined) {
637
+ queryParameters.endDate = endDate.toString();
638
+ }
639
+ if (limit !== undefined) {
640
+ queryParameters.limit = limit.toString();
641
+ }
642
+ if (offset !== undefined) {
643
+ queryParameters.offset = offset.toString();
644
+ }
645
+ if (tags !== undefined) {
646
+ queryParameters.tags = tags.toString();
647
+ }
648
+ const request = {
649
+ method: 'GET',
650
+ path: requestPath,
651
+ queryParameters,
652
+ headers,
653
+ };
654
+ return transporter.request(request, requestOptions);
655
+ },
656
+ /**
657
+ * Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes.
658
+ *
659
+ * Required API Key ACLs:
660
+ * - analytics.
661
+ *
662
+ * @param getStatus - The getStatus object.
663
+ * @param getStatus.index - Index name.
664
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
665
+ */
666
+ getStatus({ index }, requestOptions) {
667
+ if (!index) {
668
+ throw new Error('Parameter `index` is required when calling `getStatus`.');
669
+ }
670
+ const requestPath = '/2/status';
671
+ const headers = {};
672
+ const queryParameters = {};
673
+ if (index !== undefined) {
674
+ queryParameters.index = index.toString();
675
+ }
676
+ const request = {
677
+ method: 'GET',
678
+ path: requestPath,
679
+ queryParameters,
680
+ headers,
681
+ };
682
+ return transporter.request(request, requestOptions);
683
+ },
684
+ /**
685
+ * Retrieves the countries with the most searches to your index.
686
+ *
687
+ * Required API Key ACLs:
688
+ * - analytics.
689
+ *
690
+ * @param getTopCountries - The getTopCountries object.
691
+ * @param getTopCountries.index - Index name.
692
+ * @param getTopCountries.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
693
+ * @param getTopCountries.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
694
+ * @param getTopCountries.limit - Number of items to return.
695
+ * @param getTopCountries.offset - Position of the first item to return.
696
+ * @param getTopCountries.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
697
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
698
+ */
699
+ getTopCountries({ index, startDate, endDate, limit, offset, tags }, requestOptions) {
700
+ if (!index) {
701
+ throw new Error('Parameter `index` is required when calling `getTopCountries`.');
702
+ }
703
+ const requestPath = '/2/countries';
704
+ const headers = {};
705
+ const queryParameters = {};
706
+ if (index !== undefined) {
707
+ queryParameters.index = index.toString();
708
+ }
709
+ if (startDate !== undefined) {
710
+ queryParameters.startDate = startDate.toString();
711
+ }
712
+ if (endDate !== undefined) {
713
+ queryParameters.endDate = endDate.toString();
714
+ }
715
+ if (limit !== undefined) {
716
+ queryParameters.limit = limit.toString();
717
+ }
718
+ if (offset !== undefined) {
719
+ queryParameters.offset = offset.toString();
720
+ }
721
+ if (tags !== undefined) {
722
+ queryParameters.tags = tags.toString();
723
+ }
724
+ const request = {
725
+ method: 'GET',
726
+ path: requestPath,
727
+ queryParameters,
728
+ headers,
729
+ };
730
+ return transporter.request(request, requestOptions);
731
+ },
732
+ /**
733
+ * Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting.
734
+ *
735
+ * Required API Key ACLs:
736
+ * - analytics.
737
+ *
738
+ * @param getTopFilterAttributes - The getTopFilterAttributes object.
739
+ * @param getTopFilterAttributes.index - Index name.
740
+ * @param getTopFilterAttributes.search - Search query.
741
+ * @param getTopFilterAttributes.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
742
+ * @param getTopFilterAttributes.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
743
+ * @param getTopFilterAttributes.limit - Number of items to return.
744
+ * @param getTopFilterAttributes.offset - Position of the first item to return.
745
+ * @param getTopFilterAttributes.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
746
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
747
+ */
748
+ getTopFilterAttributes({ index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
749
+ if (!index) {
750
+ throw new Error('Parameter `index` is required when calling `getTopFilterAttributes`.');
751
+ }
752
+ const requestPath = '/2/filters';
753
+ const headers = {};
754
+ const queryParameters = {};
755
+ if (index !== undefined) {
756
+ queryParameters.index = index.toString();
757
+ }
758
+ if (search !== undefined) {
759
+ queryParameters.search = search.toString();
760
+ }
761
+ if (startDate !== undefined) {
762
+ queryParameters.startDate = startDate.toString();
763
+ }
764
+ if (endDate !== undefined) {
765
+ queryParameters.endDate = endDate.toString();
766
+ }
767
+ if (limit !== undefined) {
768
+ queryParameters.limit = limit.toString();
769
+ }
770
+ if (offset !== undefined) {
771
+ queryParameters.offset = offset.toString();
772
+ }
773
+ if (tags !== undefined) {
774
+ queryParameters.tags = tags.toString();
775
+ }
776
+ const request = {
777
+ method: 'GET',
778
+ path: requestPath,
779
+ queryParameters,
780
+ headers,
781
+ };
782
+ return transporter.request(request, requestOptions);
783
+ },
784
+ /**
785
+ * Retrieves the most frequent filter (facet) values for a filter attribute. These are attributes of your records that you included in the `attributesForFaceting` setting.
786
+ *
787
+ * Required API Key ACLs:
788
+ * - analytics.
789
+ *
790
+ * @param getTopFilterForAttribute - The getTopFilterForAttribute object.
791
+ * @param getTopFilterForAttribute.attribute - Attribute name.
792
+ * @param getTopFilterForAttribute.index - Index name.
793
+ * @param getTopFilterForAttribute.search - Search query.
794
+ * @param getTopFilterForAttribute.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
795
+ * @param getTopFilterForAttribute.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
796
+ * @param getTopFilterForAttribute.limit - Number of items to return.
797
+ * @param getTopFilterForAttribute.offset - Position of the first item to return.
798
+ * @param getTopFilterForAttribute.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
799
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
800
+ */
801
+ getTopFilterForAttribute({ attribute, index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
802
+ if (!attribute) {
803
+ throw new Error('Parameter `attribute` is required when calling `getTopFilterForAttribute`.');
804
+ }
805
+ if (!index) {
806
+ throw new Error('Parameter `index` is required when calling `getTopFilterForAttribute`.');
807
+ }
808
+ const requestPath = '/2/filters/{attribute}'.replace('{attribute}', encodeURIComponent(attribute));
809
+ const headers = {};
810
+ const queryParameters = {};
811
+ if (index !== undefined) {
812
+ queryParameters.index = index.toString();
813
+ }
814
+ if (search !== undefined) {
815
+ queryParameters.search = search.toString();
816
+ }
817
+ if (startDate !== undefined) {
818
+ queryParameters.startDate = startDate.toString();
819
+ }
820
+ if (endDate !== undefined) {
821
+ queryParameters.endDate = endDate.toString();
822
+ }
823
+ if (limit !== undefined) {
824
+ queryParameters.limit = limit.toString();
825
+ }
826
+ if (offset !== undefined) {
827
+ queryParameters.offset = offset.toString();
828
+ }
829
+ if (tags !== undefined) {
830
+ queryParameters.tags = tags.toString();
831
+ }
832
+ const request = {
833
+ method: 'GET',
834
+ path: requestPath,
835
+ queryParameters,
836
+ headers,
837
+ };
838
+ return transporter.request(request, requestOptions);
839
+ },
840
+ /**
841
+ * Retrieves the most frequently used filters for a search that didn\'t return any results. To get the most frequent searches without results, use the [Retrieve searches without results](#tag/search/operation/getSearchesNoResults) operation.
842
+ *
843
+ * Required API Key ACLs:
844
+ * - analytics.
845
+ *
846
+ * @param getTopFiltersNoResults - The getTopFiltersNoResults object.
847
+ * @param getTopFiltersNoResults.index - Index name.
848
+ * @param getTopFiltersNoResults.search - Search query.
849
+ * @param getTopFiltersNoResults.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
850
+ * @param getTopFiltersNoResults.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
851
+ * @param getTopFiltersNoResults.limit - Number of items to return.
852
+ * @param getTopFiltersNoResults.offset - Position of the first item to return.
853
+ * @param getTopFiltersNoResults.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
854
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
855
+ */
856
+ getTopFiltersNoResults({ index, search, startDate, endDate, limit, offset, tags, }, requestOptions) {
857
+ if (!index) {
858
+ throw new Error('Parameter `index` is required when calling `getTopFiltersNoResults`.');
859
+ }
860
+ const requestPath = '/2/filters/noResults';
861
+ const headers = {};
862
+ const queryParameters = {};
863
+ if (index !== undefined) {
864
+ queryParameters.index = index.toString();
865
+ }
866
+ if (search !== undefined) {
867
+ queryParameters.search = search.toString();
868
+ }
869
+ if (startDate !== undefined) {
870
+ queryParameters.startDate = startDate.toString();
871
+ }
872
+ if (endDate !== undefined) {
873
+ queryParameters.endDate = endDate.toString();
874
+ }
875
+ if (limit !== undefined) {
876
+ queryParameters.limit = limit.toString();
877
+ }
878
+ if (offset !== undefined) {
879
+ queryParameters.offset = offset.toString();
880
+ }
881
+ if (tags !== undefined) {
882
+ queryParameters.tags = tags.toString();
883
+ }
884
+ const request = {
885
+ method: 'GET',
886
+ path: requestPath,
887
+ queryParameters,
888
+ headers,
889
+ };
890
+ return transporter.request(request, requestOptions);
891
+ },
892
+ /**
893
+ * Retrieves the object IDs of the most frequent search results.
894
+ *
895
+ * Required API Key ACLs:
896
+ * - analytics.
897
+ *
898
+ * @param getTopHits - The getTopHits object.
899
+ * @param getTopHits.index - Index name.
900
+ * @param getTopHits.search - Search query.
901
+ * @param getTopHits.clickAnalytics - Whether to include metrics related to click and conversion events in the response.
902
+ * @param getTopHits.revenueAnalytics - Whether to include revenue-related metrics in the response. If true, metrics related to click and conversion events are also included in the response.
903
+ * @param getTopHits.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
904
+ * @param getTopHits.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
905
+ * @param getTopHits.limit - Number of items to return.
906
+ * @param getTopHits.offset - Position of the first item to return.
907
+ * @param getTopHits.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
908
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
909
+ */
910
+ getTopHits({ index, search, clickAnalytics, revenueAnalytics, startDate, endDate, limit, offset, tags, }, requestOptions) {
911
+ if (!index) {
912
+ throw new Error('Parameter `index` is required when calling `getTopHits`.');
913
+ }
914
+ const requestPath = '/2/hits';
915
+ const headers = {};
916
+ const queryParameters = {};
917
+ if (index !== undefined) {
918
+ queryParameters.index = index.toString();
919
+ }
920
+ if (search !== undefined) {
921
+ queryParameters.search = search.toString();
922
+ }
923
+ if (clickAnalytics !== undefined) {
924
+ queryParameters.clickAnalytics = clickAnalytics.toString();
925
+ }
926
+ if (revenueAnalytics !== undefined) {
927
+ queryParameters.revenueAnalytics = revenueAnalytics.toString();
928
+ }
929
+ if (startDate !== undefined) {
930
+ queryParameters.startDate = startDate.toString();
931
+ }
932
+ if (endDate !== undefined) {
933
+ queryParameters.endDate = endDate.toString();
934
+ }
935
+ if (limit !== undefined) {
936
+ queryParameters.limit = limit.toString();
937
+ }
938
+ if (offset !== undefined) {
939
+ queryParameters.offset = offset.toString();
940
+ }
941
+ if (tags !== undefined) {
942
+ queryParameters.tags = tags.toString();
943
+ }
944
+ const request = {
945
+ method: 'GET',
946
+ path: requestPath,
947
+ queryParameters,
948
+ headers,
949
+ };
950
+ return transporter.request(request, requestOptions);
951
+ },
952
+ /**
953
+ * Returns the most popular search terms.
954
+ *
955
+ * Required API Key ACLs:
956
+ * - analytics.
957
+ *
958
+ * @param getTopSearches - The getTopSearches object.
959
+ * @param getTopSearches.index - Index name.
960
+ * @param getTopSearches.clickAnalytics - Whether to include metrics related to click and conversion events in the response.
961
+ * @param getTopSearches.revenueAnalytics - Whether to include revenue-related metrics in the response. If true, metrics related to click and conversion events are also included in the response.
962
+ * @param getTopSearches.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
963
+ * @param getTopSearches.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
964
+ * @param getTopSearches.orderBy - Attribute by which to order the response items. If the `clickAnalytics` parameter is false, only `searchCount` is available.
965
+ * @param getTopSearches.direction - Sorting direction of the results: ascending or descending.
966
+ * @param getTopSearches.limit - Number of items to return.
967
+ * @param getTopSearches.offset - Position of the first item to return.
968
+ * @param getTopSearches.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
969
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
970
+ */
971
+ getTopSearches({ index, clickAnalytics, revenueAnalytics, startDate, endDate, orderBy, direction, limit, offset, tags, }, requestOptions) {
972
+ if (!index) {
973
+ throw new Error('Parameter `index` is required when calling `getTopSearches`.');
974
+ }
975
+ const requestPath = '/2/searches';
976
+ const headers = {};
977
+ const queryParameters = {};
978
+ if (index !== undefined) {
979
+ queryParameters.index = index.toString();
980
+ }
981
+ if (clickAnalytics !== undefined) {
982
+ queryParameters.clickAnalytics = clickAnalytics.toString();
983
+ }
984
+ if (revenueAnalytics !== undefined) {
985
+ queryParameters.revenueAnalytics = revenueAnalytics.toString();
986
+ }
987
+ if (startDate !== undefined) {
988
+ queryParameters.startDate = startDate.toString();
989
+ }
990
+ if (endDate !== undefined) {
991
+ queryParameters.endDate = endDate.toString();
992
+ }
993
+ if (orderBy !== undefined) {
994
+ queryParameters.orderBy = orderBy.toString();
995
+ }
996
+ if (direction !== undefined) {
997
+ queryParameters.direction = direction.toString();
998
+ }
999
+ if (limit !== undefined) {
1000
+ queryParameters.limit = limit.toString();
1001
+ }
1002
+ if (offset !== undefined) {
1003
+ queryParameters.offset = offset.toString();
1004
+ }
1005
+ if (tags !== undefined) {
1006
+ queryParameters.tags = tags.toString();
1007
+ }
1008
+ const request = {
1009
+ method: 'GET',
1010
+ path: requestPath,
1011
+ queryParameters,
1012
+ headers,
1013
+ };
1014
+ return transporter.request(request, requestOptions);
1015
+ },
1016
+ /**
1017
+ * Retrieves the number of unique users within a time range, including a daily breakdown. Since this endpoint returns the number of unique users, the sum of the daily values might be different from the total number. By default, Algolia distinguishes search users by their IP address, _unless_ you include a pseudonymous user identifier in your search requests with the `userToken` API parameter or `x-algolia-usertoken` request header. By default, the analyzed period includes the last eight days including the current day.
1018
+ *
1019
+ * Required API Key ACLs:
1020
+ * - analytics.
1021
+ *
1022
+ * @param getUsersCount - The getUsersCount object.
1023
+ * @param getUsersCount.index - Index name.
1024
+ * @param getUsersCount.startDate - Start date (`YYYY-MM-DD`) of the period to analyze.
1025
+ * @param getUsersCount.endDate - End date (`YYYY-MM-DD`) of the period to analyze.
1026
+ * @param getUsersCount.tags - Tags by which to segment the analytics. You can combine multiple tags with `OR` and `AND`. Tags must be URL-encoded. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
1027
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1028
+ */
1029
+ getUsersCount({ index, startDate, endDate, tags }, requestOptions) {
1030
+ if (!index) {
1031
+ throw new Error('Parameter `index` is required when calling `getUsersCount`.');
1032
+ }
1033
+ const requestPath = '/2/users/count';
1034
+ const headers = {};
1035
+ const queryParameters = {};
1036
+ if (index !== undefined) {
1037
+ queryParameters.index = index.toString();
1038
+ }
1039
+ if (startDate !== undefined) {
1040
+ queryParameters.startDate = startDate.toString();
1041
+ }
1042
+ if (endDate !== undefined) {
1043
+ queryParameters.endDate = endDate.toString();
1044
+ }
1045
+ if (tags !== undefined) {
1046
+ queryParameters.tags = tags.toString();
1047
+ }
1048
+ const request = {
1049
+ method: 'GET',
1050
+ path: requestPath,
1051
+ queryParameters,
1052
+ headers,
1053
+ };
1054
+ return transporter.request(request, requestOptions);
1055
+ },
1056
+ };
899
1057
  }
900
1058
 
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
- });
1059
+ // 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.
1060
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1061
+ function analyticsClient(appId, apiKey, region, options) {
1062
+ if (!appId || typeof appId !== 'string') {
1063
+ throw new Error('`appId` is missing.');
1064
+ }
1065
+ if (!apiKey || typeof apiKey !== 'string') {
1066
+ throw new Error('`apiKey` is missing.');
1067
+ }
1068
+ if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
1069
+ throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
1070
+ }
1071
+ return {
1072
+ ...createAnalyticsClient({
1073
+ appId,
1074
+ apiKey,
1075
+ region,
1076
+ timeouts: {
1077
+ connect: DEFAULT_CONNECT_TIMEOUT_NODE,
1078
+ read: DEFAULT_READ_TIMEOUT_NODE,
1079
+ write: DEFAULT_WRITE_TIMEOUT_NODE,
1080
+ },
1081
+ requester: createHttpRequester(),
1082
+ algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
1083
+ responsesCache: createNullCache(),
1084
+ requestsCache: createNullCache(),
1085
+ hostsCache: createMemoryCache(),
1086
+ ...options,
1087
+ }),
1088
+ };
928
1089
  }
929
1090
 
930
1091
  export { analyticsClient, apiClientVersion };