Skip to content

Commit 4b583eb

Browse files
algolia-botkai687shortcutsmillotpmorganleroi
committed
chore: generated code for commit 7c5ba328. [skip ci]
algolia/api-clients-automation@7c5ba32 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Kai Welke <[email protected]> Co-authored-by: shortcuts <[email protected]> Co-authored-by: Pierre Millot <[email protected]> Co-authored-by: Morgan Leroi <[email protected]>
1 parent 34faa1d commit 4b583eb

19 files changed

+312
-185
lines changed

Sources/Insights/InsightsClient.swift

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,53 @@ open class InsightsClient {
248248
transporter: self.transporter, requestOptions: requestOptions)
249249
}
250250

251+
/**
252+
Delete user token.
253+
254+
- parameter userToken: (path) The user token for which to delete all associated events.
255+
- returns: Void
256+
*/
257+
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
258+
open func deleteUserToken(userToken: String, requestOptions: RequestOptions? = nil) async throws {
259+
return try await deleteUserTokenWithRequestBuilder(
260+
userToken: userToken, requestOptions: requestOptions
261+
).execute().body
262+
}
263+
264+
/**
265+
Delete user token.
266+
267+
Delete all events related to a certain user token from events metrics and analytics. To delete a personalization user profile, see [Delete a user profile](https://www.algolia.com/doc/rest-api/personalization/#delete-a-user-profile).
268+
- responseHeaders: [x-ratelimit-limit(Int), x-ratelimit-remaining(Int), x-ratelimit-reset(Int)]
269+
- parameter userToken: (path) The user token for which to delete all associated events.
270+
- returns: RequestBuilder<Void>
271+
*/
272+
open func deleteUserTokenWithRequestBuilder(
273+
userToken: String, requestOptions: RequestOptions? = nil
274+
) -> RequestBuilder<Void> {
275+
var localVariablePath = "/1/usertokens/{userToken}"
276+
let userTokenPreEscape = "\(APIHelper.mapValueToPathItem(userToken))"
277+
let userTokenPostEscape =
278+
userTokenPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
279+
localVariablePath = localVariablePath.replacingOccurrences(
280+
of: "{userToken}", with: userTokenPostEscape, options: .literal, range: nil)
281+
let localVariableParameters: [String: Any?]? = nil
282+
283+
let localVariableQueryItems: [URLQueryItem]? = nil
284+
285+
let localVariableNillableHeaders: [String: Any?] = [:]
286+
287+
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
288+
289+
let localVariableRequestBuilder: RequestBuilder<Void>.Type = Transporter.requestBuilderFactory
290+
.getNonDecodableBuilder()
291+
292+
return localVariableRequestBuilder.init(
293+
method: "DELETE", path: localVariablePath, queryItems: localVariableQueryItems,
294+
parameters: localVariableParameters, headers: localVariableHeaderParameters,
295+
transporter: self.transporter, requestOptions: requestOptions)
296+
}
297+
251298
/**
252299
Send events.
253300

Sources/Insights/Models/AddedToCartObjectIDs.swift

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,45 @@ public struct AddedToCartObjectIDs: Codable, JSONEncodable, Hashable {
1313
static let eventNameRule = StringRule(minLength: 1, maxLength: 64, pattern: "[\\x20-\\x7E]{1,64}")
1414
static let userTokenRule = StringRule(
1515
minLength: 1, maxLength: 129, pattern: "[a-zA-Z0-9_=/+-]{1,129}")
16-
/** Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */
16+
static let authenticatedUserTokenRule = StringRule(
17+
minLength: 1, maxLength: 129, pattern: "[a-zA-Z0-9_=/+-]{1,129}")
18+
/** The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */
1719
public var eventName: String
1820
public var eventType: ConversionEvent
1921
public var eventSubtype: AddToCartEvent
20-
/** Name of the Algolia index. */
22+
/** The name of an Algolia index. */
2123
public var index: String
22-
/** List of object identifiers for items of an Algolia index. */
24+
/** The object IDs of the records that are part of the event. */
2325
public var objectIDs: [String]
24-
/** Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. */
25-
public var objectData: [ObjectData]?
26-
/** If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. */
27-
public var currency: String?
28-
/** Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */
26+
/** An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */
2927
public var userToken: String
30-
/** Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */
31-
public var timestamp: Int64?
32-
/** User token for authenticated users. */
28+
/** An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */
3329
public var authenticatedUserToken: String?
30+
/** Three-letter [currency code](https://www.iso.org/iso-4217-currency-codes.html). */
31+
public var currency: String?
32+
/** Extra information about the records involved in a purchase or add-to-cart event. If specified, it must have the same length as `objectIDs`. */
33+
public var objectData: [ObjectData]?
34+
/** The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */
35+
public var timestamp: Int64?
36+
public var value: Value?
3437

