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

import Foundation



open class OrganizationAPI {
    
    
    public enum ModelType_getFieldconfig: String { 
        case person = "person"
        case group = "group"
        case org = "org"
        case externalcontact = "externalContact"
    }

    
    
    /**
     
     Fetch field config for an entity type
     
     - parameter type: (query) Field type 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getFieldconfig(type: ModelType_getFieldconfig, completion: @escaping ((_ data: FieldConfig?,_ error: Error?) -> Void)) {
        let requestBuilder = getFieldconfigWithRequestBuilder(type: type)
        requestBuilder.execute { (response: Response<FieldConfig>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Fetch field config for an entity type
     
     - GET /api/v2/fieldconfig
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "schemaVersion" : "aeiou",
  "entityType" : "aeiou",
  "selfUri" : "aeiou",
  "name" : "aeiou",
  "id" : "aeiou",
  "state" : "aeiou",
  "version" : "aeiou",
  "sections" : [ {
    "instructionText" : "aeiou",
    "state" : "aeiou",
    "fieldList" : [ {
      "instructionText" : "aeiou",
      "repeatable" : true,
      "customLabels" : true,
      "labelKeys" : [ "aeiou" ],
      "state" : "aeiou",
      "params" : {
        "key" : "{}"
      },
      "type" : "aeiou",
      "key" : "aeiou",
      "required" : true,
      "gdpr" : true
    } ],
    "key" : "aeiou"
  } ]
}}]
     
     - parameter type: (query) Field type 

     - returns: RequestBuilder<FieldConfig> 
     */
    open class func getFieldconfigWithRequestBuilder(type: ModelType_getFieldconfig) -> RequestBuilder<FieldConfig> {
        let path = "/api/v2/fieldconfig"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        var url = URLComponents(string: URLString)
        url?.queryItems = APIHelper.mapValuesToQueryItems([
            
            "type": type.rawValue
            
        ])

        let requestBuilder: RequestBuilder<FieldConfig>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    /**
     
     Get the list of domains that will be allowed to embed PureCloud applications
     
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsEmbeddedintegration(completion: @escaping ((_ data: EmbeddedIntegration?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsEmbeddedintegrationWithRequestBuilder()
        requestBuilder.execute { (response: Response<EmbeddedIntegration>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get the list of domains that will be allowed to embed PureCloud applications
     
     - GET /api/v2/organizations/embeddedintegration
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "domainWhitelist" : [ "aeiou" ],
  "enableWhitelist" : true
}}]

     - returns: RequestBuilder<EmbeddedIntegration> 
     */
    open class func getOrganizationsEmbeddedintegrationWithRequestBuilder() -> RequestBuilder<EmbeddedIntegration> {
        let path = "/api/v2/organizations/embeddedintegration"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<EmbeddedIntegration>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    /**
     
     Get organization IP address whitelist settings
     
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsIpaddressauthentication(completion: @escaping ((_ data: IpAddressAuthentication?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsIpaddressauthenticationWithRequestBuilder()
        requestBuilder.execute { (response: Response<IpAddressAuthentication>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get organization IP address whitelist settings
     
     - GET /api/v2/organizations/ipaddressauthentication
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "networkWhitelist" : [ "aeiou" ]
}}]

     - returns: RequestBuilder<IpAddressAuthentication> 
     */
    open class func getOrganizationsIpaddressauthenticationWithRequestBuilder() -> RequestBuilder<IpAddressAuthentication> {
        let path = "/api/v2/organizations/ipaddressauthentication"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<IpAddressAuthentication>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    
    
