|
- package uploadersdk
-
- import (
- "gitlink.org.cn/cloudream/common/sdks/storage/cdsapi"
- "mime/multipart"
- )
-
- type ObjectUploadReq struct {
- Info cdsapi.ObjectUploadInfo `form:"info" binding:"required"`
- Files []*multipart.FileHeader `form:"files"`
- }
-
- //func (c *Client) Upload(req ObjectUploadReq) (*cdsapi.ObjectUploadResp, error) {
- // targetUrl, err := url.JoinPath(c.baseURL, "/object/upload")
- // if err != nil {
- // return nil, err
- // }
- //
- // resp, err := http2.PostJSON(targetUrl, http2.RequestParam{
- // Body: req,
- // })
- // if err != nil {
- // return nil, err
- // }
- //
- // contType := resp.Header.Get("Content-Type")
- // if strings.Contains(contType, http2.ContentTypeJSON) {
- // var codeResp response[cdsapi.ObjectUploadResp]
- // if err := serder.JSONToObjectStream(resp.Body, &codeResp); err != nil {
- // return nil, fmt.Errorf("parsing response: %w", err)
- // }
- //
- // if codeResp.Code == errorcode.OK {
- // return &codeResp.Data, nil
- // }
- //
- // return nil, codeResp.ToError()
- // }
- //
- // return nil, fmt.Errorf("unknow response content type: %s", contType)
- //}
|