Skip to content

Commit

Permalink
Run codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlocke committed Dec 15, 2023
1 parent 7bb3b27 commit e89163a
Show file tree
Hide file tree
Showing 37 changed files with 11,691 additions and 3,985 deletions.
32 changes: 24 additions & 8 deletions Source/SwiftyDropbox/Shared/Generated/Account.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ import Foundation
/// Datatypes and serializers for the account namespace
public class Account {
/// The PhotoSourceArg union
public enum PhotoSourceArg: CustomStringConvertible {
public enum PhotoSourceArg: CustomStringConvertible, JSONRepresentable {
/// Image data in base64-encoded bytes.
case base64Data(String)
/// An unspecified error.
case other

func json() throws -> JSON {
try PhotoSourceArgSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try PhotoSourceArgSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for PhotoSourceArg: \(error)"
}
}
}
Expand Down Expand Up @@ -59,18 +63,22 @@ public class Account {
}

/// The SetProfilePhotoArg struct
public class SetProfilePhotoArg: CustomStringConvertible {
public class SetProfilePhotoArg: CustomStringConvertible, JSONRepresentable {
/// Image to set as the user's new profile photo.
public let photo: Account.PhotoSourceArg
public init(photo: Account.PhotoSourceArg) {
self.photo = photo
}

func json() throws -> JSON {
try SetProfilePhotoArgSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try SetProfilePhotoArgSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for SetProfilePhotoArg: \(error)"
}
}
}
Expand All @@ -96,7 +104,7 @@ public class Account {
}

/// The SetProfilePhotoError union
public enum SetProfilePhotoError: CustomStringConvertible {
public enum SetProfilePhotoError: CustomStringConvertible, JSONRepresentable {
/// File cannot be set as profile photo.
case fileTypeError
/// File cannot exceed 10 MB.
Expand All @@ -110,11 +118,15 @@ public class Account {
/// An unspecified error.
case other

func json() throws -> JSON {
try SetProfilePhotoErrorSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try SetProfilePhotoErrorSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for SetProfilePhotoError: \(error)"
}
}
}
Expand Down Expand Up @@ -177,19 +189,23 @@ public class Account {
}

/// The SetProfilePhotoResult struct
public class SetProfilePhotoResult: CustomStringConvertible {
public class SetProfilePhotoResult: CustomStringConvertible, JSONRepresentable {
/// URL for the photo representing the user, if one is set.
public let profilePhotoUrl: String
public init(profilePhotoUrl: String) {
stringValidator()(profilePhotoUrl)
self.profilePhotoUrl = profilePhotoUrl
}

func json() throws -> JSON {
try SetProfilePhotoResultSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try SetProfilePhotoResultSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for SetProfilePhotoResult: \(error)"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/SwiftyDropbox/Shared/Generated/AccountRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import Foundation

/// Routes for the account namespace
/// For Objective-C compatible routes see DBAccountRoutes
public class AccountRoutes {
public class AccountRoutes: DropboxTransportClientOwning {
public let client: DropboxTransportClient
init(client: DropboxTransportClient) {
required init(client: DropboxTransportClient) {
self.client = client
}

Expand Down
48 changes: 36 additions & 12 deletions Source/SwiftyDropbox/Shared/Generated/Async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ public class Async {
/// Result returned by methods that launch an asynchronous job. A method who may either launch an asynchronous job,
/// or complete the request synchronously, can use this union by extending it, and adding a 'complete' field
/// with the type of the synchronous response. See LaunchEmptyResult for an example.
public enum LaunchResultBase: CustomStringConvertible {
public enum LaunchResultBase: CustomStringConvertible, JSONRepresentable {
/// This response indicates that the processing is asynchronous. The string is an id that can be used to obtain
/// the status of the asynchronous job.
case asyncJobId(String)

func json() throws -> JSON {
try LaunchResultBaseSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try LaunchResultBaseSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for LaunchResultBase: \(error)"
}
}
}
Expand Down Expand Up @@ -55,18 +59,22 @@ public class Async {

/// Result returned by methods that may either launch an asynchronous job or complete synchronously. Upon
/// synchronous completion of the job, no additional information is returned.
public enum LaunchEmptyResult: CustomStringConvertible {
public enum LaunchEmptyResult: CustomStringConvertible, JSONRepresentable {
/// This response indicates that the processing is asynchronous. The string is an id that can be used to obtain
/// the status of the asynchronous job.
case asyncJobId(String)
/// The job finished synchronously and successfully.
case complete

func json() throws -> JSON {
try LaunchEmptyResultSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try LaunchEmptyResultSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for LaunchEmptyResult: \(error)"
}
}
}
Expand Down Expand Up @@ -106,19 +114,23 @@ public class Async {
}

/// Arguments for methods that poll the status of an asynchronous job.
public class PollArg: CustomStringConvertible {
public class PollArg: CustomStringConvertible, JSONRepresentable {
/// Id of the asynchronous job. This is the value of a response returned from the method that launched the job.
public let asyncJobId: String
public init(asyncJobId: String) {
stringValidator(minLength: 1)(asyncJobId)
self.asyncJobId = asyncJobId
}

func json() throws -> JSON {
try PollArgSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try PollArgSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for PollArg: \(error)"
}
}
}
Expand Down Expand Up @@ -146,15 +158,19 @@ public class Async {
/// Result returned by methods that poll for the status of an asynchronous job. Unions that extend this union should
/// add a 'complete' field with a type of the information returned upon job completion. See PollEmptyResult for
/// an example.
public enum PollResultBase: CustomStringConvertible {
public enum PollResultBase: CustomStringConvertible, JSONRepresentable {
/// The asynchronous job is still in progress.
case inProgress

func json() throws -> JSON {
try PollResultBaseSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try PollResultBaseSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for PollResultBase: \(error)"
}
}
}
Expand Down Expand Up @@ -188,17 +204,21 @@ public class Async {

/// Result returned by methods that poll for the status of an asynchronous job. Upon completion of the job, no
/// additional information is returned.
public enum PollEmptyResult: CustomStringConvertible {
public enum PollEmptyResult: CustomStringConvertible, JSONRepresentable {
/// The asynchronous job is still in progress.
case inProgress
/// The asynchronous job has completed successfully.
case complete

func json() throws -> JSON {
try PollEmptyResultSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try PollEmptyResultSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for PollEmptyResult: \(error)"
}
}
}
Expand Down Expand Up @@ -237,7 +257,7 @@ public class Async {
}

/// Error returned by methods for polling the status of asynchronous job.
public enum PollError: CustomStringConvertible {
public enum PollError: CustomStringConvertible, JSONRepresentable {
/// The job ID is invalid.
case invalidAsyncJobId
/// Something went wrong with the job on Dropbox's end. You'll need to verify that the action you were taking
Expand All @@ -246,11 +266,15 @@ public class Async {
/// An unspecified error.
case other

func json() throws -> JSON {
try PollErrorSerializer().serialize(self)
}

public var description: String {
do {
return "\(SerializeUtil.prepareJSONForSerialization(try PollErrorSerializer().serialize(self)))"
} catch {
return "\(self)"
return "Failed to generate description for PollError: \(error)"
}
}
}
Expand Down
Loading

0 comments on commit e89163a

Please sign in to comment.