Documentation
¶
Overview ¶
Package dto is the subscription module's contract: the commands, queries and results of its facade and HTTP handlers, and the module's own JSON snapshots of the identity and network data its views embed.
Index ¶
- type BatchDeleteSubscribeGroupRequest
- type BatchDeleteSubscribeRequest
- type CreateSubscribeApplicationRequest
- type CreateSubscribeGroupRequest
- type CreateSubscribeRequest
- type CreateUserSubscribeRequest
- type DeleteSubscribeApplicationRequest
- type DeleteSubscribeGroupRequest
- type DeleteSubscribeRequest
- type DeleteUserSubscribeRequest
- type DownloadLink
- type EntitlementResult
- type GetSubscribeApplicationListRequest
- type GetSubscribeApplicationListResponse
- type GetSubscribeDetailsRequest
- type GetSubscribeGroupListResponse
- type GetSubscribeListRequest
- type GetSubscribeListResponse
- type GetSubscribeLogRequest
- type GetSubscribeLogResponse
- type GetUserSubscribeByIdRequest
- type GetUserSubscribeDevicesRequest
- type GetUserSubscribeDevicesResponse
- type GetUserSubscribeListRequest
- type GetUserSubscribeListResponse
- type GetUserSubscribeLogsRequest
- type GetUserSubscribeLogsResponse
- type GetUserSubscribeResetTrafficLogsRequest
- type GetUserSubscribeResetTrafficLogsResponse
- type GetUserSubscribeTrafficLogsRequest
- type GetUserSubscribeTrafficLogsResponse
- type PreUnsubscribeRequest
- type PreUnsubscribeResponse
- type PreviewSubscribeTemplateRequest
- type PreviewSubscribeTemplateResponse
- type QuerySubscribeGroupListResponse
- type QuerySubscribeListRequest
- type QuerySubscribeListResponse
- type QueryUserSubscribeListResponse
- type QueryUserSubscribeNodeListResponse
- type ReconcileEntitlementCommand
- type ResetAllSubscribeTokenResponse
- type ResetSubscribeTrafficLog
- type ResetUserSubscribeTokenRequest
- type ResetUserSubscribeTrafficRequest
- type SortItem
- type StringInt64Slice
- type Subscribe
- type SubscribeApplication
- type SubscribeDiscount
- type SubscribeGroup
- type SubscribeItem
- type SubscribeRequest
- type SubscribeResponse
- type SubscribeSortRequest
- type SubscriptionUserAuthMethodSnapshot
- type SubscriptionUserDeviceSnapshot
- type SubscriptionUserSnapshot
- type ToggleUserSubscribeStatusRequest
- type TrafficLog
- type UnsubscribeRequest
- type UpdateSubscribeApplicationRequest
- type UpdateSubscribeGroupRequest
- type UpdateSubscribeRequest
- type UpdateUserSubscribeNoteRequest
- type UpdateUserSubscribeRequest
- type UserSubscribe
- type UserSubscribeDetail
- type UserSubscribeInfo
- type UserSubscribeLog
- type UserSubscribeNodeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchDeleteSubscribeGroupRequest ¶
type BatchDeleteSubscribeGroupRequest struct {
Ids []int64 `json:"ids" validate:"required"`
}
type BatchDeleteSubscribeRequest ¶
type BatchDeleteSubscribeRequest struct {
Ids []int64 `json:"ids" validate:"required"`
}
type CreateSubscribeApplicationRequest ¶
type CreateSubscribeApplicationRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Icon string `json:"icon,omitempty"`
Scheme string `json:"scheme,omitempty"`
UserAgent string `json:"user_agent"`
IsDefault bool `json:"is_default"`
SubscribeTemplate string `json:"template"`
OutputFormat string `json:"output_format"`
// DefaultParams holds the template params this client should receive when the
// subscription URL does not carry them, in query-string form such as
// "mode=rule&emoji=1".
DefaultParams string `json:"default_params,omitempty"`
DownloadLink DownloadLink `json:"download_link"`
}
type CreateSubscribeRequest ¶
type CreateSubscribeRequest struct {
Name string `json:"name" validate:"required"`
Language string `json:"language"`
Description string `json:"description"`
UnitPrice int64 `json:"unit_price"`
UnitTime string `json:"unit_time"`
Discount []SubscribeDiscount `json:"discount"`
Replacement int64 `json:"replacement"`
Inventory int64 `json:"inventory"`
Traffic int64 `json:"traffic"`
SpeedLimit int64 `json:"speed_limit"`
DeviceLimit int64 `json:"device_limit"`
Quota int64 `json:"quota"`
Nodes StringInt64Slice `json:"nodes"`
NodeTags []string `json:"node_tags"`
Show *bool `json:"show"`
Sell *bool `json:"sell"`
DeductionRatio int64 `json:"deduction_ratio"`
AllowDeduction *bool `json:"allow_deduction"`
ResetCycle int64 `json:"reset_cycle"`
RenewalReset *bool `json:"renewal_reset"`
ShowOriginalPrice bool `json:"show_original_price"`
}
type CreateUserSubscribeRequest ¶
type CreateUserSubscribeRequest struct {
UserId int64 `json:"user_id"`
ExpiredAt int64 `json:"expired_at"`
Traffic int64 `json:"traffic"`
SubscribeId int64 `json:"subscribe_id"`
}
Cross-domain view types are module-owned snapshots. They deliberately duplicate JSON shapes instead of coupling one module's API to another.
type DeleteSubscribeApplicationRequest ¶
type DeleteSubscribeApplicationRequest struct {
Id int64 `json:"id"`
}
type DeleteSubscribeGroupRequest ¶
type DeleteSubscribeGroupRequest struct {
Id int64 `json:"id" validate:"required"`
}
type DeleteSubscribeRequest ¶
type DeleteSubscribeRequest struct {
Id int64 `json:"id" validate:"required"`
}
type DeleteUserSubscribeRequest ¶
type DeleteUserSubscribeRequest struct {
UserSubscribeId int64 `json:"user_subscribe_id"`
}
type DownloadLink ¶
type EntitlementResult ¶ added in v1.21.0
type GetSubscribeApplicationListResponse ¶
type GetSubscribeApplicationListResponse struct {
Total int64 `json:"total"`
List []SubscribeApplication `json:"list"`
}
type GetSubscribeDetailsRequest ¶
type GetSubscribeDetailsRequest struct {
Id int64 `form:"id" validate:"required"`
}
type GetSubscribeGroupListResponse ¶
type GetSubscribeGroupListResponse struct {
List []SubscribeGroup `json:"list"`
Total int64 `json:"total"`
}
type GetSubscribeListRequest ¶
type GetSubscribeListResponse ¶
type GetSubscribeListResponse struct {
List []SubscribeItem `json:"list"`
Total int64 `json:"total"`
}
type GetSubscribeLogRequest ¶
type GetSubscribeLogResponse ¶
type GetSubscribeLogResponse struct {
List []UserSubscribeLog `json:"list"`
Total int64 `json:"total"`
}
type GetUserSubscribeByIdRequest ¶
type GetUserSubscribeByIdRequest struct {
Id int64 `form:"id" validate:"required"`
}
type GetUserSubscribeDevicesResponse ¶
type GetUserSubscribeDevicesResponse struct {
List []SubscriptionUserDeviceSnapshot `json:"list"`
Total int64 `json:"total"`
}
type GetUserSubscribeListResponse ¶
type GetUserSubscribeListResponse struct {
List []UserSubscribe `json:"list"`
Total int64 `json:"total"`
}
type GetUserSubscribeLogsResponse ¶
type GetUserSubscribeLogsResponse struct {
List []UserSubscribeLog `json:"list"`
Total int64 `json:"total"`
}
type GetUserSubscribeResetTrafficLogsResponse ¶
type GetUserSubscribeResetTrafficLogsResponse struct {
List []ResetSubscribeTrafficLog `json:"list"`
Total int64 `json:"total"`
}
type GetUserSubscribeTrafficLogsResponse ¶
type GetUserSubscribeTrafficLogsResponse struct {
List []TrafficLog `json:"list"`
Total int64 `json:"total"`
}
type PreUnsubscribeRequest ¶
type PreUnsubscribeRequest struct {
Id int64 `json:"id"`
}
type PreUnsubscribeResponse ¶
type PreUnsubscribeResponse struct {
DeductionAmount int64 `json:"deduction_amount"`
}
type PreviewSubscribeTemplateRequest ¶
type PreviewSubscribeTemplateRequest struct {
Id int64 `form:"id"`
}
type PreviewSubscribeTemplateResponse ¶
type PreviewSubscribeTemplateResponse struct {
Template string `json:"template"` // The rendered template preview
}
type QuerySubscribeGroupListResponse ¶
type QuerySubscribeGroupListResponse struct {
List []SubscribeGroup `json:"list"`
Total int64 `json:"total"`
}
type QuerySubscribeListRequest ¶
type QuerySubscribeListRequest struct {
Language string `form:"language"`
}
type QueryUserSubscribeListResponse ¶
type QueryUserSubscribeListResponse struct {
List []UserSubscribe `json:"list"`
Total int64 `json:"total"`
}
type QueryUserSubscribeNodeListResponse ¶
type QueryUserSubscribeNodeListResponse struct {
List []UserSubscribeInfo `json:"list"`
}
type ReconcileEntitlementCommand ¶ added in v1.21.0
type ReconcileEntitlementCommand struct {
Source string
// Scope isolates app and environment (for example bundleID:Production).
Scope string
SubscriptionKey string
TransactionKey string
UserID int64
PlanID int64
OrderID int64
Revision int64
// Mode must be auto_renewable. Fixed-term IAP is outside the supported scope.
Mode string
// BillingInterval is month or year, taken from the verified product mapping.
// It describes the standard product interval, not a duration to add to
// PeriodStart; actual trial, renewal and extension dates come from Apple.
BillingInterval string
// Status is active, grace, billing_retry, expired, or revoked.
Status string
PeriodStart time.Time
PeriodEnd time.Time
GraceUntil *time.Time
RevokedAt *time.Time
AutoRenew bool
// ResetTraffic applies at most once for this transaction's current
// period, never for an expired period or a plan whose traffic is reset
// by a separate calendar schedule (ResetCycle != 0).
ResetTraffic bool
}
ReconcileEntitlementCommand is an internal, trusted billing-to-subscription contract. It must NOT be bound to an HTTP request. Billing must authenticate the provider, resolve ownership and reconcile history before issuing it. Revision is a durable monotonic revision of that reconciled ledger, NOT a local receipt timestamp, raw Apple signedDate, or notification sequence.
type ResetAllSubscribeTokenResponse ¶
type ResetAllSubscribeTokenResponse struct {
Success bool `json:"success"`
}
type ResetSubscribeTrafficLog ¶
type ResetSubscribeTrafficLog struct {
Id int64 `json:"id"`
Type uint16 `json:"type"`
UserSubscribeId int64 `json:"user_subscribe_id"`
OrderNo string `json:"order_no,omitempty"`
Timestamp int64 `json:"timestamp"`
ClientIP string `json:"client_ip,omitempty"`
UserAgent string `json:"user_agent,omitempty"`
ActorID int64 `json:"actor_id,omitempty"`
IPCountryCode string `json:"ip_country_code,omitempty"`
IPCountry string `json:"ip_country,omitempty"`
IPRegion string `json:"ip_region,omitempty"`
IPCity string `json:"ip_city,omitempty"`
IPASN uint `json:"ip_asn,omitempty"`
IPASOrganization string `json:"ip_as_organization,omitempty"`
}
type ResetUserSubscribeTokenRequest ¶
type ResetUserSubscribeTokenRequest struct {
UserSubscribeId int64 `json:"user_subscribe_id"`
}
type ResetUserSubscribeTrafficRequest ¶
type ResetUserSubscribeTrafficRequest struct {
UserSubscribeId int64 `json:"user_subscribe_id"`
}
type StringInt64Slice ¶
type StringInt64Slice []int64
func (StringInt64Slice) Int64s ¶
func (s StringInt64Slice) Int64s() []int64
func (StringInt64Slice) MarshalJSON ¶
func (s StringInt64Slice) MarshalJSON() ([]byte, error)
func (*StringInt64Slice) UnmarshalJSON ¶
func (s *StringInt64Slice) UnmarshalJSON(data []byte) error
type Subscribe ¶
type Subscribe struct {
Id int64 `json:"id"`
Name string `json:"name"`
Language string `json:"language"`
Description string `json:"description"`
UnitPrice int64 `json:"unit_price"`
UnitTime string `json:"unit_time"`
Discount []SubscribeDiscount `json:"discount"`
Replacement int64 `json:"replacement"`
Inventory int64 `json:"inventory"`
Traffic int64 `json:"traffic"`
SpeedLimit int64 `json:"speed_limit"`
DeviceLimit int64 `json:"device_limit"`
Quota int64 `json:"quota"`
Nodes StringInt64Slice `json:"nodes"`
NodeTags []string `json:"node_tags"`
Show bool `json:"show"`
Sell bool `json:"sell"`
Sort int64 `json:"sort"`
DeductionRatio int64 `json:"deduction_ratio"`
AllowDeduction bool `json:"allow_deduction"`
ResetCycle int64 `json:"reset_cycle"`
RenewalReset bool `json:"renewal_reset"`
ShowOriginalPrice bool `json:"show_original_price"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type SubscribeApplication ¶
type SubscribeApplication struct {
Id int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Icon string `json:"icon,omitempty"`
Scheme string `json:"scheme,omitempty"`
UserAgent string `json:"user_agent"`
IsDefault bool `json:"is_default"`
SubscribeTemplate string `json:"template"`
OutputFormat string `json:"output_format"`
DefaultParams string `json:"default_params,omitempty"`
DownloadLink DownloadLink `json:"download_link,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type SubscribeDiscount ¶
type SubscribeGroup ¶
type SubscribeItem ¶
type SubscribeRequest ¶
SubscribeRequest names the subscription to deliver and the query parameters its template receives. The client application, and with it the format, is chosen by the request's user agent.
type SubscribeResponse ¶
type SubscribeSortRequest ¶
type SubscribeSortRequest struct {
Sort []SortItem `json:"sort"`
}
type SubscriptionUserDeviceSnapshot ¶
type SubscriptionUserDeviceSnapshot struct {
Id int64 `json:"id"`
Ip string `json:"ip"`
Identifier string `json:"identifier"`
UserAgent string `json:"user_agent"`
Online bool `json:"online"`
Enabled bool `json:"enabled"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
} // @name dto.UserDevice
type SubscriptionUserSnapshot ¶
type SubscriptionUserSnapshot struct {
Id int64 `json:"id"`
Avatar string `json:"avatar"`
Balance int64 `json:"balance"`
Commission int64 `json:"commission"`
ReferralPercentage uint8 `json:"referral_percentage"`
OnlyFirstPurchase bool `json:"only_first_purchase"`
GiftAmount int64 `json:"gift_amount"`
Telegram int64 `json:"telegram"`
ReferCode string `json:"refer_code"`
RefererId int64 `json:"referer_id"`
Enable bool `json:"enable"`
IsAdmin bool `json:"is_admin,omitempty"`
EnableBalanceNotify bool `json:"enable_balance_notify"`
EnableLoginNotify bool `json:"enable_login_notify"`
EnableSubscribeNotify bool `json:"enable_subscribe_notify"`
EnableTradeNotify bool `json:"enable_trade_notify"`
AuthMethods []SubscriptionUserAuthMethodSnapshot `json:"auth_methods"`
UserDevices []SubscriptionUserDeviceSnapshot `json:"user_devices"`
Rules []string `json:"rules"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
DeletedAt int64 `json:"deleted_at,omitempty"`
} // @name dto.User
type ToggleUserSubscribeStatusRequest ¶
type ToggleUserSubscribeStatusRequest struct {
UserSubscribeId int64 `json:"user_subscribe_id"`
}
type TrafficLog ¶
type UnsubscribeRequest ¶
type UnsubscribeRequest struct {
Id int64 `json:"id"`
}
type UpdateSubscribeApplicationRequest ¶
type UpdateSubscribeApplicationRequest struct {
Id int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Icon string `json:"icon,omitempty"`
Scheme string `json:"scheme,omitempty"`
UserAgent string `json:"user_agent"`
IsDefault bool `json:"is_default"`
SubscribeTemplate string `json:"template"`
OutputFormat string `json:"output_format"`
DefaultParams string `json:"default_params,omitempty"`
DownloadLink DownloadLink `json:"download_link,omitempty"`
}
type UpdateSubscribeRequest ¶
type UpdateSubscribeRequest struct {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Language string `json:"language"`
Description string `json:"description"`
UnitPrice int64 `json:"unit_price"`
UnitTime string `json:"unit_time"`
Discount []SubscribeDiscount `json:"discount"`
Replacement int64 `json:"replacement"`
Inventory int64 `json:"inventory"`
Traffic int64 `json:"traffic"`
SpeedLimit int64 `json:"speed_limit"`
DeviceLimit int64 `json:"device_limit"`
Quota int64 `json:"quota"`
Nodes StringInt64Slice `json:"nodes"`
NodeTags []string `json:"node_tags"`
Show *bool `json:"show"`
Sell *bool `json:"sell"`
Sort int64 `json:"sort"`
DeductionRatio int64 `json:"deduction_ratio"`
AllowDeduction *bool `json:"allow_deduction"`
ResetCycle int64 `json:"reset_cycle"`
RenewalReset *bool `json:"renewal_reset"`
ShowOriginalPrice bool `json:"show_original_price"`
}
type UserSubscribe ¶
type UserSubscribe struct {
EntitlementSource string `json:"entitlement_source,omitempty"`
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
OrderId int64 `json:"order_id"`
SubscribeId int64 `json:"subscribe_id"`
Subscribe Subscribe `json:"subscribe"`
StartTime int64 `json:"start_time"`
ExpireTime int64 `json:"expire_time"`
FinishedAt int64 `json:"finished_at"`
ResetTime int64 `json:"reset_time"`
Traffic int64 `json:"traffic"`
Download int64 `json:"download"`
Upload int64 `json:"upload"`
Token string `json:"token"`
Status uint8 `json:"status"`
Short string `json:"short"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type UserSubscribeDetail ¶
type UserSubscribeDetail struct {
EntitlementSource string `json:"entitlement_source,omitempty"`
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
User SubscriptionUserSnapshot `json:"user"`
OrderId int64 `json:"order_id"`
SubscribeId int64 `json:"subscribe_id"`
Subscribe Subscribe `json:"subscribe"`
StartTime int64 `json:"start_time"`
ExpireTime int64 `json:"expire_time"`
ResetTime int64 `json:"reset_time"`
Traffic int64 `json:"traffic"`
Download int64 `json:"download"`
Upload int64 `json:"upload"`
Token string `json:"token"`
Status uint8 `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type UserSubscribeInfo ¶
type UserSubscribeInfo struct {
EntitlementSource string `json:"entitlement_source,omitempty"`
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
OrderId int64 `json:"order_id"`
SubscribeId int64 `json:"subscribe_id"`
StartTime int64 `json:"start_time"`
ExpireTime int64 `json:"expire_time"`
FinishedAt int64 `json:"finished_at"`
ResetTime int64 `json:"reset_time"`
Traffic int64 `json:"traffic"`
Download int64 `json:"download"`
Upload int64 `json:"upload"`
Token string `json:"token"`
Status uint8 `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
IsTryOut bool `json:"is_try_out"`
Nodes []*UserSubscribeNodeInfo `json:"nodes"`
}
type UserSubscribeLog ¶
type UserSubscribeLog struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
UserSubscribeId int64 `json:"user_subscribe_id"`
Token string `json:"token"`
IP string `json:"ip"`
UserAgent string `json:"user_agent"`
Timestamp int64 `json:"timestamp"`
ActorID int64 `json:"actor_id,omitempty"`
IPCountryCode string `json:"ip_country_code,omitempty"`
IPCountry string `json:"ip_country,omitempty"`
IPRegion string `json:"ip_region,omitempty"`
IPCity string `json:"ip_city,omitempty"`
IPASN uint `json:"ip_asn,omitempty"`
IPASOrganization string `json:"ip_as_organization,omitempty"`
}
type UserSubscribeNodeInfo ¶
type UserSubscribeNodeInfo struct {
Id int64 `json:"id"`
Name string `json:"name"`
Uuid string `json:"uuid"`
Protocol string `json:"protocol"`
Port uint16 `json:"port"`
Address string `json:"address"`
Tags []string `json:"tags"`
Country string `json:"country"`
City string `json:"city"`
CreatedAt int64 `json:"created_at"`
}