    /**
     
     Get a limit change request
     
     - parameter requestId: (path) Unique id for the limit change request 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsLimitsChangerequest(requestId: String, completion: @escaping ((_ data: LimitChangeRequestDetails?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsLimitsChangerequestWithRequestBuilder(requestId: requestId)
        requestBuilder.execute { (response: Response<LimitChangeRequestDetails>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get a limit change request
     
     - GET /api/v2/organizations/limits/changerequests/{requestId}
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "selfUri" : "aeiou",
  "description" : "aeiou",
  "requestedValue" : 1.3579000000000001069366817318950779736042022705078125,
  "statusHistory" : [ {
    "dateStatusChanged" : "2000-01-23T04:56:07.000+0000",
    "rejectReason" : "aeiou",
    "changedBy" : "aeiou",
    "message" : "aeiou",
    "status" : "aeiou",
    "previousStatus" : "aeiou"
  } ],
  "dateCreated" : "2000-01-23T04:56:07.000+0000",
  "rejectReason" : "aeiou",
  "createdBy" : "aeiou",
  "dateCompleted" : "2000-01-23T04:56:07.000+0000",
  "namespace" : "aeiou",
  "id" : "aeiou",
  "lastChangedBy" : "aeiou",
  "key" : "aeiou",
  "currentValue" : 1.3579000000000001069366817318950779736042022705078125,
  "supportCaseUrl" : "aeiou",
  "status" : "aeiou"
}}]
     
     - parameter requestId: (path) Unique id for the limit change request 

     - returns: RequestBuilder<LimitChangeRequestDetails> 
     */
    open class func getOrganizationsLimitsChangerequestWithRequestBuilder(requestId: String) -> RequestBuilder<LimitChangeRequestDetails> {
        var path = "/api/v2/organizations/limits/changerequests/{requestId}"
        let requestIdPreEscape = "\(requestId)"
        let requestIdPostEscape = requestIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
        path = path.replacingOccurrences(of: "{requestId}", with: requestIdPostEscape, options: .literal, range: nil)
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<LimitChangeRequestDetails>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    
    
    
    
    
    public enum Status_getOrganizationsLimitsChangerequests: String { 
        case _open = "Open"
        case approved = "Approved"
        case implementingChange = "ImplementingChange"
        case changeImplemented = "ChangeImplemented"
        case rejected = "Rejected"
        case rollback = "Rollback"
        case implementingRollback = "ImplementingRollback"
        case rollbackImplemented = "RollbackImplemented"
    }

    
    
    
    
    
    public enum Expand_getOrganizationsLimitsChangerequests: String { 
        case statushistory = "statusHistory"
    }

    
    
    /**
     
     Get the available limit change requests
     
     - parameter after: (query) Timestamp indicating the date to begin after when searching for requests. (optional)
     - parameter before: (query) Timestamp indicating the date to end before when searching for requests. (optional)
     - parameter status: (query) Status of the request to be filtered by (optional)
     - parameter pageSize: (query) Page Size (optional, default to 25)
     - parameter expand: (query) Which fields, if any, to expand. (optional)
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsLimitsChangerequests(after: Int64? = nil, before: Int64? = nil, status: Status_getOrganizationsLimitsChangerequests? = nil, pageSize: Int? = nil, expand: [String]? = nil, completion: @escaping ((_ data: LimitChangeRequestsEntityListing?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsLimitsChangerequestsWithRequestBuilder(after: after, before: before, status: status, pageSize: pageSize, expand: expand)
        requestBuilder.execute { (response: Response<LimitChangeRequestsEntityListing>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get the available limit change requests
     
     - GET /api/v2/organizations/limits/changerequests
     - Timestamp interval defaults to the last 365 days if both query parameters are omitted. If only one parameter is omitted, the interval will default to a 180 day range in the specified direction.
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "entities" : [ {
    "selfUri" : "aeiou",
    "description" : "aeiou",
    "requestedValue" : 1.3579000000000001069366817318950779736042022705078125,
    "statusHistory" : [ {
      "dateStatusChanged" : "2000-01-23T04:56:07.000+0000",
      "rejectReason" : "aeiou",
      "changedBy" : "aeiou",
      "message" : "aeiou",
      "status" : "aeiou",
      "previousStatus" : "aeiou"
    } ],
    "dateCreated" : "2000-01-23T04:56:07.000+0000",
    "rejectReason" : "aeiou",
    "createdBy" : "aeiou",
    "dateCompleted" : "2000-01-23T04:56:07.000+0000",
    "namespace" : "aeiou",
    "id" : "aeiou",
    "lastChangedBy" : "aeiou",
    "key" : "aeiou",
    "currentValue" : 1.3579000000000001069366817318950779736042022705078125,
    "supportCaseUrl" : "aeiou",
    "status" : "aeiou"
  } ],
  "selfUri" : "aeiou",
  "nextUri" : "aeiou",
  "previousUri" : "aeiou"
}}]
     
     - parameter after: (query) Timestamp indicating the date to begin after when searching for requests. (optional)
     - parameter before: (query) Timestamp indicating the date to end before when searching for requests. (optional)
     - parameter status: (query) Status of the request to be filtered by (optional)
     - parameter pageSize: (query) Page Size (optional, default to 25)
     - parameter expand: (query) Which fields, if any, to expand. (optional)

     - returns: RequestBuilder<LimitChangeRequestsEntityListing> 
     */
    open class func getOrganizationsLimitsChangerequestsWithRequestBuilder(after: Int64? = nil, before: Int64? = nil, status: Status_getOrganizationsLimitsChangerequests? = nil, pageSize: Int? = nil, expand: [String]? = nil) -> RequestBuilder<LimitChangeRequestsEntityListing> {
        let path = "/api/v2/organizations/limits/changerequests"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        var url = URLComponents(string: URLString)
        url?.queryItems = APIHelper.mapValuesToQueryItems([
            
            "after": after?.encodeToJSON(), 
            
            "before": before?.encodeToJSON(), 
            
            "status": status?.rawValue, 
            
            "pageSize": pageSize?.encodeToJSON(), 
            
            "expand": expand
            
        ])

