@algolia/client-analytics 5.2.4 → 5.3.0

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 (142) hide show
  1. package/dist/browser.d.ts +1742 -0
  2. package/dist/builds/browser.js +1125 -0
  3. package/dist/builds/browser.js.map +1 -0
  4. package/dist/builds/browser.min.js +2 -0
  5. package/dist/builds/browser.min.js.map +1 -0
  6. package/dist/builds/browser.umd.js +12 -0
  7. package/dist/builds/node.cjs +1143 -0
  8. package/dist/builds/node.cjs.map +1 -0
  9. package/dist/builds/node.js +1123 -0
  10. package/dist/builds/node.js.map +1 -0
  11. package/dist/node.d.cts +1742 -0
  12. package/dist/node.d.ts +1742 -0
  13. package/dist/src/analyticsClient.cjs +1110 -0
  14. package/dist/src/analyticsClient.cjs.map +1 -0
  15. package/dist/src/{analyticsClient.d.ts → analyticsClient.js} +749 -58
  16. package/dist/src/analyticsClient.js.map +1 -0
  17. package/index.d.ts +1 -1
  18. package/index.js +1 -1
  19. package/package.json +28 -25
  20. package/dist/builds/browser.d.ts +0 -40
  21. package/dist/builds/browser.d.ts.map +0 -1
  22. package/dist/builds/node.d.ts +0 -40
  23. package/dist/builds/node.d.ts.map +0 -1
  24. package/dist/client-analytics.cjs +0 -1089
  25. package/dist/client-analytics.esm.browser.js +0 -1763
  26. package/dist/client-analytics.esm.node.js +0 -1086
  27. package/dist/client-analytics.umd.js +0 -2
  28. package/dist/model/clickPosition.d.ts +0 -14
  29. package/dist/model/clickPosition.d.ts.map +0 -1
  30. package/dist/model/clientMethodProps.d.ts +0 -579
  31. package/dist/model/clientMethodProps.d.ts.map +0 -1
  32. package/dist/model/currencyCode.d.ts +0 -14
  33. package/dist/model/currencyCode.d.ts.map +0 -1
  34. package/dist/model/dailyAddToCartRates.d.ts +0 -19
  35. package/dist/model/dailyAddToCartRates.d.ts.map +0 -1
  36. package/dist/model/dailyAverageClicks.d.ts +0 -15
  37. package/dist/model/dailyAverageClicks.d.ts.map +0 -1
  38. package/dist/model/dailyClickThroughRates.d.ts +0 -19
  39. package/dist/model/dailyClickThroughRates.d.ts.map +0 -1
  40. package/dist/model/dailyConversionRates.d.ts +0 -19
  41. package/dist/model/dailyConversionRates.d.ts.map +0 -1
  42. package/dist/model/dailyNoClickRates.d.ts +0 -19
  43. package/dist/model/dailyNoClickRates.d.ts.map +0 -1
  44. package/dist/model/dailyNoResultsRates.d.ts +0 -19
  45. package/dist/model/dailyNoResultsRates.d.ts.map +0 -1
  46. package/dist/model/dailyPurchaseRates.d.ts +0 -19
  47. package/dist/model/dailyPurchaseRates.d.ts.map +0 -1
  48. package/dist/model/dailyRevenue.d.ts +0 -12
  49. package/dist/model/dailyRevenue.d.ts.map +0 -1
  50. package/dist/model/dailySearches.d.ts +0 -11
  51. package/dist/model/dailySearches.d.ts.map +0 -1
  52. package/dist/model/dailySearchesNoClicks.d.ts +0 -15
  53. package/dist/model/dailySearchesNoClicks.d.ts.map +0 -1
  54. package/dist/model/dailySearchesNoResults.d.ts +0 -15
  55. package/dist/model/dailySearchesNoResults.d.ts.map +0 -1
  56. package/dist/model/dailyUsers.d.ts +0 -11
  57. package/dist/model/dailyUsers.d.ts.map +0 -1
  58. package/dist/model/direction.d.ts +0 -2
  59. package/dist/model/direction.d.ts.map +0 -1
  60. package/dist/model/errorBase.d.ts +0 -7
  61. package/dist/model/errorBase.d.ts.map +0 -1
  62. package/dist/model/getAddToCartRateResponse.d.ts +0 -20
  63. package/dist/model/getAddToCartRateResponse.d.ts.map +0 -1
  64. package/dist/model/getAverageClickPositionResponse.d.ts +0 -16
  65. package/dist/model/getAverageClickPositionResponse.d.ts.map +0 -1
  66. package/dist/model/getClickPositionsResponse.d.ts +0 -8
  67. package/dist/model/getClickPositionsResponse.d.ts.map +0 -1
  68. package/dist/model/getClickThroughRateResponse.d.ts +0 -20
  69. package/dist/model/getClickThroughRateResponse.d.ts.map +0 -1
  70. package/dist/model/getConversionRateResponse.d.ts +0 -20
  71. package/dist/model/getConversionRateResponse.d.ts.map +0 -1
  72. package/dist/model/getNoClickRateResponse.d.ts +0 -20
  73. package/dist/model/getNoClickRateResponse.d.ts.map +0 -1
  74. package/dist/model/getNoResultsRateResponse.d.ts +0 -20
  75. package/dist/model/getNoResultsRateResponse.d.ts.map +0 -1
  76. package/dist/model/getPurchaseRateResponse.d.ts +0 -20
  77. package/dist/model/getPurchaseRateResponse.d.ts.map +0 -1
  78. package/dist/model/getRevenue.d.ts +0 -13
  79. package/dist/model/getRevenue.d.ts.map +0 -1
  80. package/dist/model/getSearchesCountResponse.d.ts +0 -12
  81. package/dist/model/getSearchesCountResponse.d.ts.map +0 -1
  82. package/dist/model/getSearchesNoClicksResponse.d.ts +0 -8
  83. package/dist/model/getSearchesNoClicksResponse.d.ts.map +0 -1
  84. package/dist/model/getSearchesNoResultsResponse.d.ts +0 -8
  85. package/dist/model/getSearchesNoResultsResponse.d.ts.map +0 -1
  86. package/dist/model/getStatusResponse.d.ts +0 -7
  87. package/dist/model/getStatusResponse.d.ts.map +0 -1
  88. package/dist/model/getTopCountriesResponse.d.ts +0 -8
  89. package/dist/model/getTopCountriesResponse.d.ts.map +0 -1
  90. package/dist/model/getTopFilterAttribute.d.ts +0 -11
  91. package/dist/model/getTopFilterAttribute.d.ts.map +0 -1
  92. package/dist/model/getTopFilterAttributesResponse.d.ts +0 -8
  93. package/dist/model/getTopFilterAttributesResponse.d.ts.map +0 -1
  94. package/dist/model/getTopFilterForAttribute.d.ts +0 -17
  95. package/dist/model/getTopFilterForAttribute.d.ts.map +0 -1
  96. package/dist/model/getTopFilterForAttributeResponse.d.ts +0 -8
  97. package/dist/model/getTopFilterForAttributeResponse.d.ts.map +0 -1
  98. package/dist/model/getTopFiltersNoResultsResponse.d.ts +0 -8
  99. package/dist/model/getTopFiltersNoResultsResponse.d.ts.map +0 -1
  100. package/dist/model/getTopFiltersNoResultsValue.d.ts +0 -13
  101. package/dist/model/getTopFiltersNoResultsValue.d.ts.map +0 -1
  102. package/dist/model/getTopFiltersNoResultsValues.d.ts +0 -12
  103. package/dist/model/getTopFiltersNoResultsValues.d.ts.map +0 -1
  104. package/dist/model/getTopHitsResponse.d.ts +0 -5
  105. package/dist/model/getTopHitsResponse.d.ts.map +0 -1
  106. package/dist/model/getTopSearchesResponse.d.ts +0 -5
  107. package/dist/model/getTopSearchesResponse.d.ts.map +0 -1
  108. package/dist/model/getUsersCountResponse.d.ts +0 -12
  109. package/dist/model/getUsersCountResponse.d.ts.map +0 -1
  110. package/dist/model/index.d.ts +0 -57
  111. package/dist/model/index.d.ts.map +0 -1
  112. package/dist/model/operator.d.ts +0 -5
  113. package/dist/model/operator.d.ts.map +0 -1
  114. package/dist/model/orderBy.d.ts +0 -5
  115. package/dist/model/orderBy.d.ts.map +0 -1
  116. package/dist/model/topCountry.d.ts +0 -11
  117. package/dist/model/topCountry.d.ts.map +0 -1
  118. package/dist/model/topHit.d.ts +0 -11
  119. package/dist/model/topHit.d.ts.map +0 -1
  120. package/dist/model/topHitWithAnalytics.d.ts +0 -31
  121. package/dist/model/topHitWithAnalytics.d.ts.map +0 -1
  122. package/dist/model/topHitWithRevenueAnalytics.d.ts +0 -52
  123. package/dist/model/topHitWithRevenueAnalytics.d.ts.map +0 -1
  124. package/dist/model/topHitsResponse.d.ts +0 -8
  125. package/dist/model/topHitsResponse.d.ts.map +0 -1
  126. package/dist/model/topHitsResponseWithAnalytics.d.ts +0 -8
  127. package/dist/model/topHitsResponseWithAnalytics.d.ts.map +0 -1
  128. package/dist/model/topHitsResponseWithRevenueAnalytics.d.ts +0 -8
  129. package/dist/model/topHitsResponseWithRevenueAnalytics.d.ts.map +0 -1
  130. package/dist/model/topSearch.d.ts +0 -15
  131. package/dist/model/topSearch.d.ts.map +0 -1
  132. package/dist/model/topSearchWithAnalytics.d.ts +0 -44
  133. package/dist/model/topSearchWithAnalytics.d.ts.map +0 -1
  134. package/dist/model/topSearchWithRevenueAnalytics.d.ts +0 -65
  135. package/dist/model/topSearchWithRevenueAnalytics.d.ts.map +0 -1
  136. package/dist/model/topSearchesResponse.d.ts +0 -8
  137. package/dist/model/topSearchesResponse.d.ts.map +0 -1
  138. package/dist/model/topSearchesResponseWithAnalytics.d.ts +0 -8
  139. package/dist/model/topSearchesResponseWithAnalytics.d.ts.map +0 -1
  140. package/dist/model/topSearchesResponseWithRevenueAnalytics.d.ts +0 -8
  141. package/dist/model/topSearchesResponseWithRevenueAnalytics.d.ts.map +0 -1
  142. package/dist/src/analyticsClient.d.ts.map +0 -1
