<commit_before>import Foundation
import RxSwift
import Moya
import Alamofire

protocol ArtsyAPIType {
    var addXAuth: Bool { get }
}

enum ArtsyAPI {
    case xApp
    case xAuth(email: String, password: String)
    case trustToken(number: String, auctionPIN: String)

    case systemTime
    case ping

    case artwork(id: String)
    case artist(id: String)

    case auctions
    case auctionListings(id: String, page: Int, pageSize: Int)
    case auctionInfo(auctionID: String)
    case auctionInfoForArtwork(auctionID: String, artworkID: String)
    case findBidderRegistration(auctionID: String, phone: String)
    case activeAuctions

    case createUser(email: String, password: String, phone: String, postCode: String, name: String)

    case bidderDetailsNotification(auctionID: String, identifier: String)
    
    case lostPasswordNotification(email: String)
    case findExistingEmailRegistration(email: String)
}

enum ArtsyAuthenticatedAPI {
    case myCreditCards
    case createPINForBidder(bidderID: String)
    case registerToBid(auctionID: String)
    case myBiddersForAuction(auctionID: String)
    case myBidPositionsForAuctionArtwork(auctionID: String, artworkID: String)
    case myBidPosition(id: String)
    case findMyBidderRegistration(auctionID: String)
    case placeABid(auctionID: String, artworkID: String, maxBidCents: String)

    case updateMe(email: String, phone: String, postCode: String, name: String)
    case registerCard(stripeToken: String, swiped: Bool)
    case me
}

extension ArtsyAPI : TargetType, ArtsyAPIType {

    public var parameterEncoding: ParameterEncoding {
        return JSONEncoding.default
    }

    public var task: Task {
        return .request
    }

     var path: String {
        switch self {

        case .xApp:
            return "/api/v1/xapp_token"

        case .xAuth:
            return "/oauth2/access_token"

        case .auctionInfo(let id):
            return "/api/v1/sale/\(id)"
            
        case .auctions:
            return "/api/v1/sales"

        case .auctionListings(let id, _, _):
            return "/api/v1/sale/\(id)/sale_artworks"

        case .auctionInfoForArtwork(let auctionID, let artworkID):
            return "/api/v1/sale/\(auctionID)/sale_artwork/\(artworkID)"

        case .systemTime:
            return "/api/v1/system/time"

        case .ping:
            return "/api/v1/system/ping"

        case .findBidderRegistration:
            return "/api/v1/bidder"

        case .activeAuctions:
            return "/api/v1/sales"

        case .createUser:
            return "/api/v1/user"

        case .artwork(let id):
            return "/api/v1/artwork/\(id)"

        case .artist(let id):
            return "/api/v1/artist/\(id)"

        case .trustToken:
            return "/api/v1/me/trust_token"

        case .bidderDetailsNotification:
            return "/api/v1/bidder/bidding_details_notification"

        case .lostPasswordNotification:
            return "/api/v1/users/send_reset_password_instructions"

        case .findExistingEmailRegistration:
            return "/api/v1/user"

        }
    }

    var base: String { return AppSetup.sharedState.useStaging ? "https://stagingapi.artsy.net" : "https://api.artsy.net" }
    var baseURL: URL { return URL(string: base)! }

    var parameters: [String: Any]? {
        switch self {

        case .xAuth(let email, let password):
            return [
                "client_id": APIKeys.sharedKeys.key as AnyObject? ?? "" as AnyObject,
                "client_secret": APIKeys.sharedKeys.secret as AnyObject? ?? "" as AnyObject,
                "email": email as AnyObject,
                "password":  password as AnyObject,
                "grant_type": "credentials" as AnyObject
            ]

        case .xApp:
            return ["client_id": APIKeys.sharedKeys.key as AnyObject? ?? "" as AnyObject,
                "client_secret": APIKeys.sharedKeys.secret as AnyObject? ?? "" as AnyObject]

        case .auctions:
            return ["is_auction": "true" as AnyObject]

        case .trustToken(let number, let auctionID):
            return ["number": number as AnyObject, "auction_pin": auctionID as AnyObject]

        case .createUser(let email, let password,let phone,let postCode, let name):
            return [
                "email": email as AnyObject, "password": password as AnyObject,
                "phone": phone as AnyObject, "name": name as AnyObject,
                "location": [ "postal_code": postCode ] as AnyObject
            ]

        case .bidderDetailsNotification(let auctionID, let identifier):
            return ["sale_id": auctionID as AnyObject, "identifier": identifier as AnyObject]
<commit_msg>Removes compiler warnings.<commit_after>import Foundation
import RxSwift
import Moya
import Alamofire

protocol ArtsyAPIType {
    var addXAuth: Bool { get }
}

enum ArtsyAPI {
    case xApp
    case xAuth(email: String, password: String)
    case trustToken(number: String, auctionPIN: String)

    case systemTime
    case ping

    case artwork(id: String)
    case artist(id: String)

    case auctions
    case auctionListings(id: String, page: Int, pageSize: Int)
    case auctionInfo(auctionID: String)
    case auctionInfoForArtwork(auctionID: String, artworkID: String)
    case findBidderRegistration(auctionID: String, phone: String)
    case activeAuctions

    case createUser(email: String, password: String, phone: String, postCode: String, name: String)

    case bidderDetailsNotification(auctionID: String, identifier: String)
    
    case lostPasswordNotification(email: String)
    case findExistingEmailRegistration(email: String)
}

enum ArtsyAuthenticatedAPI {
    case myCreditCards
    case createPINForBidder(bidderID: String)
    case registerToBid(auctionID: String)
    case myBiddersForAuction(auctionID: String)
    case myBidPositionsForAuctionArtwork(auctionID: String, artworkID: String)
    case myBidPosition(id: String)
    case findMyBidderRegistration(auctionID: String)
    case placeABid(auctionID: String, artworkID: String, maxBidCents: String)

    case updateMe(email: String, phone: String, postCode: String, name: String)
    case registerCard(stripeToken: String, swiped: Bool)
    case me
}

extension ArtsyAPI : TargetType, ArtsyAPIType {

    public var parameterEncoding: ParameterEncoding {
        return JSONEncoding.default
    }

    public var task: Task {
        return .request
    }

     var path: String {
        switch self {

        case .xApp:
            return "/api/v1/xapp_token"

        case .xAuth:
            return "/oauth2/access_token"

        case .auctionInfo(let id):
            return "/api/v1/sale/\(id)"
            
        case .auctions:
            return "/api/v1/sales"

        case .auctionListings(let id, _, _):
            return "/api/v1/sale/\(id)/sale_artworks"

        case .auctionInfoForArtwork(let auctionID, let artworkID):
            return "/api/v1/sale/\(auctionID)/sale_artwork/\(artworkID)"

        case .systemTime:
            return "/api/v1/system/time"

        case .ping:
            return "/api/v1/system/ping"

        case .findBidderRegistration:
            return "/api/v1/bidder"

        case .activeAuctions:
            return "/api/v1/sales"

        case .createUser:
            return "/api/v1/user"

        case .artwork(let id):
            return "/api/v1/artwork/\(id)"

        case .artist(let id):
            return "/api/v1/artist/\(id)"

        case .trustToken:
            return "/api/v1/me/trust_token"

        case .bidderDetailsNotification:
            return "/api/v1/bidder/bidding_details_notification"

        case .lostPasswordNotification:
            return "/api/v1/users/send_reset_password_instructions"

        case .findExistingEmailRegistration:
            return "/api/v1/user"

        }
    }

    var base: String { return AppSetup.sharedState.useStaging ? "https://stagingapi.artsy.net" : "https://api.artsy.net" }
    var baseURL: URL { return URL(string: base)! }

    var parameters: [String: Any]? {
        switch self {

        case .xAuth(let email, let password):
            return [
                "client_id": APIKeys.sharedKeys.key,
                "client_secret": APIKeys.sharedKeys.secret,
                "email": email as AnyObject,
                "password":  password as AnyObject,
                "grant_type": "credentials" as AnyObject
            ]

        case .xApp:
            return ["client_id": APIKeys.sharedKeys.key,
                "client_secret": APIKeys.sharedKeys.secret]

        case .auctions:
            return ["is_auction": "true" as AnyObject]

        case .trustToken(let number, let auctionID):
            return ["number": number as AnyObject, "auction_pin": auctionID as AnyObject]

        case .createUser(let email, let password,let phone,let postCode, let name):
            return [
                "email": email as AnyObject, "password": password as AnyObject,
                "phone": phone as AnyObject, "name": name as AnyObject,
                "location": [ "postal_code": postCode ] as AnyObject
            ]

        case .bidderDetailsNotification(let auctionID, let identifier):
            return ["sale_id": auctionID as AnyObject, "identifier": identifier as AnyObject]

{'fraction_non_alphanumeric': 0.09659515423204185, 'fraction_numerical': 0.0036289892197673176, 'mean_word_length': 2.397389412617839, 'pattern_counts': {'":': 36, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '4992700', 'n_tokens_mistral': 2808, 'n_tokens_neox': 2681, 'n_words': 700}