@@ -11,6 +11,7 @@ import (
1111 "io"
1212 "mime/multipart"
1313 "net/http"
14+ "slices"
1415 "time"
1516
1617 "github.com/imagekit-developer/imagekit-go/internal/apiform"
@@ -53,7 +54,7 @@ func NewFileService(opts ...option.RequestOption) (r FileService) {
5354// You can update `tags`, `customCoordinates`, `customMetadata`, publication
5455// status, remove existing `AITags` and apply extensions using this API.
5556func (r * FileService ) Update (ctx context.Context , fileID string , body FileUpdateParams , opts ... option.RequestOption ) (res * FileUpdateResponse , err error ) {
56- opts = append (r .Options [:] , opts ... )
57+ opts = slices . Concat (r .Options , opts )
5758 if fileID == "" {
5859 err = errors .New ("missing required fileId parameter" )
5960 return
@@ -69,7 +70,7 @@ func (r *FileService) Update(ctx context.Context, fileID string, body FileUpdate
6970// the response is cached. Deleting a file does not purge the cache. You can purge
7071// the cache using purge cache API.
7172func (r * FileService ) Delete (ctx context.Context , fileID string , opts ... option.RequestOption ) (err error ) {
72- opts = append (r .Options [:] , opts ... )
73+ opts = slices . Concat (r .Options , opts )
7374 opts = append ([]option.RequestOption {option .WithHeader ("Accept" , "" )}, opts ... )
7475 if fileID == "" {
7576 err = errors .New ("missing required fileId parameter" )
@@ -86,7 +87,7 @@ func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.
8687// the source file and its versions (if `includeFileVersions` is set to true) will
8788// be appended to the destination file version history.
8889func (r * FileService ) Copy (ctx context.Context , body FileCopyParams , opts ... option.RequestOption ) (res * FileCopyResponse , err error ) {
89- opts = append (r .Options [:] , opts ... )
90+ opts = slices . Concat (r .Options , opts )
9091 path := "v1/files/copy"
9192 err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
9293 return
@@ -95,7 +96,7 @@ func (r *FileService) Copy(ctx context.Context, body FileCopyParams, opts ...opt
9596// This API returns an object with details or attributes about the current version
9697// of the file.
9798func (r * FileService ) Get (ctx context.Context , fileID string , opts ... option.RequestOption ) (res * File , err error ) {
98- opts = append (r .Options [:] , opts ... )
99+ opts = slices . Concat (r .Options , opts )
99100 if fileID == "" {
100101 err = errors .New ("missing required fileId parameter" )
101102 return
@@ -110,7 +111,7 @@ func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.Req
110111// Note: If any file at the destination has the same name as the source file, then
111112// the source file and its versions will be appended to the destination file.
112113func (r * FileService ) Move (ctx context.Context , body FileMoveParams , opts ... option.RequestOption ) (res * FileMoveResponse , err error ) {
113- opts = append (r .Options [:] , opts ... )
114+ opts = slices . Concat (r .Options , opts )
114115 path := "v1/files/move"
115116 err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
116117 return
@@ -122,7 +123,7 @@ func (r *FileService) Move(ctx context.Context, body FileMoveParams, opts ...opt
122123// Note: The old URLs will stop working. The file/file version URLs cached on CDN
123124// will continue to work unless a purge is requested.
124125func (r * FileService ) Rename (ctx context.Context , body FileRenameParams , opts ... option.RequestOption ) (res * FileRenameResponse , err error ) {
125- opts = append (r .Options [:] , opts ... )
126+ opts = slices . Concat (r .Options , opts )
126127 path := "v1/files/rename"
127128 err = requestconfig .ExecuteNewRequest (ctx , http .MethodPut , path , body , & res , opts ... )
128129 return
@@ -156,7 +157,7 @@ func (r *FileService) Rename(ctx context.Context, body FileRenameParams, opts ..
156157// - [Quick start guides](/docs/quick-start-guides) for various frameworks and
157158// technologies.
158159func (r * FileService ) Upload (ctx context.Context , body FileUploadParams , opts ... option.RequestOption ) (res * FileUploadResponse , err error ) {
159- opts = append (r .Options [:] , opts ... )
160+ opts = slices . Concat (r .Options , opts )
160161 opts = append ([]option.RequestOption {option .WithBaseURL ("https://upload.imagekit.io/" )}, opts ... )
161162 path := "api/v1/files/upload"
162163 err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
0 commit comments