MCPcopy
hub / github.com/koderover/zadig / RequestJob

Method RequestJob

pkg/cli/zadig-agent/internal/network/network.go:52–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50}
51
52func (c *ZadigClient) RequestJob() (*types.ZadigJobTask, error) {
53 resp := new(types.ZadigJobTask)
54
55 body, err := httpclient.Get(GetFullURL(c.AgentConfig.URL, RequestJobBaseUrl), httpclient.SetQueryParam("token", c.AgentConfig.Token), httpclient.SetResult(resp))
56 if err != nil {
57 return nil, err
58 }
59
60 if body.IsError() {
61 errMsg := httpclient.NewErrorFromRestyResponse(body)
62 return nil, errMsg
63 }
64
65 if body.IsSuccess() {
66 return resp, nil
67 }
68 return nil, fmt.Errorf("failed to request job from zadig server")
69}
70
71type ReportJobRequest struct {
72 Token string `json:"token"`

Callers 1

PollingJobMethod · 0.80

Calls 3

GetFullURLFunction · 0.85
GetMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected