package anyapi import ( "context" "encoding/json" "fmt" "gitee.com/lansexiongdi/ymt/api" "gitee.com/lansexiongdi/ymt/core" "net/http" ) type AnyApi api.Service func (a *AnyApi) AnyApi(ctx context.Context, method string, bizContent any) (http.Header, *http.Response, *core.Response, error) { p, err := a.BuildAnyApiParams(bizContent) if err != nil { return nil, nil, nil, err } reqBodyBytes, err := json.Marshal(p) if err != nil { return nil, nil, nil, err } h := a.GetHeaders(p) url := fmt.Sprintf("%s%s", a.Config.BaseURL, method) httpResponse, bodyBytes, err := a.Request(ctx, h, http.MethodPost, url, reqBodyBytes) if err != nil { return nil, nil, nil, err } res, err := core.BuildResponse(bodyBytes) if err != nil { return h, httpResponse, nil, err } return h, httpResponse, res, nil }