3538
public init(
3639
eventName: String, eventType: ConversionEvent, eventSubtype: AddToCartEvent, index: String,
37-
objectIDs: [String], objectData: [ObjectData]? = nil, currency: String? = nil,
38-
userToken: String, timestamp: Int64? = nil, authenticatedUserToken: String? = nil
40+
objectIDs: [String], userToken: String, authenticatedUserToken: String? = nil,
41+
currency: String? = nil, objectData: [ObjectData]? = nil, timestamp: Int64? = nil,
42+
value: Value? = nil
3943
) {
4044
self.eventName = eventName
4145
self.eventType = eventType
4246
self.eventSubtype = eventSubtype
4347
self.index = index
4448
self.objectIDs = objectIDs
45-
self.objectData = objectData
46-
self.currency = currency
4749
self.userToken = userToken
48-
self.timestamp = timestamp
4950
self.authenticatedUserToken = authenticatedUserToken
51+
self.currency = currency
52+
self.objectData = objectData
53+
self.timestamp = timestamp
54+
self.value = value
5055
}
5156

5257
public enum CodingKeys: String, CodingKey, CaseIterable {
@@ -55,11 +60,12 @@ public struct AddedToCartObjectIDs: Codable, JSONEncodable, Hashable {
5560
case eventSubtype
5661
case index
5762
case objectIDs
58-
case objectData
59-
case currency
6063
case userToken
61-
case timestamp
6264
case authenticatedUserToken
65+
case currency
66+
case objectData
67+
case timestamp
68+
case value
6369
}
6470

6571
// Encodable protocol methods
@@ -71,10 +77,11 @@ public struct AddedToCartObjectIDs: Codable, JSONEncodable, Hashable {
7177
try container.encode(eventSubtype, forKey: .eventSubtype)
7278
try container.encode(index, forKey: .index)
7379
try container.encode(objectIDs, forKey: .objectIDs)
74-
try container.encodeIfPresent(objectData, forKey: .objectData)
75-
try container.encodeIfPresent(currency, forKey: .currency)
7680
try container.encode(userToken, forKey: .userToken)
77-
try container.encodeIfPresent(timestamp, forKey: .timestamp)
7881
try container.encodeIfPresent(authenticatedUserToken, forKey: .authenticatedUserToken)
82+
try container.encodeIfPresent(currency, forKey: .currency)
83+
try container.encodeIfPresent(objectData, forKey: .objectData)
84+
try container.encodeIfPresent(timestamp, forKey: .timestamp)
85+
try container.encodeIfPresent(value, forKey: .value)
7986
}
8087
}

Sources/Insights/Models/AddedToCartObjectIDsAfterSearch.swift

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,48 @@ public struct AddedToCartObjectIDsAfterSearch: Codable, JSONEncodable, Hashable
1414
static let queryIDRule = StringRule(minLength: 32, maxLength: 32, pattern: "[0-9a-f]{32}")
1515
static let userTokenRule = StringRule(
1616
minLength: 1, maxLength: 129, pattern: "[a-zA-Z0-9_=/+-]{1,129}")
17-
/** Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */
17+
static let authenticatedUserTokenRule = StringRule(
18+
minLength: 1, maxLength: 129, pattern: "[a-zA-Z0-9_=/+-]{1,129}")
19+
/** The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */
1820
public var eventName: String
1921
public var eventType: ConversionEvent
2022
public var eventSubtype: AddToCartEvent
21-
/** Name of the Algolia index. */
23+
/** The name of an Algolia index. */
2224
public var index: String
2325
/** Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. */
2426
public var queryID: String
25-
/** List of object identifiers for items of an Algolia index. */
27+
/** The object IDs of the records that are part of the event. */
2628
public var objectIDs: [String]
27-
/** Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. */
28-
public var objectData: [ObjectDataAfterSearch]?
29-
/** If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. */
30-
public var currency: String?
31-
/** Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */
29+
/** An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */
3230
public var userToken: String
33-
/** Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */
34-
public var timestamp: Int64?
35-
/** User token for authenticated users. */
31+
/** An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */
3632
public var authenticatedUserToken: String?
33+
/** Three-letter [currency code](https://www.iso.org/iso-4217-currency-codes.html). */
34+
public var currency: String?
35+
/** Extra information about the records involved in a purchase or add-to-cart events. If provided, it must be the same length as `objectIDs`. */
36+
public var objectData: [ObjectDataAfterSearch]?
37+
/** The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */
38+
public var timestamp: Int64?
39+
public var value: Value?
3740

