<commit_before>//
//  GonawinAPI.swift
//  GonawinEngine
//
//  Created by <NAME> on 26/02/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Moya

public protocol GonawinAPIType {
    var addAuthorization: Bool { get }
}

public enum GonawinAPI {
    case Auth(String, String, Int, String, String)
}

public enum GonawinAuthenticatedAPI {
    case User(Int)
}

extension GonawinAPI: TargetType, GonawinAPIType {
    public var baseURL: NSURL { return NSURL(string: "http://www.gonawin.com/j")! }
    
    public var path: String {
        switch self {
        case .Auth:
            return "/auth"
        }
    }
    
    public var method: Moya.Method {
        switch self {
        default:
            return .GET
        }
    }
    
    public var parameters: [String: AnyObject]? {
        switch self {
        case .Auth(let accessToken, let provider, let id, let email, let name):
            return [
                "access_token": accessToken,
                "provider": provider,
                "id": id,
                "email": email,
                "name": name
            ]
        }
    }
    
    public var sampleData: NSData {
        switch self {
        case .Auth:
            return stubbedResponse("Auth")
        }
    }
    
    public var addAuthorization: Bool {
        return false
    }
}

extension GonawinAuthenticatedAPI: TargetType, GonawinAPIType {
    public var baseURL: NSURL { return NSURL(string: "http://www.gonawin.com/j")! }
    
    public var path: String {
        switch self {
        case .User:
            return "/users"
        }
    }
    
    public var method: Moya.Method {
        switch self {
        default:
            return .GET
        }
    }
    
    public var parameters: [String: AnyObject]? {
        switch self {
        case .User(let id):
            return ["id": id]
        }
    }<commit_msg>fixed user endpoint<commit_after>//
//  GonawinAPI.swift
//  GonawinEngine
//
//  Created by <NAME> on 26/02/2016.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Moya

public protocol GonawinAPIType {
    var addAuthorization: Bool { get }
}

public enum GonawinAPI {
    case Auth(String, String, Int, String, String)
}

public enum GonawinAuthenticatedAPI {
    case User(Int)
}

extension GonawinAPI: TargetType, GonawinAPIType {
    public var baseURL: NSURL { return NSURL(string: "http://www.gonawin.com/j")! }
    
    public var path: String {
        switch self {
        case .Auth:
            return "/auth"
        }
    }
    
    public var method: Moya.Method {
        switch self {
        default:
            return .GET
        }
    }
    
    public var parameters: [String: AnyObject]? {
        switch self {
        case .Auth(let accessToken, let provider, let id, let email, let name):
            return [
                "access_token": accessToken,
                "provider": provider,
                "id": id,
                "email": email,
                "name": name
            ]
        }
    }
    
    public var sampleData: NSData {
        switch self {
        case .Auth:
            return stubbedResponse("Auth")
        }
    }
    
    public var addAuthorization: Bool {
        return false
    }
}

extension GonawinAuthenticatedAPI: TargetType, GonawinAPIType {
    public var baseURL: NSURL { return NSURL(string: "http://www.gonawin.com/j")! }
    
    public var path: String {
        switch self {
        case .User(let id):
            return "/users/show/\(id)"
        }
    }
    
    public var method: Moya.Method {
        switch self {
        default:
            return .GET
        }
    }
    
    public var parameters: [String: AnyObject]? {
        return nil
    }
{'fraction_non_alphanumeric': 0.09904153354632587, 'fraction_numerical': 0.006389776357827476, 'mean_word_length': 1.6090277777777777, 'pattern_counts': {'":': 11, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '901188', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1130, 'n_words': 309}