feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
64
backend/api/model/crossdomain/search/resource_doc.go
Normal file
64
backend/api/model/crossdomain/search/resource_doc.go
Normal file
@@ -0,0 +1,64 @@
|
||||
package search
|
||||
|
||||
import (
|
||||
resource "github.com/coze-dev/coze-studio/backend/api/model/resource/common"
|
||||
)
|
||||
|
||||
type ResourceDocument struct {
|
||||
ResID int64 `json:"res_id"`
|
||||
ResType resource.ResType `json:"res_type"`
|
||||
ResSubType *int32 `json:"res_sub_type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
OwnerID *int64 `json:"owner_id,omitempty"`
|
||||
SpaceID *int64 `json:"space_id,omitempty"`
|
||||
APPID *int64 `json:"app_id,omitempty"`
|
||||
BizStatus *int64 `json:"biz_status,omitempty"`
|
||||
PublishStatus *resource.PublishStatus `json:"publish_status,omitempty"`
|
||||
|
||||
CreateTimeMS *int64 `json:"create_time,omitempty"`
|
||||
UpdateTimeMS *int64 `json:"update_time,omitempty"`
|
||||
PublishTimeMS *int64 `json:"publish_time,omitempty"`
|
||||
}
|
||||
|
||||
func (r *ResourceDocument) GetName() string {
|
||||
if r.Name != nil {
|
||||
return *r.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (r *ResourceDocument) GetOwnerID() int64 {
|
||||
if r.OwnerID != nil {
|
||||
return *r.OwnerID
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetUpdateTime 获取更新时间
|
||||
func (r *ResourceDocument) GetUpdateTime() int64 {
|
||||
if r.UpdateTimeMS != nil {
|
||||
return *r.UpdateTimeMS
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (r *ResourceDocument) GetResSubType() int32 {
|
||||
if r.ResSubType != nil {
|
||||
return *r.ResSubType
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (r *ResourceDocument) GetCreateTime() int64 {
|
||||
if r.CreateTimeMS == nil {
|
||||
return 0
|
||||
}
|
||||
return *r.CreateTimeMS
|
||||
}
|
||||
|
||||
func (r *ResourceDocument) GetPublishTime() int64 {
|
||||
if r.PublishTimeMS == nil {
|
||||
return 0
|
||||
}
|
||||
return *r.PublishTimeMS
|
||||
}
|
||||
38
backend/api/model/crossdomain/search/search.go
Normal file
38
backend/api/model/crossdomain/search/search.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package search
|
||||
|
||||
import (
|
||||
resource "github.com/coze-dev/coze-studio/backend/api/model/resource/common"
|
||||
)
|
||||
|
||||
type SearchResourcesRequest struct {
|
||||
SpaceID int64
|
||||
OwnerID int64
|
||||
Name string
|
||||
APPID int64
|
||||
|
||||
OrderFiledName string
|
||||
OrderAsc bool
|
||||
ResTypeFilter []resource.ResType
|
||||
PublishStatusFilter resource.PublishStatus
|
||||
SearchKeys []string
|
||||
|
||||
Cursor string
|
||||
Page *int32
|
||||
Limit int32
|
||||
}
|
||||
|
||||
type SearchResourcesResponse struct {
|
||||
HasMore bool
|
||||
NextCursor string
|
||||
TotalHits *int64
|
||||
|
||||
Data []*ResourceDocument
|
||||
}
|
||||
|
||||
const (
|
||||
FieldOfCreateTime = "create_time"
|
||||
FieldOfUpdateTime = "update_time"
|
||||
FieldOfPublishTime = "publish_time"
|
||||
FieldOfFavTime = "fav_time"
|
||||
FieldOfRecentlyOpenTime = "recently_open_time"
|
||||
)
|
||||
Reference in New Issue
Block a user