        let requestBuilder: RequestBuilder<LimitChangeRequestsEntityListing>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    /**
     
     Get a link to the limit documentation
     
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsLimitsDocs(completion: @escaping ((_ data: UrlResponse?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsLimitsDocsWithRequestBuilder()
        requestBuilder.execute { (response: Response<UrlResponse>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get a link to the limit documentation
     
     - GET /api/v2/organizations/limits/docs
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "url" : "aeiou"
}}]

     - returns: RequestBuilder<UrlResponse> 
     */
    open class func getOrganizationsLimitsDocsWithRequestBuilder() -> RequestBuilder<UrlResponse> {
        let path = "/api/v2/organizations/limits/docs"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<UrlResponse>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    
    
    /**
     
     Get the effective limits in a namespace for an organization
     
     - parameter namespaceName: (path) The namespace to fetch limits for 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsLimitsNamespace(namespaceName: String, completion: @escaping ((_ data: LimitsEntityListing?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsLimitsNamespaceWithRequestBuilder(namespaceName: namespaceName)
        requestBuilder.execute { (response: Response<LimitsEntityListing>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get the effective limits in a namespace for an organization
     
     - GET /api/v2/organizations/limits/namespaces/{namespaceName}
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "entities" : [ {
    "value" : 1.3579000000000001069366817318950779736042022705078125,
    "key" : "aeiou"
  } ]
}}]
     
     - parameter namespaceName: (path) The namespace to fetch limits for 

     - returns: RequestBuilder<LimitsEntityListing> 
     */
    open class func getOrganizationsLimitsNamespaceWithRequestBuilder(namespaceName: String) -> RequestBuilder<LimitsEntityListing> {
        var path = "/api/v2/organizations/limits/namespaces/{namespaceName}"
        let namespaceNamePreEscape = "\(namespaceName)"
        let namespaceNamePostEscape = namespaceNamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
        path = path.replacingOccurrences(of: "{namespaceName}", with: namespaceNamePostEscape, options: .literal, range: nil)
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<LimitsEntityListing>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    
    
