{"modulePath":"github.com/osapi-io/osapi","version":"v0.2.0","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package file\n\nPackage file provides file management API handlers.\n\n## Functions\n\n```go\nfunc Handler(\n\tlogger *slog.Logger,\n\tobjStore ObjectStoreManager,\n\tstateKV StateKeyValue,\n\tsigningKey string,\n\tcustomRoles map[string][]string,\n) []func(e *echo.Echo)\n```\nHandler returns file route registration functions.\n\n## Types\n\n```go\ntype File struct {\n\t// contains filtered or unexported fields\n}\n```\nFile implementation of the File APIs operations.\n\n```go\nfunc New(\n\tlogger *slog.Logger,\n\tobjStore ObjectStoreManager,\n\tstateKV StateKeyValue,\n) *File\n```\nNew factory to create a new instance.\n\n```go\nfunc (f *File) DeleteFileByName(\n\tctx context.Context,\n\trequest gen.DeleteFileByNameRequestObject,\n) (gen.DeleteFileByNameResponseObject, error)\n```\nDeleteFileByName delete a file from the Object Store.\n\n```go\nfunc (f *File) GetFileByName(\n\tctx context.Context,\n\trequest gen.GetFileByNameRequestObject,\n) (gen.GetFileByNameResponseObject, error)\n```\nGetFileByName get metadata for a specific file in the Object Store.\n\n```go\nfunc (f *File) GetFileStale(\n\tctx context.Context,\n\t_ gen.GetFileStaleRequestObject,\n) (gen.GetFileStaleResponseObject, error)\n```\nGetFileStale returns deployments where the source object has been updated since the file was last deployed.\n\n```go\nfunc (f *File) GetFiles(\n\tctx context.Context,\n\t_ gen.GetFilesRequestObject,\n) (gen.GetFilesResponseObject, error)\n```\nGetFiles list all files stored in the Object Store.\n\n```go\nfunc (f *File) PostFile(\n\tctx context.Context,\n\trequest gen.PostFileRequestObject,\n) (gen.PostFileResponseObject, error)\n```\nPostFile upload a file to the Object Store via multipart/form-data.\n\n```go\ntype ObjectStoreManager interface {\n\t// Put stores data from a reader under the given metadata.\n\tPut(\n\t\tctx context.Context,\n\t\tmeta jetstream.ObjectMeta,\n\t\treader io.Reader,\n\t) (*jetstream.ObjectInfo, error)\n\n\t// PutBytes stores data under the given name.\n\tPutBytes(ctx context.Context, name string, data []byte) (*jetstream.ObjectInfo, error)\n\n\t// GetBytes retrieves the content stored under the given name.\n\tGetBytes(ctx context.Context, name string, opts ...jetstream.GetObjectOpt) ([]byte, error)\n\n\t// GetInfo retrieves metadata for the named object.\n\tGetInfo(\n\t\tctx context.Context,\n\t\tname string,\n\t\topts ...jetstream.GetObjectInfoOpt,\n\t) (*jetstream.ObjectInfo, error)\n\n\t// Delete removes the named object.\n\tDelete(ctx context.Context, name string) error\n\n\t// List returns metadata for all objects in the store.\n\tList(ctx context.Context, opts ...jetstream.ListObjectsOpt) ([]*jetstream.ObjectInfo, error)\n}\n```\nObjectStoreManager wraps the subset of jetstream.ObjectStore methods needed by the file API handlers. This minimal interface enables straightforward mocking in tests.\n\n```go\ntype StateKeyValue interface {\n\tKeys(ctx context.Context, opts ...jetstream.WatchOpt) ([]string, error)\n\tGet(ctx context.Context, key string) (jetstream.KeyValueEntry, error)\n}\n```\nStateKeyValue wraps the subset of jetstream.KeyValue methods needed by the file stale check.\n\n","path":"github.com/osapi-io/osapi/internal/controller/api/file","name":"file","synopsis":"Package file provides file management API handlers.","isRedistributable":true}
