Help us shape the future of Go! Take the 2026 Go Developer Survey

smspva

package module
v0.1.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 15 Imported by: 0

README

SMSPVA Go SDK

Official Go client for SMSPVA, a service for receiving verification SMS, renting phone numbers and renting private email addresses. Covers all 56 methods in Activation V2 (20), Rental (22) and Private Email (14). Requires Go 1.22+ and uses only the standard library. This is an alpha release. Alternative API is excluded.

Installation

go get github.com/SMSPVA/smspva-go@v0.1.0-alpha.1

Sign in to your SMSPVA account, open Profile and ApiKey, and set SMSPVA_API_KEY in your server environment. Keep it out of source control. The example reads your balance and reference lists; it does not create an order.

package main

import (
    "context"
    "fmt"
    "log"
    "os"

    smspva "github.com/SMSPVA/smspva-go"
)

func main() {
    client, err := smspva.New(smspva.Options{APIKey: os.Getenv("SMSPVA_API_KEY")})
    if err != nil { log.Fatal(err) }
    defer client.CloseIdleConnections()
    ctx := context.Background()

    balance, err := client.Activation.GetBalance(ctx)
    if err != nil { log.Fatal(err) }
    fmt.Println(string(balance.Body))
    countries, err := client.Rental.GetCountries(ctx)
    if err != nil { log.Fatal(err) }
    fmt.Println(string(countries.Body))
    providers, err := client.Email.GetProviders(ctx)
    if err != nil { log.Fatal(err) }
    fmt.Println(string(providers.Body))
}

Requests and responses

Every method takes a context, a typed parameter struct when it has parameters, and optional request options. Parameter fields are pointers; nil omits a field and Ptr(value) supplies one. Required fields are checked before making a request. Integer fields use int64; strings, enums and bounds follow the original documentation. METHODS.md lists all methods.

services, err := client.Email.GetData(ctx, smspva.EmailGetDataParams{
    Pcode: smspva.Ptr("CODE_FROM_GET_PROVIDERS"),
})
if err != nil { return err }
fmt.Println(string(services.Body))

Country, service, provider, price and availability methods fetch live API data; the SDK has no fixed lists. Public methods work without a key and never send the configured key. Omitted or empty Email pcode is not sent. Optional-key Rental calls can use WithoutAPIKey(); required-key methods still require and send it. Activation sends apikey as a header; Rental and Email use query apikey.

Response.Body is the original JSON bytes and HTTPStatus is the actual HTTP status. Prices, IDs, timestamps and envelope fields are not normalized. Use response.Decode(&yourStruct) to read selected fields into your own types, or json.Decoder.UseNumber if decoding arbitrary numbers into maps. Generated response DTOs are not included.

Receiving an existing order's new SMS can charge your account:

sms, err := client.Activation.ReceiveSms(ctx, smspva.ActivationReceiveSmsParams{
    OrderID: smspva.Ptr(int64(12345)),
})
if err != nil { return err }
if smspva.IsPending(sms) {
    fmt.Println("SMS has not arrived yet")
} else {
    fmt.Println(string(sms.Body))
}

IsPending recognizes HTTP 202 / SMS_NOT_YET_RECEIVED. Email creation status=2 is also an ordinary result; use IsNoStock. For Rental multi-service counts, send dtype and dcount explicitly; backend defaults are unreliable according to the source documentation.

Errors, timeout and cancellation

Use errors.As for *smspva.APIError, *smspva.ProtocolError, *smspva.TransportError, *smspva.ValidationError or *smspva.PollingTimeoutError. APIError retains the original HTTPStatus, Code and JSON Body. Codes decoded as numbers use json.Number.

The default whole-request timeout is 30 seconds, including reading the response body. Configure Options.Timeout or per-call WithTimeout(duration). A shorter context deadline wins. Cancelling the context aborts the request; context sentinel errors can be checked using errors.Is. TransportError.Kind is network, timeout or cancelled; OutcomeUnknown flags uncertain paid/state-changing operations. Error messages omit credentials and URLs. Raw bodies can contain private message data; redact your own logs.