    /**
     
     Get the default limits in a namespace for an organization
     
     - parameter namespaceName: (path) The namespace to fetch defaults limits for 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsLimitsNamespaceDefaults(namespaceName: String, completion: @escaping ((_ data: LimitsEntityListing?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsLimitsNamespaceDefaultsWithRequestBuilder(namespaceName: namespaceName)
        requestBuilder.execute { (response: Response<LimitsEntityListing>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get the default limits in a namespace for an organization
     
     - GET /api/v2/organizations/limits/namespaces/{namespaceName}/defaults
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "entities" : [ {
    "value" : 1.3579000000000001069366817318950779736042022705078125,
    "key" : "aeiou"
  } ]
}}]
     
     - parameter namespaceName: (path) The namespace to fetch defaults limits for 

     - returns: RequestBuilder<LimitsEntityListing> 
     */
    open class func getOrganizationsLimitsNamespaceDefaultsWithRequestBuilder(namespaceName: String) -> RequestBuilder<LimitsEntityListing> {
        var path = "/api/v2/organizations/limits/namespaces/{namespaceName}/defaults"
        let namespaceNamePreEscape = "\(namespaceName)"
        let namespaceNamePostEscape = namespaceNamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
        path = path.replacingOccurrences(of: "{namespaceName}", with: namespaceNamePostEscape, options: .literal, range: nil)
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<LimitsEntityListing>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    
    
    
    
    /**
     
     Get the available limit namespaces
     
     - parameter pageSize: (query) Page size (optional, default to 100)
     - parameter pageNumber: (query) Page number (optional, default to 1)
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsLimitsNamespaces(pageSize: Int? = nil, pageNumber: Int? = nil, completion: @escaping ((_ data: PagedNamespaceListing?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsLimitsNamespacesWithRequestBuilder(pageSize: pageSize, pageNumber: pageNumber)
        requestBuilder.execute { (response: Response<PagedNamespaceListing>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get the available limit namespaces
     
     - GET /api/v2/organizations/limits/namespaces
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={ }}]
     
     - parameter pageSize: (query) Page size (optional, default to 100)
     - parameter pageNumber: (query) Page number (optional, default to 1)

     - returns: RequestBuilder<PagedNamespaceListing> 
     */
    open class func getOrganizationsLimitsNamespacesWithRequestBuilder(pageSize: Int? = nil, pageNumber: Int? = nil) -> RequestBuilder<PagedNamespaceListing> {
        let path = "/api/v2/organizations/limits/namespaces"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        var url = URLComponents(string: URLString)
        url?.queryItems = APIHelper.mapValuesToQueryItems([
            
            "pageSize": pageSize?.encodeToJSON(), 
            
            "pageNumber": pageNumber?.encodeToJSON()
            
        ])

        let requestBuilder: RequestBuilder<PagedNamespaceListing>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    /**
     
     Get organization.
     
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsMe(completion: @escaping ((_ data: Organization?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsMeWithRequestBuilder()
        requestBuilder.execute { (response: Response<Organization>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Get organization.
     
     - GET /api/v2/organizations/me
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "defaultCountryCode" : "aeiou",
  "selfUri" : "aeiou",
  "thirdPartyURI" : "aeiou",
  "version" : 123,
  "thirdPartyOrgName" : "aeiou",
  "features" : {
    "key" : true
  },
  "defaultLanguage" : "aeiou",
  "defaultSiteId" : "aeiou",
  "supportURI" : "aeiou",
  "domain" : "aeiou",
  "name" : "aeiou",
  "id" : "aeiou",
  "state" : "aeiou",
  "voicemailEnabled" : true,
  "productPlatform" : "aeiou"
}}]

     - returns: RequestBuilder<Organization> 
     */
    open class func getOrganizationsMeWithRequestBuilder() -> RequestBuilder<Organization> {
        let path = "/api/v2/organizations/me"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<Organization>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    /**
     
     Use PUT /api/v2/organizations/embeddedintegration instead
     
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func getOrganizationsWhitelist(completion: @escaping ((_ data: OrgWhitelistSettings?,_ error: Error?) -> Void)) {
        let requestBuilder = getOrganizationsWhitelistWithRequestBuilder()
        requestBuilder.execute { (response: Response<OrgWhitelistSettings>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Use PUT /api/v2/organizations/embeddedintegration instead
     
     - GET /api/v2/organizations/whitelist
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "domainWhitelist" : [ "aeiou" ],
  "enableWhitelist" : true
}}]

     - returns: RequestBuilder<OrgWhitelistSettings> 
     */
    open class func getOrganizationsWhitelistWithRequestBuilder() -> RequestBuilder<OrgWhitelistSettings> {
        let path = "/api/v2/organizations/whitelist"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        
            
            
        let body: Data? = nil
            
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<OrgWhitelistSettings>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "GET", url: url!, body: body)
    }

    
    
