Skip to content

Commit 7554fde

Browse files
makonigevartosky
andauthored
2.0.2 (#28)
* swift-docc-plugin 1.3.0 * async-http-client 1.19.0 * replaced deprecated .createNew with the new .singleton * Adding _find capability. (#13) * docs * tabs * renames * added test for find method with body * docs added * findError added * tests renamed * added test for find method with generic type * docs * README updated * updated dependencies * docs updated * try Swift 5.7.1 * Update build-ubuntu.yml * Swift 5.7.3 * Revert "Swift 5.7.3" This reverts commit ab8f67a. * updated dependencies * Docs updated * Delete .github/workflows/CodeQL.yml * dependencies updated * fixed when update method didn’t use passed dateEncodingStrategy * noData error added * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * … * migrating to new HTTPClientRequest from HTTPClient.Request wip * rename * tests updated * auth fixed * collect body bytes before returning response * param renamed to make keep backward compatibility with old methods * marking old find as deprecated * private * deprecated message * renames * moved deprecations * docs * docs * added Codable to CouchDBRepresentable protocol * added RowsResponse model * docs * Vapor tutorial updated * docs * docs and refactoring * docs and refactoring * Tutorials updated * docs * platforms list updated * minimum swift version 5.8 * workflow updated * Update build-ubuntu.yml * Update build-macos.yml * import NIOFoundationCompat to fix building on Ubuntu * using async-http-client from 1.21.0. Not calling http * Using HTTPClient.shared if eventLoopGroup not provided. No more calls httpClient.syncShutdown() if using shared singleton * docs updated * docs updated * Vapor tutorial updated * A SwiftUI tutorial * tutorial fixed * updated dependencies * Package.resolved * docs updated * userName param is now required for CouchDB init * cleanup * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * dependencices updated * updated swift-docc-plugin URL. Updated dependencies to latest versions. * Update build-ubuntu.yml * dependencies updated * deleted deprecated methods * Sendable conformance * swift-format added * formatting * formatting * revert sendable * updated dependencies * Sensable conformance * updated CouchDBRepresentable protocol * Sendable conformance * Strict concurrency implemented * Swift 6 * docs updated * errors and docs * docs * docs * docs wip * docs * wip * wip * docs * docs * get only _rev * tutorials updated * docs * Update README.md * Update README.md * updated GitHub actions configs * dependencies updated * updated docs * code formatting * refactoring * localized error messages * Added error messages translations * More translations * fixes for Linux --------- Co-authored-by: Gregório Gevartosky Torrezan <[email protected]>
1 parent fb6e880 commit 7554fde

File tree

4 files changed

+2619
-77
lines changed

4 files changed

+2619
-77
lines changed

Package.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import PackageDescription
55

66
let package = Package(
77
name: "couchdb-vapor",
8+
defaultLocalization: "en",
89
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)],
910
products: [
1011
// Products define the executables and libraries a package produces, and make them visible to other packages.
@@ -21,7 +22,11 @@ let package = Package(
2122
name: "CouchDBClient",
2223
dependencies: [
2324
.product(name: "AsyncHTTPClient", package: "async-http-client")
24-
]),
25+
],
26+
resources: [
27+
.process("Localizable.xcstrings")
28+
]
29+
),
2530
.testTarget(
2631
name: "CouchDBClientTests",
2732
dependencies: ["CouchDBClient"])

Sources/CouchDBClient/CouchDBClient.swift

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -11,82 +11,6 @@ import NIOHTTP1
1111
import NIOFoundationCompat
1212
import AsyncHTTPClient
1313

14-
/// An enumeration representing the various errors that can occur when interacting with CouchDB through a client.
15-
/// This enum conforms to both `Error` and `Sendable`, making it suitable for error handling and thread-safe operations.
16-
public enum CouchDBClientError: Error, Sendable {
17-
/// The `id` property is empty or missing in the provided document.
18-
/// This error indicates that the document does not have a valid identifier.
19-
case idMissing
20-
21-
/// The `_rev` property is empty or missing in the provided document.
22-
/// This error indicates that the document does not have a valid revision token for concurrency control.
23-
case revMissing
24-
25-
/// The `GET` request was unsuccessful.
26-
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
27-
case getError(error: CouchDBError)
28-
29-
/// The `INSERT` request was unsuccessful.
30-
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
31-
case insertError(error: CouchDBError)
32-
33-
/// The `DELETE` request was unsuccessful.
34-
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
35-
case deleteError(error: CouchDBError)
36-
37-
/// The `UPDATE` request was unsuccessful.
38-
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
39-
case updateError(error: CouchDBError)
40-
41-
/// The `FIND` request was unsuccessful.
42-
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
43-
case findError(error: CouchDBError)
44-
45-
/// The response from CouchDB was unrecognized or could not be processed.
46-
/// This error indicates that the response was not in the expected format.
47-
case unknownResponse
48-
49-
/// Authentication failed due to incorrect username or password.
50-
/// This error suggests that the provided credentials were invalid.
51-
case unauthorized
52-
53-
/// The response body is missing required data.
54-
/// This error indicates that the server response lacked the expected content.
55-
case noData
56-
}
57-
58-
/// Extends the `CouchDBClientError` enumeration to provide localized error descriptions.
59-
/// This extension conforms to the `LocalizedError` protocol, offering user-friendly messages
60-
/// that describe the nature of each error in detail.
61-
extension CouchDBClientError: LocalizedError {
62-
/// A textual description of the error, tailored for user-facing contexts.
63-
/// The message provides specific details about the error type and underlying cause.
64-
public var errorDescription: String? {
65-
switch self {
66-
case .idMissing:
67-
return "The 'id' property is empty or missing in the provided document."
68-
case .revMissing:
69-
return "The '_rev' property is empty or missing in the provided document."
70-
case .getError(let error):
71-
return "The GET request wasn't successful: \(error.localizedDescription)"
72-
case .insertError(let error):
73-
return "The INSERT request wasn't successful: \(error.localizedDescription)"
74-
case .updateError(let error):
75-
return "The UPDATE request wasn't successful: \(error.localizedDescription)"
76-
case .deleteError(let error):
77-
return "The DELETE request wasn't successful: \(error.localizedDescription)"
78-
case .findError(let error):
79-
return "The FIND request wasn't successful: \(error.localizedDescription)"
80-
case .unknownResponse:
81-
return "The response from CouchDB was unrecognized or invalid."
82-
case .unauthorized:
83-
return "Authentication failed due to an incorrect username or password."
84-
case .noData:
85-
return "The response body is missing the expected data."
86-
}
87-
}
88-
}
89-
9014
/// A CouchDB client actor with methods using Swift Concurrency.
9115
public actor CouchDBClient {
9216
/// A configuration model for CouchDB client setup.

0 commit comments

Comments
 (0)