The default transport uses fresh HTTP/1.1 connections with keep-alives disabled, without environment proxies, cookie storage or redirects. This avoids the standard Go transport's automatic replay of idempotent requests on reused connections. Several paid API methods use GET. The SDK makes no automatic retries; inspect existing orders after an uncertain paid result before repeating it. An injected Options.Transport is the caller's responsibility: do not install a retrying transport or a transport that adds credentials to public requests.

Base URLs can be overridden in Options for controlled proxies or tests. Keys, URLs and headers are not method parameters.

Waiting for SMS

result, err := client.Activation.WaitForSMS(ctx, smspva.WaitForSMSOptions{
    OrderID: 12345,
    ExpiresAt: savedOrderExpiry,
})

Save an absolute expiry when the order is obtained and pass that same time.Time each time. The helper converts it once to a monotonic deadline, waits at least five seconds between pending requests, and never creates or cancels orders. It stops on a terminal API error, context cancellation, network failure or expiry. If an in-flight request times out at the deadline, its transport error retains the uncertain outcome; expiry while sleeping returns PollingTimeoutError.

Development

From the repository root:

node scripts/generate.mjs
gofmt -w resources.go named_calls_test.go
go test ./...
go vet ./...

Generation uses the bundled contracts.json and testdata/cases.json. The generated source, embedded contracts and test fixtures are included, so an extracted module builds and tests on its own. Tests use loopback HTTP and cover every named method, auth and encoding, original responses, pending/no-stock, validation, redirects/cookies, a disconnected paid GET without replay, timeouts, cancellation and saved deadlines. No production API is called.

Tests do not validate paid production behavior.

License

MIT. See LICENSE.

Documentation and support

Read the SMSPVA API documentation and the method index for parameters, response codes and workflows. SMSPVA supports phone number rentals and private email rentals; availability and prices come from the live API.

For account or billing questions, visit the SMSPVA help center. Report SDK bugs through GitHub issues, without API keys or private message content.

Documentation

Overview

Package smspva provides a client for the SMSPVA Activation V2, Rental and Private Email APIs. It preserves the documented wire methods and responses. Requests use contexts and do not retry automatically. Reference lists are live.

Code generated from sdk/contracts.json. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNoStock

func IsNoStock(r Response) bool

func IsPending

func IsPending(r Response) bool

func Ptr

func Ptr[T any](value T) *T

Types

type APIError

type APIError struct {
	Family     string
	Operation  string
	HTTPStatus int
	Code       any
	Body       json.RawMessage
}

func (*APIError) Error

func (e *APIError) Error() string

type Activation

type Activation struct {
	// contains filtered or unexported fields
}

func (*Activation) BlockNumber

func (r *Activation) BlockNumber(ctx context.Context, params ActivationBlockNumberParams, options ...RequestOption) (Response, error)

BlockNumber calls PUT /activation/blocknumber/{orderid}. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Activation) CancelOrder

func (r *Activation) CancelOrder(ctx context.Context, params ActivationCancelOrderParams, options ...RequestOption) (Response, error)

CancelOrder calls PUT /activation/cancelorder/{orderid}. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Activation) ClearSms

func (r *Activation) ClearSms(ctx context.Context, params ActivationClearSmsParams, options ...RequestOption) (Response, error)

ClearSms calls PUT /activation/clearsms/{orderid}. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Activation) GetAllNumberCounts

func (r *Activation) GetAllNumberCounts(ctx context.Context, options ...RequestOption) (Response, error)

GetAllNumberCounts calls GET /activation/countnumbers.

func (*Activation) GetAllServicePrices

func (r *Activation) GetAllServicePrices(ctx context.Context, params ActivationGetAllServicePricesParams, options ...RequestOption) (Response, error)

GetAllServicePrices calls GET /activation/servicesprices.

func (*Activation) GetBalance

func (r *Activation) GetBalance(ctx context.Context, options ...RequestOption) (Response, error)

GetBalance calls GET /activation/balance.

func (*Activation) GetConversions

