Documentation
¶
Index ¶
- type ClicksByDay
- type ClicksStats
- type CreateQRCodeOptions
- type CreateShortCodeOptions
- type GetCodeStatsResponse
- type GetQRCodesResponse
- type GetShortCodesResponse
- type Link
- func (l *Link) CreateQRCode(ctx context.Context, code string, opts *CreateQRCodeOptions) (*QRCodeResponse, error)
- func (l *Link) CreateShortCode(ctx context.Context, longURL, domain string, opts *CreateShortCodeOptions) (*ShortCodeResponse, error)
- func (l *Link) DeleteQRCode(ctx context.Context, code, qrID string) error
- func (l *Link) DeleteShortCode(ctx context.Context, code string) error
- func (l *Link) GetCodeStats(ctx context.Context, code string, startDate, endDate time.Time) (*GetCodeStatsResponse, error)
- func (l *Link) GetQRCode(ctx context.Context, code, qrID string) (*QRCodeResponse, error)
- func (l *Link) GetQRCodes(ctx context.Context, code string, pageNumber, pageSize int) (*GetQRCodesResponse, error)
- func (l *Link) GetShortCode(ctx context.Context, code string) (*ShortCodeResponse, error)
- func (l *Link) GetShortCodes(ctx context.Context, titleSearch string, tags []string, ...) (*GetShortCodesResponse, error)
- func (l *Link) GetTags(ctx context.Context) ([]string, error)
- func (l *Link) SetErrorHandler(handler func(error))
- func (l *Link) UpdateShortCode(ctx context.Context, code string, opts *UpdateShortCodeOptions) (*ShortCodeResponse, error)
- type Option
- type Options
- type OrganizationID
- type QRCodeResponse
- type QRSize
- type ShortCodeResponse
- type UpdateShortCodeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClicksByDay ¶
type ClicksByDay struct {
Date string `json:"date"`
Total int `json:"total"`
Unique int `json:"unique"`
}
ClicksByDay represents daily click statistics
type ClicksStats ¶
type ClicksStats struct {
Total int `json:"total"`
Unique int `json:"unique"`
ByDay []ClicksByDay `json:"byDay"`
}
ClicksStats represents click statistics
type CreateQRCodeOptions ¶
type CreateQRCodeOptions struct {
Title string `json:"title,omitempty"`
BackgroundColor string `json:"backgroundColor,omitempty"`
Color string `json:"color,omitempty"`
Size QRSize `json:"size,omitempty"`
Logo string `json:"logo,omitempty"`
}
CreateQRCodeOptions contains optional parameters for creating QR codes
type CreateShortCodeOptions ¶
type CreateShortCodeOptions struct {
Code string `json:"code,omitempty"`
Title string `json:"title,omitempty"`
Tags []string `json:"tags,omitempty"`
}
CreateShortCodeOptions contains optional parameters for creating short codes
type GetCodeStatsResponse ¶
type GetCodeStatsResponse struct {
Clicks ClicksStats `json:"clicks"`
Referrals []any `json:"referrals"`
Browsers []any `json:"browsers"`
Devices []any `json:"devices"`
Locations []any `json:"locations"`
}
GetCodeStatsResponse represents code statistics response
type GetQRCodesResponse ¶
type GetQRCodesResponse struct {
Total int `json:"total"`
PageNum int `json:"pageNum"`
PageSize int `json:"pageSize"`
Data []QRCodeResponse `json:"data"`
}
GetQRCodesResponse represents a paginated response of QR codes
type GetShortCodesResponse ¶
type GetShortCodesResponse struct {
Total int `json:"total"`
PageNum int `json:"pageNum"`
PageSize int `json:"pageSize"`
Data []ShortCodeResponse `json:"data"`
}
GetShortCodesResponse represents a paginated response of short codes
type Link ¶
type Link struct {
// contains filtered or unexported fields
}
Link is the client for URL shortening services
func (*Link) CreateQRCode ¶
func (l *Link) CreateQRCode(ctx context.Context, code string, opts *CreateQRCodeOptions) (*QRCodeResponse, error)
CreateQRCode creates a QR code for a specific short code
func (*Link) CreateShortCode ¶
func (l *Link) CreateShortCode(ctx context.Context, longURL, domain string, opts *CreateShortCodeOptions) (*ShortCodeResponse, error)
CreateShortCode creates a short code for a long URL
func (*Link) DeleteQRCode ¶
DeleteQRCode deletes a QR code by its ID
func (*Link) DeleteShortCode ¶
DeleteShortCode deletes a short code
func (*Link) GetCodeStats ¶
func (l *Link) GetCodeStats(ctx context.Context, code string, startDate, endDate time.Time) (*GetCodeStatsResponse, error)
GetCodeStats retrieves statistics for a specific short code
func (*Link) GetQRCodes ¶
func (l *Link) GetQRCodes(ctx context.Context, code string, pageNumber, pageSize int) (*GetQRCodesResponse, error)
GetQRCodes retrieves all QR codes for a short code
func (*Link) GetShortCode ¶
GetShortCode retrieves a short code by its code
func (*Link) GetShortCodes ¶
func (l *Link) GetShortCodes(ctx context.Context, titleSearch string, tags []string, pageNumber, pageSize int) (*GetShortCodesResponse, error)
GetShortCodes retrieves all short codes for the organization
func (*Link) SetErrorHandler ¶
SetErrorHandler sets a custom error handler function
func (*Link) UpdateShortCode ¶
func (l *Link) UpdateShortCode(ctx context.Context, code string, opts *UpdateShortCodeOptions) (*ShortCodeResponse, error)
UpdateShortCode updates a short code
type Option ¶
type Option func(*Options)
Option is a functional option for configuring the Link client
func WithOrganizationID ¶
WithOrganizationID sets the organization ID
type OrganizationID ¶
OrganizationID represents the organization identifier in responses
type QRCodeResponse ¶
type QRCodeResponse struct {
ID string `json:"id"`
Title string `json:"title,omitempty"`
QRCode string `json:"qrCode"`
QRCodeBytes []byte `json:"-"`
QRLink string `json:"qrLink"`
}
QRCodeResponse represents a QR code response
type ShortCodeResponse ¶
type ShortCodeResponse struct {
ID string `json:"id"`
Code string `json:"code"`
LongURL string `json:"long_url"`
Domain string `json:"domain"`
CreatedAt string `json:"createdAt"`
Title string `json:"title,omitempty"`
Tags []string `json:"tags,omitempty"`
OrganizationID OrganizationID `json:"organizationId"`
}
ShortCodeResponse represents a short code response
type UpdateShortCodeOptions ¶
type UpdateShortCodeOptions struct {
LongURL string `json:"long_url,omitempty"`
Title string `json:"title,omitempty"`
Tags []string `json:"tags,omitempty"`
}
UpdateShortCodeOptions contains optional parameters for updating short codes