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