func (r *Activation) GetConversions(ctx context.Context, params ActivationGetConversionsParams, options ...RequestOption) (Response, error)

GetConversions calls GET /activation/conversions/{service}.

func (*Activation) GetCountryNumberCounts

func (r *Activation) GetCountryNumberCounts(ctx context.Context, params ActivationGetCountryNumberCountsParams, options ...RequestOption) (Response, error)

GetCountryNumberCounts calls GET /activation/countnumbers/{country}.

func (*Activation) GetCountryOperatorPrices

func (r *Activation) GetCountryOperatorPrices(ctx context.Context, params ActivationGetCountryOperatorPricesParams, options ...RequestOption) (Response, error)

GetCountryOperatorPrices calls GET /activation/serviceprice/{country}.

func (*Activation) GetMessageTypeSettings

func (r *Activation) GetMessageTypeSettings(ctx context.Context, options ...RequestOption) (Response, error)

GetMessageTypeSettings calls GET /activation/countryservicesettings.

func (*Activation) GetNumber

func (r *Activation) GetNumber(ctx context.Context, params ActivationGetNumberParams, options ...RequestOption) (Response, error)

GetNumber calls GET /activation/number/{country}/{service}. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Activation) GetNumberByOperator

func (r *Activation) GetNumberByOperator(ctx context.Context, params ActivationGetNumberByOperatorParams, options ...RequestOption) (Response, error)

GetNumberByOperator calls GET /activation/number/{country}/{service}/{operator}. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Activation) GetNumberStatus

func (r *Activation) GetNumberStatus(ctx context.Context, params ActivationGetNumberStatusParams, options ...RequestOption) (Response, error)

GetNumberStatus calls GET /activation/numberstatus/{number}/{service}.

func (*Activation) GetOperators

func (r *Activation) GetOperators(ctx context.Context, params ActivationGetOperatorsParams, options ...RequestOption) (Response, error)

GetOperators calls GET /activation/operators/{country}.

func (*Activation) GetOrders

func (r *Activation) GetOrders(ctx context.Context, options ...RequestOption) (Response, error)

GetOrders calls GET /activation/orders.

func (*Activation) GetServicePrice

func (r *Activation) GetServicePrice(ctx context.Context, params ActivationGetServicePriceParams, options ...RequestOption) (Response, error)

GetServicePrice calls GET /activation/serviceprice/{country}/{service}.

func (*Activation) GetServicePrices

func (r *Activation) GetServicePrices(ctx context.Context, params ActivationGetServicePricesParams, options ...RequestOption) (Response, error)

GetServicePrices calls GET /activation/serviceprices/{service}.

func (*Activation) GetUserInfo

func (r *Activation) GetUserInfo(ctx context.Context, options ...RequestOption) (Response, error)

GetUserInfo calls GET /activation/userinfo.

func (*Activation) ReceiveSms

func (r *Activation) ReceiveSms(ctx context.Context, params ActivationReceiveSmsParams, options ...RequestOption) (Response, error)

ReceiveSms calls GET /activation/sms/{orderid}. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Activation) StopSms

func (r *Activation) StopSms(ctx context.Context, params ActivationStopSmsParams, options ...RequestOption) (Response, error)

StopSms calls PUT /activation/stopsms/{orderid}. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Activation) WaitForSMS

func (r *Activation) WaitForSMS(ctx context.Context, options WaitForSMSOptions) (Response, error)

WaitForSMS polls an existing activation. A newly received SMS may charge the account. It never purchases, retries failed requests, or cancels an order.

type ActivationBlockNumberParams

type ActivationBlockNumberParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
}

type ActivationCancelOrderParams

type ActivationCancelOrderParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
}

type ActivationClearSmsParams

type ActivationClearSmsParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
}

type ActivationGetAllServicePricesParams

type ActivationGetAllServicePricesParams struct {
	Voice *int64 "json:\"voice,omitempty\"" // Optional.
}

type ActivationGetConversionsParams

type ActivationGetConversionsParams struct {
	Service *string "json:\"service,omitempty\"" // Required.
}

