From d2f7d5a40c2bd31d47d0e685edbe401b55f15be9 Mon Sep 17 00:00:00 2001 From: dankinsoid <30962149+dankinsoid@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:59:06 +0400 Subject: [PATCH] 1.33.0 --- Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift | 5 +++-- Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift b/Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift index 2fe7424..0a97291 100644 --- a/Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift +++ b/Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift @@ -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(_ components: [T], percentEncoded: Bool = false) -> BuildResult { + func path(_ components: [String], percentEncoded: Bool = false) -> BuildResult { configureURLComponents { guard !components.isEmpty else { return } let items = components.flatMap { diff --git a/Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift b/Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift index 2466b87..195e96e 100644 --- a/Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift +++ b/Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift @@ -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(_ components: [T], percentEncoded: Bool = false) -> Self { + func path(_ components: [String], percentEncoded: Bool = false) -> Self { modifyRequest { $0 = $0.path(components, percentEncoded: percentEncoded) }