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

Add missing API calls: manage hosted repositories, get integrations #48

Merged
merged 16 commits into from
Jun 30, 2015
Merged
Changes from 1 commit
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
32 changes: 32 additions & 0 deletions XcodeServerSDK/XcodeServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,38 @@ public extension XcodeServer {
}
}

/**
XCS API call for retrievieng specified Integration.

- parameter integrationId: ID of integration which is about to be retrieved.
- parameter completion:
- Optional retrieved integration.
- Optional operation error.
*/
public func retrieveIntegration(integrationId: String, completion: (integration: Integration?, error: NSError?) -> ()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not insistent on keeping it this way, but so far I've tried to name most of these API calls with words starting with get, post etc, to sort of mirror the HTTP verb convention. There are exceptions, like createBot (which could just be postBot), but I think, for the sake of users' autocompletion, that we should keep the first words as predictable as possible. Here I'd name it just getIntegrations. Whadaya think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


let params = [
"integration": integrationId
]

self.sendRequestWithMethod(.GET, endpoint: .Integrations, params: params, query: nil, body: nil) {
(response, body, error) -> () in

guard error == nil else {
completion(integration: nil, error: error)
return
}

guard let integrationBody = body as? NSDictionary else {
completion(integration: nil, error: Error.withInfo("Wrong body \(body)"))
return
}

let integration = Integration(json: integrationBody)
completion(integration: integration, error: nil)
}
}

public func cancelIntegration(integrationId: String, completion: (success: Bool, error: NSError?) -> ()) {

let params = [
Expand Down