/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/engine/team_blocks_get.go
66 строк
1 KB
Joshua Blum
Refactor trace to take a pointer to an error instead of a closure (#23779)
15 апр 2020, 21:08
Не верифицирован
15 апр 2020, 21:08
08da174
Код
Авторство
О чём код?
package engine import ( "github.com/keybase/client/go/libkb" keybase1 "github.com/keybase/client/go/protocol/keybase1" ) type TeamBlocksGet struct { libkb.Contextified blocks []keybase1.TeamBlock } func NewTeamBlocksGet(g *libkb.GlobalContext) *TeamBlocksGet { return &TeamBlocksGet{ Contextified: libkb.NewContextified(g), } } // Name is the unique engine name. func (e *TeamBlocksGet) Name() string { return "TeamBlocksGet" } // GetPrereqs returns the engine prereqs. func (e *TeamBlocksGet) Prereqs() Prereqs { return Prereqs{} } // RequiredUIs returns the required UIs. func (e *TeamBlocksGet) RequiredUIs() []libkb.UIKind { return []libkb.UIKind{} } // SubConsumers returns the other UI consumers for this engine. func (e *TeamBlocksGet) SubConsumers() []libkb.UIConsumer { return nil } // Run starts the engine. func (e *TeamBlocksGet) Run(mctx libkb.MetaContext) (err error) { defer mctx.Trace("TeamBlocksGet#Run", &err)() apiArg := libkb.APIArg{ Endpoint: "team/blocks", SessionType: libkb.APISessionTypeREQUIRED, } type getBlockResult struct { libkb.AppStatusEmbed TeamBlocks []keybase1.TeamBlock `json:"team_blocks"` } var apiRes getBlockResult err = mctx.G().API.GetDecode(mctx, apiArg, &apiRes) if err != nil { return err } e.blocks = apiRes.TeamBlocks return nil } func (e *TeamBlocksGet) Blocks() []keybase1.TeamBlock { return e.blocks }