Skip to content

chore: add deprecation warning for old tfms, fix packaging (box/box-codegen#733) #450

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

Closed
wants to merge 8 commits into from
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "c6650a9", "specHash": "a8825be", "version": "0.6.1" }
{ "engineHash": "fe574b1", "specHash": "a8825be", "version": "0.6.1" }
23 changes: 23 additions & 0 deletions Sources/Internal/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ public enum Utils {
/// - value: An instance of any type.
/// - Returns: A string representation of the provided parameter, or nil when this is not possible.
public static func toString(value: Any?) -> String? {
if let date = value as? Date {
if Utils.Dates.isDateOnly(date) {
return Utils.Dates.dateToString(date: date)
} else {
return Utils.Dates.dateTimeToString(dateTime: date)
}
}

if let parameterConvertible = value as? ParameterConvertible {
return parameterConvertible.paramValue
} else if let encodable = value as? Encodable {
Expand Down Expand Up @@ -170,6 +178,21 @@ public enum Utils {
public static func dateToString(date: Date) -> String {
dateFormatter.string(from: date)
}

/// Checks if the date is in date only format
/// - Parameters:
/// - date: Date
/// - Returns: True if the date is in date only format, otherwise false.
public static func isDateOnly(_ date: Date) -> Bool {
var calendar = Calendar.current
calendar.timeZone = TimeZone(secondsFromGMT: 0)!
let components = calendar.dateComponents([.hour, .minute, .second, .nanosecond], from: date)

return (components.hour == 0 &&
components.minute == 0 &&
components.second == 0 &&
components.nanosecond == 0)
}
}

/// Creates and returns a string created from the UUID
Expand Down
2 changes: 2 additions & 0 deletions Sources/Networking/BoxNetworkClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ public class BoxNetworkClient: NetworkClient {
let nonNullQueryParams: [String: String] = params.compactMapValues { $0?.paramValue }
var components = URLComponents(url: URL(string: url)!, resolvingAgainstBaseURL: true)!
components.queryItems = nonNullQueryParams.map { URLQueryItem(name: $0.key, value: $0.value) }
components.percentEncodedQuery = components.percentEncodedQuery?
.replacingOccurrences(of: "+", with: "%2B")

return components.url!
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/Networking/DefaultNetworkClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ public class DefaultNetworkClient: NetworkClient {
let nonNullQueryParams: [String: String] = params.compactMapValues { $0?.paramValue }
var components = URLComponents(url: URL(string: url)!, resolvingAgainstBaseURL: true)!
components.queryItems = nonNullQueryParams.map { URLQueryItem(name: $0.key, value: $0.value) }
components.percentEncodedQuery = components.percentEncodedQuery?
.replacingOccurrences(of: "+", with: "%2B")

return components.url!
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public enum AiAgentAllowedEntity: Codable {
}

default:
throw DecodingError.typeMismatch(AiAgentAllowedEntity.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public enum AiAgentAskOrAiAgentExtractOrAiAgentExtractStructuredOrAiAgentTextGen
}

default:
throw DecodingError.typeMismatch(AiAgentAskOrAiAgentExtractOrAiAgentExtractStructuredOrAiAgentTextGen.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum AiAgentAskOrAiAgentReference: Codable {
}

default:
throw DecodingError.typeMismatch(AiAgentAskOrAiAgentReference.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum AiAgentExtractOrAiAgentReference: Codable {
}

default:
throw DecodingError.typeMismatch(AiAgentExtractOrAiAgentReference.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum AiAgentExtractStructuredOrAiAgentReference: Codable {
}

default:
throw DecodingError.typeMismatch(AiAgentExtractStructuredOrAiAgentReference.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum AiAgentReferenceOrAiAgentTextGen: Codable {
}

default:
throw DecodingError.typeMismatch(AiAgentReferenceOrAiAgentTextGen.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public enum AiLlmEndpointParams: Codable {
}

default:
throw DecodingError.typeMismatch(AiLlmEndpointParams.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public enum AppItemEventSourceOrEventSourceOrFileOrFolderOrGenericSourceOrUser:
}

default:
throw DecodingError.typeMismatch(AppItemEventSourceOrEventSourceOrFileOrFolderOrGenericSourceOrUser.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand All @@ -62,8 +61,7 @@ public enum AppItemEventSourceOrEventSourceOrFileOrFolderOrGenericSourceOrUser:
}

default:
throw DecodingError.typeMismatch(AppItemEventSourceOrEventSourceOrFileOrFolderOrGenericSourceOrUser.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key itemType"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public enum FileBaseOrFolderBaseOrWebLinkBase: Codable {
}

default:
throw DecodingError.typeMismatch(FileBaseOrFolderBaseOrWebLinkBase.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum FileFullOrFolderFull: Codable {
}

default:
throw DecodingError.typeMismatch(FileFullOrFolderFull.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public enum FileFullOrFolderFullOrWebLink: Codable {
}

default:
throw DecodingError.typeMismatch(FileFullOrFolderFullOrWebLink.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public enum FileFullOrFolderMiniOrWebLink: Codable {
}

default:
throw DecodingError.typeMismatch(FileFullOrFolderMiniOrWebLink.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum FileMiniOrFolderMini: Codable {
}

default:
throw DecodingError.typeMismatch(FileMiniOrFolderMini.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
3 changes: 1 addition & 2 deletions Sources/Schemas/FileOrFolder/FileOrFolder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum FileOrFolder: Codable {
}

default:
throw DecodingError.typeMismatch(FileOrFolder.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public enum FileOrFolderOrWebLink: Codable {
}

default:
throw DecodingError.typeMismatch(FileOrFolderOrWebLink.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum GroupMiniOrUserCollaborations: Codable {
}

default:
throw DecodingError.typeMismatch(GroupMiniOrUserCollaborations.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public enum IntegrationMappingPartnerItemSlackUnion: Codable {
}

default:
throw DecodingError.typeMismatch(IntegrationMappingPartnerItemSlackUnion.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public enum IntegrationMappingPartnerItemTeamsUnion: Codable {
}

default:
throw DecodingError.typeMismatch(IntegrationMappingPartnerItemTeamsUnion.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public enum KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkil
}

default:
throw DecodingError.typeMismatch(KeywordSkillCardOrStatusSkillCardOrTimelineSkillCardOrTranscriptSkillCard.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key skillCardType"))

break
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public enum SearchResultsOrSearchResultsWithSharedLinks: Codable {
}

default:
throw DecodingError.typeMismatch(SearchResultsOrSearchResultsWithSharedLinks.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type"))

break
}
}

Expand Down
Loading
Loading