@@ -1,51 +1,75 @@
1
- import type { CreateClientOptions, RequestOptions } from '@algolia/client-common';
2
- import type { CustomDeleteProps, CustomGetProps, CustomPostProps, CustomPutProps, GetAddToCartRateProps, GetAverageClickPositionProps, GetClickPositionsProps, GetClickThroughRateProps, GetConversionRateProps, GetNoClickRateProps, GetNoResultsRateProps, GetPurchaseRateProps, GetRevenueProps, GetSearchesCountProps, GetSearchesNoClicksProps, GetSearchesNoResultsProps, GetStatusProps, GetTopCountriesProps, GetTopFilterAttributesProps, GetTopFilterForAttributeProps, GetTopFiltersNoResultsProps, GetTopHitsProps, GetTopSearchesProps, GetUsersCountProps } from '../model/clientMethodProps';
3
- import type { GetAddToCartRateResponse } from '../model/getAddToCartRateResponse';
4
- import type { GetAverageClickPositionResponse } from '../model/getAverageClickPositionResponse';
5
- import type { GetClickPositionsResponse } from '../model/getClickPositionsResponse';
6
- import type { GetClickThroughRateResponse } from '../model/getClickThroughRateResponse';
7
- import type { GetConversionRateResponse } from '../model/getConversionRateResponse';
8
- import type { GetNoClickRateResponse } from '../model/getNoClickRateResponse';
9
- import type { GetNoResultsRateResponse } from '../model/getNoResultsRateResponse';
10
- import type { GetPurchaseRateResponse } from '../model/getPurchaseRateResponse';
11
- import type { GetRevenue } from '../model/getRevenue';
12
- import type { GetSearchesCountResponse } from '../model/getSearchesCountResponse';
13
- import type { GetSearchesNoClicksResponse } from '../model/getSearchesNoClicksResponse';
14
- import type { GetSearchesNoResultsResponse } from '../model/getSearchesNoResultsResponse';
15
- import type { GetStatusResponse } from '../model/getStatusResponse';
16
- import type { GetTopCountriesResponse } from '../model/getTopCountriesResponse';
17
- import type { GetTopFilterAttributesResponse } from '../model/getTopFilterAttributesResponse';
18
- import type { GetTopFilterForAttributeResponse } from '../model/getTopFilterForAttributeResponse';
19
- import type { GetTopFiltersNoResultsResponse } from '../model/getTopFiltersNoResultsResponse';
20
- import type { GetTopHitsResponse } from '../model/getTopHitsResponse';
21
- import type { GetTopSearchesResponse } from '../model/getTopSearchesResponse';
22
- import type { GetUsersCountResponse } from '../model/getUsersCountResponse';
23
- export declare const apiClientVersion = "5.2.4";
24
- export declare const REGIONS: readonly ["de", "us"];
25
- export type Region = (typeof REGIONS)[number];
26
- export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
27
- region?: Region;
28
- }): {
29
- transporter: import("@algolia/client-common").Transporter;
1
+ // src/analyticsClient.ts
2
+ import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
3
+ var apiClientVersion = "5.3.0";
4
+ var REGIONS = ["de", "us"];
5
+ function getDefaultHosts(region) {
6
+ const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
7
+ return [{ url, accept: "readWrite", protocol: "https" }];
8
+ }
9
+ function createAnalyticsClient({
10
+ appId: appIdOption,
11
+ apiKey: apiKeyOption,
12
+ authMode,
13
+ algoliaAgents,
14
+ region: regionOption,
15
+ ...options
16
+ }) {
17
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
18
+ return {
19
+ transporter: createTransporter({
20
+ hosts: getDefaultHosts(regionOption),
21
+ ...options,
22
+ algoliaAgent: getAlgoliaAgent({
23
+ algoliaAgents,
24
+ client: "Analytics",
25
+ version: apiClientVersion
26
+ }),
27
+ baseHeaders: {
28
+ "content-type": "text/plain",
29
+ ...auth.headers(),
30
+ ...options.baseHeaders
31
+ },
32
+ baseQueryParameters: {
33
+ ...auth.queryParameters(),
34
+ ...options.baseQueryParameters
35
+ }
36
+ }),
30
37
  /**
31
38
  * The `appId` currently in use.
32
39
  */
33
- appId: string;
40
+ appId: appIdOption,
34
41
  /**
35
42
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
36
43
  */
37
- clearCache(): Promise<void>;
44
+ clearCache() {
45
+ return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
46
+ () => void 0
47
+ );
48
+ },
38
49
  /**
39
50
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
40
51
  */
41
- readonly _ua: string;
52
+ get _ua() {
53
+ return this.transporter.algoliaAgent.value;
54
+ },
42
55
  /**
43
56
  * Adds a `segment` to the `x-algolia-agent` sent with every requests.
44
57
  *
45
58
  * @param segment - The algolia agent (user-agent) segment to add.
46
59
  * @param version - The version of the agent.
47
60
  */
48
- addAlgoliaAgent(segment: string, version?: string): void;
61
+ addAlgoliaAgent(segment, version) {
62
+ this.transporter.algoliaAgent.add({ segment, version });
63
+ },
64
+ /**
65
+ * Helper method to switch the API key used to authenticate the requests.
66
+ *
67
+ * @param params - Method params.
68
+ * @param params.apiKey - The new API Key to use.
69
+ */
70
+ setClientApiKey({ apiKey }) {
71
+ this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
72
+ },
49
73
  /**
50
74
  * This method allow you to send requests to the Algolia REST API.
51
75
  *
@@ -54,7 +78,21 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
54
78
  * @param customDelete.parameters - Query parameters to apply to the current query.
55
79
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
56
80
  */
57
- customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
81
+ customDelete({ path, parameters }, requestOptions) {
82
+ if (!path) {
83
+ throw new Error("Parameter `path` is required when calling `customDelete`.");
84
+ }
85
+ const requestPath = "/{path}".replace("{path}", path);
86
+ const headers = {};
87
+ const queryParameters = parameters ? parameters : {};
88
+ const request = {
89
+ method: "DELETE",
90
+ path: requestPath,
91
+ queryParameters,
92
+ headers
93
+ };
94
+ return this.transporter.request(request, requestOptions);
95
+ },
58
96
  /**
59
97
  * This method allow you to send requests to the Algolia REST API.
60
98
  *
@@ -63,7 +101,21 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
63
101
  * @param customGet.parameters - Query parameters to apply to the current query.
64
102
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
65
103
  */
66
- customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
104
+ customGet({ path, parameters }, requestOptions) {
105
+ if (!path) {
106
+ throw new Error("Parameter `path` is required when calling `customGet`.");
107
+ }
108
+ const requestPath = "/{path}".replace("{path}", path);
109
+ const headers = {};
110
+ const queryParameters = parameters ? parameters : {};
111
+ const request = {
112
+ method: "GET",
113
+ path: requestPath,
114
+ queryParameters,
115
+ headers
116
+ };
117
+ return this.transporter.request(request, requestOptions);
118
+ },
67
119
  /**
68
120
  * This method allow you to send requests to the Algolia REST API.
69
121
  *
@@ -73,7 +125,22 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
73
125
  * @param customPost.body - Parameters to send with the custom request.
74
126
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
75
127
  */
76
- customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
128
+ customPost({ path, parameters, body }, requestOptions) {
129
+ if (!path) {
130
+ throw new Error("Parameter `path` is required when calling `customPost`.");
131
+ }
132
+ const requestPath = "/{path}".replace("{path}", path);
133
+ const headers = {};
134
+ const queryParameters = parameters ? parameters : {};
135
+ const request = {
136
+ method: "POST",
137
+ path: requestPath,
138
+ queryParameters,
139
+ headers,
140
+ data: body ? body : {}
141
+ };
142
+ return this.transporter.request(request, requestOptions);
143
+ },
77
144
  /**
78
145
  * This method allow you to send requests to the Algolia REST API.
79
146
  *
@@ -83,7 +150,22 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
83
150
  * @param customPut.body - Parameters to send with the custom request.
84
151
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
85
152
  */
86
- customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
153
+ customPut({ path, parameters, body }, requestOptions) {
154
+ if (!path) {
155
+ throw new Error("Parameter `path` is required when calling `customPut`.");
156
+ }
157
+ const requestPath = "/{path}".replace("{path}", path);
158
+ const headers = {};
159
+ const queryParameters = parameters ? parameters : {};
160
+ const request = {
161
+ method: "PUT",
162
+ path: requestPath,
163
+ queryParameters,
164
+ headers,
165
+ data: body ? body : {}
166
+ };
167
+ return this.transporter.request(request, requestOptions);
168
+ },
87
169
  /**
88
170
  * 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.
89
171
  *
@@ -97,7 +179,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
97
179
  * @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/).
98
180
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
99
181
  */
100
- getAddToCartRate({ index, startDate, endDate, tags }: GetAddToCartRateProps, requestOptions?: RequestOptions): Promise<GetAddToCartRateResponse>;
182
+ getAddToCartRate({ index, startDate, endDate, tags }, requestOptions) {
183
+ if (!index) {
184
+ throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");
185
+ }
186
+ const requestPath = "/2/conversions/addToCartRate";
187
+ const headers = {};
188
+ const queryParameters = {};
189
+ if (index !== void 0) {
190
+ queryParameters.index = index.toString();
191
+ }
192
+ if (startDate !== void 0) {
193
+ queryParameters.startDate = startDate.toString();
194
+ }
195
+ if (endDate !== void 0) {
196
+ queryParameters.endDate = endDate.toString();
197
+ }
198
+ if (tags !== void 0) {
199
+ queryParameters.tags = tags.toString();
200
+ }
201
+ const request = {
202
+ method: "GET",
203
+ path: requestPath,
204
+ queryParameters,
205
+ headers
206
+ };
207
+ return this.transporter.request(request, requestOptions);
208
+ },
101
209
  /**
102
210
  * 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.
103
211
  *
@@ -111,7 +219,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
111
219
  * @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/).
112
220
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
113
221
  */
114
- getAverageClickPosition({ index, startDate, endDate, tags }: GetAverageClickPositionProps, requestOptions?: RequestOptions): Promise<GetAverageClickPositionResponse>;
222
+ getAverageClickPosition({ index, startDate, endDate, tags }, requestOptions) {
223
+ if (!index) {
224
+ throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");
225
+ }
226
+ const requestPath = "/2/clicks/averageClickPosition";
227
+ const headers = {};
228
+ const queryParameters = {};
229
+ if (index !== void 0) {
230
+ queryParameters.index = index.toString();
231
+ }
232
+ if (startDate !== void 0) {
233
+ queryParameters.startDate = startDate.toString();
234
+ }
235
+ if (endDate !== void 0) {
236
+ queryParameters.endDate = endDate.toString();
237
+ }
238
+ if (tags !== void 0) {
239
+ queryParameters.tags = tags.toString();
240
+ }
241
+ const request = {
242
+ method: "GET",
243
+ path: requestPath,
244
+ queryParameters,
245
+ headers
246
+ };
247
+ return this.transporter.request(request, requestOptions);
248
+ },
115
249
  /**
116
250
  * 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.
117
251
  *
@@ -125,7 +259,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
125
259
  * @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/).
126
260
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
127
261
  */
128
- getClickPositions({ index, startDate, endDate, tags }: GetClickPositionsProps, requestOptions?: RequestOptions): Promise<GetClickPositionsResponse>;
262
+ getClickPositions({ index, startDate, endDate, tags }, requestOptions) {
263
+ if (!index) {
264
+ throw new Error("Parameter `index` is required when calling `getClickPositions`.");
265
+ }
266
+ const requestPath = "/2/clicks/positions";
267
+ const headers = {};
268
+ const queryParameters = {};
269
+ if (index !== void 0) {
270
+ queryParameters.index = index.toString();
271
+ }
272
+ if (startDate !== void 0) {
273
+ queryParameters.startDate = startDate.toString();
274
+ }
275
+ if (endDate !== void 0) {
276
+ queryParameters.endDate = endDate.toString();
277
+ }
278
+ if (tags !== void 0) {
279
+ queryParameters.tags = tags.toString();
280
+ }
281
+ const request = {
282
+ method: "GET",
283
+ path: requestPath,
284
+ queryParameters,
285
+ headers
286
+ };
287
+ return this.transporter.request(request, requestOptions);
288
+ },
129
289
  /**
130
290
  * 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.
131
291
  *
@@ -139,7 +299,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
139
299
  * @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/).
140
300
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
141
301
  */
142
- getClickThroughRate({ index, startDate, endDate, tags }: GetClickThroughRateProps, requestOptions?: RequestOptions): Promise<GetClickThroughRateResponse>;
302
+ getClickThroughRate({ index, startDate, endDate, tags }, requestOptions) {
303
+ if (!index) {
304
+ throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");
305
+ }
306
+ const requestPath = "/2/clicks/clickThroughRate";
307
+ const headers = {};
308
+ const queryParameters = {};
309
+ if (index !== void 0) {
310
+ queryParameters.index = index.toString();
311
+ }
312
+ if (startDate !== void 0) {
313
+ queryParameters.startDate = startDate.toString();
314
+ }
315
+ if (endDate !== void 0) {
316
+ queryParameters.endDate = endDate.toString();
317
+ }
318
+ if (tags !== void 0) {
319
+ queryParameters.tags = tags.toString();
320
+ }
321
+ const request = {
322
+ method: "GET",
323
+ path: requestPath,
324
+ queryParameters,
325
+ headers
326
+ };
327
+ return this.transporter.request(request, requestOptions);
328
+ },
143
329
  /**
144
330
  * 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.
145
331
  *
@@ -153,7 +339,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
153
339
  * @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/).
154
340
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
155
341
  */
156
- getConversionRate({ index, startDate, endDate, tags }: GetConversionRateProps, requestOptions?: RequestOptions): Promise<GetConversionRateResponse>;
342
+ getConversionRate({ index, startDate, endDate, tags }, requestOptions) {
343
+ if (!index) {
344
+ throw new Error("Parameter `index` is required when calling `getConversionRate`.");
345
+ }
346
+ const requestPath = "/2/conversions/conversionRate";
347
+ const headers = {};
348
+ const queryParameters = {};
349
+ if (index !== void 0) {
350
+ queryParameters.index = index.toString();
351
+ }
352
+ if (startDate !== void 0) {
353
+ queryParameters.startDate = startDate.toString();
354
+ }
355
+ if (endDate !== void 0) {
356
+ queryParameters.endDate = endDate.toString();
357
+ }
358
+ if (tags !== void 0) {
359
+ queryParameters.tags = tags.toString();
360
+ }
361
+ const request = {
362
+ method: "GET",
363
+ path: requestPath,
364
+ queryParameters,
365
+ headers
366
+ };
367
+ return this.transporter.request(request, requestOptions);
368
+ },
157
369
  /**
158
370
  * 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.
159
371
  *
@@ -167,7 +379,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
167
379
  * @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/).
168
380
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
169
381
  */
170
- getNoClickRate({ index, startDate, endDate, tags }: GetNoClickRateProps, requestOptions?: RequestOptions): Promise<GetNoClickRateResponse>;
382
+ getNoClickRate({ index, startDate, endDate, tags }, requestOptions) {
383
+ if (!index) {
384
+ throw new Error("Parameter `index` is required when calling `getNoClickRate`.");
385
+ }
386
+ const requestPath = "/2/searches/noClickRate";
387
+ const headers = {};
388
+ const queryParameters = {};
389
+ if (index !== void 0) {
390
+ queryParameters.index = index.toString();
391
+ }
392
+ if (startDate !== void 0) {
393
+ queryParameters.startDate = startDate.toString();
394
+ }
395
+ if (endDate !== void 0) {
396
+ queryParameters.endDate = endDate.toString();
397
+ }
398
+ if (tags !== void 0) {
399
+ queryParameters.tags = tags.toString();
400
+ }
401
+ const request = {
402
+ method: "GET",
403
+ path: requestPath,
404
+ queryParameters,
405
+ headers
406
+ };
407
+ return this.transporter.request(request, requestOptions);
408
+ },
171
409
  /**
172
410
  * 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.
173
411
  *
@@ -181,7 +419,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
181
419
  * @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/).
182
420
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
183
421
  */
184
- getNoResultsRate({ index, startDate, endDate, tags }: GetNoResultsRateProps, requestOptions?: RequestOptions): Promise<GetNoResultsRateResponse>;
422
+ getNoResultsRate({ index, startDate, endDate, tags }, requestOptions) {
423
+ if (!index) {
424
+ throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");
425
+ }
426
+ const requestPath = "/2/searches/noResultRate";
427
+ const headers = {};
428
+ const queryParameters = {};
429
+ if (index !== void 0) {
430
+ queryParameters.index = index.toString();
431
+ }
432
+ if (startDate !== void 0) {
433
+ queryParameters.startDate = startDate.toString();
434
+ }
435
+ if (endDate !== void 0) {
436
+ queryParameters.endDate = endDate.toString();
437
+ }
438
+ if (tags !== void 0) {
439
+ queryParameters.tags = tags.toString();
440
+ }
441
+ const request = {
442
+ method: "GET",
443
+ path: requestPath,
444
+ queryParameters,
445
+ headers
446
+ };
447
+ return this.transporter.request(request, requestOptions);
448
+ },
185
449
  /**
186
450
  * 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.
187
451
  *
@@ -195,7 +459,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
195
459
  * @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/).
196
460
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
197
461
  */
198
- getPurchaseRate({ index, startDate, endDate, tags }: GetPurchaseRateProps, requestOptions?: RequestOptions): Promise<GetPurchaseRateResponse>;
462
+ getPurchaseRate({ index, startDate, endDate, tags }, requestOptions) {
463
+ if (!index) {
464
+ throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");
465
+ }
466
+ const requestPath = "/2/conversions/purchaseRate";
467
+ const headers = {};
468
+ const queryParameters = {};
469
+ if (index !== void 0) {
470
+ queryParameters.index = index.toString();
471
+ }
472
+ if (startDate !== void 0) {
473
+ queryParameters.startDate = startDate.toString();
474
+ }
475
+ if (endDate !== void 0) {
476
+ queryParameters.endDate = endDate.toString();
477
+ }
478
+ if (tags !== void 0) {
479
+ queryParameters.tags = tags.toString();
480
+ }
481
+ const request = {
482
+ method: "GET",
483
+ path: requestPath,
484
+ queryParameters,
485
+ headers
486
+ };
487
+ return this.transporter.request(request, requestOptions);
488
+ },
199
489
  /**
200
490
  * 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.
201
491
  *
@@ -209,7 +499,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
209
499
  * @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/).
210
500
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
211
501
  */
212
- getRevenue({ index, startDate, endDate, tags }: GetRevenueProps, requestOptions?: RequestOptions): Promise<GetRevenue>;
502
+ getRevenue({ index, startDate, endDate, tags }, requestOptions) {
503
+ if (!index) {
504
+ throw new Error("Parameter `index` is required when calling `getRevenue`.");
505
+ }
506
+ const requestPath = "/2/conversions/revenue";
507
+ const headers = {};
508
+ const queryParameters = {};
509
+ if (index !== void 0) {
510
+ queryParameters.index = index.toString();
511
+ }
512
+ if (startDate !== void 0) {
513
+ queryParameters.startDate = startDate.toString();
514
+ }
515
+ if (endDate !== void 0) {
516
+ queryParameters.endDate = endDate.toString();
517
+ }
518
+ if (tags !== void 0) {
519
+ queryParameters.tags = tags.toString();
520
+ }
521
+ const request = {
522
+ method: "GET",
523
+ path: requestPath,
524
+ queryParameters,
525
+ headers
526
+ };
527
+ return this.transporter.request(request, requestOptions);
528
+ },
213
529
  /**
214
530
  * 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.
215
531
  *
@@ -223,7 +539,33 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
223
539
  * @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/).
224
540
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
225
541
  */
226
- getSearchesCount({ index, startDate, endDate, tags }: GetSearchesCountProps, requestOptions?: RequestOptions): Promise<GetSearchesCountResponse>;
542
+ getSearchesCount({ index, startDate, endDate, tags }, requestOptions) {
543
+ if (!index) {
544
+ throw new Error("Parameter `index` is required when calling `getSearchesCount`.");
545
+ }
546
+ const requestPath = "/2/searches/count";
547
+ const headers = {};
548
+ const queryParameters = {};
549
+ if (index !== void 0) {
550
+ queryParameters.index = index.toString();
551
+ }
552
+ if (startDate !== void 0) {
553
+ queryParameters.startDate = startDate.toString();
554
+ }
555
+ if (endDate !== void 0) {
556
+ queryParameters.endDate = endDate.toString();
557
+ }
558
+ if (tags !== void 0) {
559
+ queryParameters.tags = tags.toString();
560
+ }
561
+ const request = {
562
+ method: "GET",
563
+ path: requestPath,
564
+ queryParameters,
565
+ headers
566
+ };
567
+ return this.transporter.request(request, requestOptions);
568
+ },
227
569
  /**
228
570
  * Retrieves the most popular searches that didn\'t lead to any clicks, from the 1,000 most frequent searches.
229
571
  *
@@ -239,7 +581,39 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
239
581
  * @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/).
240
582
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
241
583
  */
242
- getSearchesNoClicks({ index, startDate, endDate, limit, offset, tags }: GetSearchesNoClicksProps, requestOptions?: RequestOptions): Promise<GetSearchesNoClicksResponse>;
584
+ getSearchesNoClicks({ index, startDate, endDate, limit, offset, tags }, requestOptions) {
585
+ if (!index) {
586
+ throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");
587
+ }
588
+ const requestPath = "/2/searches/noClicks";
589
+ const headers = {};
590
+ const queryParameters = {};
591
+ if (index !== void 0) {
592
+ queryParameters.index = index.toString();
593
+ }
594
+ if (startDate !== void 0) {
595
+ queryParameters.startDate = startDate.toString();
596
+ }
597
+ if (endDate !== void 0) {
598
+ queryParameters.endDate = endDate.toString();
599
+ }
600
+ if (limit !== void 0) {
601
+ queryParameters.limit = limit.toString();
602
+ }
603
+ if (offset !== void 0) {
604
+ queryParameters.offset = offset.toString();
605
+ }
606
+ if (tags !== void 0) {
607
+ queryParameters.tags = tags.toString();
608
+ }
609
+ const request = {
610
+ method: "GET",
611
+ path: requestPath,
612
+ queryParameters,
613
+ headers
614
+ };
615
+ return this.transporter.request(request, requestOptions);
616
+ },
243
617
  /**
244
618
  * Retrieves the most popular searches that didn\'t return any results.
245
619
  *
@@ -255,7 +629,39 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
255
629
  * @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/).
256
630
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
257
631
  */
258
- getSearchesNoResults({ index, startDate, endDate, limit, offset, tags }: GetSearchesNoResultsProps, requestOptions?: RequestOptions): Promise<GetSearchesNoResultsResponse>;
632
+ getSearchesNoResults({ index, startDate, endDate, limit, offset, tags }, requestOptions) {
633
+ if (!index) {
634
+ throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");
635
+ }
636
+ const requestPath = "/2/searches/noResults";
637
+ const headers = {};
638
+ const queryParameters = {};
639
+ if (index !== void 0) {
640
+ queryParameters.index = index.toString();
641
+ }
642
+ if (startDate !== void 0) {
643
+ queryParameters.startDate = startDate.toString();
644
+ }
645
+ if (endDate !== void 0) {
646
+ queryParameters.endDate = endDate.toString();
647
+ }
648
+ if (limit !== void 0) {
649
+ queryParameters.limit = limit.toString();
650
+ }
651
+ if (offset !== void 0) {
652
+ queryParameters.offset = offset.toString();
653
+ }
654
+ if (tags !== void 0) {
655
+ queryParameters.tags = tags.toString();
656
+ }
657
+ const request = {
658
+ method: "GET",
659
+ path: requestPath,
660
+ queryParameters,
661
+ headers
662
+ };
663
+ return this.transporter.request(request, requestOptions);
664
+ },
259
665
  /**
260
666
  * Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes.
261
667
  *
@@ -266,7 +672,24 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
266
672
  * @param getStatus.index - Index name.
267
673
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
268
674
  */
269
- getStatus({ index }: GetStatusProps, requestOptions?: RequestOptions): Promise<GetStatusResponse>;
675
+ getStatus({ index }, requestOptions) {
676
+ if (!index) {
677
+ throw new Error("Parameter `index` is required when calling `getStatus`.");
678
+ }
679
+ const requestPath = "/2/status";
680
+ const headers = {};
681
+ const queryParameters = {};
682
+ if (index !== void 0) {
683
+ queryParameters.index = index.toString();
684
+ }
685
+ const request = {
686
+ method: "GET",
687
+ path: requestPath,
688
+ queryParameters,
689
+ headers
690
+ };
691
+ return this.transporter.request(request, requestOptions);
692
+ },
270
693
  /**
271
694
  * Retrieves the countries with the most searches to your index.
272
695
  *
@@ -282,7 +705,39 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
282
705
  * @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/).
283
706
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
284
707
  */
285
- getTopCountries({ index, startDate, endDate, limit, offset, tags }: GetTopCountriesProps, requestOptions?: RequestOptions): Promise<GetTopCountriesResponse>;
708
+ getTopCountries({ index, startDate, endDate, limit, offset, tags }, requestOptions) {
709
+ if (!index) {
710
+ throw new Error("Parameter `index` is required when calling `getTopCountries`.");
711
+ }
712
+ const requestPath = "/2/countries";
713
+ const headers = {};
714
+ const queryParameters = {};
715
+ if (index !== void 0) {
716
+ queryParameters.index = index.toString();
717
+ }
718
+ if (startDate !== void 0) {
719
+ queryParameters.startDate = startDate.toString();
720
+ }
721
+ if (endDate !== void 0) {
722
+ queryParameters.endDate = endDate.toString();
723
+ }
724
+ if (limit !== void 0) {
725
+ queryParameters.limit = limit.toString();
726
+ }
727
+ if (offset !== void 0) {
728
+ queryParameters.offset = offset.toString();
729
+ }
730
+ if (tags !== void 0) {
731
+ queryParameters.tags = tags.toString();
732
+ }
733
+ const request = {
734
+ method: "GET",
735
+ path: requestPath,
736
+ queryParameters,
737
+ headers
738
+ };
739
+ return this.transporter.request(request, requestOptions);
740
+ },
286
741
  /**
287
742
  * Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting.
288
743
  *
@@ -299,7 +754,42 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
299
754
  * @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/).
300
755
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
301
756
  */
302
- getTopFilterAttributes({ index, search, startDate, endDate, limit, offset, tags }: GetTopFilterAttributesProps, requestOptions?: RequestOptions): Promise<GetTopFilterAttributesResponse>;
757
+ getTopFilterAttributes({ index, search, startDate, endDate, limit, offset, tags }, requestOptions) {
758
+ if (!index) {
759
+ throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");
760
+ }
761
+ const requestPath = "/2/filters";
762
+ const headers = {};
763
+ const queryParameters = {};
764
+ if (index !== void 0) {
765
+ queryParameters.index = index.toString();
766
+ }
767
+ if (search !== void 0) {
768
+ queryParameters.search = search.toString();
769
+ }
770
+ if (startDate !== void 0) {
771
+ queryParameters.startDate = startDate.toString();
772
+ }
773
+ if (endDate !== void 0) {
774
+ queryParameters.endDate = endDate.toString();
775
+ }
776
+ if (limit !== void 0) {
777
+ queryParameters.limit = limit.toString();
778
+ }
779
+ if (offset !== void 0) {
780
+ queryParameters.offset = offset.toString();
781
+ }
782
+ if (tags !== void 0) {
783
+ queryParameters.tags = tags.toString();
784
+ }
785
+ const request = {
786
+ method: "GET",
787
+ path: requestPath,
788
+ queryParameters,
789
+ headers
790
+ };
791
+ return this.transporter.request(request, requestOptions);
792
+ },
303
793
  /**
304
794
  * Retrieves the most frequent filter (facet) values for a filter attribute. These are attributes of your records that you included in the `attributesForFaceting` setting.
305
795
  *
@@ -317,7 +807,45 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
317
807
  * @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/).
318
808
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
319
809
  */
320
- getTopFilterForAttribute({ attribute, index, search, startDate, endDate, limit, offset, tags }: GetTopFilterForAttributeProps, requestOptions?: RequestOptions): Promise<GetTopFilterForAttributeResponse>;
810
+ getTopFilterForAttribute({ attribute, index, search, startDate, endDate, limit, offset, tags }, requestOptions) {
811
+ if (!attribute) {
812
+ throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");
813
+ }
814
+ if (!index) {
815
+ throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");
816
+ }
817
+ const requestPath = "/2/filters/{attribute}".replace("{attribute}", encodeURIComponent(attribute));
818
+ const headers = {};
819
+ const queryParameters = {};
820
+ if (index !== void 0) {
821
+ queryParameters.index = index.toString();
822
+ }
823
+ if (search !== void 0) {
824
+ queryParameters.search = search.toString();
825
+ }
826
+ if (startDate !== void 0) {
827
+ queryParameters.startDate = startDate.toString();
828
+ }
829
+ if (endDate !== void 0) {
830
+ queryParameters.endDate = endDate.toString();
831
+ }
832
+ if (limit !== void 0) {
833
+ queryParameters.limit = limit.toString();
834
+ }
835
+ if (offset !== void 0) {
836
+ queryParameters.offset = offset.toString();
837
+ }
838
+ if (tags !== void 0) {
839
+ queryParameters.tags = tags.toString();
840
+ }
841
+ const request = {
842
+ method: "GET",
843
+ path: requestPath,
844
+ queryParameters,
845
+ headers
846
+ };
847
+ return this.transporter.request(request, requestOptions);
848
+ },
321
849
  /**
322
850
  * 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.
323
851
  *
@@ -334,7 +862,42 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
334
862
  * @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/).
335
863
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
336
864
  */
337
- getTopFiltersNoResults({ index, search, startDate, endDate, limit, offset, tags }: GetTopFiltersNoResultsProps, requestOptions?: RequestOptions): Promise<GetTopFiltersNoResultsResponse>;
865
+ getTopFiltersNoResults({ index, search, startDate, endDate, limit, offset, tags }, requestOptions) {
866
+ if (!index) {
867
+ throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");
868
+ }
869
+ const requestPath = "/2/filters/noResults";
870
+ const headers = {};
871
+ const queryParameters = {};
872
+ if (index !== void 0) {
873
+ queryParameters.index = index.toString();
874
+ }
875
+ if (search !== void 0) {
876
+ queryParameters.search = search.toString();
877
+ }
878
+ if (startDate !== void 0) {
879
+ queryParameters.startDate = startDate.toString();
880
+ }
881
+ if (endDate !== void 0) {
882
+ queryParameters.endDate = endDate.toString();
883
+ }
884
+ if (limit !== void 0) {
885
+ queryParameters.limit = limit.toString();
886
+ }
887
+ if (offset !== void 0) {
888
+ queryParameters.offset = offset.toString();
889
+ }
890
+ if (tags !== void 0) {
891
+ queryParameters.tags = tags.toString();
892
+ }
893
+ const request = {
894
+ method: "GET",
895
+ path: requestPath,
896
+ queryParameters,
897
+ headers
898
+ };
899
+ return this.transporter.request(request, requestOptions);
900
+ },
338
901
  /**
339
902
  * Retrieves the object IDs of the most frequent search results.
340
903
  *
@@ -353,7 +916,48 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
353
916
  * @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/).
354
917
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
355
918
  */
356
- getTopHits({ index, search, clickAnalytics, revenueAnalytics, startDate, endDate, limit, offset, tags }: GetTopHitsProps, requestOptions?: RequestOptions): Promise<GetTopHitsResponse>;
919
+ getTopHits({ index, search, clickAnalytics, revenueAnalytics, startDate, endDate, limit, offset, tags }, requestOptions) {
920
+ if (!index) {
921
+ throw new Error("Parameter `index` is required when calling `getTopHits`.");
922
+ }
923
+ const requestPath = "/2/hits";
924
+ const headers = {};
925
+ const queryParameters = {};
926
+ if (index !== void 0) {
927
+ queryParameters.index = index.toString();
928
+ }
929
+ if (search !== void 0) {
930
+ queryParameters.search = search.toString();
931
+ }
932
+ if (clickAnalytics !== void 0) {
933
+ queryParameters.clickAnalytics = clickAnalytics.toString();
934
+ }
935
+ if (revenueAnalytics !== void 0) {
936
+ queryParameters.revenueAnalytics = revenueAnalytics.toString();
937
+ }
938
+ if (startDate !== void 0) {
939
+ queryParameters.startDate = startDate.toString();
940
+ }
941
+ if (endDate !== void 0) {
942
+ queryParameters.endDate = endDate.toString();
943
+ }
944
+ if (limit !== void 0) {
945
+ queryParameters.limit = limit.toString();
946
+ }
947
+ if (offset !== void 0) {
948
+ queryParameters.offset = offset.toString();
949
+ }
950
+ if (tags !== void 0) {
951
+ queryParameters.tags = tags.toString();
952
+ }
953
+ const request = {
954
+ method: "GET",
955
+ path: requestPath,
956
+ queryParameters,
957
+ headers
958
+ };
959
+ return this.transporter.request(request, requestOptions);
960
+ },
357
961
  /**
358
962
  * Returns the most popular search terms.
359
963
  *
@@ -373,7 +977,62 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
373
977
  * @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/).
374
978
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
375
979
  */
376
- getTopSearches({ index, clickAnalytics, revenueAnalytics, startDate, endDate, orderBy, direction, limit, offset, tags, }: GetTopSearchesProps, requestOptions?: RequestOptions): Promise<GetTopSearchesResponse>;
980
+ getTopSearches({
981
+ index,
982
+ clickAnalytics,
983
+ revenueAnalytics,
984
+ startDate,
985
+ endDate,
986
+ orderBy,
987
+ direction,
988
+ limit,
989
+ offset,
990
+ tags
991
+ }, requestOptions) {
992
+ if (!index) {
993
+ throw new Error("Parameter `index` is required when calling `getTopSearches`.");
994
+ }
995
+ const requestPath = "/2/searches";
996
+ const headers = {};
997
+ const queryParameters = {};
998
+ if (index !== void 0) {
999
+ queryParameters.index = index.toString();
1000
+ }
1001
+ if (clickAnalytics !== void 0) {
1002
+ queryParameters.clickAnalytics = clickAnalytics.toString();
1003
+ }
1004
+ if (revenueAnalytics !== void 0) {
1005
+ queryParameters.revenueAnalytics = revenueAnalytics.toString();
1006
+ }
1007
+ if (startDate !== void 0) {
1008
+ queryParameters.startDate = startDate.toString();
1009
+ }
1010
+ if (endDate !== void 0) {
1011
+ queryParameters.endDate = endDate.toString();
1012
+ }
1013
+ if (orderBy !== void 0) {
1014
+ queryParameters.orderBy = orderBy.toString();
1015
+ }
1016
+ if (direction !== void 0) {
1017
+ queryParameters.direction = direction.toString();
1018
+ }
1019
+ if (limit !== void 0) {
1020
+ queryParameters.limit = limit.toString();
1021
+ }
1022
+ if (offset !== void 0) {
1023
+ queryParameters.offset = offset.toString();
1024
+ }
1025
+ if (tags !== void 0) {
1026
+ queryParameters.tags = tags.toString();
1027
+ }
1028
+ const request = {
1029
+ method: "GET",
1030
+ path: requestPath,
1031
+ queryParameters,
1032
+ headers
1033
+ };
1034
+ return this.transporter.request(request, requestOptions);
1035
+ },
377
1036
  /**
378
1037
  * 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.
379
1038
  *
@@ -387,6 +1046,38 @@ export declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiK
387
1046
  * @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/).
388
1047
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
389
1048
  */
390
- getUsersCount({ index, startDate, endDate, tags }: GetUsersCountProps, requestOptions?: RequestOptions): Promise<GetUsersCountResponse>;
1049
+ getUsersCount({ index, startDate, endDate, tags }, requestOptions) {
1050
+ if (!index) {
1051
+ throw new Error("Parameter `index` is required when calling `getUsersCount`.");
1052
+ }
1053
+ const requestPath = "/2/users/count";
1054
+ const headers = {};
1055
+ const queryParameters = {};
1056
+ if (index !== void 0) {
1057
+ queryParameters.index = index.toString();
1058
+ }
1059
+ if (startDate !== void 0) {
1060
+ queryParameters.startDate = startDate.toString();
1061
+ }
1062
+ if (endDate !== void 0) {
1063
+ queryParameters.endDate = endDate.toString();
1064
+ }
1065
+ if (tags !== void 0) {
1066
+ queryParameters.tags = tags.toString();
1067
+ }
1068
+ const request = {
1069
+ method: "GET",
1070
+ path: requestPath,
1071
+ queryParameters,
1072
+ headers
1073
+ };
1074
+ return this.transporter.request(request, requestOptions);
1075
+ }
1076
+ };
1077
+ }
1078
+ export {
1079
+ REGIONS,
1080
+ apiClientVersion,
1081
+ createAnalyticsClient
391
1082
  };
392
- //# sourceMappingURL=analyticsClient.d.ts.map
1083
+ //# sourceMappingURL=analyticsClient.js.map