type ActivationGetCountryNumberCountsParams

type ActivationGetCountryNumberCountsParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
}

type ActivationGetCountryOperatorPricesParams

type ActivationGetCountryOperatorPricesParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
	Voice   *int64  "json:\"voice,omitempty\""   // Optional.
}

type ActivationGetNumberByOperatorParams

type ActivationGetNumberByOperatorParams struct {
	Country  *string "json:\"country,omitempty\""  // Required.
	Service  *string "json:\"service,omitempty\""  // Required.
	Operator *string "json:\"operator,omitempty\"" // Required.
	Voice    *int64  "json:\"voice,omitempty\""    // Optional.
}

type ActivationGetNumberParams

type ActivationGetNumberParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
	Service *string "json:\"service,omitempty\"" // Required.
	Voice   *int64  "json:\"voice,omitempty\""   // Optional.
}

type ActivationGetNumberStatusParams

type ActivationGetNumberStatusParams struct {
	Number  *string "json:\"number,omitempty\""  // Required.
	Service *string "json:\"service,omitempty\"" // Required.
}

type ActivationGetOperatorsParams

type ActivationGetOperatorsParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
}

type ActivationGetServicePriceParams

type ActivationGetServicePriceParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
	Service *string "json:\"service,omitempty\"" // Required.
	Voice   *int64  "json:\"voice,omitempty\""   // Optional.
}

type ActivationGetServicePricesParams

type ActivationGetServicePricesParams struct {
	Service *string "json:\"service,omitempty\"" // Required.
	Voice   *int64  "json:\"voice,omitempty\""   // Optional.
}

type ActivationReceiveSmsParams

type ActivationReceiveSmsParams struct {
	PartnerKey *string "json:\"partnerkey,omitempty\"" // Optional.
	OrderID    *int64  "json:\"orderid,omitempty\""    // Required.
}

type ActivationStopSmsParams

type ActivationStopSmsParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
}

type Client

type Client struct {
	Activation *Activation
	Rental     *Rental
	Email      *Email
	// contains filtered or unexported fields
}

func New

func New(options Options) (*Client, error)

func (*Client) CloseIdleConnections

func (c *Client) CloseIdleConnections()

func (*Client) GoString

func (c *Client) GoString() string

func (*Client) String

func (c *Client) String() string

type Email

type Email struct {
	// contains filtered or unexported fields
}

func (*Email) BuyAlias

func (r *Email) BuyAlias(ctx context.Context, params EmailBuyAliasParams, options ...RequestOption) (Response, error)

BuyAlias calls GET /api/rent_email.php?method=buy_alias. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Email) CalcRestoreOrder

func (r *Email) CalcRestoreOrder(ctx context.Context, params EmailCalcRestoreOrderParams, options ...RequestOption) (Response, error)

CalcRestoreOrder calls GET /api/rent_email.php?method=calc_restore_order.

func (*Email) CancelOrder

func (r *Email) CancelOrder(ctx context.Context, params EmailCancelOrderParams, options ...RequestOption) (Response, error)

CancelOrder calls GET /api/rent_email.php?method=cancel_order. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Email) CreateOrder

func (r *Email) CreateOrder(ctx context.Context, params EmailCreateOrderParams, options ...RequestOption) (Response, error)

CreateOrder calls GET /api/rent_email.php?method=create_order. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Email) GetArchivedOrders

func (r *Email) GetArchivedOrders(ctx context.Context, options ...RequestOption) (Response, error)

GetArchivedOrders calls GET /api/rent_email.php?method=get_archived_orders.

func (*Email) GetCount

func (r *Email) GetCount(ctx context.Context, params EmailGetCountParams, options ...RequestOption) (Response, error)

GetCount calls GET /api/rent_email.php?method=get_count.

func (*Email) GetData

func (r *Email) GetData(ctx context.Context, params EmailGetDataParams, options ...RequestOption) (Response, error)

GetData calls GET /api/rent_email.php?method=get_data.

func (*Email) GetMailBody

