/// <summary>
        ///  The method createnewschedule creates a new schedule stored in the backup list.
        /// </summary>
        /// <param name="accessToken">Your access token</param>
        /// <param name="deviceId">The relay id</param>
        /// <param name="moduleId">The thermostat id</param>
        /// <param name="thermProgram">The thermostat program (zones and timetable)</param>
        /// <returns>NANewScheduleResponse</returns>
        public async System.Threading.Tasks.Task<NANewScheduleResponse> CreatenewscheduleAsync (string accessToken, string deviceId, string moduleId, NAThermProgram thermProgram)
        {
            // verify the required parameter 'accessToken' is set
            if (accessToken == null) throw new ApiException(400, "Missing required parameter 'accessToken' when calling Createnewschedule");
            // verify the required parameter 'deviceId' is set
            if (deviceId == null) throw new ApiException(400, "Missing required parameter 'deviceId' when calling Createnewschedule");
            // verify the required parameter 'moduleId' is set
            if (moduleId == null) throw new ApiException(400, "Missing required parameter 'moduleId' when calling Createnewschedule");
            // verify the required parameter 'thermProgram' is set
            if (thermProgram == null) throw new ApiException(400, "Missing required parameter 'thermProgram' when calling Createnewschedule");
            
    
            var path = "/api/createnewschedule";
    
            var pathParams = new Dictionary<String, String>();
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();
            var formParams = new Dictionary<String, String>();
            var fileParams = new Dictionary<String, FileParameter>();
            String postBody = null;

            // to determine the Accept header
            String[] http_header_accepts = new String[] {
                
            };
            String http_header_accept = ApiClient.SelectHeaderAccept(http_header_accepts);
            if (http_header_accept != null)
                headerParams.Add("Accept", ApiClient.SelectHeaderAccept(http_header_accepts));

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            pathParams.Add("format", "json");
            
            if (accessToken != null) queryParams.Add("access_token", ApiClient.ParameterToString(accessToken)); // query parameter
            if (deviceId != null) queryParams.Add("device_id", ApiClient.ParameterToString(deviceId)); // query parameter
            if (moduleId != null) queryParams.Add("module_id", ApiClient.ParameterToString(moduleId)); // query parameter
            
            
            
            postBody = ApiClient.Serialize(thermProgram); // http body (model) parameter
            
    
            // authentication setting, if any
            String[] authSettings = new String[] {  };
    
            // make the HTTP request
            IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
            if (((int)response.StatusCode) >= 400)
                throw new ApiException ((int)response.StatusCode, "Error calling Createnewschedule: " + response.Content, response.Content);

            return (NANewScheduleResponse) ApiClient.Deserialize(response.Content, typeof(NANewScheduleResponse), response.Headers);
        }
        /// <summary>
        ///  The method syncschedule changes the Thermostat weekly schedule.
        /// </summary>
        /// <param name="deviceId">The relay id</param>
        /// <param name="moduleId">The thermostat id</param>
        /// <param name="thermProgram">The thermostat program (zones, timetable and name)</param>
        /// <returns>NAOkResponse</returns>
        public async System.Threading.Tasks.Task<NAOkResponse> SyncscheduleAsync (string deviceId, string moduleId, NAThermProgram thermProgram)
        {
            // verify the required parameter 'deviceId' is set
            if (deviceId == null) throw new ApiException(400, "Missing required parameter 'deviceId' when calling Syncschedule");
            // verify the required parameter 'moduleId' is set
            if (moduleId == null) throw new ApiException(400, "Missing required parameter 'moduleId' when calling Syncschedule");
            // verify the required parameter 'thermProgram' is set
            if (thermProgram == null) throw new ApiException(400, "Missing required parameter 'thermProgram' when calling Syncschedule");
            
    
            var path = "/syncschedule";
    
            var pathParams = new Dictionary<String, String>();
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();
            var formParams = new Dictionary<String, String>();
            var fileParams = new Dictionary<String, FileParameter>();
            String postBody = null;
    
            pathParams.Add("format", "json");
            
            if (deviceId != null) queryParams.Add("device_id", ApiClient.ParameterToString(deviceId)); // query parameter
            if (moduleId != null) queryParams.Add("module_id", ApiClient.ParameterToString(moduleId)); // query parameter
            
            
            
            postBody = ApiClient.Serialize(thermProgram); // http body (model) parameter
            
    
            // authentication setting, if any
            String[] authSettings = new String[] { "code_oauth", "password_oauth" };
    
            // make the HTTP request
            IRestResponse response = (IRestResponse) await ApiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams, authSettings);
            if (((int)response.StatusCode) >= 400)
                throw new ApiException ((int)response.StatusCode, "Error calling Syncschedule: " + response.Content, response.Content);

            return (NAOkResponse) ApiClient.Deserialize(response.Content, typeof(NAOkResponse), response.Headers);
        }