Skip to content

Commit 81a3a81

Browse files
Merge pull request #19 from tranhoangvuit/chore/separate-type-struct
chore: separate type struct to new file
2 parents b240598 + 58dedd9 commit 81a3a81

File tree

3 files changed

+91
-90
lines changed

3 files changed

+91
-90
lines changed

bucket.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -143,30 +143,3 @@ func (c *Client) DeleteBucket(id string) (MessageResponse, BucketResponseError)
143143

144144
return data, error_
145145
}
146-
147-
type MessageResponse struct {
148-
Message string `json:"message"`
149-
}
150-
151-
type BucketResponseError struct {
152-
Error string `json:"error"`
153-
Message string `json:"message"`
154-
StatusCode uint16 `json:"statusCode"`
155-
}
156-
157-
type Bucket struct {
158-
Id string `json:"id"`
159-
Name string `json:"name"`
160-
Owner string `json:"owner"`
161-
Public bool `json:"public"`
162-
FileSizeLimit string `json:"file_size_limit"`
163-
AllowedMimeTypes []string `json:"allowed_mine_types"`
164-
CreatedAt string `json:"created_at"`
165-
UpdatedAt string `json:"updated_at"`
166-
}
167-
168-
type BucketOptions struct {
169-
Public bool
170-
FileSizeLimit string
171-
AllowedMimeTypes []string
172-
}

storage.go

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -314,66 +314,3 @@ func buildUrlWithOption(urlStr string, options UrlOptions) string {
314314
func removeEmptyFolderName(filePath string) string {
315315
return regexp.MustCompile(`\/\/`).ReplaceAllString(filePath, "/")
316316
}
317-
318-
type SortBy struct {
319-
Column string `json:"column"`
320-
Order string `json:"order"`
321-
}
322-
323-
type FileUploadResponse struct {
324-
Key string `json:"Key"`
325-
Message string `json:"message"`
326-
Data []byte
327-
Code string `json:"statusCode"`
328-
Error string `json:"error"`
329-
}
330-
331-
type SignedUrlResponse struct {
332-
SignedURL string `json:"signedURL"`
333-
}
334-
335-
type FileSearchOptions struct {
336-
Limit int `json:"limit"`
337-
Offset int `json:"offset"`
338-
SortByOptions SortBy `json:"sortBy"`
339-
}
340-
341-
type FileObject struct {
342-
Name string `json:"name"`
343-
BucketId string `json:"bucket_id"`
344-
Owner string `json:"owner"`
345-
Id string `json:"id"`
346-
UpdatedAt string `json:"updated_at"`
347-
CreatedAt string `json:"created_at"`
348-
LastAccessedAt string `json:"last_accessed_at"`
349-
Metadata interface{} `json:"metadata"`
350-
Buckets Bucket
351-
}
352-
353-
type ListFileRequestBody struct {
354-
Limit int `json:"limit"`
355-
Offset int `json:"offset"`
356-
SortByOptions SortBy `json:"sortBy"`
357-
Prefix string `json:"prefix"`
358-
}
359-
360-
type TransformOptions struct {
361-
Width int `json:"width"`
362-
Height int `json:"height"`
363-
Resize string `json:"resize"`
364-
Format string `json:"format"`
365-
Quality int `json:"quality"`
366-
}
367-
368-
type UrlOptions struct {
369-
Transform *TransformOptions `json:"transform"`
370-
Download bool `json:"download"`
371-
}
372-
373-
type SignedUploadUrlResponse struct {
374-
Url string `json:"url"`
375-
}
376-
377-
type UploadToSignedUrlResponse struct {
378-
Key string `json:"key"`
379-
}

types.go

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package storage_go
2+
3+
type MessageResponse struct {
4+
Message string `json:"message"`
5+
}
6+
7+
type BucketResponseError struct {
8+
Error string `json:"error"`
9+
Message string `json:"message"`
10+
StatusCode uint16 `json:"statusCode"`
11+
}
12+
13+
type Bucket struct {
14+
Id string `json:"id"`
15+
Name string `json:"name"`
16+
Owner string `json:"owner"`
17+
Public bool `json:"public"`
18+
FileSizeLimit string `json:"file_size_limit"`
19+
AllowedMimeTypes []string `json:"allowed_mine_types"`
20+
CreatedAt string `json:"created_at"`
21+
UpdatedAt string `json:"updated_at"`
22+
}
23+
24+
type BucketOptions struct {
25+
Public bool
26+
FileSizeLimit string
27+
AllowedMimeTypes []string
28+
}
29+
30+
type SortBy struct {
31+
Column string `json:"column"`
32+
Order string `json:"order"`
33+
}
34+
35+
type FileUploadResponse struct {
36+
Key string `json:"Key"`
37+
Message string `json:"message"`
38+
Data []byte
39+
Code string `json:"statusCode"`
40+
Error string `json:"error"`
41+
}
42+
43+
type SignedUrlResponse struct {
44+
SignedURL string `json:"signedURL"`
45+
}
46+
47+
type FileSearchOptions struct {
48+
Limit int `json:"limit"`
49+
Offset int `json:"offset"`
50+
SortByOptions SortBy `json:"sortBy"`
51+
}
52+
53+
type FileObject struct {
54+
Name string `json:"name"`
55+
BucketId string `json:"bucket_id"`
56+
Owner string `json:"owner"`
57+
Id string `json:"id"`
58+
UpdatedAt string `json:"updated_at"`
59+
CreatedAt string `json:"created_at"`
60+
LastAccessedAt string `json:"last_accessed_at"`
61+
Metadata interface{} `json:"metadata"`
62+
Buckets Bucket
63+
}
64+
65+
type ListFileRequestBody struct {
66+
Limit int `json:"limit"`
67+
Offset int `json:"offset"`
68+
SortByOptions SortBy `json:"sortBy"`
69+
Prefix string `json:"prefix"`
70+
}
71+
72+
type TransformOptions struct {
73+
Width int `json:"width"`
74+
Height int `json:"height"`
75+
Resize string `json:"resize"`
76+
Format string `json:"format"`
77+
Quality int `json:"quality"`
78+
}
79+
80+
type UrlOptions struct {
81+
Transform *TransformOptions `json:"transform"`
82+
Download bool `json:"download"`
83+
}
84+
85+
type SignedUploadUrlResponse struct {
86+
Url string `json:"url"`
87+
}
88+
89+
type UploadToSignedUrlResponse struct {
90+
Key string `json:"key"`
91+
}

0 commit comments

Comments
 (0)