func (r *Email) GetMailBody(ctx context.Context, params EmailGetMailBodyParams, options ...RequestOption) (Response, error)

GetMailBody calls GET /api/rent_email.php?method=get_mail_body.

func (*Email) GetMails

func (r *Email) GetMails(ctx context.Context, params EmailGetMailsParams, options ...RequestOption) (Response, error)

GetMails calls GET /api/rent_email.php?method=get_mails.

func (*Email) GetMailsByAlias

func (r *Email) GetMailsByAlias(ctx context.Context, params EmailGetMailsByAliasParams, options ...RequestOption) (Response, error)

GetMailsByAlias calls GET /api/rent_email.php?method=get_mails_by_alias.

func (*Email) GetOrders

func (r *Email) GetOrders(ctx context.Context, options ...RequestOption) (Response, error)

GetOrders calls GET /api/rent_email.php?method=get_orders.

func (*Email) GetProviders

func (r *Email) GetProviders(ctx context.Context, options ...RequestOption) (Response, error)

GetProviders calls GET /api/rent_email.php?method=get_providers.

func (*Email) ProlongOrder

func (r *Email) ProlongOrder(ctx context.Context, params EmailProlongOrderParams, options ...RequestOption) (Response, error)

ProlongOrder calls GET /api/rent_email.php?method=prolong_order. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Email) RestoreOrder

func (r *Email) RestoreOrder(ctx context.Context, params EmailRestoreOrderParams, options ...RequestOption) (Response, error)

RestoreOrder calls GET /api/rent_email.php?method=restore_order. This operation changes state or may charge the account. It is never retried by the SDK.

type EmailBuyAliasParams

type EmailBuyAliasParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
	Aliasid *int64 "json:\"aliasid,omitempty\"" // Required.
}

type EmailCalcRestoreOrderParams

type EmailCalcRestoreOrderParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
}

type EmailCancelOrderParams

type EmailCancelOrderParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
}

type EmailCreateOrderParams

type EmailCreateOrderParams struct {
	Scode  *string "json:\"scode,omitempty\""  // Required.
	Pcode  *string "json:\"pcode,omitempty\""  // Optional.
	Dtype  *string "json:\"dtype,omitempty\""  // Required.
	Dcount *int64  "json:\"dcount,omitempty\"" // Required.
}

type EmailGetCountParams

type EmailGetCountParams struct {
	Pcode *string "json:\"pcode,omitempty\"" // Optional.
}

type EmailGetDataParams

type EmailGetDataParams struct {
	Pcode *string "json:\"pcode,omitempty\"" // Optional.
}

type EmailGetMailBodyParams

type EmailGetMailBodyParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
	Emailid *int64 "json:\"emailid,omitempty\"" // Required.
}

type EmailGetMailsByAliasParams

type EmailGetMailsByAliasParams struct {
	OrderID *int64  "json:\"orderid,omitempty\"" // Required.
	Aliasid *int64  "json:\"aliasid,omitempty\"" // Required.
	T       *int64  "json:\"t,omitempty\""       // Optional.
	S       *int64  "json:\"s,omitempty\""       // Optional.
	Sq      *string "json:\"sq,omitempty\""      // Optional.
}

type EmailGetMailsParams

type EmailGetMailsParams struct {
	OrderID *int64  "json:\"orderid,omitempty\"" // Required.
	T       *int64  "json:\"t,omitempty\""       // Optional.
	S       *int64  "json:\"s,omitempty\""       // Optional.
	Sq      *string "json:\"sq,omitempty\""      // Optional.
}

type EmailProlongOrderParams

type EmailProlongOrderParams struct {
	OrderID *int64  "json:\"orderid,omitempty\"" // Required.
	Dtype   *string "json:\"dtype,omitempty\""   // Required.
	Dcount  *int64  "json:\"dcount,omitempty\""  // Required.
}

type EmailRestoreOrderParams

type EmailRestoreOrderParams struct {
	OrderID *int64 "json:\"orderid,omitempty\"" // Required.
}

type Options