3841
public init(
3942
eventName: String, eventType: ConversionEvent, eventSubtype: AddToCartEvent, index: String,
40-
queryID: String, objectIDs: [String], objectData: [ObjectDataAfterSearch]? = nil,
41-
currency: String? = nil, userToken: String, timestamp: Int64? = nil,
42-
authenticatedUserToken: String? = nil
43+
queryID: String, objectIDs: [String], userToken: String, authenticatedUserToken: String? = nil,
44+
currency: String? = nil, objectData: [ObjectDataAfterSearch]? = nil, timestamp: Int64? = nil,
45+
value: Value? = nil
4346
) {
4447
self.eventName = eventName
4548
self.eventType = eventType
4649
self.eventSubtype = eventSubtype
4750
self.index = index
4851
self.queryID = queryID
4952
self.objectIDs = objectIDs
50-
self.objectData = objectData
51-
self.currency = currency
5253
self.userToken = userToken
53-
self.timestamp = timestamp
5454
self.authenticatedUserToken = authenticatedUserToken
55+
self.currency = currency
56+
self.objectData = objectData
57+
self.timestamp = timestamp
58+
self.value = value
5559
}
5660

5761
public enum CodingKeys: String, CodingKey, CaseIterable {
@@ -61,11 +65,12 @@ public struct AddedToCartObjectIDsAfterSearch: Codable, JSONEncodable, Hashable
6165
case index
6266
case queryID
6367
case objectIDs
64-
case objectData
65-
case currency
6668
case userToken
67-
case timestamp
6869
case authenticatedUserToken
70+
case currency
71+
case objectData
72+
case timestamp
73+
case value
6974
}
7075

7176
// Encodable protocol methods
@@ -78,10 +83,11 @@ public struct AddedToCartObjectIDsAfterSearch: Codable, JSONEncodable, Hashable
7883
try container.encode(index, forKey: .index)
7984
try container.encode(queryID, forKey: .queryID)
8085
try container.encode(objectIDs, forKey: .objectIDs)
81-
try container.encodeIfPresent(objectData, forKey: .objectData)
82-
try container.encodeIfPresent(currency, forKey: .currency)
8386
try container.encode(userToken, forKey: .userToken)
84-
try container.encodeIfPresent(timestamp, forKey: .timestamp)
8587
try container.encodeIfPresent(authenticatedUserToken, forKey: .authenticatedUserToken)
88+
try container.encodeIfPresent(currency, forKey: .currency)
89+
try container.encodeIfPresent(objectData, forKey: .objectData)
90+
try container.encodeIfPresent(timestamp, forKey: .timestamp)
91+
try container.encodeIfPresent(value, forKey: .value)
8692
}
8793
}

