Skip to content

Commit

Permalink
1.32.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dankinsoid committed Jul 23, 2024
1 parent 43f1c65 commit aceaa42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public extension URLComponentBuilder {
/// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`.
/// - Returns: An instance with updated path.
func path(_ components: any CustomStringConvertible..., percentEncoded: Bool = false) -> BuildResult {
path(components, percentEncoded: percentEncoded)
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`.
/// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`.
/// - Returns: An instance with updated path.
func path(_ components: [any CustomStringConvertible], percentEncoded: Bool = false) -> BuildResult {
func path<T: CustomStringConvertible>(_ components: [T], percentEncoded: Bool = false) -> BuildResult {
configureURLComponents {
guard !components.isEmpty else { return }
let items = components.flatMap {
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public extension RequestBuilder where Request == HTTPRequestComponents {
/// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`.
/// - Returns: An instance with updated path.
func path(_ components: any CustomStringConvertible..., percentEncoded: Bool = false) -> Self {
path(components, percentEncoded: percentEncoded)
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`.
/// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`.
/// - Returns: An instance with updated path.
func path(_ components: [any CustomStringConvertible], percentEncoded: Bool = false) -> Self {
func path<T: CustomStringConvertible>(_ components: [T], percentEncoded: Bool = false) -> Self {
modifyRequest {
$0 = $0.path(components, percentEncoded: percentEncoded)
}
Expand Down

0 comments on commit aceaa42

Please sign in to comment.