This repository was archived by the owner on Mar 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI.swift
More file actions
35 lines (32 loc) · 1.46 KB
/
API.swift
File metadata and controls
35 lines (32 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// API.swift
// GithubIssues
//
// Created by Leonard on 2017. 9. 10..
// Copyright © 2017년 intmain. All rights reserved.
//
import Foundation
import Alamofire
import SwiftyJSON
struct App {
static var api: API = {
switch GlobalState.instance.serviceType {
case .github:
return GithubAPI()
case .bitbucket:
return BitbucketAPI()
}
}()
}
protocol API {
typealias IssueResponsesHandler = (DataResponse<[Model.Issue]>) -> Void
typealias CommentResponsesHandler = (DataResponse<[Model.Comment]>) -> Void
func getToekn(handler: @escaping (() -> Void))
func tokenRefresh(handler: @escaping (() -> Void))
func repoIssues(owner: String, repo: String) -> (Int, @escaping IssueResponsesHandler) -> Void
func issueComment(owner: String, repo: String, number: Int) -> (Int, @escaping CommentResponsesHandler) -> Void
func createComment(owner: String, repo: String, number: Int, comment: String, completionHandler: @escaping (DataResponse<Model.Comment>) -> Void )
func createIssue(owner: String, repo: String, title: String, body: String, completionHandler: @escaping (DataResponse<Model.Issue>) -> Void )
func closeIssue(owner: String, repo: String, number: Int, issue: Model.Issue, completionHandler: @escaping (DataResponse<Model.Issue>) -> Void)
func openIssue(owner: String, repo: String, number: Int, issue: Model.Issue, completionHandler: @escaping (DataResponse<Model.Issue>) -> Void)
}