    public enum FeatureName_patchOrganizationsFeature: String { 
        case realtimecic = "realtimeCIC"
        case purecloud = "purecloud"
        case hipaa = "hipaa"
        case ucenabled = "ucEnabled"
        case pci = "pci"
        case purecloudvoice = "purecloudVoice"
        case xmppfederation = "xmppFederation"
        case chat = "chat"
        case informalphotos = "informalPhotos"
        case directory = "directory"
        case contactcenter = "contactCenter"
        case unifiedcommunications = "unifiedCommunications"
        case custserv = "custserv"
    }

    
    
    
    
    /**
     
     Update organization
     
     - parameter featureName: (path) Organization feature 
     - parameter enabled: (body) New state of feature 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func patchOrganizationsFeature(featureName: FeatureName_patchOrganizationsFeature, enabled: FeatureState, completion: @escaping ((_ data: OrganizationFeatures?,_ error: Error?) -> Void)) {
        let requestBuilder = patchOrganizationsFeatureWithRequestBuilder(featureName: featureName, enabled: enabled)
        requestBuilder.execute { (response: Response<OrganizationFeatures>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Update organization
     
     - PATCH /api/v2/organizations/features/{featureName}
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "purecloud" : true,
  "purecloudVoice" : true,
  "xmppFederation" : true,
  "informalPhotos" : true,
  "hipaa" : true,
  "custserv" : true,
  "directory" : true,
  "ucEnabled" : true,
  "chat" : true,
  "pci" : true,
  "unifiedCommunications" : true,
  "realtimeCIC" : true,
  "contactCenter" : true
}}]
     
     - parameter featureName: (path) Organization feature 
     - parameter enabled: (body) New state of feature 

     - returns: RequestBuilder<OrganizationFeatures> 
     */
    open class func patchOrganizationsFeatureWithRequestBuilder(featureName: FeatureName_patchOrganizationsFeature, enabled: FeatureState) -> RequestBuilder<OrganizationFeatures> {
        var path = "/api/v2/organizations/features/{featureName}"
        let featureNamePreEscape = "\(featureName.rawValue)"
        let featureNamePostEscape = featureNamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
        path = path.replacingOccurrences(of: "{featureName}", with: featureNamePostEscape, options: .literal, range: nil)
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        let body = JSONEncodingHelper.encodingParameters(forEncodableObject: enabled)
        
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<OrganizationFeatures>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "PATCH", url: url!, body: body)
    }

    
    
    
    /**
     
     Update the list of domains that will be allowed to embed PureCloud applications
     
     - parameter body: (body) Whitelist settings 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func putOrganizationsEmbeddedintegration(body: EmbeddedIntegration, completion: @escaping ((_ data: EmbeddedIntegration?,_ error: Error?) -> Void)) {
        let requestBuilder = putOrganizationsEmbeddedintegrationWithRequestBuilder(body: body)
        requestBuilder.execute { (response: Response<EmbeddedIntegration>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Update the list of domains that will be allowed to embed PureCloud applications
     
     - PUT /api/v2/organizations/embeddedintegration
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "domainWhitelist" : [ "aeiou" ],
  "enableWhitelist" : true
}}]
     
     - parameter body: (body) Whitelist settings 

     - returns: RequestBuilder<EmbeddedIntegration> 
     */
    open class func putOrganizationsEmbeddedintegrationWithRequestBuilder(body: EmbeddedIntegration) -> RequestBuilder<EmbeddedIntegration> {
        let path = "/api/v2/organizations/embeddedintegration"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        let body = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
        
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<EmbeddedIntegration>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "PUT", url: url!, body: body)
    }

    
    
    
    /**
     
     Update organization IP address whitelist settings
     
     - parameter body: (body) IP address Whitelist settings 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func putOrganizationsIpaddressauthentication(body: IpAddressAuthentication, completion: @escaping ((_ data: IpAddressAuthentication?,_ error: Error?) -> Void)) {
        let requestBuilder = putOrganizationsIpaddressauthenticationWithRequestBuilder(body: body)
        requestBuilder.execute { (response: Response<IpAddressAuthentication>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Update organization IP address whitelist settings
     
     - PUT /api/v2/organizations/ipaddressauthentication
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "networkWhitelist" : [ "aeiou" ]
}}]
     
     - parameter body: (body) IP address Whitelist settings 

     - returns: RequestBuilder<IpAddressAuthentication> 
     */
    open class func putOrganizationsIpaddressauthenticationWithRequestBuilder(body: IpAddressAuthentication) -> RequestBuilder<IpAddressAuthentication> {
        let path = "/api/v2/organizations/ipaddressauthentication"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        let body = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
        
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<IpAddressAuthentication>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "PUT", url: url!, body: body)
    }

    
    
    
    /**
     
     Update organization.
     
     - parameter body: (body) Organization (optional)
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func putOrganizationsMe(body: Organization? = nil, completion: @escaping ((_ data: Organization?,_ error: Error?) -> Void)) {
        let requestBuilder = putOrganizationsMeWithRequestBuilder(body: body)
        requestBuilder.execute { (response: Response<Organization>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Update organization.
     
     - PUT /api/v2/organizations/me
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "defaultCountryCode" : "aeiou",
  "selfUri" : "aeiou",
  "thirdPartyURI" : "aeiou",
  "version" : 123,
  "thirdPartyOrgName" : "aeiou",
  "features" : {
    "key" : true
  },
  "defaultLanguage" : "aeiou",
  "defaultSiteId" : "aeiou",
  "supportURI" : "aeiou",
  "domain" : "aeiou",
  "name" : "aeiou",
  "id" : "aeiou",
  "state" : "aeiou",
  "voicemailEnabled" : true,
  "productPlatform" : "aeiou"
}}]
     
     - parameter body: (body) Organization (optional)

     - returns: RequestBuilder<Organization> 
     */
    open class func putOrganizationsMeWithRequestBuilder(body: Organization? = nil) -> RequestBuilder<Organization> {
        let path = "/api/v2/organizations/me"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        let body = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
        
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<Organization>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "PUT", url: url!, body: body)
    }

    
    
    
    /**
     
     Use PUT /api/v2/organizations/embeddedintegration instead
     
     - parameter body: (body) Whitelist settings 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func putOrganizationsWhitelist(body: OrgWhitelistSettings, completion: @escaping ((_ data: OrgWhitelistSettings?,_ error: Error?) -> Void)) {
        let requestBuilder = putOrganizationsWhitelistWithRequestBuilder(body: body)
        requestBuilder.execute { (response: Response<OrgWhitelistSettings>?, error) -> Void in
            do {
                if let e = error {
                    completion(nil, e)
                } else if let r = response {
                    try requestBuilder.decode(r)
                    completion(response?.body, error)
                } else {
                    completion(nil, error)
                }
            } catch {
                completion(nil, error)
            }
        }
    }

    /**
     
     Use PUT /api/v2/organizations/embeddedintegration instead
     
     - PUT /api/v2/organizations/whitelist
     - 
     - OAuth:
       - type: oauth2
       - name: PureCloud OAuth
     - examples: [{contentType=application/json, example={
  "domainWhitelist" : [ "aeiou" ],
  "enableWhitelist" : true
}}]
     
     - parameter body: (body) Whitelist settings 

     - returns: RequestBuilder<OrgWhitelistSettings> 
     */
    open class func putOrganizationsWhitelistWithRequestBuilder(body: OrgWhitelistSettings) -> RequestBuilder<OrgWhitelistSettings> {
        let path = "/api/v2/organizations/whitelist"
        let URLString = PureCloudPlatformClientV2API.basePath + path
        
        let body = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
        
        
        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<OrgWhitelistSettings>.Type = PureCloudPlatformClientV2API.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "PUT", url: url!, body: body)
    }

}
