Documentation
¶
Overview ¶
Package proxyhat provides a Go client for the ProxyHat API.
Usage:
client := proxyhat.NewClient("your-api-key")
user, err := client.Auth.User(context.Background())
Index ¶
- Constants
- func Bool(v bool) *bool
- func Float64(v float64) *float64
- func Int(v int) *int
- func IsAuthenticationError(err error) bool
- func IsNotFoundError(err error) bool
- func IsPermissionError(err error) bool
- func IsRateLimitError(err error) bool
- func IsValidationError(err error) bool
- func String(v string) *string
- type APIKey
- type AnalyticsParams
- type AnalyticsService
- func (s *AnalyticsService) DomainBreakdown(ctx context.Context, params *AnalyticsParams) (*DomainBreakdownResponse, error)
- func (s *AnalyticsService) Requests(ctx context.Context, params *AnalyticsParams) (*TimeSeriesResponse, error)
- func (s *AnalyticsService) RequestsTotal(ctx context.Context, params *AnalyticsParams) (*TotalResponse, error)
- func (s *AnalyticsService) Traffic(ctx context.Context, params *AnalyticsParams) (*TimeSeriesResponse, error)
- func (s *AnalyticsService) TrafficTotal(ctx context.Context, params *AnalyticsParams) (*TotalResponse, error)
- type AuthService
- func (s *AuthService) DisconnectSocial(ctx context.Context, provider string) error
- func (s *AuthService) Login(ctx context.Context, params LoginParams) (*LoginResponse, error)
- func (s *AuthService) Logout(ctx context.Context) error
- func (s *AuthService) OAuthRedirect(ctx context.Context, provider string) (any, error)
- func (s *AuthService) Register(ctx context.Context, params RegisterParams) (*RegisterResponse, error)
- func (s *AuthService) SocialAccounts(ctx context.Context) ([]SocialAccount, error)
- func (s *AuthService) SupportedProviders(ctx context.Context) ([]SupportedProvider, error)
- func (s *AuthService) User(ctx context.Context) (*User, error)
- type BulkDeleteResponse
- type ChangePasswordParams
- type City
- type CityParams
- type Client
- type Country
- type Coupon
- type CouponParams
- type CouponResponse
- type CouponsService
- type CreatePaymentParams
- type CreateProxyPresetParams
- type CreateSubUserGroupParams
- type CreateSubUserParams
- type CryptoInfo
- type Cryptocurrency
- type DomainBreakdownItem
- type DomainBreakdownResponse
- type EmailChangeResponse
- type EmailService
- func (s *EmailService) CancelChange(ctx context.Context) (*EmailChangeResponse, error)
- func (s *EmailService) ConfirmChange(ctx context.Context, token string) (*EmailChangeResponse, error)
- func (s *EmailService) RequestChange(ctx context.Context, params RequestEmailChangeParams) (*EmailChangeResponse, error)
- func (s *EmailService) ResendVerification(ctx context.Context) (*EmailChangeResponse, error)
- type Error
- type ISP
- type LocationParams
- type LocationsService
- func (s *LocationsService) Cities(ctx context.Context, params *CityParams) ([]City, error)
- func (s *LocationsService) Countries(ctx context.Context, params *LocationParams) ([]Country, error)
- func (s *LocationsService) ISPs(ctx context.Context, params *RegionParams) ([]ISP, error)
- func (s *LocationsService) Regions(ctx context.Context, params *RegionParams) ([]Region, error)
- func (s *LocationsService) Zipcodes(ctx context.Context, params *ZipcodeParams) ([]Zipcode, error)
- type LoginParams
- type LoginResponse
- type Option
- type Payment
- type PaymentCreateResponse
- type PaymentDetails
- type PaymentsService
- func (s *PaymentsService) Check(ctx context.Context, id string) (*PaymentDetails, error)
- func (s *PaymentsService) Create(ctx context.Context, params CreatePaymentParams) (*PaymentCreateResponse, error)
- func (s *PaymentsService) Cryptocurrencies(ctx context.Context) ([]Cryptocurrency, error)
- func (s *PaymentsService) Get(ctx context.Context, id string) (*PaymentDetails, error)
- func (s *PaymentsService) Invoice(ctx context.Context, id string, format string) (*http.Response, error)
- func (s *PaymentsService) List(ctx context.Context) ([]Payment, error)
- type PlansService
- func (s *PlansService) GetRegular(ctx context.Context, name string) (*RegularPlan, error)
- func (s *PlansService) GetSubscription(ctx context.Context, name string) (*SubscriptionPlan, error)
- func (s *PlansService) ListRegular(ctx context.Context) ([]RegularPlan, error)
- func (s *PlansService) ListSubscriptions(ctx context.Context) ([]SubscriptionPlan, error)
- func (s *PlansService) PricingRegular(ctx context.Context) ([]any, error)
- func (s *PlansService) PricingSubscriptions(ctx context.Context) ([]any, error)
- type Preferences
- type ProfileService
- func (s *ProfileService) CreateAPIKey(ctx context.Context, name *string) (*APIKey, error)
- func (s *ProfileService) DeleteAPIKey(ctx context.Context, id string) error
- func (s *ProfileService) GetPreferences(ctx context.Context) (*Preferences, error)
- func (s *ProfileService) ListAPIKeys(ctx context.Context) ([]APIKey, error)
- func (s *ProfileService) RegenerateAPIKey(ctx context.Context, id string) (*APIKey, error)
- func (s *ProfileService) UpdatePreferences(ctx context.Context, preferences map[string]any) (*Preferences, error)
- type ProxyPreset
- type ProxyPresetsService
- func (s *ProxyPresetsService) Create(ctx context.Context, params CreateProxyPresetParams) (*ProxyPreset, error)
- func (s *ProxyPresetsService) Delete(ctx context.Context, id string) error
- func (s *ProxyPresetsService) Get(ctx context.Context, id string) (*ProxyPreset, error)
- func (s *ProxyPresetsService) List(ctx context.Context) ([]ProxyPreset, error)
- func (s *ProxyPresetsService) Update(ctx context.Context, id string, params UpdateProxyPresetParams) (*ProxyPreset, error)
- type RateLimitError
- type RecoveryCodes
- type Region
- type RegionParams
- type RegisterParams
- type RegisterResponse
- type RegularPlan
- type RequestEmailChangeParams
- type ResetUsageResponse
- type SocialAccount
- type SubUser
- type SubUserGroup
- type SubUserGroupsService
- func (s *SubUserGroupsService) Create(ctx context.Context, params CreateSubUserGroupParams) (*SubUserGroup, error)
- func (s *SubUserGroupsService) Delete(ctx context.Context, id string) error
- func (s *SubUserGroupsService) Get(ctx context.Context, id string) (*SubUserGroup, error)
- func (s *SubUserGroupsService) List(ctx context.Context) ([]SubUserGroup, error)
- func (s *SubUserGroupsService) Update(ctx context.Context, id string, params UpdateSubUserGroupParams) (*SubUserGroup, error)
- type SubUsersService
- func (s *SubUsersService) BulkDelete(ctx context.Context, ids []string) (*BulkDeleteResponse, error)
- func (s *SubUsersService) BulkMoveToGroup(ctx context.Context, ids []string, groupID *string) (any, error)
- func (s *SubUsersService) Create(ctx context.Context, params CreateSubUserParams) (*SubUser, error)
- func (s *SubUsersService) Delete(ctx context.Context, id string) error
- func (s *SubUsersService) Get(ctx context.Context, id string) (*SubUser, error)
- func (s *SubUsersService) List(ctx context.Context) ([]SubUser, error)
- func (s *SubUsersService) ResetUsage(ctx context.Context, ids []string) (*ResetUsageResponse, error)
- func (s *SubUsersService) Update(ctx context.Context, id string, params UpdateSubUserParams) (*SubUser, error)
- type SubscriptionPlan
- type SupportedProvider
- type TimeSeriesResponse
- type TotalResponse
- type TrafficInfo
- type TwoFactorEnableResponse
- type TwoFactorService
- func (s *TwoFactorService) ChangePassword(ctx context.Context, params ChangePasswordParams) (any, error)
- func (s *TwoFactorService) Confirm(ctx context.Context, code string) (any, error)
- func (s *TwoFactorService) Disable(ctx context.Context, twofaCode string) (any, error)
- func (s *TwoFactorService) DisableByRecovery(ctx context.Context, recoveryCode string) (any, error)
- func (s *TwoFactorService) Enable(ctx context.Context) (*TwoFactorEnableResponse, error)
- func (s *TwoFactorService) QRCode(ctx context.Context) (*TwoFactorEnableResponse, error)
- func (s *TwoFactorService) RecoveryCodes(ctx context.Context) (*RecoveryCodes, error)
- func (s *TwoFactorService) Status(ctx context.Context) (*TwoFactorStatus, error)
- type TwoFactorStatus
- type UpdateProxyPresetParams
- type UpdateSubUserGroupParams
- type UpdateSubUserParams
- type User
- type Zipcode
- type ZipcodeParams
Constants ¶
const ( DefaultBaseURL = "https://api.proxyhat.com/v1" DefaultTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func IsAuthenticationError ¶
IsAuthenticationError returns true if the error is a 401 Unauthorized.
func IsNotFoundError ¶
IsNotFoundError returns true if the error is a 404 Not Found.
func IsPermissionError ¶
IsPermissionError returns true if the error is a 403 Forbidden.
func IsRateLimitError ¶
IsRateLimitError returns true if the error is a 429 Too Many Requests.
func IsValidationError ¶
IsValidationError returns true if the error is a 422 Unprocessable Entity.
Types ¶
type AnalyticsParams ¶
type AnalyticsParams struct {
Period string `json:"period"`
StartDate *string `json:"start_date,omitempty"`
EndDate *string `json:"end_date,omitempty"`
}
AnalyticsParams are common parameters for analytics endpoints.
type AnalyticsService ¶
type AnalyticsService struct {
// contains filtered or unexported fields
}
AnalyticsService handles analytics endpoints.
func (*AnalyticsService) DomainBreakdown ¶
func (s *AnalyticsService) DomainBreakdown(ctx context.Context, params *AnalyticsParams) (*DomainBreakdownResponse, error)
DomainBreakdown returns domain breakdown analytics.
func (*AnalyticsService) Requests ¶
func (s *AnalyticsService) Requests(ctx context.Context, params *AnalyticsParams) (*TimeSeriesResponse, error)
Requests returns request time series data.
func (*AnalyticsService) RequestsTotal ¶
func (s *AnalyticsService) RequestsTotal(ctx context.Context, params *AnalyticsParams) (*TotalResponse, error)
RequestsTotal returns total requests for the period.
func (*AnalyticsService) Traffic ¶
func (s *AnalyticsService) Traffic(ctx context.Context, params *AnalyticsParams) (*TimeSeriesResponse, error)
Traffic returns traffic time series data.
func (*AnalyticsService) TrafficTotal ¶
func (s *AnalyticsService) TrafficTotal(ctx context.Context, params *AnalyticsParams) (*TotalResponse, error)
TrafficTotal returns total traffic for the period.
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService handles authentication endpoints.
func (*AuthService) DisconnectSocial ¶
func (s *AuthService) DisconnectSocial(ctx context.Context, provider string) error
DisconnectSocial removes a connected social account.
func (*AuthService) Login ¶
func (s *AuthService) Login(ctx context.Context, params LoginParams) (*LoginResponse, error)
Login authenticates a user.
func (*AuthService) Logout ¶
func (s *AuthService) Logout(ctx context.Context) error
Logout invalidates the current session.
func (*AuthService) OAuthRedirect ¶
OAuthRedirect returns the OAuth redirect URL for a provider.
func (*AuthService) Register ¶
func (s *AuthService) Register(ctx context.Context, params RegisterParams) (*RegisterResponse, error)
Register creates a new account.
func (*AuthService) SocialAccounts ¶
func (s *AuthService) SocialAccounts(ctx context.Context) ([]SocialAccount, error)
SocialAccounts returns the user's connected social accounts.
func (*AuthService) SupportedProviders ¶
func (s *AuthService) SupportedProviders(ctx context.Context) ([]SupportedProvider, error)
SupportedProviders returns the list of supported OAuth providers.
type BulkDeleteResponse ¶
type ChangePasswordParams ¶
type CityParams ¶
type CityParams struct {
RegionParams
RegionCode *string
}
CityParams extends RegionParams with a region code filter.
type Client ¶
type Client struct {
Auth *AuthService
SubUsers *SubUsersService
SubUserGroups *SubUserGroupsService
Locations *LocationsService
Analytics *AnalyticsService
ProxyPresets *ProxyPresetsService
Profile *ProfileService
TwoFactor *TwoFactorService
Email *EmailService
Coupons *CouponsService
Plans *PlansService
Payments *PaymentsService
// contains filtered or unexported fields
}
Client manages communication with the ProxyHat API.
type CouponParams ¶
type CouponResponse ¶
type CouponsService ¶
type CouponsService struct {
// contains filtered or unexported fields
}
CouponsService handles coupon endpoints.
func (*CouponsService) Apply ¶
func (s *CouponsService) Apply(ctx context.Context, params CouponParams) (*CouponResponse, error)
Apply applies a coupon code.
func (*CouponsService) Redeem ¶
func (s *CouponsService) Redeem(ctx context.Context, code string) (*CouponResponse, error)
Redeem redeems a coupon code.
func (*CouponsService) Validate ¶
func (s *CouponsService) Validate(ctx context.Context, params CouponParams) (*CouponResponse, error)
Validate validates a coupon code.
type CreatePaymentParams ¶
type CreateProxyPresetParams ¶
type CreateSubUserParams ¶
type CreateSubUserParams struct {
ProxyPassword string `json:"proxy_password"`
IsTrafficLimited bool `json:"is_traffic_limited"`
TrafficLimit *string `json:"traffic_limit,omitempty"`
Name *string `json:"name,omitempty"`
Notes *string `json:"notes,omitempty"`
SubUserGroupID *string `json:"sub_user_group_id,omitempty"`
}
type CryptoInfo ¶
type Cryptocurrency ¶
type DomainBreakdownItem ¶
type DomainBreakdownResponse ¶
type DomainBreakdownResponse struct {
Items []DomainBreakdownItem `json:"items"`
}
type EmailChangeResponse ¶
type EmailChangeResponse struct {
Message string `json:"message"`
}
type EmailService ¶
type EmailService struct {
// contains filtered or unexported fields
}
EmailService handles email change endpoints.
func (*EmailService) CancelChange ¶
func (s *EmailService) CancelChange(ctx context.Context) (*EmailChangeResponse, error)
CancelChange cancels a pending email change.
func (*EmailService) ConfirmChange ¶
func (s *EmailService) ConfirmChange(ctx context.Context, token string) (*EmailChangeResponse, error)
ConfirmChange confirms an email change with a token.
func (*EmailService) RequestChange ¶
func (s *EmailService) RequestChange(ctx context.Context, params RequestEmailChangeParams) (*EmailChangeResponse, error)
RequestChange initiates an email change.
func (*EmailService) ResendVerification ¶
func (s *EmailService) ResendVerification(ctx context.Context) (*EmailChangeResponse, error)
ResendVerification resends the email verification.
type Error ¶
type Error struct {
Message string `json:"message"`
StatusCode int `json:"status_code"`
Errors any `json:"errors,omitempty"`
}
Error represents an API error response.
type LocationParams ¶
LocationParams are common query parameters for location endpoints.
type LocationsService ¶
type LocationsService struct {
// contains filtered or unexported fields
}
LocationsService handles location endpoints.
func (*LocationsService) Cities ¶
func (s *LocationsService) Cities(ctx context.Context, params *CityParams) ([]City, error)
Cities returns the list of available cities.
func (*LocationsService) Countries ¶
func (s *LocationsService) Countries(ctx context.Context, params *LocationParams) ([]Country, error)
Countries returns the list of available countries.
func (*LocationsService) ISPs ¶
func (s *LocationsService) ISPs(ctx context.Context, params *RegionParams) ([]ISP, error)
ISPs returns the list of available ISPs.
func (*LocationsService) Regions ¶
func (s *LocationsService) Regions(ctx context.Context, params *RegionParams) ([]Region, error)
Regions returns the list of available regions.
func (*LocationsService) Zipcodes ¶
func (s *LocationsService) Zipcodes(ctx context.Context, params *ZipcodeParams) ([]Zipcode, error)
Zipcodes returns the list of available zipcodes.
type LoginParams ¶
type LoginResponse ¶
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithHTTPClient ¶
WithHTTPClient sets the underlying HTTP client.
type PaymentCreateResponse ¶
type PaymentDetails ¶
type PaymentDetails struct {
PayAddress string `json:"pay_address"`
CryptoAmount float64 `json:"crypto_amount"`
AmountUSD float64 `json:"amount_usd"`
Crypto CryptoInfo `json:"crypto"`
Status string `json:"status"`
TxHash *string `json:"tx_hash"`
ExpiresAt *string `json:"expires_at"`
CompletedAt *string `json:"completed_at"`
}
type PaymentsService ¶
type PaymentsService struct {
// contains filtered or unexported fields
}
PaymentsService handles payment endpoints.
func (*PaymentsService) Check ¶
func (s *PaymentsService) Check(ctx context.Context, id string) (*PaymentDetails, error)
Check checks the status of a payment.
func (*PaymentsService) Create ¶
func (s *PaymentsService) Create(ctx context.Context, params CreatePaymentParams) (*PaymentCreateResponse, error)
Create creates a new payment.
func (*PaymentsService) Cryptocurrencies ¶
func (s *PaymentsService) Cryptocurrencies(ctx context.Context) ([]Cryptocurrency, error)
Cryptocurrencies returns the list of supported cryptocurrencies.
func (*PaymentsService) Get ¶
func (s *PaymentsService) Get(ctx context.Context, id string) (*PaymentDetails, error)
Get returns a payment by ID.
type PlansService ¶
type PlansService struct {
// contains filtered or unexported fields
}
PlansService handles plan endpoints.
func (*PlansService) GetRegular ¶
func (s *PlansService) GetRegular(ctx context.Context, name string) (*RegularPlan, error)
GetRegular returns a regular plan by name.
func (*PlansService) GetSubscription ¶
func (s *PlansService) GetSubscription(ctx context.Context, name string) (*SubscriptionPlan, error)
GetSubscription returns a subscription plan by name.
func (*PlansService) ListRegular ¶
func (s *PlansService) ListRegular(ctx context.Context) ([]RegularPlan, error)
ListRegular returns all regular (one-time) plans.
func (*PlansService) ListSubscriptions ¶
func (s *PlansService) ListSubscriptions(ctx context.Context) ([]SubscriptionPlan, error)
ListSubscriptions returns all subscription plans.
func (*PlansService) PricingRegular ¶
func (s *PlansService) PricingRegular(ctx context.Context) ([]any, error)
PricingRegular returns regular plan pricing.
func (*PlansService) PricingSubscriptions ¶
func (s *PlansService) PricingSubscriptions(ctx context.Context) ([]any, error)
PricingSubscriptions returns subscription plan pricing.
type Preferences ¶
type ProfileService ¶
type ProfileService struct {
// contains filtered or unexported fields
}
ProfileService handles profile endpoints.
func (*ProfileService) CreateAPIKey ¶
CreateAPIKey creates a new API key.
func (*ProfileService) DeleteAPIKey ¶
func (s *ProfileService) DeleteAPIKey(ctx context.Context, id string) error
DeleteAPIKey deletes an API key by ID.
func (*ProfileService) GetPreferences ¶
func (s *ProfileService) GetPreferences(ctx context.Context) (*Preferences, error)
GetPreferences returns user preferences.
func (*ProfileService) ListAPIKeys ¶
func (s *ProfileService) ListAPIKeys(ctx context.Context) ([]APIKey, error)
ListAPIKeys returns all API keys.
func (*ProfileService) RegenerateAPIKey ¶
RegenerateAPIKey regenerates an API key.
func (*ProfileService) UpdatePreferences ¶
func (s *ProfileService) UpdatePreferences(ctx context.Context, preferences map[string]any) (*Preferences, error)
UpdatePreferences updates user preferences.
type ProxyPreset ¶
type ProxyPresetsService ¶
type ProxyPresetsService struct {
// contains filtered or unexported fields
}
ProxyPresetsService handles proxy preset endpoints.
func (*ProxyPresetsService) Create ¶
func (s *ProxyPresetsService) Create(ctx context.Context, params CreateProxyPresetParams) (*ProxyPreset, error)
Create creates a new proxy preset.
func (*ProxyPresetsService) Delete ¶
func (s *ProxyPresetsService) Delete(ctx context.Context, id string) error
Delete removes a proxy preset.
func (*ProxyPresetsService) Get ¶
func (s *ProxyPresetsService) Get(ctx context.Context, id string) (*ProxyPreset, error)
Get returns a proxy preset by ID.
func (*ProxyPresetsService) List ¶
func (s *ProxyPresetsService) List(ctx context.Context) ([]ProxyPreset, error)
List returns all proxy presets.
func (*ProxyPresetsService) Update ¶
func (s *ProxyPresetsService) Update(ctx context.Context, id string, params UpdateProxyPresetParams) (*ProxyPreset, error)
Update modifies a proxy preset.
type RateLimitError ¶
type RateLimitError struct {
Message string `json:"message"`
StatusCode int `json:"status_code"`
Errors any `json:"errors,omitempty"`
RetryAfter int `json:"retry_after"`
}
RateLimitError is returned when the API rate limit is exceeded (HTTP 429).
func AsRateLimitError ¶
func AsRateLimitError(err error) (*RateLimitError, bool)
AsRateLimitError extracts a RateLimitError from err if present.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type RecoveryCodes ¶
type RecoveryCodes struct {
Codes []string `json:"codes"`
}
type RegionParams ¶
type RegionParams struct {
LocationParams
CountryCode *string
}
RegionParams extends LocationParams with a country code filter.
type RegisterParams ¶
type RegisterParams struct {
Name string `json:"name"`
Email string `json:"email"`
Password string `json:"password"`
PasswordConfirmation string `json:"password_confirmation"`
ReferralCode *string `json:"referral_code,omitempty"`
UTMSource *string `json:"utm_source,omitempty"`
UTMMedium *string `json:"utm_medium,omitempty"`
UTMCampaign *string `json:"utm_campaign,omitempty"`
}
type RegisterResponse ¶
type RegularPlan ¶
type ResetUsageResponse ¶
type ResetUsageResponse struct {
Reset int `json:"reset"`
}
type SocialAccount ¶
type SubUser ¶
type SubUser struct {
UUID string `json:"uuid"`
ProxyUsername string `json:"proxy_username"`
IsDefaultUser bool `json:"is_default_user"`
IsTrafficLimited bool `json:"is_traffic_limited"`
UsedTraffic int `json:"used_traffic"`
TrafficLimit int `json:"traffic_limit"`
LifecycleStatus string `json:"lifecycle_status"`
Name *string `json:"name"`
Notes *string `json:"notes"`
SubUserGroupID *string `json:"sub_user_group_id"`
CreatedAt string `json:"created_at"`
}
type SubUserGroup ¶
type SubUserGroupsService ¶
type SubUserGroupsService struct {
// contains filtered or unexported fields
}
SubUserGroupsService handles sub-user group endpoints.
func (*SubUserGroupsService) Create ¶
func (s *SubUserGroupsService) Create(ctx context.Context, params CreateSubUserGroupParams) (*SubUserGroup, error)
Create creates a new sub-user group.
func (*SubUserGroupsService) Delete ¶
func (s *SubUserGroupsService) Delete(ctx context.Context, id string) error
Delete removes a sub-user group.
func (*SubUserGroupsService) Get ¶
func (s *SubUserGroupsService) Get(ctx context.Context, id string) (*SubUserGroup, error)
Get returns a sub-user group by ID.
func (*SubUserGroupsService) List ¶
func (s *SubUserGroupsService) List(ctx context.Context) ([]SubUserGroup, error)
List returns all sub-user groups.
func (*SubUserGroupsService) Update ¶
func (s *SubUserGroupsService) Update(ctx context.Context, id string, params UpdateSubUserGroupParams) (*SubUserGroup, error)
Update modifies a sub-user group.
type SubUsersService ¶
type SubUsersService struct {
// contains filtered or unexported fields
}
SubUsersService handles sub-user endpoints.
func (*SubUsersService) BulkDelete ¶
func (s *SubUsersService) BulkDelete(ctx context.Context, ids []string) (*BulkDeleteResponse, error)
BulkDelete deletes multiple sub-users.
func (*SubUsersService) BulkMoveToGroup ¶
func (s *SubUsersService) BulkMoveToGroup(ctx context.Context, ids []string, groupID *string) (any, error)
BulkMoveToGroup moves multiple sub-users to a group.
func (*SubUsersService) Create ¶
func (s *SubUsersService) Create(ctx context.Context, params CreateSubUserParams) (*SubUser, error)
Create creates a new sub-user.
func (*SubUsersService) Delete ¶
func (s *SubUsersService) Delete(ctx context.Context, id string) error
Delete removes a sub-user.
func (*SubUsersService) List ¶
func (s *SubUsersService) List(ctx context.Context) ([]SubUser, error)
List returns all sub-users.
func (*SubUsersService) ResetUsage ¶
func (s *SubUsersService) ResetUsage(ctx context.Context, ids []string) (*ResetUsageResponse, error)
ResetUsage resets traffic usage for the given sub-user IDs.
func (*SubUsersService) Update ¶
func (s *SubUsersService) Update(ctx context.Context, id string, params UpdateSubUserParams) (*SubUser, error)
Update modifies a sub-user.
type SubscriptionPlan ¶
type SupportedProvider ¶
type TimeSeriesResponse ¶
type TotalResponse ¶
type TotalResponse struct {
Total int `json:"total"`
}
type TrafficInfo ¶
type TrafficInfo struct {
Subscription *string `json:"subscription"`
SubscriptionStartsAt *string `json:"subscription_starts_at"`
SubscriptionExpiresAt *string `json:"subscription_expires_at"`
RegularBytes int `json:"regular_bytes"`
RegularHuman string `json:"regular_human"`
SubscriptionBytes int `json:"subscription_bytes"`
SubscriptionHuman string `json:"subscription_human"`
TotalBytes int `json:"total_bytes"`
TotalHuman string `json:"total_human"`
}
type TwoFactorEnableResponse ¶
type TwoFactorService ¶
type TwoFactorService struct {
// contains filtered or unexported fields
}
TwoFactorService handles two-factor authentication endpoints.
func (*TwoFactorService) ChangePassword ¶
func (s *TwoFactorService) ChangePassword(ctx context.Context, params ChangePasswordParams) (any, error)
ChangePassword changes the user's password.
func (*TwoFactorService) DisableByRecovery ¶
DisableByRecovery disables 2FA using a recovery code.
func (*TwoFactorService) Enable ¶
func (s *TwoFactorService) Enable(ctx context.Context) (*TwoFactorEnableResponse, error)
Enable initiates 2FA setup.
func (*TwoFactorService) QRCode ¶
func (s *TwoFactorService) QRCode(ctx context.Context) (*TwoFactorEnableResponse, error)
QRCode returns the QR code for 2FA setup.
func (*TwoFactorService) RecoveryCodes ¶
func (s *TwoFactorService) RecoveryCodes(ctx context.Context) (*RecoveryCodes, error)
RecoveryCodes returns the 2FA recovery codes.
func (*TwoFactorService) Status ¶
func (s *TwoFactorService) Status(ctx context.Context) (*TwoFactorStatus, error)
Status returns the 2FA status for the authenticated user.
type TwoFactorStatus ¶
type TwoFactorStatus struct {
Enabled bool `json:"enabled"`
}
type UpdateProxyPresetParams ¶
type UpdateSubUserParams ¶
type User ¶
type User struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Email string `json:"email"`
Traffic TrafficInfo `json:"traffic"`
}
type ZipcodeParams ¶
type ZipcodeParams struct {
LocationParams
CountryCode *string
CityCode *string
}
ZipcodeParams extends LocationParams with country and city code filters.