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

Refactor HTTP clients: separate admin and client #76

Merged
merged 3 commits into from
Aug 22, 2018

Conversation

mederic-p
Copy link
Contributor

Closes #75

Overview

This PR separates the client and admin HTTP api clients in order to avoid conflicts later when implementing the Admin API.

Changes

  • Added HTTPClientAPI and HTTPAdminAPI classes that subclass the base HTTPAPI class.

Implementation Details

This split is necessary to avoid future conflicts. For now if we want to retrieve a user we can use the function:

public static func getCurrent(using client: HTTPClient, callback: @escaping User.RetrieveRequestCallback) -> User.RetrieveRequest? {}

The problem is that this method will be in both client and admin APIs so we need a way to differentiate it.

The new implementation will be:

public static func getCurrent(using client: HTTPClientAPI, callback: @escaping User.RetrieveRequestCallback) -> User.RetrieveRequest? {}

for the client API, and

public static func getCurrent(using client: HTTPAdminAPI, callback: @escaping User.RetrieveRequestCallback) -> User.RetrieveRequest? {}

for the admin API.

Usage

The readme has been updated to reflect the changes. The only difference is the initialization of the client that we now do like this:

let client = HTTPClientAPI(config: config)

@ghost ghost assigned mederic-p Aug 17, 2018
@ghost ghost added the s2/wip 🚧 This is still being worked on label Aug 17, 2018
@mederic-p mederic-p added kind/refactor ⚙️ and removed s2/wip 🚧 This is still being worked on labels Aug 17, 2018
@ghost ghost added the s2/wip 🚧 This is still being worked on label Aug 17, 2018
@mederic-p mederic-p removed the s2/wip 🚧 This is still being worked on label Aug 19, 2018
@ghost ghost added the s2/wip 🚧 This is still being worked on label Aug 22, 2018
@mederic-p mederic-p changed the base branch from 73-improve-travis-config to master August 22, 2018 07:20
@mederic-p mederic-p merged commit 4d65a80 into master Aug 22, 2018
@ghost ghost removed the s2/wip 🚧 This is still being worked on label Aug 22, 2018
@mederic-p mederic-p deleted the 75-refactor-http-clients branch August 22, 2018 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants