<commit_before>//
//  RESTController.swift
//  DMTables
//
//  Created by <NAME> on 3/31/16.
//  Copyright © 2016 <NAME>. All rights reserved.

import Foundation
//MARK: RESTControllerProtocol
/**
 *  The protocol to make sure that a class properly defines these set functions
 */
protocol RESTControllerProtocol {
    /**
     The REST call was successful and returned a valid JSON result and was able to convert it to a `[key:value]` pair dictionary.
     
     - parameter results: the JSON data in a dictionary format
     - parameter url:     the server url in a string format
     */
    func didReceiveAPIResults(results: [String: AnyObject]!, url: String)
    
    /**
     The REST call was unsuccessful. This is defaulted to do nothing, but you may want to add addtional functionality later
     
     - parameter error: the error string
     - parameter url:   the server url
     */
    func didNotReceiveAPIResults(error: String, url: String)
}
//MARK: Default Method
extension RESTControllerProtocol {
    /**
     The REST call was unsuccessful. This is defaulted to do nothing, but you may want to add addtional functionality later
     
     - parameter error: the error string
     - parameter url:   the server url
     */
    func didNotReceiveAPIResults(error: String, url: String) {
        //purposely left empty
    }
}

//MARK: - ENUMS
//MARK: HTTPMethod
/**
 All the various HTTP call requests
 
 - post: makes a post call
 - get:  makes a get call
 */
enum HTTPMethod: String {
    case post = "POST"
    case get = "GET"
}
//MARK: ContentType
/// The HTTP header field for the various MIME types of the body of the request (used with POST and PUT requests)
enum ContentType: String {
    
    case json = "application/json"
    case urlEncode = "application/x-www-form-urlencoded"
    case multipartForm = "multipart/form-data"
    case textHTML = "text/html"
    
    static let headerFieldValue = "Content-Type"
}

//MARK: -
/** 
 The class that makes JSON RESTful calls to a server
 <commit_msg>RESTController Comment edit.<commit_after>//
//  RESTController.swift
//  DMTables
//
//  Created by <NAME> on 3/31/16.
//  Copyright © 2016 <NAME>. All rights reserved.

import Foundation
//MARK: RESTControllerProtocol
/**
 *  The protocol to make sure that a class properly defines these set functions
 */
protocol RESTControllerProtocol {
    /**
     The REST call was successful and returned a valid JSON result and was able to convert it to a `[key:value]` pair dictionary.
     
     - parameter results: the JSON data in a dictionary format
     - parameter url:     the server url in a string format
     */
    func didReceiveAPIResults(results: [String: AnyObject]!, url: String)
    
    /**
     The REST call was unsuccessful. This is defaulted to do nothing, but you may want to add addtional functionality later
     
     - parameter error: the error string
     - parameter url:   the server url
     */
    func didNotReceiveAPIResults(error: String, url: String)
}
//MARK: Default Method
extension RESTControllerProtocol {
    /**
     The REST call was unsuccessful. This is defaulted to do nothing, but you may want to add addtional functionality later
     
     - parameter error: the error string
     - parameter url:   the server url
     */
    func didNotReceiveAPIResults(error: String, url: String) {
        //purposely left empty
    }
}

//MARK: - ENUMS
//MARK: HTTPMethod
/**
 All the various HTTP call requests
 
 - post: makes a post call
 - get:  makes a get call
 */
enum HTTPMethod: String {
    case post = "POST"
    case get = "GET"
}
//MARK: ContentType
/// The HTTP header field for the various MIME types of the body of the request (used with `POST` and `PUT` requests)
enum ContentType: String {
    
    case json = "application/json"
    case urlEncode = "application/x-www-form-urlencoded"
    case multipartForm = "multipart/form-data"
    case textHTML = "text/html"
    
    static let headerFieldValue = "Content-Type"
}

//MARK: -
/** 
 The class that makes JSON RESTful calls to a server
 
{'fraction_non_alphanumeric': 0.08425448292802751, 'fraction_numerical': 0.004421518054532056, 'mean_word_length': 2.77037037037037, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3351926', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1106, 'n_words': 482}