Skip to content

Commit d7edabd

Browse files
committed
1 parent ea32880 commit d7edabd

File tree

2 files changed

+270
-123
lines changed

2 files changed

+270
-123
lines changed

go/client.go

Lines changed: 52 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,11 @@ type UpdateTTLRequest struct {
157157
Cfg sdk.WriteConfig `json:"cfg"`
158158
}
159159

160-
type GetScopeFileRequest struct {
161-
Scope sdk.DataScope `json:"scope"`
162-
Request GetFileRequest `json:"request"`
163-
}
164-
165160
// GetFileRequest represents the JSON structure for get file operations
166161
type GetFileRequest struct {
167-
TenantId string `json:"tenantId"`
168-
Path string `json:"path"`
162+
Scope sdk.DataScope `json:"scope"`
163+
TenantId string `json:"tenantId"`
164+
Path string `json:"path"`
169165
}
170166

171167
// GetFileResponse represents the JSON structure for get file response
@@ -174,88 +170,60 @@ type GetFileResponse struct {
174170
Metadata sdk.FileMetaData `json:"metadata"`
175171
}
176172

177-
type ReadScopeFileContentRequest struct {
178-
Scope sdk.DataScope `json:"scope"`
179-
Request ReadFileContentRequest `json:"request"`
180-
}
181-
182173
type ReadFileContentRequest struct {
183-
TenantId string `json:"tenantId"`
184-
Path string `json:"path"`
174+
Scope sdk.DataScope `json:"scope"`
175+
TenantId string `json:"tenantId"`
176+
Path string `json:"path"`
185177
}
186178

187179
type ReadFileContentResponse struct {
188180
Content string `json:"content"`
189181
}
190182

191-
type GetScopeLinkRequest struct {
192-
Scope sdk.DataScope `json:"scope"`
193-
Request GetLinkRequest `json:"request"`
194-
}
195-
196183
type GetLinkRequest struct {
197-
TenantId string `json:"tenantId"`
198-
Path string `json:"path"`
184+
Scope sdk.DataScope `json:"scope"`
185+
TenantId string `json:"tenantId"`
186+
Path string `json:"path"`
199187
}
200188

201189
type GetLinkResponse struct {
202190
Link string `json:"link"`
203191
}
204192

205-
type PutScopeFileRequest struct {
206-
Scope sdk.DataScope `json:"scope"`
207-
Request PutFileRequest `json:"request"`
208-
}
209-
210193
// PutFileRequest represents the JSON structure for put file operations
211194
type PutFileRequest struct {
212-
TenantId string `json:"tenantId"`
213-
Path string `json:"path"`
214-
Content string `json:"content"`
215-
LocalFilePath string `json:"filePath"`
216-
}
217-
218-
type DeleteScopeFileRequest struct {
219-
Scope sdk.DataScope `json:"scope"`
220-
Request DeleteFileRequest `json:"request"`
195+
Scope sdk.DataScope `json:"scope"`
196+
TenantId string `json:"tenantId"`
197+
Path string `json:"path"`
198+
Content string `json:"content"`
199+
LocalFilePath string `json:"filePath"`
221200
}
222201

223202
type DeleteFileRequest struct {
224-
TenantId string `json:"tenantId"`
225-
Path string `json:"path"`
226-
}
227-
228-
type RenameScopeFileRequest struct {
229-
Scope sdk.DataScope `json:"scope"`
230-
Request RenameFileRequest `json:"request"`
203+
Scope sdk.DataScope `json:"scope"`
204+
TenantId string `json:"tenantId"`
205+
Path string `json:"path"`
231206
}
232207

233208
type RenameFileRequest struct {
234-
TenantId string `json:"tenantId"`
235-
OldPath string `json:"oldPath"`
236-
NewPath string `json:"newPath"`
237-
}
238-
239-
type CreateScopeFolderRequest struct {
240-
Scope sdk.DataScope `json:"scope"`
241-
Request CreateFolderRequest `json:"request"`
209+
Scope sdk.DataScope `json:"scope"`
210+
TenantId string `json:"tenantId"`
211+
OldPath string `json:"oldPath"`
212+
NewPath string `json:"newPath"`
242213
}
243214

244215
type CreateFolderRequest struct {
245-
TenantId string `json:"tenantId"`
246-
FolderPath string `json:"folderPath"`
247-
}
248-
249-
type ListScopeFolderRequest struct {
250-
Scope sdk.DataScope `json:"scope"`
251-
Request ListFolderRequest `json:"request"`
216+
Scope sdk.DataScope `json:"scope"`
217+
TenantId string `json:"tenantId"`
218+
FolderPath string `json:"folderPath"`
252219
}
253220

254221
type ListFolderRequest struct {
255-
TenantId string `json:"tenantId"`
256-
FolderPath string `json:"folderPath"`
257-
OffsetToken *string `json:"offsetToken"`
258-
Limit int32 `json:"limit"`
222+
Scope sdk.DataScope `json:"scope"`
223+
TenantId string `json:"tenantId"`
224+
FolderPath string `json:"folderPath"`
225+
OffsetToken *string `json:"offsetToken"`
226+
Limit int32 `json:"limit"`
259227
}
260228

