Skip to content

Commit 0e4512c

Browse files
algolia-botleonardogavaudanshortcuts
committed
feat(clients): add new abtesting-v3 package to clients + stabilize alpha js package (generated)
algolia/api-clients-automation#5157 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Leonardo Gavaudan <[email protected]> Co-authored-by: shortcuts <[email protected]>
1 parent 1b7be70 commit 0e4512c

File tree

61 files changed

+2757
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2757
-194
lines changed

AlgoliaSearchClient.podspec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Pod::Spec.new do |s|
2222
subs.source_files = 'Sources/Abtesting/**/*.swift'
2323
subs.dependency 'AlgoliaSearchClient/Core'
2424
end
25+
s.subspec 'AbtestingV3' do |subs|
26+
subs.source_files = 'Sources/AbtestingV3/**/*.swift'
27+
subs.dependency 'AlgoliaSearchClient/Core'
28+
end
2529
s.subspec 'Analytics' do |subs|
2630
subs.source_files = 'Sources/Analytics/**/*.swift'
2731
subs.dependency 'AlgoliaSearchClient/Core'

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ products.append(
5656

5757
[
5858
"Abtesting",
59+
"AbtestingV3",
5960
"Analytics",
6061
"Composition",
6162
"Ingestion",

Sources/Abtesting/AbtestingClient.swift

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ open class AbtestingClient {
3333
}
3434

3535
/// - parameter addABTestsRequest: (body)
36-
/// - returns: ABTestResponse
36+
/// - returns: AbtestingABTestResponse
3737
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
3838
open func addABTests(
39-
addABTestsRequest: AddABTestsRequest,
39+
addABTestsRequest: AbtestingAddABTestsRequest,
4040
requestOptions: RequestOptions? = nil
41-
) async throws -> ABTestResponse {
42-
let response: Response<ABTestResponse> = try await addABTestsWithHTTPInfo(
41+
) async throws -> AbtestingABTestResponse {
42+
let response: Response<AbtestingABTestResponse> = try await addABTestsWithHTTPInfo(
4343
addABTestsRequest: addABTestsRequest,
4444
requestOptions: requestOptions
4545
)
@@ -56,12 +56,12 @@ open class AbtestingClient {
5656
// - editSettings
5757
//
5858
// - parameter addABTestsRequest: (body)
59-
// - returns: RequestBuilder<ABTestResponse>
59+
// - returns: RequestBuilder<AbtestingABTestResponse>
6060

6161
open func addABTestsWithHTTPInfo(
62-
addABTestsRequest: AddABTestsRequest,
62+
addABTestsRequest: AbtestingAddABTestsRequest,
6363
requestOptions userRequestOptions: RequestOptions? = nil
64-
) async throws -> Response<ABTestResponse> {
64+
) async throws -> Response<AbtestingABTestResponse> {
6565
let resourcePath = "/2/abtests"
6666
let body = addABTestsRequest
6767
let queryParameters: [String: Any?]? = nil
@@ -354,10 +354,10 @@ open class AbtestingClient {
354354
}
355355

356356
/// - parameter id: (path) Unique A/B test identifier.
357-
/// - returns: ABTestResponse
357+
/// - returns: AbtestingABTestResponse
358358
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
359-
open func deleteABTest(id: Int, requestOptions: RequestOptions? = nil) async throws -> ABTestResponse {
360-
let response: Response<ABTestResponse> = try await deleteABTestWithHTTPInfo(
359+
open func deleteABTest(id: Int, requestOptions: RequestOptions? = nil) async throws -> AbtestingABTestResponse {
360+
let response: Response<AbtestingABTestResponse> = try await deleteABTestWithHTTPInfo(
361361
id: id,
362362
requestOptions: requestOptions
363363
)
@@ -374,12 +374,12 @@ open class AbtestingClient {
374374
// - editSettings
375375
//
376376
// - parameter id: (path) Unique A/B test identifier.
377-
// - returns: RequestBuilder<ABTestResponse>
377+
// - returns: RequestBuilder<AbtestingABTestResponse>
378378

379379
open func deleteABTestWithHTTPInfo(
380380
id: Int,
381381
requestOptions userRequestOptions: RequestOptions? = nil
382-
) async throws -> Response<ABTestResponse> {
382+
) async throws -> Response<AbtestingABTestResponse> {
383383
var resourcePath = "/2/abtests/{id}"
384384
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
385385
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAlgoliaAllowed) ?? ""
@@ -403,13 +403,13 @@ open class AbtestingClient {
403403
}
404404

405405
/// - parameter estimateABTestRequest: (body)
406-
/// - returns: EstimateABTestResponse
406+
/// - returns: AbtestingEstimateABTestResponse
407407
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
408408
open func estimateABTest(
409-
estimateABTestRequest: EstimateABTestRequest,
409+
estimateABTestRequest: AbtestingEstimateABTestRequest,
410410
requestOptions: RequestOptions? = nil
411-
) async throws -> EstimateABTestResponse {
412-
let response: Response<EstimateABTestResponse> = try await estimateABTestWithHTTPInfo(
411+
) async throws -> AbtestingEstimateABTestResponse {
412+
let response: Response<AbtestingEstimateABTestResponse> = try await estimateABTestWithHTTPInfo(
413413
estimateABTestRequest: estimateABTestRequest,
414414
requestOptions: requestOptions
415415
)
@@ -427,12 +427,12 @@ open class AbtestingClient {
427427
// - analytics
428428
//
429429
// - parameter estimateABTestRequest: (body)
430-
// - returns: RequestBuilder<EstimateABTestResponse>
430+
// - returns: RequestBuilder<AbtestingEstimateABTestResponse>
431431

432432
open func estimateABTestWithHTTPInfo(
433-
estimateABTestRequest: EstimateABTestRequest,
433+
estimateABTestRequest: AbtestingEstimateABTestRequest,
434434
requestOptions userRequestOptions: RequestOptions? = nil
435-
) async throws -> Response<EstimateABTestResponse> {
435+
) async throws -> Response<AbtestingEstimateABTestResponse> {
436436
let resourcePath = "/2/abtests/estimate"
437437
let body = estimateABTestRequest
438438
let queryParameters: [String: Any?]? = nil
@@ -453,10 +453,13 @@ open class AbtestingClient {
453453
}
454454

455455
/// - parameter id: (path) Unique A/B test identifier.
456-
/// - returns: ABTest
456+
/// - returns: AbtestingABTest
457457
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
458-
open func getABTest(id: Int, requestOptions: RequestOptions? = nil) async throws -> ABTest {
459-
let response: Response<ABTest> = try await getABTestWithHTTPInfo(id: id, requestOptions: requestOptions)
458+
open func getABTest(id: Int, requestOptions: RequestOptions? = nil) async throws -> AbtestingABTest {
459+
let response: Response<AbtestingABTest> = try await getABTestWithHTTPInfo(
460+
id: id,
461+
requestOptions: requestOptions
462+
)
460463

461464
guard let body = response.body else {
462465
throw AlgoliaError.missingData
@@ -470,12 +473,12 @@ open class AbtestingClient {
470473
// - analytics
471474
//
472475
// - parameter id: (path) Unique A/B test identifier.
473-
// - returns: RequestBuilder<ABTest>
476+
// - returns: RequestBuilder<AbtestingABTest>
474477

475478
open func getABTestWithHTTPInfo(
476479
id: Int,
477480
requestOptions userRequestOptions: RequestOptions? = nil
478-
) async throws -> Response<ABTest> {
481+
) async throws -> Response<AbtestingABTest> {
479482
var resourcePath = "/2/abtests/{id}"
480483
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
481484
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAlgoliaAllowed) ?? ""
@@ -504,16 +507,16 @@ open class AbtestingClient {
504507
/// included in the response. (optional)
505508
/// - parameter indexSuffix: (query) Index name suffix. Only A/B tests for indices ending with this string are
506509
/// included in the response. (optional)
507-
/// - returns: ListABTestsResponse
510+
/// - returns: AbtestingListABTestsResponse
508511
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
509512
open func listABTests(
510513
offset: Int? = nil,
511514
limit: Int? = nil,
512515
indexPrefix: String? = nil,
513516
indexSuffix: String? = nil,
514517
requestOptions: RequestOptions? = nil
515-
) async throws -> ListABTestsResponse {
516-
let response: Response<ListABTestsResponse> = try await listABTestsWithHTTPInfo(
518+
) async throws -> AbtestingListABTestsResponse {
519+
let response: Response<AbtestingListABTestsResponse> = try await listABTestsWithHTTPInfo(
517520
offset: offset,
518521
limit: limit,
519522
indexPrefix: indexPrefix,
@@ -541,15 +544,15 @@ open class AbtestingClient {
541544
//
542545
// - parameter indexSuffix: (query) Index name suffix. Only A/B tests for indices ending with this string are
543546
// included in the response. (optional)
544-
// - returns: RequestBuilder<ListABTestsResponse>
547+
// - returns: RequestBuilder<AbtestingListABTestsResponse>
545548

546549
open func listABTestsWithHTTPInfo(
547550
offset: Int? = nil,
548551
limit: Int? = nil,
549552
indexPrefix: String? = nil,
550553
indexSuffix: String? = nil,
551554
requestOptions userRequestOptions: RequestOptions? = nil
552-
) async throws -> Response<ListABTestsResponse> {
555+
) async throws -> Response<AbtestingListABTestsResponse> {
553556
let resourcePath = "/2/abtests"
554557
let body: AnyCodable? = nil
555558
let queryParameters: [String: Any?] = [
@@ -575,13 +578,13 @@ open class AbtestingClient {
575578
}
576579

577580
/// - parameter scheduleABTestsRequest: (body)
578-
/// - returns: ScheduleABTestResponse
581+
/// - returns: AbtestingScheduleABTestResponse
579582
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
580583
open func scheduleABTest(
581-
scheduleABTestsRequest: ScheduleABTestsRequest,
584+
scheduleABTestsRequest: AbtestingScheduleABTestsRequest,
582585
requestOptions: RequestOptions? = nil
583-
) async throws -> ScheduleABTestResponse {
584-
let response: Response<ScheduleABTestResponse> = try await scheduleABTestWithHTTPInfo(
586+
) async throws -> AbtestingScheduleABTestResponse {
587+
let response: Response<AbtestingScheduleABTestResponse> = try await scheduleABTestWithHTTPInfo(
585588
scheduleABTestsRequest: scheduleABTestsRequest,
586589
requestOptions: requestOptions
587590
)
@@ -598,12 +601,12 @@ open class AbtestingClient {
598601
// - editSettings
599602
//
600603
// - parameter scheduleABTestsRequest: (body)
601-
// - returns: RequestBuilder<ScheduleABTestResponse>
604+
// - returns: RequestBuilder<AbtestingScheduleABTestResponse>
602605

603606
open func scheduleABTestWithHTTPInfo(
604-
scheduleABTestsRequest: ScheduleABTestsRequest,
607+
scheduleABTestsRequest: AbtestingScheduleABTestsRequest,
605608
requestOptions userRequestOptions: RequestOptions? = nil
606-
) async throws -> Response<ScheduleABTestResponse> {
609+
) async throws -> Response<AbtestingScheduleABTestResponse> {
607610
let resourcePath = "/2/abtests/schedule"
608611
let body = scheduleABTestsRequest
609612
let queryParameters: [String: Any?]? = nil
@@ -624,10 +627,10 @@ open class AbtestingClient {
624627
}
625628

626629
/// - parameter id: (path) Unique A/B test identifier.
627-
/// - returns: ABTestResponse
630+
/// - returns: AbtestingABTestResponse
628631
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
629-
open func stopABTest(id: Int, requestOptions: RequestOptions? = nil) async throws -> ABTestResponse {
630-
let response: Response<ABTestResponse> = try await stopABTestWithHTTPInfo(
632+
open func stopABTest(id: Int, requestOptions: RequestOptions? = nil) async throws -> AbtestingABTestResponse {
633+
let response: Response<AbtestingABTestResponse> = try await stopABTestWithHTTPInfo(
631634
id: id,
632635
requestOptions: requestOptions
633636
)
@@ -644,12 +647,12 @@ open class AbtestingClient {
644647
// - editSettings
645648
//
646649
// - parameter id: (path) Unique A/B test identifier.
647-
// - returns: RequestBuilder<ABTestResponse>
650+
// - returns: RequestBuilder<AbtestingABTestResponse>
648651

649652
open func stopABTestWithHTTPInfo(
650653
id: Int,
651654
requestOptions userRequestOptions: RequestOptions? = nil
652-
) async throws -> Response<ABTestResponse> {
655+
) async throws -> Response<AbtestingABTestResponse> {
653656
var resourcePath = "/2/abtests/{id}/stop"
654657
let idPreEscape = "\(APIHelper.mapValueToPathItem(id))"
655658
let idPostEscape = idPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAlgoliaAllowed) ?? ""

Sources/Abtesting/Models/ABTest.swift renamed to Sources/Abtesting/Models/AbtestingABTest.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Foundation
66
import Core
77
#endif
88

9-
public struct ABTest: Codable, JSONEncodable {
9+
public struct AbtestingABTest: Codable, JSONEncodable {
1010
/// Unique A/B test identifier.
1111
public var abTestID: Int
1212
public var clickSignificance: Double?
@@ -25,8 +25,8 @@ public struct ABTest: Codable, JSONEncodable {
2525
public var status: AbtestingStatus
2626
/// A/B test variants. The first variant is your _control_ index, typically your production index. The second
2727
/// variant is an index with changed settings that you want to test against the control.
28-
public var variants: [Variant]
29-
public var configuration: ABTestConfiguration?
28+
public var variants: [AbtestingVariant]
29+
public var configuration: AbtestingABTestConfiguration?
3030

3131
public init(
3232
abTestID: Int,
@@ -40,8 +40,8 @@ public struct ABTest: Codable, JSONEncodable {
4040
endAt: String,
4141
name: String,
4242
status: AbtestingStatus,
43-
variants: [Variant],
44-
configuration: ABTestConfiguration? = nil
43+
variants: [AbtestingVariant],
44+
configuration: AbtestingABTestConfiguration? = nil
4545
) {
4646
self.abTestID = abTestID
4747
self.clickSignificance = clickSignificance
@@ -94,8 +94,8 @@ public struct ABTest: Codable, JSONEncodable {
9494
}
9595
}
9696

97-
extension ABTest: Equatable {
98-
public static func ==(lhs: ABTest, rhs: ABTest) -> Bool {
97+
extension AbtestingABTest: Equatable {
98+
public static func ==(lhs: AbtestingABTest, rhs: AbtestingABTest) -> Bool {
9999
lhs.abTestID == rhs.abTestID &&
100100
lhs.clickSignificance == rhs.clickSignificance &&
101101
lhs.conversionSignificance == rhs.conversionSignificance &&
@@ -112,7 +112,7 @@ extension ABTest: Equatable {
112112
}
113113
}
114114

115-
extension ABTest: Hashable {
115+
extension AbtestingABTest: Hashable {
116116
public func hash(into hasher: inout Hasher) {
117117
hasher.combine(self.abTestID.hashValue)
118118
hasher.combine(self.clickSignificance?.hashValue)

Sources/Abtesting/Models/ABTestConfiguration.swift renamed to Sources/Abtesting/Models/AbtestingABTestConfiguration.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import Foundation
77
#endif
88

99
/// A/B test configuration.
10-
public struct ABTestConfiguration: Codable, JSONEncodable {
10+
public struct AbtestingABTestConfiguration: Codable, JSONEncodable {
1111
public var outliers: Outliers?
1212
public var emptySearch: EmptySearch?
13-
public var minimumDetectableEffect: MinimumDetectableEffect?
13+
public var minimumDetectableEffect: AbtestingMinimumDetectableEffect?
1414

1515
public init(
1616
outliers: Outliers? = nil,
1717
emptySearch: EmptySearch? = nil,
18-
minimumDetectableEffect: MinimumDetectableEffect? = nil
18+
minimumDetectableEffect: AbtestingMinimumDetectableEffect? = nil
1919
) {
2020
self.outliers = outliers
2121
self.emptySearch = emptySearch
@@ -38,15 +38,15 @@ public struct ABTestConfiguration: Codable, JSONEncodable {
3838
}
3939
}
4040

41-
extension ABTestConfiguration: Equatable {
42-
public static func ==(lhs: ABTestConfiguration, rhs: ABTestConfiguration) -> Bool {
41+
extension AbtestingABTestConfiguration: Equatable {
42+
public static func ==(lhs: AbtestingABTestConfiguration, rhs: AbtestingABTestConfiguration) -> Bool {
4343
lhs.outliers == rhs.outliers &&
4444
lhs.emptySearch == rhs.emptySearch &&
4545
lhs.minimumDetectableEffect == rhs.minimumDetectableEffect
4646
}
4747
}
4848

49-
extension ABTestConfiguration: Hashable {
49+
extension AbtestingABTestConfiguration: Hashable {
5050
public func hash(into hasher: inout Hasher) {
5151
hasher.combine(self.outliers?.hashValue)
5252
hasher.combine(self.emptySearch?.hashValue)

Sources/Abtesting/Models/ABTestResponse.swift renamed to Sources/Abtesting/Models/AbtestingABTestResponse.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Foundation
66
import Core
77
#endif
88

9-
public struct ABTestResponse: Codable, JSONEncodable {
9+
public struct AbtestingABTestResponse: Codable, JSONEncodable {
1010
/// Index name of the A/B test variant (case-sensitive).
1111
public var index: String
1212
/// Unique A/B test identifier.
@@ -38,15 +38,15 @@ public struct ABTestResponse: Codable, JSONEncodable {
3838
}
3939
}
4040

41-
extension ABTestResponse: Equatable {
42-
public static func ==(lhs: ABTestResponse, rhs: ABTestResponse) -> Bool {
41+
extension AbtestingABTestResponse: Equatable {
42+
public static func ==(lhs: AbtestingABTestResponse, rhs: AbtestingABTestResponse) -> Bool {
4343
lhs.index == rhs.index &&
4444
lhs.abTestID == rhs.abTestID &&
4545
lhs.taskID == rhs.taskID
4646
}
4747
}
4848

49-
extension ABTestResponse: Hashable {
49+
extension AbtestingABTestResponse: Hashable {
5050
public func hash(into hasher: inout Hasher) {
5151
hasher.combine(self.index.hashValue)
5252
hasher.combine(self.abTestID.hashValue)

Sources/Abtesting/Models/AbTestsVariant.swift renamed to Sources/Abtesting/Models/AbtestingAbTestsVariant.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Foundation
66
import Core
77
#endif
88

9-
public struct AbTestsVariant: Codable, JSONEncodable {
9+
public struct AbtestingAbTestsVariant: Codable, JSONEncodable {
1010
/// Index name of the A/B test variant (case-sensitive).
1111
public var index: String
1212
/// Percentage of search requests each variant receives.
@@ -36,15 +36,15 @@ public struct AbTestsVariant: Codable, JSONEncodable {
3636
}
3737
}
3838

39-
extension AbTestsVariant: Equatable {
40-
public static func ==(lhs: AbTestsVariant, rhs: AbTestsVariant) -> Bool {
39+
extension AbtestingAbTestsVariant: Equatable {
40+
public static func ==(lhs: AbtestingAbTestsVariant, rhs: AbtestingAbTestsVariant) -> Bool {
4141
lhs.index == rhs.index &&
4242
lhs.trafficPercentage == rhs.trafficPercentage &&
4343
lhs.description == rhs.description
4444
}
4545
}
4646

47-
extension AbTestsVariant: Hashable {
47+
extension AbtestingAbTestsVariant: Hashable {
4848
public func hash(into hasher: inout Hasher) {
4949
hasher.combine(self.index.hashValue)
5050
hasher.combine(self.trafficPercentage.hashValue)

0 commit comments

Comments
 (0)