Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[swift6] Change Response to struct #20185

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ extension NullEncodable: Codable where Wrapped: Codable {
case generalError(Error)
}

{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class Response<T> {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct Response<T> {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let statusCode: Int
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let header: [String: String]
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} let body: T
Expand All @@ -103,7 +103,7 @@ extension NullEncodable: Codable where Wrapped: Codable {
self.bodyData = bodyData
}

{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,7 +113,8 @@ extension NullEncodable: Codable where Wrapped: Codable {
}
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}{{#useAlamofire}}
}
extension Response : Sendable where T : Sendable {}{{#useAlamofire}}

/// Type-erased ResponseSerializer
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -103,7 +103,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -114,6 +114,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

/// Type-erased ResponseSerializer
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -103,7 +103,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -114,6 +114,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

/// Type-erased ResponseSerializer
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

internal class Response<T> {
internal struct Response<T> {
internal let statusCode: Int
internal let header: [String: String]
internal let body: T
Expand All @@ -102,7 +102,7 @@ internal class Response<T> {
self.bodyData = bodyData
}

internal convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
internal init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ internal class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

internal final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public enum DecodableRequestBuilderError: Error {
case generalError(Error)
}

open class Response<T> {
public struct Response<T> {
public let statusCode: Int
public let header: [String: String]
public let body: T
Expand All @@ -102,7 +102,7 @@ open class Response<T> {
self.bodyData = bodyData
}

public convenience init(response: HTTPURLResponse, body: T, bodyData: Data?) {
public init(response: HTTPURLResponse, body: T, bodyData: Data?) {
let rawHeader = response.allHeaderFields
var responseHeader = [String: String]()
for (key, value) in rawHeader {
Expand All @@ -113,6 +113,7 @@ open class Response<T> {
self.init(statusCode: response.statusCode, header: responseHeader, body: body, bodyData: bodyData)
}
}
extension Response : Sendable where T : Sendable {}

public final class RequestTask: @unchecked Sendable {
private let lock = NSRecursiveLock()
Expand Down
Loading