type Options struct {
	APIKey                                         string
	Timeout                                        time.Duration
	ActivationBaseURL, RentalBaseURL, EmailBaseURL string
	Transport                                      http.RoundTripper
}

Options configures one account. Transport is optional; custom transports must not retry paid GETs.

type PollingTimeoutError

type PollingTimeoutError struct{}

func (*PollingTimeoutError) Error

func (e *PollingTimeoutError) Error() string

type ProtocolError

type ProtocolError struct {
	Family, Operation string
	HTTPStatus        int
	OutcomeUnknown    bool
}

func (*ProtocolError) Error

func (e *ProtocolError) Error() string

type Rental

type Rental struct {
	// contains filtered or unexported fields
}

func (*Rental) Activate

func (r *Rental) Activate(ctx context.Context, params RentalActivateParams, options ...RequestOption) (Response, error)

Activate calls GET /api/rent.php?method=activate. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Rental) AddServiceToOrder

func (r *Rental) AddServiceToOrder(ctx context.Context, params RentalAddServiceToOrderParams, options ...RequestOption) (Response, error)

AddServiceToOrder calls GET /api/rent.php?method=add_service_to_order. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Rental) Create

func (r *Rental) Create(ctx context.Context, params RentalCreateParams, options ...RequestOption) (Response, error)

Create calls GET /api/rent.php?method=create. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Rental) CreateMulti

func (r *Rental) CreateMulti(ctx context.Context, params RentalCreateMultiParams, options ...RequestOption) (Response, error)

CreateMulti calls GET /api/rent.php?method=create_multi. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Rental) DeleteOrder

func (r *Rental) DeleteOrder(ctx context.Context, params RentalDeleteOrderParams, options ...RequestOption) (Response, error)

DeleteOrder calls GET /api/rent.php?method=delete. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Rental) GetCanadaPaypalDays

func (r *Rental) GetCanadaPaypalDays(ctx context.Context, options ...RequestOption) (Response, error)

GetCanadaPaypalDays calls GET /api/rent.php?method=get_days_canada_paypal.

func (*Rental) GetCount

func (r *Rental) GetCount(ctx context.Context, params RentalGetCountParams, options ...RequestOption) (Response, error)

GetCount calls GET /api/rent.php?method=getcount.

func (*Rental) GetCountWithProviders

func (r *Rental) GetCountWithProviders(ctx context.Context, params RentalGetCountWithProvidersParams, options ...RequestOption) (Response, error)

GetCountWithProviders calls GET /api/rent.php?method=getCountWithProviders.

func (*Rental) GetCountries

func (r *Rental) GetCountries(ctx context.Context, options ...RequestOption) (Response, error)

GetCountries calls GET /api/rent.php?method=getcountries.

func (*Rental) GetCountriesByService

func (r *Rental) GetCountriesByService(ctx context.Context, params RentalGetCountriesByServiceParams, options ...RequestOption) (Response, error)

GetCountriesByService calls GET /api/rent.php?method=get_country_by_service.

func (*Rental) GetData

func (r *Rental) GetData(ctx context.Context, params RentalGetDataParams, options ...RequestOption) (Response, error)

GetData calls GET /api/rent.php?method=getdata.

func (*Rental) GetDataWithProviders

func (r *Rental) GetDataWithProviders(ctx context.Context, params RentalGetDataWithProvidersParams, options ...RequestOption) (Response, error)

GetDataWithProviders calls GET /api/rent.php?method=getdataWithProviders.

func (*Rental) GetDefaultServices

func (r *Rental) GetDefaultServices(ctx context.Context, options ...RequestOption) (Response, error)

GetDefaultServices calls GET /api/rent.php?method=get_default_services.

func (*Rental) GetHistory

func (r *Rental) GetHistory(ctx context.Context, params RentalGetHistoryParams, options ...RequestOption) (Response, error)

GetHistory calls GET /api/rent.php?method=get_rent_history.

func (*Rental) GetMinimumPaypalDays

