MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / UnmarshalJSON

Method UnmarshalJSON

internal/api/models.go:196–225  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

194}
195
196func (e *ExchangeResponse) UnmarshalJSON(data []byte) error {
197 var raw struct {
198 Status string `json:"status"`
199 CliID string `json:"cli_id"`
200 CliId2 string `json:"cliId"`
201 APIKey string `json:"api_key"`
202 APIKey2 string `json:"apiKey"`
203 }
204 if err := json.Unmarshal(data, &raw); err != nil {
205 return err
206 }
207 if raw.Status != "" {
208 e.Status = &raw.Status
209 }
210 cliID := raw.CliID
211 if cliID == "" {
212 cliID = raw.CliId2
213 }
214 if cliID != "" {
215 e.CliID = &cliID
216 }
217 apiKey := raw.APIKey
218 if apiKey == "" {
219 apiKey = raw.APIKey2
220 }
221 if apiKey != "" {
222 e.APIKey = &apiKey
223 }
224 return nil
225}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected