<commit_before>//
//  ListTeams.swift
//  QiitaKit
//
//  Created on 2015/06/08.
//  Copyright (c) 2015年 林達也. All rights reserved.
//

import Foundation
import APIKit

/**
*  ユーザが所属している全てのチームを、チーム作成日時の降順で返します。
*/
public class ListTeams {
    public init() {
    }
}

extension ListTeams: RequestToken {

    public typealias Response = [Team]
    public typealias SerializedType = [[String: AnyObject]]

    public var method: HTTPMethod {
        return .GET
    }

    public var URL: String {
        return "/api/v2/teams"
    }

    public var headers: [String: AnyObject]? {
        return nil
    }

    public var parameters: [String: AnyObject]? {
        return nil
    }

    public var encoding: RequestEncoding {
        return .URL
    }

    public var resonseEncoding: ResponseEncoding {
        return .JSON(.AllowFragments)
    }
}

extension ListTeams {
    
    public static func transform(request: NSURLRequest, response: NSHTTPURLResponse?, object: SerializedType) -> Result<Response> {
        
        let teams = object.map { object in
            Team(
                active: object["active"] as! Bool,
                id: object["id"] as! String,
                name: object["name"] as! String
            )
        }<commit_msg>Fix request params in Team<commit_after>//
//  ListTeams.swift
//  QiitaKit
//
//  Created on 2015/06/08.
//  Copyright (c) 2015年 林達也. All rights reserved.
//

import Foundation
import APIKit

/**
*  ユーザが所属している全てのチームを、チーム作成日時の降順で返します。
*/
public class ListTeams {
    public init() {
    }
}

extension ListTeams: RequestToken {

    public typealias Response = [Team]
    public typealias SerializedType = [[String: AnyObject]]

    public var method: HTTPMethod {
        return .GET
    }

    public var URL: String {
        return "/api/v2/teams"
    }

    public var headers: [String: AnyObject]? {
        return nil
    }

    public var parameters: [String: AnyObject]? {
        return nil
    }

    public var encoding: RequestEncoding {
        return .JSON
    }

    public var resonseEncoding: ResponseEncoding {
        return .JSON(.AllowFragments)
    }
}

extension ListTeams {
    
    public static func transform(request: NSURLRequest, response: NSHTTPURLResponse?, object: SerializedType) -> Result<Response> {
        
        let teams = object.map { object in
            Team(
                active: object["active"] as! Bool,
                id: object["id"] as! String,
                name: object["name"] as! String
            )
        }
{'fraction_non_alphanumeric': 0.10110584518167456, 'fraction_numerical': 0.010268562401263823, 'mean_word_length': 2.123304562268804, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6634806', 'n_tokens_mistral': 821, 'n_tokens_neox': 777, 'n_words': 210}