fileevent

package
v1.0.95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fileevent reports upload outcomes to the Drive file-event endpoint.

Index

Constants

View Source
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

func IsTenantCapacityExceeded(err error) bool

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.

func NewBudget

func NewBudget() *Budget

NewBudget creates the production reporting budget for one command.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL