Skip to content

Commit 40f3aec

Browse files
Merge pull request #649 from algolia/develop
Release 8.0.1
2 parents fa9a261 + 31a954e commit 40f3aec

27 files changed

+156
-47
lines changed

Sources/AlgoliaSearchClient/Client/Search/SearchClient.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import Foundation
99

10+
typealias Client = SearchClient
11+
1012
/// Client to perform operations on indices.
1113
public struct SearchClient: Credentials {
1214

Sources/AlgoliaSearchClient/Models/Common/UserToken.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ public struct UserToken: StringWrapper, URLEncodable {
1111

1212
public let rawValue: String
1313

14-
private let allowedCharacters: CharacterSet = CharacterSet.alphanumerics.union(.init(charactersIn: "_-"))
14+
private let allowedCharacters: CharacterSet = CharacterSet.alphanumerics.union(.init(charactersIn: "._-"))
1515

1616
public init(rawValue: String) {
1717
assert(!rawValue.isEmpty, "UserToken can't be empty")
18-
assert(rawValue.count <= 64, "UserToken length can't be superior to 64 characters.")
18+
assert(rawValue.count <= 64, "UserToken length can't be superior to 64 characters. Input: \(rawValue)")
1919
let containsOnlyAllowedCharacters = rawValue.trimmingCharacters(in: allowedCharacters).isEmpty
20-
assert(containsOnlyAllowedCharacters, "UserToken allows only characters of type [a-zA-Z0-9_-]")
20+
assert(containsOnlyAllowedCharacters, "UserToken allows only characters of type [a-zA-Z0-9_-.]. Input: \(rawValue)")
2121
self.rawValue = rawValue
2222
}
2323

Sources/AlgoliaSearchClient/Models/Search/Indexing/Scope.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public struct ScopeComponent: StringOption & ProvidingCustomOption {
5555

5656
public let rawValue: String
5757

58-
public init(rawValue: RawValue) {
58+
public init(rawValue: String) {
5959
self.rawValue = rawValue
6060
}
6161

Sources/AlgoliaSearchClient/Models/Search/Response/SearchResponse/Auxiliary/Alternative/AlternativeType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public struct AlternativeType: StringOption & ProvidingCustomOption {
1111

1212
public let rawValue: String
1313

14-
public init(rawValue: RawValue) {
14+
public init(rawValue: String) {
1515
self.rawValue = rawValue
1616
}
1717

Sources/AlgoliaSearchClient/Models/Task/Common/TaskStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public struct TaskStatus: StringOption & ProvidingCustomOption {
1111

1212
public let rawValue: String
1313

14-
public init(rawValue: RawValue) {
14+
public init(rawValue: String) {
1515
self.rawValue = rawValue
1616
}
1717

Tests/AlgoliaSearchClientTests/Helper/XCTest+Codable.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func AssertDecode<T: Codable & Equatable>(_ input: JSON, expected: T, file: Stat
2424
jsonDecoder.dateDecodingStrategy = .swiftAPIClient
2525
let decoded = try jsonDecoder.decode(T.self, from: data)
2626

27-
XCTAssertEqual(expected, decoded, file: file, line: line)
27+
XCTAssertEqual(expected, decoded, file: (file), line: line)
2828
}
2929

3030
func AssertDecode<T: Codable>(_ input: JSON, expected: T, file: StaticString = #file, line: UInt = #line) throws {
@@ -40,7 +40,7 @@ func AssertDecode<T: Codable>(_ input: JSON, expected: T, file: StaticString = #
4040
let decodedJSON = try JSON(decoded)
4141
let expectedJSON = try JSON(expected)
4242

43-
XCTAssertEqual(expectedJSON, decodedJSON, file: file, line: line)
43+
XCTAssertEqual(expectedJSON, decodedJSON, file: (file), line: line)
4444
}
4545

4646
@discardableResult func AssertDecode<T: Decodable>(jsonFilename filename: String, expected: T.Type, file: StaticString = #file, line: UInt = #line) throws -> T {
@@ -58,14 +58,14 @@ func AssertEncode<T: Encodable>(_ value: T, expected: JSON, file: StaticString =
5858
jsonDecoder.dateDecodingStrategy = .swiftAPIClient
5959
let jsonFromValue = try jsonDecoder.decode(JSON.self, from: valueData)
6060

61-
XCTAssertEqual(jsonFromValue, expected, file: file, line: line)
61+
XCTAssertEqual(jsonFromValue, expected, file: (file), line: line)
6262
}
6363

6464
func AssertEquallyEncoded<A: Encodable, B: Encodable>(_ l: A, _ r: B, file: StaticString = #file, line: UInt = #line) throws {
6565
let encoder = JSONEncoder()
6666
encoder.dateEncodingStrategy = .swiftAPIClient
6767
let lData = try encoder.encode(l)
6868
let rData = try encoder.encode(r)
69-
XCTAssertEqual(lData, rData, file: file, line: line)
69+
XCTAssertEqual(lData, rData, file: (file), line: line)
7070
}
7171

Tests/AlgoliaSearchClientTests/Helper/XCTest+HTTPError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import XCTest
1212
func AssertThrowsHTTPError<T>(_ body: @autoclosure () throws -> T, statusCode: Int, file: StaticString = #file, line: UInt = #line) throws {
1313
do {
1414
let _ = try body()
15-
XCTFail("Expected HTTP error", file: file, line: line)
15+
XCTFail("Expected HTTP error", file: (file), line: line)
1616
} catch let error {
1717
guard let httpError = error as? HTTPError, httpError.statusCode == statusCode else {
1818
throw error

Tests/AlgoliaSearchClientTests/Helper/XCTest+Wait.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func AssertWait<W: AnyWaitable>(_ waitable: W, timeout: TimeInterval = defaultWa
1616
try waitable.wait(timeout: 20, requestOptions: nil)
1717
} catch let error {
1818
let isTimeoutError = error as? WaitTask.Error == WaitTask.Error.timeout
19-
try XCTSkipIf(isTimeoutError, file: file, line: line)
19+
try XCTSkipIf(isTimeoutError, file: (file), line: line)
2020
throw error
2121
}
2222
}

Tests/AlgoliaSearchClientTests/Integration/APIKeysIntegrationTests.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ class APIKeysIntegrationTests: OnlineTestCase {
1717

1818
var keyToDelete: APIKey?
1919

20-
func testAPIKeys() throws {
20+
override var retryableTests: [() throws -> Void] {
21+
[apiKeys]
22+
}
23+
24+
25+
func apiKeys() throws {
2126

2227
let parameters = APIKeyParameters(ACLs: [.search])
2328
.set(\.description, to: "A description")

Tests/AlgoliaSearchClientTests/Integration/AnalyticsIntegrationsTests.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@ import XCTest
1111

1212
class AnalyticsIntegrationTests: OnlineTestCase {
1313

14-
func testBrowsing() throws {
14+
override var retryableTests: [() throws -> Void] {
15+
[
16+
browsing,
17+
abTesting,
18+
aaTesting
19+
]
20+
}
21+
22+
func browsing() throws {
1523
let analyticsClient = AnalyticsClient(appID: client.applicationID, apiKey: client.apiKey)
1624
let _ = try analyticsClient.browseAllABTests(hitsPerPage: 3)
1725
}
1826

19-
func testABTesting() throws {
27+
func abTesting() throws {
2028

2129
let analyticsClient = AnalyticsClient(appID: client.applicationID, apiKey: client.apiKey)
2230

@@ -60,7 +68,7 @@ class AnalyticsIntegrationTests: OnlineTestCase {
6068
try AssertThrowsHTTPError(try analyticsClient.getABTest(withID: creation.wrapped.abTestID), statusCode: 404)
6169
}
6270

63-
func testAATesting() throws {
71+
func aaTesting() throws {
6472

6573
let analyticsClient = AnalyticsClient(appID: client.applicationID, apiKey: client.apiKey)
6674
let index = client.index(withName: "aa_testing")

0 commit comments

Comments
 (0)