func (r *Rental) GetMinimumPaypalDays(ctx context.Context, params RentalGetMinimumPaypalDaysParams, options ...RequestOption) (Response, error)

GetMinimumPaypalDays calls GET /api/rent.php?method=get_min_paypal_days.

func (*Rental) GetMultiServiceCount

func (r *Rental) GetMultiServiceCount(ctx context.Context, params RentalGetMultiServiceCountParams, options ...RequestOption) (Response, error)

GetMultiServiceCount calls GET /api/rent.php?method=get_count_multi.

func (*Rental) GetOrders

func (r *Rental) GetOrders(ctx context.Context, options ...RequestOption) (Response, error)

GetOrders calls GET /api/rent.php?method=orders.

func (*Rental) GetRestoreCost

func (r *Rental) GetRestoreCost(ctx context.Context, params RentalGetRestoreCostParams, options ...RequestOption) (Response, error)

GetRestoreCost calls GET /api/rent.php?method=restore_user_precalc.

func (*Rental) GetSms

func (r *Rental) GetSms(ctx context.Context, params RentalGetSmsParams, options ...RequestOption) (Response, error)

GetSms calls GET /api/rent.php?method=sms.

func (*Rental) Prolong

func (r *Rental) Prolong(ctx context.Context, params RentalProlongParams, options ...RequestOption) (Response, error)

Prolong calls GET /api/rent.php?method=prolong. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Rental) ProlongByDays

func (r *Rental) ProlongByDays(ctx context.Context, params RentalProlongByDaysParams, options ...RequestOption) (Response, error)

ProlongByDays calls GET /api/rent.php?method=prolong_max. This operation changes state or may charge the account. It is never retried by the SDK.

func (*Rental) Restore

func (r *Rental) Restore(ctx context.Context, params RentalRestoreParams, options ...RequestOption) (Response, error)

Restore calls GET /api/rent.php?method=restore_user. This operation changes state or may charge the account. It is never retried by the SDK.

type RentalActivateParams

type RentalActivateParams struct {
	ID *int64 "json:\"id,omitempty\"" // Required.
}

type RentalAddServiceToOrderParams

type RentalAddServiceToOrderParams struct {
	ID       *int64  "json:\"id,omitempty\""        // Required.
	Service  *string "json:\"service,omitempty\""   // Required.
	Pnumber  *string "json:\"pnumber,omitempty\""   // Required.
	RentDays *int64  "json:\"rent_days,omitempty\"" // Optional.
}

type RentalCreateMultiParams

type RentalCreateMultiParams struct {
	Dtype      *string "json:\"dtype,omitempty\""       // Required.
	Dcount     *int64  "json:\"dcount,omitempty\""      // Required.
	Country    *string "json:\"country,omitempty\""     // Required.
	Services   *string "json:\"services,omitempty\""    // Required.
	Provider   *string "json:\"provider,omitempty\""    // Optional.
	PartnerKey *string "json:\"partner_key,omitempty\"" // Optional.
}

type RentalCreateParams

type RentalCreateParams struct {
	Dtype      *string "json:\"dtype,omitempty\""       // Required.
	Dcount     *int64  "json:\"dcount,omitempty\""      // Required.
	Country    *string "json:\"country,omitempty\""     // Required.
	Service    *string "json:\"service,omitempty\""     // Required.
	Provider   *string "json:\"provider,omitempty\""    // Optional.
	PartnerKey *string "json:\"partner_key,omitempty\"" // Optional.
}

type RentalDeleteOrderParams

type RentalDeleteOrderParams struct {
	ID *int64 "json:\"id,omitempty\"" // Required.
}

type RentalGetCountParams

type RentalGetCountParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
	Dtype   *string "json:\"dtype,omitempty\""   // Optional.
	Dcount  *int64  "json:\"dcount,omitempty\""  // Optional.
}

type RentalGetCountWithProvidersParams

type RentalGetCountWithProvidersParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
	Dtype   *string "json:\"dtype,omitempty\""   // Optional.
	Dcount  *int64  "json:\"dcount,omitempty\""  // Optional.
}

