Documentation
¶
Index ¶
- func GetMimeType(fileName string) string
- func ValidateFileName(fileName string) error
- type Attachment
- type AttachmentClient
- func (a *AttachmentClient) Delete(sysID string) error
- func (a *AttachmentClient) DeleteWithContext(ctx context.Context, sysID string) error
- func (a *AttachmentClient) Download(sysID, savePath string) error
- func (a *AttachmentClient) DownloadWithContext(ctx context.Context, sysID, savePath string) error
- func (a *AttachmentClient) List(tableName, sysID string) ([]map[string]interface{}, error)
- func (a *AttachmentClient) ListWithContext(ctx context.Context, tableName, sysID string) ([]map[string]interface{}, error)
- func (a *AttachmentClient) Upload(tableName, sysID, filePath string) (map[string]interface{}, error)
- func (a *AttachmentClient) UploadWithContext(ctx context.Context, tableName, sysID, filePath string) (map[string]interface{}, error)
- type AttachmentFilter
- type UploadFromBytesRequest
- type UploadFromReaderRequest
- type UploadRequest
- type UploadResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMimeType ¶
GetMimeType attempts to determine the MIME type of a file
func ValidateFileName ¶
ValidateFileName checks if a filename is valid for ServiceNow
Types ¶
type Attachment ¶
type Attachment struct {
SysID string `json:"sys_id"`
FileName string `json:"file_name"`
ContentType string `json:"content_type"`
SizeBytes int64 `json:"size_bytes"`
SizeCompressed int64 `json:"size_compressed"`
Compressed bool `json:"compressed"`
State string `json:"state"`
TableName string `json:"table_name"`
TableSysID string `json:"table_sys_id"`
DownloadLink string `json:"download_link"`
CreatedBy string `json:"sys_created_by"`
CreatedOn time.Time `json:"sys_created_on"`
UpdatedBy string `json:"sys_updated_by"`
UpdatedOn time.Time `json:"sys_updated_on"`
Hash string `json:"hash"`
AverageImageColor string `json:"average_image_color"`
ImageWidth int `json:"image_width"`
ImageHeight int `json:"image_height"`
}
Attachment represents a ServiceNow attachment record
type AttachmentClient ¶
type AttachmentClient struct {
// contains filtered or unexported fields
}
AttachmentClient provides methods for managing file attachments in ServiceNow
func NewAttachmentClient ¶
func NewAttachmentClient(client *core.Client) *AttachmentClient
NewAttachmentClient creates a new attachment client
func (*AttachmentClient) Delete ¶
func (a *AttachmentClient) Delete(sysID string) error
Delete removes an attachment
func (*AttachmentClient) DeleteWithContext ¶
func (a *AttachmentClient) DeleteWithContext(ctx context.Context, sysID string) error
DeleteWithContext removes an attachment with context support
func (*AttachmentClient) Download ¶
func (a *AttachmentClient) Download(sysID, savePath string) error
Download downloads an attachment to a file
func (*AttachmentClient) DownloadWithContext ¶
func (a *AttachmentClient) DownloadWithContext(ctx context.Context, sysID, savePath string) error
DownloadWithContext downloads an attachment to a file with context support
func (*AttachmentClient) List ¶
func (a *AttachmentClient) List(tableName, sysID string) ([]map[string]interface{}, error)
List retrieves attachments for a record
func (*AttachmentClient) ListWithContext ¶
func (a *AttachmentClient) ListWithContext(ctx context.Context, tableName, sysID string) ([]map[string]interface{}, error)
ListWithContext retrieves attachments for a record with context support
func (*AttachmentClient) Upload ¶
func (a *AttachmentClient) Upload(tableName, sysID, filePath string) (map[string]interface{}, error)
Upload uploads a file as an attachment
func (*AttachmentClient) UploadWithContext ¶
func (a *AttachmentClient) UploadWithContext(ctx context.Context, tableName, sysID, filePath string) (map[string]interface{}, error)
UploadWithContext uploads a file as an attachment with context support
type AttachmentFilter ¶
type AttachmentFilter struct {
TableName string `json:"table_name,omitempty"`
TableSysID string `json:"table_sys_id,omitempty"`
FileName string `json:"file_name,omitempty"`
ContentType string `json:"content_type,omitempty"`
CreatedBy string `json:"sys_created_by,omitempty"`
CreatedAfter string `json:"created_after,omitempty"`
CreatedBefore string `json:"created_before,omitempty"`
MinSize int64 `json:"min_size,omitempty"`
MaxSize int64 `json:"max_size,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
AttachmentFilter provides filtering options for listing attachments
type UploadFromBytesRequest ¶
type UploadFromBytesRequest struct {
UploadRequest
Data []byte `json:"-"`
}
UploadFromBytesRequest contains options for uploading from byte data
type UploadFromReaderRequest ¶
type UploadFromReaderRequest struct {
UploadRequest
Reader io.Reader `json:"-"`
Size int64 `json:"-"` // Optional, for progress tracking
}
UploadFromReaderRequest contains options for uploading from an io.Reader
type UploadRequest ¶
type UploadRequest struct {
TableName string `json:"table_name"`
TableSysID string `json:"table_sys_id"`
FileName string `json:"file_name,omitempty"`
ContentType string `json:"content_type,omitempty"`
Encryption string `json:"encryption_context,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
UploadRequest contains options for uploading an attachment
type UploadResult ¶
type UploadResult struct {
Attachment *Attachment `json:"result"`
Success bool `json:"success"`
Message string `json:"message"`
Error string `json:"error,omitempty"`
}
UploadResult contains the result of an attachment upload