MCPcopy
hub / github.com/larksuite/cli / ParseJSONResponse

Function ParseJSONResponse

internal/client/response.go:196–204  ·  view source on GitHub ↗

ParseJSONResponse decodes a raw SDK response body as JSON. CallAPI and HandleResponse both delegate to this function.

(resp *larkcore.ApiResp)

Source from the content-addressed store, hash-verified

194// ParseJSONResponse decodes a raw SDK response body as JSON.
195// CallAPI and HandleResponse both delegate to this function.
196func ParseJSONResponse(resp *larkcore.ApiResp) (interface{}, error) {
197 var result interface{}
198 dec := json.NewDecoder(bytes.NewReader(resp.RawBody))
199 dec.UseNumber()
200 if err := dec.Decode(&result); err != nil {
201 return nil, fmt.Errorf("response parse error: %w (body: %s)", err, util.TruncateStr(string(resp.RawBody), 500))
202 }
203 return result, nil
204}
205
206// ── File saving ──
207

Callers 7

CallAPIMethod · 0.92
ClassifyAPIResponseWithFunction · 0.92
TestParseJSONResponseFunction · 0.85
HandleResponseFunction · 0.85
CallAPIMethod · 0.85

Calls 1

TruncateStrFunction · 0.92