2
0
Files
gitcaddy-server/modules/structs/attachment.go
logikonline 12f4ea03a8
Some checks failed
Build and Release / Create Release (push) Successful in 0s
Trigger Vault Plugin Rebuild / Trigger Vault Rebuild (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 2m48s
Build and Release / Lint (push) Failing after 5m2s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (arm64, linux, linux-latest) (push) Has been skipped
Build and Release / Unit Tests (push) Successful in 5m37s
refactor: add /v3 suffix to module path for proper Go semver
Go's semantic import versioning requires v2+ modules to include the
major version in the module path. This enables using proper version
tags (v3.x.x) instead of pseudo-versions.

Updated module path: code.gitcaddy.com/server/v3
2026-01-17 17:53:59 -05:00

91 lines
3.4 KiB
Go

// Copyright 2017 The Gitea Authors and MarketAlly. All rights reserved.
// SPDX-License-Identifier: MIT
package structs // import "code.gitcaddy.com/server/v3/modules/structs"
import (
"time"
)
// Attachment a generic attachment
// swagger:model
type Attachment struct {
// ID is the unique identifier for the attachment
ID int64 `json:"id"`
// Name is the filename of the attachment
Name string `json:"name"`
// Size is the file size in bytes
Size int64 `json:"size"`
// DownloadCount is the number of times the attachment has been downloaded
DownloadCount int64 `json:"download_count"`
// swagger:strfmt date-time
// Created is the time when the attachment was uploaded
Created time.Time `json:"created_at"`
// UUID is the unique identifier for the attachment file
UUID string `json:"uuid"`
// DownloadURL is the URL to download the attachment
DownloadURL string `json:"browser_download_url"`
}
// EditAttachmentOptions options for editing attachments
// swagger:model
type EditAttachmentOptions struct {
// Name is the new filename for the attachment
Name string `json:"name"`
}
// UploadSessionResponse response for creating an upload session
// swagger:model
type UploadSessionResponse struct {
// UUID is the unique identifier for this upload session
UUID string `json:"uuid"`
// FileName is the name of the file being uploaded
FileName string `json:"file_name"`
// FileSize is the total size of the file in bytes (-1 if unknown)
FileSize int64 `json:"file_size"`
// ChunkSize is the size of each chunk in bytes
ChunkSize int64 `json:"chunk_size"`
// ChunksExpected is the expected number of chunks (-1 if unknown)
ChunksExpected int64 `json:"chunks_expected"`
// ExpiresAt is the Unix timestamp when this session expires
ExpiresAt int64 `json:"expires_at"`
}
// UploadChunkResponse response after uploading a chunk
// swagger:model
type UploadChunkResponse struct {
// ChunkNumber is the number of the chunk that was uploaded
ChunkNumber int64 `json:"chunk_number"`
// ChunksReceived is the total number of chunks received so far
ChunksReceived int64 `json:"chunks_received"`
// BytesReceived is the total number of bytes received so far
BytesReceived int64 `json:"bytes_received"`
// Complete indicates whether all chunks have been received
Complete bool `json:"complete"`
}
// UploadSessionInfo contains information about an upload session for resuming
// swagger:model
type UploadSessionInfo struct {
// UUID is the unique identifier for this upload session
UUID string `json:"uuid"`
// FileName is the name of the file being uploaded
FileName string `json:"file_name"`
// FileSize is the total size of the file in bytes (-1 if unknown)
FileSize int64 `json:"file_size"`
// ChunkSize is the size of each chunk in bytes
ChunkSize int64 `json:"chunk_size"`
// ChunksExpected is the expected number of chunks (-1 if unknown)
ChunksExpected int64 `json:"chunks_expected"`
// ChunksReceived is the number of chunks received so far
ChunksReceived int64 `json:"chunks_received"`
// BytesReceived is the total number of bytes received so far
BytesReceived int64 `json:"bytes_received"`
// ReceivedChunks is the list of chunk numbers that have been received
ReceivedChunks []int64 `json:"received_chunks"`
// Status is the current status of the upload session (active, complete, expired, failed)
Status string `json:"status"`
// ExpiresAt is the Unix timestamp when this session expires
ExpiresAt int64 `json:"expires_at"`
}