// Updates ACL item with specified ID
548337
func (s *NetworkACLService) UpdateNetworkACLItem(p *UpdateNetworkACLItemParams) (*UpdateNetworkACLItemResponse, error) {
	resp, err := s.cs.newRequest("updateNetworkACLItem", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r UpdateNetworkACLItemResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
1099616
func (c *FakeOAuthClientAuthorizations) Update(oAuthClientAuthorization *oauth.OAuthClientAuthorization) (result *oauth.OAuthClientAuthorization, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateAction(oauthclientauthorizationsResource, oAuthClientAuthorization), &oauth.OAuthClientAuthorization{})
	if obj == nil {
		return nil, err
	}
	return obj.(*oauth.OAuthClientAuthorization), err
}
283839
func (c *Card) Update(args Arguments) error {
	path := fmt.Sprintf("cards/%s", c.ID)
	return c.client.Put(path, args, c)
}
96122
func (c *WorkitemController) Update(ctx *app.UpdateWorkitemContext) error {
	if ctx.Payload == nil || ctx.Payload.Data == nil || ctx.Payload.Data.ID == nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("missing data.ID element in request", nil))
	}
	currentUserIdentityID, err := login.ContextIdentity(ctx)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(err.Error()))
	}
	var wi *workitem.WorkItem
	err = application.Transactional(c.db, func(appl application.Application) error {
		wi, err = appl.WorkItems().LoadByID(ctx, *ctx.Payload.Data.ID)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	creator := wi.Fields[workitem.SystemCreator]
	if creator == nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewInternalError(ctx, errs.New("work item doesn't have creator")))
	}
	creatorIDStr, ok := creator.(string)
	if !ok {
		return jsonapi.JSONErrorResponse(ctx, errs.Errorf("failed to convert user to string: %+v (%[1]T)", creator))
	}
	creatorID, err := uuid.FromString(creatorIDStr)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	authorized, err := authorizeWorkitemEditor(ctx, c.db, wi.SpaceID, creator.(string), currentUserIdentityID.String())
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	if !authorized {
		return jsonapi.JSONErrorResponse(ctx, errors.NewForbiddenError("user is not authorized to access the space"))
	}

	if ctx.Payload.Data.Relationships != nil && ctx.Payload.Data.Relationships.BaseType != nil &&
		ctx.Payload.Data.Relationships.BaseType.Data != nil && ctx.Payload.Data.Relationships.BaseType.Data.ID != wi.Type {

		err := c.WorkitemCreatorOrSpaceOwner(ctx, wi.SpaceID, creatorID, *currentUserIdentityID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		// Store new values of type and version
		newType := ctx.Payload.Data.Relationships.BaseType
		newVersion := ctx.Payload.Data.Attributes[workitem.SystemVersion]

		// Remove version and base type from payload
		delete(ctx.Payload.Data.Attributes, workitem.SystemVersion)
		ctx.Payload.Data.Relationships.BaseType = nil

		// Ensure we do not have any other change in payload except type change
		if (app.WorkItemRelationships{}) != *ctx.Payload.Data.Relationships || len(ctx.Payload.Data.Attributes) > 0 {
			// Todo(ibrahim) - Change this error to 422 Unprocessable entity
			// error once we have this error in our error package. Please see
			// https://github.com/fabric8-services/fabric8-wit/pull/2202#discussion_r208842063
			return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterErrorFromString("cannot update type along with other fields"))
		}

		// Restore the original values
		ctx.Payload.Data.Relationships.BaseType = newType
		ctx.Payload.Data.Attributes[workitem.SystemVersion] = newVersion

	}
	var rev *workitem.Revision
	err = application.Transactional(c.db, func(appl application.Application) error {
		// The Number of a work item is not allowed to be changed which is why
		// we overwrite the values with its old value after the work item was
		// converted.
		oldNumber := wi.Number
		err = ConvertJSONAPIToWorkItem(ctx, ctx.Method, appl, *ctx.Payload.Data, wi, wi.Type, wi.SpaceID)
		if err != nil {
			return err
		}
		wi.Number = oldNumber
		wi, rev, err = appl.WorkItems().Save(ctx, wi.SpaceID, *wi, *currentUserIdentityID)
		if err != nil {
			return errs.Wrap(err, "Error updating work item")
		}
		return nil
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	wit, err := c.db.WorkItemTypes().Load(ctx.Context, wi.Type)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, errs.Wrapf(err, "failed to load work item type: %s", wi.Type))
	}
	c.notification.Send(ctx, notification.NewWorkItemUpdated(ctx.Payload.Data.ID.String(), rev.ID))
	converted, err := ConvertWorkItem(ctx.Request, *wit, *wi, workItemIncludeHasChildren(ctx, c.db))
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	resp := &app.WorkItemSingle{
		Data: converted,
		Links: &app.WorkItemLinks{
			Self: buildAbsoluteURL(ctx.Request),
		},
	}
	ctx.ResponseData.Header().Set("Last-Modified", lastModified(*wi))
	return ctx.OK(resp)
}
1286173
func (s *NetworkACLService) UpdateNetworkACLList(p *UpdateNetworkACLListParams) (*UpdateNetworkACLListResponse, error) {
	resp, err := s.cs.newRequest("updateNetworkACLList", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r UpdateNetworkACLListResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
867198
func (c Client) Update(id string, params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {
	path := stripe.FormatURLPath("/v1/subscription_items/%s", id)
	subi := &stripe.SubscriptionItem{}
	err := c.B.Call(http.MethodPost, path, c.Key, params, subi)
	return subi, err
}
674033
func Update(id string, params *stripe.FileLinkParams) (*stripe.FileLink, error) {
	return getC().Update(id, params)
}
292475
func (c Client) Update(id string, params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {
	path := stripe.FormatURLPath("/v1/radar/value_lists/%s", id)
	vl := &stripe.RadarValueList{}
	err := c.B.Call(http.MethodPost, path, c.Key, params, vl)
	return vl, err
}
434136
func (m *Manager) Update(see *See) error {
	return m.collection.UpdateId(see.ID, see)
}
17381
func (s *AuthorizationService) UpdateAuthorization(ctx context.Context, id platform.ID, upd *platform.AuthorizationUpdate) (*platform.Authorization, error) {
	return s.UpdateAuthorizationFn(ctx, id, upd)
}
931578
func (c *Client) UpdateAuthorization(ctx context.Context, id platform.ID, upd *platform.AuthorizationUpdate) (*platform.Authorization, error) {
	var a *platform.Authorization
	err := c.db.Update(func(tx *bolt.Tx) error {
		var pe *platform.Error
		a, pe = c.updateAuthorization(ctx, tx, id, upd)
		if pe != nil {
			return &platform.Error{
				Err: pe,
				Op:  platform.OpUpdateAuthorization,
			}
		}
		return nil
	})
	return a, err
}
92204
func (a *Agent) UpdateACLToken(token string, q *WriteOptions) (*WriteMeta, error) {
	return a.updateToken("acl_token", token, q)
}
225436
func (b *AccountController) Update(c *app.UpdateAccountContext) error {
	account, ok := b.db.GetAccount(c.AccountID)
	if !ok {
		return c.NotFound()
	}
	payload := c.Payload
	if payload.Name != "" {
		account.Name = payload.Name
	}
	b.db.SaveAccount(account)
	return c.NoContent()
}
984924
func (api *API) UpdateAccount(accountID string, account Account) (Account, error) {
	uri := "/accounts/" + accountID

	res, err := api.makeRequest("PUT", uri, account)
	if err != nil {
		return Account{}, errors.Wrap(err, errMakeRequestError)
	}

	var a AccountDetailResponse
	err = json.Unmarshal(res, &a)
	if err != nil {
		return Account{}, errors.Wrap(err, errUnmarshalError)
	}

	return a.Result, nil
}
916977
func (c *FakeIdentities) Update(identity *user.Identity) (result *user.Identity, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateAction(identitiesResource, identity), &user.Identity{})
	if obj == nil {
		return nil, err
	}
	return obj.(*user.Identity), err
}
810786
func (s *userService) Update(id int64, user datamodels.User) (datamodels.User, error) {
	user.ID = id
	return s.repo.InsertOrUpdate(user)
}
1325913
func (self *PlanClient) Update(id string, newName string) (*Plan, error) {
	values := url.Values{"name": {newName}}
	plan := Plan{}
	path := "/v1/plans/" + url.QueryEscape(id)
	err := query("POST", path, values, &plan)
	return &plan, err
}