github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/engine/profile_edit.go (about)

     1  // Copyright 2015 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package engine
     5  
     6  import (
     7  	"github.com/keybase/client/go/libkb"
     8  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
     9  )
    10  
    11  type ProfileEdit struct {
    12  	libkb.Contextified
    13  	arg keybase1.ProfileEditArg
    14  }
    15  
    16  func NewProfileEdit(g *libkb.GlobalContext, arg keybase1.ProfileEditArg) *ProfileEdit {
    17  	return &ProfileEdit{
    18  		Contextified: libkb.NewContextified(g),
    19  		arg:          arg,
    20  	}
    21  }
    22  
    23  func (e *ProfileEdit) Run(m libkb.MetaContext) (err error) {
    24  	defer m.Trace("ProfileEdit#Run", &err)()
    25  	_, err = m.G().API.Post(m, libkb.APIArg{
    26  		Endpoint:    "profile-edit",
    27  		SessionType: libkb.APISessionTypeREQUIRED,
    28  		Args: libkb.HTTPArgs{
    29  			"bio":       libkb.S{Val: e.arg.Bio},
    30  			"full_name": libkb.S{Val: e.arg.FullName},
    31  			"location":  libkb.S{Val: e.arg.Location},
    32  		},
    33  	})
    34  	if err != nil {
    35  		return err
    36  	}
    37  	u := m.G().ActiveDevice.UID()
    38  	m.Debug("Clearing Card cache for %s", u)
    39  	_ = e.G().CardCache().Delete(u)
    40  	_ = e.G().UIDMapper.ClearUIDFullName(m.Ctx(), m.G(), u)
    41  	return nil
    42  }
    43  
    44  // Name is the unique engine name.
    45  func (e *ProfileEdit) Name() string {
    46  	return "ProfileEdit"
    47  }
    48  
    49  // GetPrereqs returns the engine prereqs (none).
    50  func (e *ProfileEdit) Prereqs() Prereqs {
    51  	return Prereqs{}
    52  }
    53  
    54  func (e *ProfileEdit) RequiredUIs() []libkb.UIKind {
    55  	return nil
    56  }
    57  
    58  func (e *ProfileEdit) SubConsumers() []libkb.UIConsumer {
    59  	return nil
    60  }