261229
type ListFolderResponse struct {
@@ -329,14 +297,15 @@ type ServiceClient interface {
329297
DeleteData(sessionId string, req DeleteDataRequest) error
330298
UpdateTTL(sessionId string, req UpdateTTLRequest) error
331299

332-
GetFile(sessionId string, req GetScopeFileRequest) (GetFileResponse, error)
333-
PutFile(sessionId string, req PutScopeFileRequest) error
334-
DeleteFile(sessionId string, req DeleteScopeFileRequest) error
335-
RenameFile(sessionId string, req RenameScopeFileRequest) error
336-
GetFileDownloadLink(sessionId string, req GetScopeFileRequest) (GetLinkResponse, error)
337-
GetFileUploadLink(sessionId string, req GetScopeFileRequest) (GetLinkResponse, error)
338-
ListFolder(sessionId string, req ListScopeFolderRequest) (ListFolderResponse, error)
339-
CreateFolder(sessionId string, req CreateScopeFolderRequest) error
300+
ReadFileContent(sessionId string, req ReadFileContentRequest) (ReadFileContentResponse, error)
301+
GetFile(sessionId string, req GetFileRequest) (GetFileResponse, error)
302+
PutFile(sessionId string, req PutFileRequest) error
303+
DeleteFile(sessionId string, req DeleteFileRequest) error
304+
RenameFile(sessionId string, req RenameFileRequest) error
305+
GetFileDownloadLink(sessionId string, req GetFileRequest) (GetLinkResponse, error)
306+
GetFileUploadLink(sessionId string, req GetFileRequest) (GetLinkResponse, error)
307+
ListFolder(sessionId string, req ListFolderRequest) (ListFolderResponse, error)
308+
CreateFolder(sessionId string, req CreateFolderRequest) error
340309

341310
EmitSignal(sessionId string, req SignalEmitRequest) error
342311
WaitForSignal(sessionId string, req SignalWaitRequest) (SignalWaitResponse, error)
@@ -452,43 +421,49 @@ func (sc *ServiceClientImpl) UpdateTTL(sessionId string, req UpdateTTLRequest) e
452421
return executeApiWithoutResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/db/update-ttl", req)
453422
}
454423

455-
func (sc *ServiceClientImpl) GetFile(sessionId string, req GetScopeFileRequest) (GetFileResponse, error) {
424+
func (sc *ServiceClientImpl) ReadFileContent(sessionId string, req ReadFileContentRequest) (ReadFileContentResponse, error) {
425+
var res ReadFileContentResponse
426+
err := executeApiWithResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/read", req, &res)
427+
return res, err
428+
}
429+
430+
func (sc *ServiceClientImpl) GetFile(sessionId string, req GetFileRequest) (GetFileResponse, error) {
456431
var res GetFileResponse
457432
err := executeApiWithResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/get", req, &res)
458433
return res, err
459434
}
460435

461-
func (sc *ServiceClientImpl) GetFileDownloadLink(sessionId string, req GetScopeFileRequest) (GetLinkResponse, error) {
436+
func (sc *ServiceClientImpl) GetFileDownloadLink(sessionId string, req GetFileRequest) (GetLinkResponse, error) {
462437
var res GetLinkResponse
463438
err := executeApiWithResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/get-download-link", req, &res)
464439
return res, err
465440
}
466441

467-
func (sc *ServiceClientImpl) PutFile(sessionId string, req PutScopeFileRequest) error {
442+
func (sc *ServiceClientImpl) PutFile(sessionId string, req PutFileRequest) error {
468443
return executeApiWithoutResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/put", req)
469444
}
470445

471-
func (sc *ServiceClientImpl) GetFileUploadLink(sessionId string, req GetScopeFileRequest) (GetLinkResponse, error) {
446+
func (sc *ServiceClientImpl) GetFileUploadLink(sessionId string, req GetFileRequest) (GetLinkResponse, error) {
472447
var res GetLinkResponse
473448
err := executeApiWithResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/get-upload-link", req, &res)
474449
return res, err
475450
}
476451

477-
func (sc *ServiceClientImpl) DeleteFile(sessionId string, req DeleteScopeFileRequest) error {
452+
func (sc *ServiceClientImpl) DeleteFile(sessionId string, req DeleteFileRequest) error {
478453
return executeApiWithoutResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/delete", req)
479454
}
480455

481-
func (sc *ServiceClientImpl) RenameFile(sessionId string, req RenameScopeFileRequest) error {
456+
func (sc *ServiceClientImpl) RenameFile(sessionId string, req RenameFileRequest) error {
482457
return executeApiWithoutResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/rename", req)
483458
}
484459

485-
func (sc *ServiceClientImpl) ListFolder(sessionId string, req ListScopeFolderRequest) (ListFolderResponse, error) {
460+
func (sc *ServiceClientImpl) ListFolder(sessionId string, req ListFolderRequest) (ListFolderResponse, error) {
486461
var res ListFolderResponse
487462
err := executeApiWithResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/list", req, &res)
488463
return res, err
489464
}
490465

491-
func (sc *ServiceClientImpl) CreateFolder(sessionId string, req CreateScopeFolderRequest) error {
466+
func (sc *ServiceClientImpl) CreateFolder(sessionId string, req CreateFolderRequest) error {
492467
return executeApiWithoutResponse(sc.httpClient, sc.baseURL, sessionId, "v1/context/file/create-folder", req)
493468
}
494469

0 commit comments

Comments
 (0)