-
-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathapi_aily_app_data_asset_upload_file.go
More file actions
92 lines (81 loc) · 4.19 KB
/
Copy pathapi_aily_app_data_asset_upload_file.go
File metadata and controls
92 lines (81 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
* Copyright 2022 chyroc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lark
import (
"context"
"io"
)
// UploadAilyAppDataAssetFile 上传文件用于 Aily 的数据知识管理
//
// 。
// - 仅支持开发环境
// - 开发者需要 Aily 创建平台的应用协作者角色, 包括管理员、开发者、运维人员
// - 使用应用身份仅支持[ Aily 平台](https://aily.feishu.cn)渠道的应用身份
// - 仅支持上传docx、txt、pdf、pptx类型的文件
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/aily-v1/app-data_asset/upload_file
// new doc: https://open.feishu.cn/document/aily-v1/data-knowledge/data-knowledge-management/upload_file
func (r *AilyService) UploadAilyAppDataAssetFile(ctx context.Context, request *UploadAilyAppDataAssetFileReq, options ...MethodOptionFunc) (*UploadAilyAppDataAssetFileResp, *Response, error) {
if r.cli.mock.mockAilyUploadAilyAppDataAssetFile != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Aily#UploadAilyAppDataAssetFile mock enable")
return r.cli.mock.mockAilyUploadAilyAppDataAssetFile(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Aily",
API: "UploadAilyAppDataAssetFile",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/aily/v1/apps/:app_id/data_assets/upload_file",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
IsFile: true,
}
resp := new(uploadAilyAppDataAssetFileResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockAilyUploadAilyAppDataAssetFile mock AilyUploadAilyAppDataAssetFile method
func (r *Mock) MockAilyUploadAilyAppDataAssetFile(f func(ctx context.Context, request *UploadAilyAppDataAssetFileReq, options ...MethodOptionFunc) (*UploadAilyAppDataAssetFileResp, *Response, error)) {
r.mockAilyUploadAilyAppDataAssetFile = f
}
// UnMockAilyUploadAilyAppDataAssetFile un-mock AilyUploadAilyAppDataAssetFile method
func (r *Mock) UnMockAilyUploadAilyAppDataAssetFile() {
r.mockAilyUploadAilyAppDataAssetFile = nil
}
// UploadAilyAppDataAssetFileReq ...
type UploadAilyAppDataAssetFileReq struct {
AppID string `path:"app_id" json:"-"` // Aily 平台的应用的APPID, 可以直接从 Aily 应用的URL中获取。获取示例: /ai/{APPID}示例值: "spring_dsafdsaf__c" 长度范围: `0` ~ `255` 字符
TenantType *string `query:"tenant_type" json:"-"` // 应用环境, 枚举值: `online`: 线上环境(默认值)- `dev`: 开发环境;目前只支持 `dev`示例值: dev 长度范围: `0` ~ `255` 字符
File io.Reader `json:"file,omitempty"` // 需要上传的文件。仅支持上传 docx、txt、pdf、pptx 类型的文件。示例值: file binary
}
// UploadAilyAppDataAssetFileResp ...
type UploadAilyAppDataAssetFileResp struct {
FileInfo *UploadAilyAppDataAssetFileRespFileInfo `json:"file_info,omitempty"` // 数据知识文件
}
// UploadAilyAppDataAssetFileRespFileInfo ...
type UploadAilyAppDataAssetFileRespFileInfo struct {
Token string `json:"token,omitempty"` // 数据知识文件 token
MimeType string `json:"mime_type,omitempty"` // 解析出的文件类型, 包括pdf、docx、pptx、txt
}
// uploadAilyAppDataAssetFileResp ...
type uploadAilyAppDataAssetFileResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *UploadAilyAppDataAssetFileResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}