Skip to content

Commit

Permalink
1.33.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dankinsoid committed Jul 23, 2024
1 parent aceaa42 commit d2f7d5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,17 @@ public extension URLComponentBuilder {
/// - components: A variadic list of components that conform to `CustomStringConvertible`.
/// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`.
/// - Returns: An instance with updated path.
@_disfavoredOverload
func path(_ components: any CustomStringConvertible..., percentEncoded: Bool = false) -> BuildResult {
path(components.map(\.description), percentEncoded: percentEncoded)
}

/// Appends an array of path components to the URL.
/// - Parameters:
/// - components: An array of components that conform to `CustomStringConvertible`.
/// - components: An array of components.
/// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`.
/// - Returns: An instance with updated path.
func path<T: CustomStringConvertible>(_ components: [T], percentEncoded: Bool = false) -> BuildResult {
func path(_ components: [String], percentEncoded: Bool = false) -> BuildResult {
configureURLComponents {
guard !components.isEmpty else { return }
let items = components.flatMap {
Expand Down
5 changes: 3 additions & 2 deletions Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ public extension RequestBuilder where Request == HTTPRequestComponents {
/// - components: A variadic list of components that conform to `CustomStringConvertible`.
/// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`.
/// - Returns: An instance with updated path.
@_disfavoredOverload
func path(_ components: any CustomStringConvertible..., percentEncoded: Bool = false) -> Self {
path(components.map(\.description), percentEncoded: percentEncoded)
}

/// Appends an array of path components to the URL of the request.
/// - Parameters:
/// - components: An array of components that conform to `CustomStringConvertible`.
/// - components: An array of components.
/// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`.
/// - Returns: An instance with updated path.
func path<T: CustomStringConvertible>(_ components: [T], percentEncoded: Bool = false) -> Self {
func path(_ components: [String], percentEncoded: Bool = false) -> Self {
modifyRequest {
$0 = $0.path(components, percentEncoded: percentEncoded)
}
Expand Down

0 comments on commit d2f7d5a

Please sign in to comment.