type RentalGetCountriesByServiceParams

type RentalGetCountriesByServiceParams struct {
	Service *string "json:\"service,omitempty\"" // Required.
	Dtype   *string "json:\"dtype,omitempty\""   // Required.
	Dcount  *int64  "json:\"dcount,omitempty\""  // Optional.
}

type RentalGetDataParams

type RentalGetDataParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
	Dtype   *string "json:\"dtype,omitempty\""   // Optional.
	Dcount  *int64  "json:\"dcount,omitempty\""  // Optional.
	Extend  *string "json:\"extend,omitempty\""  // Optional.
}

type RentalGetDataWithProvidersParams

type RentalGetDataWithProvidersParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
	Dtype   *string "json:\"dtype,omitempty\""   // Optional.
	Dcount  *int64  "json:\"dcount,omitempty\""  // Optional.
	Extend  *string "json:\"extend,omitempty\""  // Optional.
}

type RentalGetHistoryParams

type RentalGetHistoryParams struct {
	Skip *int64 "json:\"skip,omitempty\"" // Optional.
	Take *int64 "json:\"take,omitempty\"" // Optional.
}

type RentalGetMinimumPaypalDaysParams

type RentalGetMinimumPaypalDaysParams struct {
	Country *string "json:\"country,omitempty\"" // Required.
	Service *string "json:\"service,omitempty\"" // Required.
}

type RentalGetMultiServiceCountParams

type RentalGetMultiServiceCountParams struct {
	Country  *string "json:\"country,omitempty\""  // Required.
	Services *string "json:\"services,omitempty\"" // Required.
	Dtype    *string "json:\"dtype,omitempty\""    // Required.
	Dcount   *int64  "json:\"dcount,omitempty\""   // Required.
}

type RentalGetRestoreCostParams

type RentalGetRestoreCostParams struct {
	ID *int64 "json:\"id,omitempty\"" // Required.
}

type RentalGetSmsParams

type RentalGetSmsParams struct {
	ID *int64 "json:\"id,omitempty\"" // Required.
}

type RentalProlongByDaysParams

type RentalProlongByDaysParams struct {
	ID     *int64  "json:\"id,omitempty\""     // Required.
	Dtype  *string "json:\"dtype,omitempty\""  // Required.
	Dcount *int64  "json:\"dcount,omitempty\"" // Required.
}

type RentalProlongParams

type RentalProlongParams struct {
	ID     *int64  "json:\"id,omitempty\""     // Required.
	Dtype  *string "json:\"dtype,omitempty\""  // Required.
	Dcount *int64  "json:\"dcount,omitempty\"" // Required.
}

type RentalRestoreParams

type RentalRestoreParams struct {
	ID *int64 "json:\"id,omitempty\"" // Required.
}

type RequestOption

type RequestOption func(*requestOptions) error

func WithTimeout

func WithTimeout(timeout time.Duration) RequestOption

func WithoutAPIKey

func WithoutAPIKey() RequestOption

type Response

type Response struct {
	HTTPStatus int
	Body       json.RawMessage
}

Response retains the original JSON bytes. Decode into a caller-owned typed value when needed.

func (Response) Decode

func (r Response) Decode(target any) error

func (Response) MarshalJSON

func (r Response) MarshalJSON() ([]byte, error)

type TransportError

type TransportError struct {
	Family, Operation, Kind string
	OutcomeUnknown          bool
	// contains filtered or unexported fields
}

func (*TransportError) Error

func (e *TransportError) Error() string

func (*TransportError) Unwrap

func (e *TransportError) Unwrap() error

Only context sentinel errors are unwrapped; raw transport URLs and credentials are not exposed.

type ValidationError

type ValidationError struct{ Message string }

func (*ValidationError) Error

func (e *ValidationError) Error() string

type WaitForSMSOptions

type WaitForSMSOptions struct {
	OrderID    int64
	ExpiresAt  time.Time
	Interval   time.Duration
	PartnerKey *string
}

WaitForSMSOptions uses a saved order expiry, never a new relative timeout on each poll.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL