MCPcopy
hub / github.com/hatchet-dev/hatchet / ParseLagoMessageCreateResponse

Function ParseLagoMessageCreateResponse

pkg/client/cloud/rest/gen.go:3769–3799  ·  view source on GitHub ↗

ParseLagoMessageCreateResponse parses an HTTP response from a LagoMessageCreateWithResponse call

(rsp *http.Response)

Source from the content-addressed store, hash-verified

3767
3768// ParseLagoMessageCreateResponse parses an HTTP response from a LagoMessageCreateWithResponse call
3769func ParseLagoMessageCreateResponse(rsp *http.Response) (*LagoMessageCreateResponse, error) {
3770 bodyBytes, err := io.ReadAll(rsp.Body)
3771 defer func() { _ = rsp.Body.Close() }()
3772 if err != nil {
3773 return nil, err
3774 }
3775
3776 response := &LagoMessageCreateResponse{
3777 Body: bodyBytes,
3778 HTTPResponse: rsp,
3779 }
3780
3781 switch {
3782 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
3783 var dest APIErrors
3784 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
3785 return nil, err
3786 }
3787 response.JSON400 = &dest
3788
3789 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403:
3790 var dest APIErrors
3791 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
3792 return nil, err
3793 }
3794 response.JSON403 = &dest
3795
3796 }
3797
3798 return response, nil
3799}
3800
3801// ParseTenantBillingStateGetResponse parses an HTTP response from a TenantBillingStateGetWithResponse call
3802func ParseTenantBillingStateGetResponse(rsp *http.Response) (*TenantBillingStateGetResponse, error) {

Callers 1

Calls 3

CloseMethod · 0.65
GetMethod · 0.65
UnmarshalMethod · 0.65

Tested by

no test coverage detected