You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

proxy.go 1.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package imsdk
  2. import (
  3. "net/url"
  4. "gitlink.org.cn/cloudream/common/consts/errorcode"
  5. schsdk "gitlink.org.cn/cloudream/common/sdks/scheduler"
  6. myhttp "gitlink.org.cn/cloudream/common/utils/http"
  7. )
  8. const ProxyGetServiceInfoPath = "/proxy/getServiceInfo"
  9. type ProxyGetServiceInfo struct {
  10. ServiceName string `json:"serviceName"`
  11. JobSetID schsdk.JobSetID `json:"jobSetID"`
  12. }
  13. type ProxyGetServiceInfoResp struct {
  14. LocalJobID string `json:"localJobID"`
  15. }
  16. func (c *Client) ProxyGetServiceInfo(req ProxyGetServiceInfo) (*ProxyGetServiceInfoResp, error) {
  17. url, err := url.JoinPath(c.baseURL, ProxyGetServiceInfoPath)
  18. if err != nil {
  19. return nil, err
  20. }
  21. resp, err := myhttp.GetForm(url, myhttp.RequestParam{
  22. Query: req,
  23. })
  24. if err != nil {
  25. return nil, err
  26. }
  27. jsonResp, err := myhttp.ParseJSONResponse[response[ProxyGetServiceInfoResp]](resp)
  28. if err != nil {
  29. return nil, err
  30. }
  31. if jsonResp.Code == errorcode.OK {
  32. return &jsonResp.Data, nil
  33. }
  34. return nil, jsonResp.ToError()
  35. }