//
// Class10searchvenuesAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//

import Foundation
import Alamofire



open class Class10searchvenuesAPI {
    /**
     Search for venues.
     
     - parameter cityId: (query) the city&#39;s geoId (optional)
     - parameter cityName: (query) name of the city where the venue is located (optional)
     - parameter country: (query) the city&#39;s country (optional)
     - parameter name: (query) name of the venue (optional)
     - parameter p: (query) the number of the result page you&#39;d like to have (optional, default to 1)
     - parameter state: (query) the city&#39;s state (optional)
     - parameter stateCode: (query) the city&#39;s state code (optional)
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getVenuesGET(cityId: String? = nil, cityName: String? = nil, country: String? = nil, name: String? = nil, p: Int? = nil, state: String? = nil, stateCode: String? = nil, completion: @escaping ((_ data: Venues?,_ error: Error?) -> Void)) {
        getVenuesGETWithRequestBuilder(cityId: cityId, cityName: cityName, country: country, name: name, p: p, state: state, stateCode: stateCode).execute { (response, error) -> Void in
            completion(response?.body, error)
        }
    }


    /**
     Search for venues.
     - GET /1.0/search/venues
     - Search for venues.
     - examples: [{contentType=application/json, example={
  "venue" : [ {
    "city" : {
      "id" : "5357527",
      "name" : "Hollywood",
      "stateCode" : "CA",
      "state" : "California",
      "coords" : { },
      "country" : { }
    },
    "url" : "https://www.setlist.fm/venue/compaq-center-san-jose-ca-usa-6bd6ca6e.html",
    "id" : "6bd6ca6e",
    "name" : "Compaq Center"
  }, {
    "city" : {
      "id" : "...",
      "name" : "...",
      "stateCode" : "...",
      "state" : "...",
      "coords" : { },
      "country" : { }
    },
    "url" : "...",
    "id" : "...",
    "name" : "..."
  } ],
  "total" : 42,
  "page" : 1,
  "itemsPerPage" : 20
}}]
     
     - parameter cityId: (query) the city&#39;s geoId (optional)
     - parameter cityName: (query) name of the city where the venue is located (optional)
     - parameter country: (query) the city&#39;s country (optional)
     - parameter name: (query) name of the venue (optional)
     - parameter p: (query) the number of the result page you&#39;d like to have (optional, default to 1)
     - parameter state: (query) the city&#39;s state (optional)
     - parameter stateCode: (query) the city&#39;s state code (optional)

     - returns: RequestBuilder<Venues> 
     */
    open class func getVenuesGETWithRequestBuilder(cityId: String? = nil, cityName: String? = nil, country: String? = nil, name: String? = nil, p: Int? = nil, state: String? = nil, stateCode: String? = nil) -> RequestBuilder<Venues> {
        let path = "/1.0/search/venues"
        let URLString = SwaggerClientAPI.basePath + path
        let parameters: [String:Any]? = nil
        
        var url = URLComponents(string: URLString)
        url?.queryItems = APIHelper.mapValuesToQueryItems([
            "cityId": cityId, 
            "cityName": cityName, 
            "country": country, 
            "name": name, 
            "p": p?.encodeToJSON(), 
            "state": state, 
            "stateCode": stateCode
        ])

        let requestBuilder: RequestBuilder<Venues>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
    }

}
