Documentation
¶
Overview ¶
Package fileevent reports upload outcomes to the Drive file-event endpoint.
Index ¶
- Constants
- func AppendUploadDryRun(dry *cmdutil.DryRunAPI, runtime Runtime, meta UploadMeta)
- func IsTenantCapacityExceeded(err error) bool
- func ReportUpload(runtime Runtime, meta UploadMeta)
- func ReportUploadError(runtime Runtime, uploadErr error, meta UploadMeta) error
- type Budget
- type Runtime
- type UploadMeta
Constants ¶
const ( // ReportPath is the API path used to report a completed upload attempt. ReportPath = "/open-apis/drive/v1/lark_cli_file_event/report" // StatusSuccess and StatusError are the supported upload outcome tags. StatusSuccess = "success" StatusError = "error" )
Variables ¶
This section is empty.
Functions ¶
func AppendUploadDryRun ¶
func AppendUploadDryRun(dry *cmdutil.DryRunAPI, runtime Runtime, meta UploadMeta)
AppendUploadDryRun adds the success-path report request that follows an upload. Error-path reporting uses the same envelope with status and code populated from the typed upload error at runtime.
func IsTenantCapacityExceeded ¶
IsTenantCapacityExceeded reports whether err is a typed API error carrying a tenant-capacity-exceeded code recognized by the CLI upload reporting flow.
func ReportUpload ¶
func ReportUpload(runtime Runtime, meta UploadMeta)
ReportUpload best-effort reports a successful upload. A reporting failure never affects the caller's success path.
func ReportUploadError ¶
func ReportUploadError(runtime Runtime, uploadErr error, meta UploadMeta) error
ReportUploadError best-effort reports a failed upload, then returns the original uploadErr. For a tenant-capacity-exceeded error, a valid expansion URL returned by the report API is appended to the typed error hint.
Types ¶
type Budget ¶
type Budget struct {
// contains filtered or unexported fields
}
Budget caps synchronous upload-report latency across one command. Ordinary reports share a cumulative allowance; a tenant-capacity error gets one separate bounded attempt because its response may contain a recovery URL.
type Runtime ¶
type Runtime interface {
Ctx() context.Context
Command() string
CommandPath() string
FileEventBudget() *Budget
DoAPIWithContext(context.Context, *larkcore.ApiReq, ...larkcore.RequestOptionFunc) (*larkcore.ApiResp, error)
}
Runtime is the subset of shortcut runtime behavior needed for reporting.
type UploadMeta ¶
type UploadMeta struct {
APIPath string
Command string
ResourceType string
Status string
Code string
// ParentType is the upload request's parent_type (explorer / wiki /
// docx_file / sheet_image / slide_file / email / bitable_file /
// ccm_import_open ...). It is reported verbatim as the tags mount_point.
ParentType string
// FileToken is the uploaded file's token, set only on success paths and
// reported as the tags file_token. Empty on failure paths.
FileToken string
}
UploadMeta describes the upload context attached to a best-effort report. Identity (user_id / tenant_id) is intentionally omitted: the server derives it from the authenticated request context.