wip: file preview

This commit is contained in:
loveuer
2024-10-14 22:31:59 +08:00
parent 6f15f82122
commit 3ff83f12b4
6 changed files with 115 additions and 67 deletions

View File

@ -12,10 +12,10 @@ import (
)
type ObjectInfo struct {
Bucket string
Key string
ContentType string
Expire int64
Bucket string `json:"bucket"`
Key string `json:"key"`
ContentType string `json:"content_type"`
Expire int64 `json:"expire"`
}
func (c *Client) GetObjectInfo(ctx context.Context, bucket string, key string) (*ObjectInfo, error) {
@ -62,9 +62,9 @@ func (presigner *Presigner) GetObject(ctx context.Context, bucketName string, ob
}
type ObjectEntry struct {
URL string
Method string
Header http.Header
URL string `json:"url"`
Method string `json:"method"`
Header http.Header `json:"header"`
}
func (c *Client) GetObjectEntry(ctx context.Context, bucket string, key string, lifetimes ...int64) (*ObjectEntry, error) {
@ -92,7 +92,7 @@ func (c *Client) GetObjectEntry(ctx context.Context, bucket string, key string,
type ObjectEntity struct {
ObjectInfo
Body io.ReadCloser
Body io.ReadCloser `json:"body"`
}
func (c *Client) GetObject(ctx context.Context, bucket string, key string) (*ObjectEntity, error) {