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

import Foundation
import Alamofire


open class PushNotificationsAPI: APIBase {
    /**
     * enum for parameter platform
     */
    public enum Platform_myPushRegistrationsDeletePushRegistration: String { 
        case windows = "Windows"
        case android = "Android"
        case ios = "IOS"
    }

    /**
     Unregister from push notifications
     - parameter platform: (path) Platform type 
     - parameter registrationId: (path) Unique registration ID provided by the mobile OS.              You must URL encode the registration ID.              For Android, this is the GCM registration ID.              For Windows, this is the PushNotificationChannel URI.              For iOS, this is the device token. 
     - parameter authorization: (header) Format is: \&quot;Scheme CredentialsList\&quot;. Possible values are:  - Anon AK&#x3D;AppKey  - SocialPlus TK&#x3D;SessionToken  - Facebook AK&#x3D;AppKey|TK&#x3D;AccessToken  - Google AK&#x3D;AppKey|TK&#x3D;AccessToken  - Twitter AK&#x3D;AppKey|RT&#x3D;RequestToken|TK&#x3D;AccessToken  - Microsoft AK&#x3D;AppKey|TK&#x3D;AccessToken  - AADS2S AK&#x3D;AppKey|[UH&#x3D;UserHandle]|TK&#x3D;AADToken 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func myPushRegistrationsDeletePushRegistration(platform: Platform_myPushRegistrationsDeletePushRegistration, registrationId: String, authorization: String, completion: @escaping ((_ data: Object?, _ error: ErrorResponse?) -> Void)) {
        myPushRegistrationsDeletePushRegistrationWithRequestBuilder(platform: platform, registrationId: registrationId, authorization: authorization).execute { (response, error) -> Void in
            completion(response?.body, error)
        }
    }


    /**
     Unregister from push notifications
     - DELETE /v0.7/users/me/push_registrations/{platform}/{registrationId}

     - examples: [{contentType=application/json, example={ }}, {contentType=application/xml, example=<null>
</null>}]
     - examples: [{contentType=application/json, example={ }}, {contentType=application/xml, example=<null>
</null>}]
     - parameter platform: (path) Platform type 
     - parameter registrationId: (path) Unique registration ID provided by the mobile OS.              You must URL encode the registration ID.              For Android, this is the GCM registration ID.              For Windows, this is the PushNotificationChannel URI.              For iOS, this is the device token. 
     - parameter authorization: (header) Format is: \&quot;Scheme CredentialsList\&quot;. Possible values are:  - Anon AK&#x3D;AppKey  - SocialPlus TK&#x3D;SessionToken  - Facebook AK&#x3D;AppKey|TK&#x3D;AccessToken  - Google AK&#x3D;AppKey|TK&#x3D;AccessToken  - Twitter AK&#x3D;AppKey|RT&#x3D;RequestToken|TK&#x3D;AccessToken  - Microsoft AK&#x3D;AppKey|TK&#x3D;AccessToken  - AADS2S AK&#x3D;AppKey|[UH&#x3D;UserHandle]|TK&#x3D;AADToken 
     - returns: RequestBuilder<Object> 
     */
    open class func myPushRegistrationsDeletePushRegistrationWithRequestBuilder(platform: Platform_myPushRegistrationsDeletePushRegistration, registrationId: String, authorization: String) -> RequestBuilder<Object> {
        var path = "/v0.7/users/me/push_registrations/{platform}/{registrationId}"
        path = path.replacingOccurrences(of: "{platform}", with: "\(platform.rawValue)", options: .literal, range: nil)
        path = path.replacingOccurrences(of: "{registrationId}", with: "\(registrationId)", options: .literal, range: nil)
        let URLString = EmbeddedSocialClientAPI.basePath + path
        let parameters: [String:Any]? = nil

        let url = NSURLComponents(string: URLString)
        let nillableHeaders: [String: Any?] = [
            "Authorization": authorization
        ]
        let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)

        let requestBuilder: RequestBuilder<Object>.Type = EmbeddedSocialClientAPI.requestBuilderFactory.getBuilder()

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

    /**
     * enum for parameter platform
     */
    public enum Platform_myPushRegistrationsPutPushRegistration: String { 
        case windows = "Windows"
        case android = "Android"
        case ios = "IOS"
    }

