MCPcopy Index your code
hub / github.com/supabase/auth / ParsePutAdminUsersUserIdResponse

Function ParsePutAdminUsersUserIdResponse

client/admin/client.go:2502–2546  ·  view source on GitHub ↗

ParsePutAdminUsersUserIdResponse parses an HTTP response from a PutAdminUsersUserIdWithResponse call

(rsp *http.Response)

Source from the content-addressed store, hash-verified

2500
2501// ParsePutAdminUsersUserIdResponse parses an HTTP response from a PutAdminUsersUserIdWithResponse call
2502func ParsePutAdminUsersUserIdResponse(rsp *http.Response) (*PutAdminUsersUserIdResponse, error) {
2503 bodyBytes, err := io.ReadAll(rsp.Body)
2504 defer func() { _ = rsp.Body.Close() }()
2505 if err != nil {
2506 return nil, err
2507 }
2508
2509 response := &PutAdminUsersUserIdResponse{
2510 Body: bodyBytes,
2511 HTTPResponse: rsp,
2512 }
2513
2514 switch {
2515 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
2516 var dest UserSchema
2517 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
2518 return nil, err
2519 }
2520 response.JSON200 = &dest
2521
2522 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
2523 var dest UnauthorizedResponse
2524 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
2525 return nil, err
2526 }
2527 response.JSON401 = &dest
2528
2529 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403:
2530 var dest ForbiddenResponse
2531 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
2532 return nil, err
2533 }
2534 response.JSON403 = &dest
2535
2536 case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
2537 var dest ErrorSchema
2538 if err := json.Unmarshal(bodyBytes, &dest); err != nil {
2539 return nil, err
2540 }
2541 response.JSON404 = &dest
2542
2543 }
2544
2545 return response, nil
2546}
2547
2548// ParseGetAdminUsersUserIdFactorsResponse parses an HTTP response from a GetAdminUsersUserIdFactorsWithResponse call
2549func ParseGetAdminUsersUserIdFactorsResponse(rsp *http.Response) (*GetAdminUsersUserIdFactorsResponse, error) {

Calls 4

ContainsMethod · 0.80
CloseMethod · 0.65
GetMethod · 0.45
UnmarshalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…