Sources/Insights/Models/ClickedFilters.swift

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,33 @@ public struct ClickedFilters: Codable, JSONEncodable, Hashable {
1313
static let eventNameRule = StringRule(minLength: 1, maxLength: 64, pattern: "[\\x20-\\x7E]{1,64}")
1414
static let userTokenRule = StringRule(
1515
minLength: 1, maxLength: 129, pattern: "[a-zA-Z0-9_=/+-]{1,129}")
16-
/** Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */
16+
static let authenticatedUserTokenRule = StringRule(
17+
minLength: 1, maxLength: 129, pattern: "[a-zA-Z0-9_=/+-]{1,129}")
18+
/** The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */
1719
public var eventName: String
1820
public var eventType: ClickEvent
19-
/** Name of the Algolia index. */
21+
/** The name of an Algolia index. */
2022
public var index: String
2123
/** Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. */
2224
public var filters: [String]
23-
/** Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */
25+
/** An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */
2426
public var userToken: String
25-
/** Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */
26-
public var timestamp: Int64?
27-
/** User token for authenticated users. */
27+
/** An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */
2828
public var authenticatedUserToken: String?
29+
/** The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */
30+
public var timestamp: Int64?
2931

3032
public init(
3133
eventName: String, eventType: ClickEvent, index: String, filters: [String], userToken: String,
32-
timestamp: Int64? = nil, authenticatedUserToken: String? = nil
34+
authenticatedUserToken: String? = nil, timestamp: Int64? = nil
3335
) {
3436
self.eventName = eventName
3537
self.eventType = eventType
3638
self.index = index
3739
self.filters = filters
3840
self.userToken = userToken
39-
self.timestamp = timestamp
4041
self.authenticatedUserToken = authenticatedUserToken
42+
self.timestamp = timestamp
4143
}
4244

4345
public enum CodingKeys: String, CodingKey, CaseIterable {
@@ -46,8 +48,8 @@ public struct ClickedFilters: Codable, JSONEncodable, Hashable {
4648
case index
4749
case filters
4850
case userToken
49-
case timestamp
5051
case authenticatedUserToken
52+
case timestamp
5153
}
5254

5355
// Encodable protocol methods
@@ -59,7 +61,7 @@ public struct ClickedFilters: Codable, JSONEncodable, Hashable {
5961
try container.encode(index, forKey: .index)
6062
try container.encode(filters, forKey: .filters)
6163
try container.encode(userToken, forKey: .userToken)
62-
try container.encodeIfPresent(timestamp, forKey: .timestamp)
6364
try container.encodeIfPresent(authenticatedUserToken, forKey: .authenticatedUserToken)
65+
try container.encodeIfPresent(timestamp, forKey: .timestamp)
6466
}
6567
}

Sources/Insights/Models/ClickedObjectIDs.swift

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,32 @@ public struct ClickedObjectIDs: Codable, JSONEncodable, Hashable {
1313
static let eventNameRule = StringRule(minLength: 1, maxLength: 64, pattern: "[\\x20-\\x7E]{1,64}")
1414
static let userTokenRule = StringRule(
1515
minLength: 1, maxLength: 129, pattern: "[a-zA-Z0-9_=/+-]{1,129}")
16-
/** Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */
16+
static let authenticatedUserTokenRule = StringRule(
17+
minLength: 1, maxLength: 129, pattern: "[a-zA-Z0-9_=/+-]{1,129}")
18+
/** The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */
1719
public var eventName: String
1820
public var eventType: ClickEvent
19-
/** Name of the Algolia index. */
21+
/** The name of an Algolia index. */
2022
public var index: String
21-
/** List of object identifiers for items of an Algolia index. */
23+
/** The object IDs of the records that are part of the event. */
2224
public var objectIDs: [String]
23-
/** Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */
25+
/** An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */
2426
public var userToken: String
25-
/** Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */
27+
/** An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */
28+
public var authenticatedUserToken: String?
29+
/** The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */
2630
public var timestamp: Int64?
2731

2832
public init(
2933
eventName: String, eventType: ClickEvent, index: String, objectIDs: [String], userToken: String,
30-
timestamp: Int64? = nil
34+
authenticatedUserToken: String? = nil, timestamp: Int64? = nil
3135
) {
3236
self.eventName = eventName
3337
self.eventType = eventType
3438
self.index = index
3539
self.objectIDs = objectIDs
3640
self.userToken = userToken
41+
self.authenticatedUserToken = authenticatedUserToken
3742
self.timestamp = timestamp
3843
}
3944

@@ -43,6 +48,7 @@ public struct ClickedObjectIDs: Codable, JSONEncodable, Hashable {
4348
case index
4449
case objectIDs
4550
case userToken
51+
case authenticatedUserToken
4652
case timestamp
4753
}
4854

@@ -55,6 +61,7 @@ public struct ClickedObjectIDs: Codable, JSONEncodable, Hashable {
5561
try container.encode(index, forKey: .index)
5662
try container.encode(objectIDs, forKey: .objectIDs)
5763
try container.encode(userToken, forKey: .userToken)
64+
try container.encodeIfPresent(authenticatedUserToken, forKey: .authenticatedUserToken)
5865
try container.encodeIfPresent(timestamp, forKey: .timestamp)
5966
}
6067
}

0 commit comments

Comments
 (0)