| @@ -15,7 +15,7 @@ const IPFSReadPath = "/ipfs/read" | |||||
| type IPFSRead struct { | type IPFSRead struct { | ||||
| FileHash string `json:"fileHash"` | FileHash string `json:"fileHash"` | ||||
| Offset int64 `json:"offset"` | Offset int64 `json:"offset"` | ||||
| Length int64 `json:"length,omitempty"` // 接口允许设置Length为0,所以这里只能omitempty | |||||
| Length int64 `json:"length"` | |||||
| } | } | ||||
| func (c *Client) IPFSRead(req IPFSRead) (io.ReadCloser, error) { | func (c *Client) IPFSRead(req IPFSRead) (io.ReadCloser, error) { | ||||
| @@ -0,0 +1,5 @@ | |||||
| package imsdk | |||||
| const ( | |||||
| EnvPackageList = "IMFS_PACKAGE_LIST" | |||||
| ) | |||||
| @@ -7,6 +7,10 @@ import ( | |||||
| "gitlink.org.cn/cloudream/common/utils/serder" | "gitlink.org.cn/cloudream/common/utils/serder" | ||||
| ) | ) | ||||
| const ( | |||||
| ObjectPathSeperator = "/" | |||||
| ) | |||||
| /// TODO 将分散在各处的公共结构体定义集中到这里来 | /// TODO 将分散在各处的公共结构体定义集中到这里来 | ||||
| const ( | const ( | ||||
| @@ -120,7 +120,7 @@ func ParseJSONResponse[TBody any](resp *http.Response) (TBody, error) { | |||||
| return ret, nil | return ret, nil | ||||
| } | } | ||||
| return ret, fmt.Errorf("unknow response content type: %s", contType) | |||||
| return ret, fmt.Errorf("unknow response content type: %s, status: %d", contType, resp.StatusCode) | |||||
| } | } | ||||
| type MultiPartRequestParam struct { | type MultiPartRequestParam struct { | ||||