    /**
     Register for push notifications or update an existing registration
     - parameter platform: (path) Platform type 
     - parameter registrationId: (path) Unique registration ID provided by the mobile OS.              You must URL encode the registration ID.              For Android, this is the GCM or FCM registration ID.              For Windows, this is the PushNotificationChannel URI.              For iOS, this is the device token. 
     - parameter request: (body) Put push registration request 
     - parameter authorization: (header) Format is: \&quot;Scheme CredentialsList\&quot;. Possible values are:  - Anon AK&#x3D;AppKey  - SocialPlus TK&#x3D;SessionToken  - Facebook AK&#x3D;AppKey|TK&#x3D;AccessToken  - Google AK&#x3D;AppKey|TK&#x3D;AccessToken  - Twitter AK&#x3D;AppKey|RT&#x3D;RequestToken|TK&#x3D;AccessToken  - Microsoft AK&#x3D;AppKey|TK&#x3D;AccessToken  - AADS2S AK&#x3D;AppKey|[UH&#x3D;UserHandle]|TK&#x3D;AADToken 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func myPushRegistrationsPutPushRegistration(platform: Platform_myPushRegistrationsPutPushRegistration, registrationId: String, request: PutPushRegistrationRequest, authorization: String, completion: @escaping ((_ data: Object?, _ error: ErrorResponse?) -> Void)) {
        myPushRegistrationsPutPushRegistrationWithRequestBuilder(platform: platform, registrationId: registrationId, request: request, authorization: authorization).execute { (response, error) -> Void in
            completion(response?.body, error)
        }
    }


    /**
     Register for push notifications or update an existing registration
     - PUT /v0.7/users/me/push_registrations/{platform}/{registrationId}
     - A push notification will be generated and sent for each activity in my              notifications feed where the unread status is true.              If multiple devices register for push notifications, then all those devices              will get push notifications.              Each push notification will have three components: (1) a human readable string              that the mobile OS should display to the user, (2) a \"publisher\" string with              value \"EmbeddedSocial\" to identify that the push notification came from              this service, and (3) an \"activityHandle\" that identifies which activity              in the notification feed this push notification is for.

     - examples: [{contentType=application/json, example={ }}, {contentType=application/xml, example=<null>
</null>}]
     - examples: [{contentType=application/json, example={ }}, {contentType=application/xml, example=<null>
</null>}]
     - parameter platform: (path) Platform type 
     - parameter registrationId: (path) Unique registration ID provided by the mobile OS.              You must URL encode the registration ID.              For Android, this is the GCM or FCM registration ID.              For Windows, this is the PushNotificationChannel URI.              For iOS, this is the device token. 
     - parameter request: (body) Put push registration request 
     - parameter authorization: (header) Format is: \&quot;Scheme CredentialsList\&quot;. Possible values are:  - Anon AK&#x3D;AppKey  - SocialPlus TK&#x3D;SessionToken  - Facebook AK&#x3D;AppKey|TK&#x3D;AccessToken  - Google AK&#x3D;AppKey|TK&#x3D;AccessToken  - Twitter AK&#x3D;AppKey|RT&#x3D;RequestToken|TK&#x3D;AccessToken  - Microsoft AK&#x3D;AppKey|TK&#x3D;AccessToken  - AADS2S AK&#x3D;AppKey|[UH&#x3D;UserHandle]|TK&#x3D;AADToken 
     - returns: RequestBuilder<Object> 
     */
    open class func myPushRegistrationsPutPushRegistrationWithRequestBuilder(platform: Platform_myPushRegistrationsPutPushRegistration, registrationId: String, request: PutPushRegistrationRequest, authorization: String) -> RequestBuilder<Object> {
        var path = "/v0.7/users/me/push_registrations/{platform}/{registrationId}"
        path = path.replacingOccurrences(of: "{platform}", with: "\(platform.rawValue)", options: .literal, range: nil)
        path = path.replacingOccurrences(of: "{registrationId}", with: "\(registrationId)", options: .literal, range: nil)
        let URLString = EmbeddedSocialClientAPI.basePath + path
        let parameters = request.encodeToJSON() as? [String:AnyObject]

        let url = NSURLComponents(string: URLString)
        let nillableHeaders: [String: Any?] = [
            "Authorization": authorization
        ]
        let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders)

        let requestBuilder: RequestBuilder<Object>.Type = EmbeddedSocialClientAPI.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true, headers: headerParameters)
    }

}
