Skip to content

Commit

Permalink
Enable mocking entire api client
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlocke committed Dec 16, 2023
1 parent 4b66501 commit 2dc1402
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Source/SwiftyDropbox/Shared/Generated/Base.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import Foundation

public class DropboxBase {
public class DropboxBase: DropboxTransportClientOwning {
public var client: DropboxTransportClient

/// Routes within the account namespace. See AccountRoutes for details.
Expand Down Expand Up @@ -34,7 +34,7 @@ public class DropboxBase {
/// Routes within the users namespace. See UsersRoutes for details.
public var users: UsersRoutes!

public init(client: DropboxTransportClient) {
public required init(client: DropboxTransportClient) {
self.client = client

self.account = AccountRoutes(client: client)
Expand Down
4 changes: 2 additions & 2 deletions Source/SwiftyDropbox/Shared/Generated/BaseApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

import Foundation

public class DropboxAppBase {
public class DropboxAppBase: DropboxTransportClientOwning {
public var client: DropboxTransportClient

/// Routes within the auth namespace. See AuthAppAuthRoutes for details.
public var auth: AuthAppAuthRoutes!
/// Routes within the check namespace. See CheckAppAuthRoutes for details.
public var check: CheckAppAuthRoutes!

public init(client: DropboxTransportClient) {
public required init(client: DropboxTransportClient) {
self.client = client

self.auth = AuthAppAuthRoutes(client: client)
Expand Down
4 changes: 2 additions & 2 deletions Source/SwiftyDropbox/Shared/Generated/BaseTeam.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

import Foundation

public class DropboxTeamBase {
public class DropboxTeamBase: DropboxTransportClientOwning {
public var client: DropboxTransportClient

/// Routes within the team namespace. See TeamRoutes for details.
public var team: TeamRoutes!

public init(client: DropboxTransportClient) {
public required init(client: DropboxTransportClient) {
self.client = client

self.team = TeamRoutes(client: client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public class DropboxAppClient: DropboxAppBase {
self.transportClient = transportClient
super.init(client: transportClient)
}

/// Initializer used by DropboxTransportClientOwning in tests.
///
/// - Parameter client: The underlying DropboxTransportClient to make API calls.
required convenience init(client: DropboxTransportClient) {
self.init(transportClient: client)
}

}
7 changes: 7 additions & 0 deletions Source/SwiftyDropbox/Shared/Handwritten/DropboxClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ public class DropboxClient: DropboxBase {
super.init(client: transportClient)
}

/// Initializer used by DropboxTransportClientOwning in tests.
///
/// - Parameter client: The underlying DropboxTransportClient to make API calls.
required convenience init(client: DropboxTransportClient) {
self.init(transportClient: client)
}

/// Creates a new DropboxClient instance with the given path root.
///
/// - Parameter pathRoot: User's path root.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public class DropboxTeamClient: DropboxTeamBase {
super.init(client: transportClient)
}

/// Initializer used by DropboxTransportClientOwning in tests.
///
/// - Parameter client: The underlying DropboxTransportClient to make API calls.
required convenience init(client: DropboxTransportClient) {
self.init(transportClient: client)
}

/// Creates a new DropboxClient instance for the team member id.
///
/// - Parameter memberId: Team member id.
Expand Down
2 changes: 1 addition & 1 deletion stone

0 comments on commit 2dc1402

Please sign in to comment.