/// <summary>
        /// Sends a PUT to '/api/agilerun/{id}'
        /// </summary>
        /// <param name="id">a path parameter (no description)</param>
        /// <param name="model">a body parameter (no description)</param>
        /// <param name="expand">a query parameter (Allows the specifying of eager-loading of related data which is returned in-line within the results of the request.)</param>
        /// <returns></returns>
        public virtual AgileRun UpdateAgileRun(string id, CreateOrUpdateAgileRun model, string expand = null)
        {
            var operation = Operations.UpdateAgileRun(id, model, expand);
			var response = _client.SendAsync(operation.BuildRequest(_client)).Result;
			EnsureSuccess(response);
			var result = response.Content.ReadAsAsync<AgileRun>().Result;
			return result;
			
		}
 /// <summary>
 /// Sends a POST to '/api/agileruns'
 /// </summary>
 /// <param name="model">a body parameter (no description)</param>
 /// <param name="expand">a query parameter (Allows the specifying of eager-loading of related data which is returned in-line within the results of the request.)</param>
 /// <returns></returns>
 public static RestOperation CreateAgileRun(CreateOrUpdateAgileRun model, string expand = null)
 {
     return new RestOperation("POST", "api/agileruns")
         {
             Content = model,                    QueryParams =
                 {
                      {"$expand", expand},
                 }
         };
 }
partial         void CopyExtraPropertiesToClone(CreateOrUpdateAgileRun clone, bool includeLocalProperties);
 public CreateOrUpdateAgileRun Clone(bool includeLocalProperties)
 {
     var c = new CreateOrUpdateAgileRun
             {
                 ActualDuration = ActualDuration,
                 AssignedToId = AssignedToId,
                 Description = Description,
                 EstimatedDuration = EstimatedDuration,
                 FieldValues = FieldValues,
                 Id = Id,
                 Name = Name,
                 Notes = Notes,
                 Number = Number,
                 Objective = Objective,
                 OrderNumber = OrderNumber,
                 PackageId = PackageId,
                 PostCondition = PostCondition,
                 PreCondition = PreCondition,
                 PriorityId = PriorityId,
                 ProjectId = ProjectId,
                 StatusId = StatusId,
                 TypeId = TypeId,
                 WidgetValues = WidgetValues,
                 Steps = Steps.Select(x=>x.Clone(includeLocalProperties)).ToList(),
             };
     CopyExtraPropertiesToClone(c, includeLocalProperties);
     return c;
 }
		/// <summary>
        /// Sends a PUT to '/api/agilerun/{id}'  (asynchronous)
        /// </summary>
        /// <param name="id">a path parameter (no description)</param>
        /// <param name="model">a body parameter (no description)</param>
        /// <param name="expand">a query parameter (Allows the specifying of eager-loading of related data which is returned in-line within the results of the request.)</param>
        /// <returns></returns>
        public virtual async Task<AgileRun> UpdateAgileRunAsync(string id, CreateOrUpdateAgileRun model, string expand = null)
        {
            var operation = Operations.UpdateAgileRun(id, model, expand);
		    var request = operation.BuildRequest(_client);
            request.Headers.Add("wait-until-indexed","false");
			var response = await _client.SendAsync(operation.BuildRequest(_client));
			EnsureSuccess(response);
			var result = await response.Content.ReadAsAsync<AgileRun>();
			return result;
						
		}
		/// <summary>
        /// Sends a POST to '/api/agileruns'  (asynchronous)
        /// </summary>
        /// <param name="model">a body parameter (no description)</param>
        /// <param name="expand">a query parameter (Allows the specifying of eager-loading of related data which is returned in-line within the results of the request.)</param>
        /// <returns></returns>
        public virtual async Task<AgileRun> CreateAgileRunAsync(CreateOrUpdateAgileRun model, string expand = null)
        {
            var operation = Operations.CreateAgileRun(model, expand);
			var response = await _client.SendAsync(operation.BuildRequest(_client));
			EnsureSuccess(response);
			var result = await response.Content.ReadAsAsync<AgileRun>();
			return result;
						
		}