/// <summary>
 /// Sends a PUT to '/api/script/{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 static RestOperation UpdateScript(string id, CreateOrUpdateScript model, string expand = null)
 {
     return new RestOperation("PUT", "api/script/" + id + "")
         {
             Content = model,                    QueryParams =
                 {
                      {"$expand", expand},
                 }
         };
 }
 /// <summary>
 /// Sends a POST to '/api/scripts'
 /// </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 CreateScript(CreateOrUpdateScript model, string expand = null)
 {
     return new RestOperation("POST", "api/scripts")
         {
             Content = model,                    QueryParams =
                 {
                      {"$expand", expand},
                 }
         };
 }
partial         void CopyExtraPropertiesToClone(CreateOrUpdateScript clone, bool includeLocalProperties);
 public CreateOrUpdateScript Clone(bool includeLocalProperties)
 {
     var c = new CreateOrUpdateScript
             {
                 AssignedToId = AssignedToId,
                 ChangeComment = ChangeComment,
                 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,
                 StatusId = StatusId,
                 TemporaryId = TemporaryId,
                 TypeId = TypeId,
                 WidgetValues = WidgetValues,
                 Steps = Steps.Select(x=>x.Clone(includeLocalProperties)).ToList(),
             };
     CopyExtraPropertiesToClone(c, includeLocalProperties);
     return c;
 }
		/// <summary>
        /// Sends a POST to '/api/scripts'  (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<Script> CreateScriptAsync(CreateOrUpdateScript model, string expand = null)
        {
            var operation = Operations.CreateScript(model, expand);
			var response = await _client.SendAsync(operation.BuildRequest(_client));
			EnsureSuccess(response);
			var result = await response.Content.ReadAsAsync<Script>();
			return result;
						
		}
        /// <summary>
        /// Sends a PUT to '/api/script/{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 Script UpdateScript(string id, CreateOrUpdateScript model, string expand = null)
        {
            var operation = Operations.UpdateScript(id, model, expand);
			var response = _client.SendAsync(operation.BuildRequest(_client)).Result;
			EnsureSuccess(response);
			var result = response.Content.ReadAsAsync<Script>().Result;
			return result;
			
		}