onlinesim

package module
v0.0.0-...-3b40608 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Onlinesim GO API

Wrapper for automatic reception of SMS-messages by onlinesim.ru

Installation

Require this package in your package.json or install it by running:

go get github.com/s00d/onlinesim-go-api
Example
package main

import (
    "github.com/s00d/onlinesim-go-api"
)

func main() {
    client := onlinesim.NewClient("", "en", "").Numbers()
    
    error, data := client.Get("vkcom", 7)
    if error != nil {
        panic(error)
    }

    println("end")
    println(fmt.Sprintf("%+v\n", data))
}

Documentation

All documentation is in the wiki of this project - Documentation

Bugs

If you have any problems, please create Issues here

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceResponse

type BalanceResponse struct {
	Balance  float64 `json:"balance"`
	Zbalance int     `json:"zbalance"`
	Income   float64 `json:"income"`
}

type ChangeTypeResponse

type ChangeTypeResponse struct {
	Response    interface{} `json:"response"`
	ConnectType string      `json:"connect_type"`
}

type CountriesResponse

type CountriesResponse struct {
	Response  interface{} `json:"response"`
	Countries []Country   `json:"countries"`
}

type Country

type Country struct {
	Country     int    `json:"country"`
	CountryText string `json:"country_text"`
}

type Default

type Default struct {
	Response interface{} `json:"response"`
}

type GetFree

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

func (*GetFree) Countries

func (c *GetFree) Countries() (error, []Country)

func (*GetFree) Messages

func (c *GetFree) Messages(phone, page int) (error, []Message)

func (*GetFree) Numbers

func (c *GetFree) Numbers(country int) (error, []Number)

type GetNumbers

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

func (*GetNumbers) Close

func (c *GetNumbers) Close(tzid int) (error, bool)

func (*GetNumbers) Get

func (c *GetNumbers) Get(service string, country int) (error, int)

func (*GetNumbers) Next

func (c *GetNumbers) Next(tzid int) (error, bool)

func (*GetNumbers) Price

func (c *GetNumbers) Price(country int, service string) (error, float64)

func (*GetNumbers) Service

func (c *GetNumbers) Service() (error, []string)

func (*GetNumbers) ServiceNumber

func (c *GetNumbers) ServiceNumber(service string) (error, []string)

func (*GetNumbers) State

func (c *GetNumbers) State(message_to_code int, orderby Order) (error, StateResponse)

func (*GetNumbers) StateOne

func (c *GetNumbers) StateOne(tzid int, message_to_code int) (error, State)

func (*GetNumbers) Tariffs

func (c *GetNumbers) Tariffs() (error, map[string]TariffsResponse)

func (*GetNumbers) TariffsOne

func (c *GetNumbers) TariffsOne(country int) (error, TariffsResponse)

type GetProxy

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

func (*GetProxy) ChangeIp

func (c *GetProxy) ChangeIp(tzid int) (error, bool)

func (*GetProxy) ChangeType

func (c *GetProxy) ChangeType(tzid int) (error, string)

func (*GetProxy) GetDays

func (c *GetProxy) GetDays(proxy_type string) (error, Proxy)

func (*GetProxy) GetTraffic

func (c *GetProxy) GetTraffic(traffic string) (error, Proxy)

func (*GetProxy) SetComment

func (c *GetProxy) SetComment(tzid int, comment string) (error, bool)

func (*GetProxy) State

func (c *GetProxy) State(orderby string) (error, []Proxy)

func (*GetProxy) StateOne

func (c *GetProxy) StateOne(tzid int) (error, Proxy)

type GetRent

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

func (*GetRent) Close

func (c *GetRent) Close(tzid int) (error, bool)

func (*GetRent) Extend

func (c *GetRent) Extend(tzid int, days int) (error, Rent)

func (*GetRent) Get

func (c *GetRent) Get(country int, days int, extension bool) (error, Rent)

func (*GetRent) PortReload

func (c *GetRent) PortReload(tzid int) (error, bool)

func (*GetRent) State

func (c *GetRent) State() (error, []Rent)

func (*GetRent) StateOne

func (c *GetRent) StateOne(tzid int) (error, Rent)

func (*GetRent) Tariffs

func (c *GetRent) Tariffs() (error, map[string]TariffsRent)

func (*GetRent) TariffsOne

func (c *GetRent) TariffsOne(country int) (error, TariffsRent)

type GetRentResponse

type GetRentResponse struct {
	Response interface{} `json:"response"`
	Item     Rent        `json:"item"`
}

type GetResponse

type GetResponse struct {
	Response interface{} `json:"response"`
	Tzid     int         `json:"tzid"`
}

type GetUser

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

func (*GetUser) Balance

func (c *GetUser) Balance() (error, BalanceResponse)

func (*GetUser) Profile

func (c *GetUser) Profile() (error, Profile)

type HTTPClientError

type HTTPClientError struct {
	StatusCode int
	Err        error
}

func (*HTTPClientError) Error

func (e *HTTPClientError) Error() string

type Message

type Message struct {
	Maxdate     string `json:"maxdate"`
	Number      string `json:"number"`
	Country     int    `json:"country"`
	UpdatedAt   string `json:"updated_at"`
	DataHumans  string `json:"data_humans"`
	FullNumber  string `json:"full_number"`
	CountryText string `json:"country_text"`
}

type MessagesResponse

type MessagesResponse struct {
	Response interface{} `json:"response"`
	Numbers  []Message   `json:"numbers"`
}

type Number

type Number struct {
	Maxdate     string `json:"maxdate"`
	Number      string `json:"number"`
	Country     int    `json:"country"`
	UpdatedAt   string `json:"updated_at"`
	DataHumans  string `json:"data_humans"`
	FullNumber  string `json:"full_number"`
	CountryText string `json:"country_text"`
}

type NumbersResponse

type NumbersResponse struct {
	Response interface{} `json:"response"`
	Numbers  []Number    `json:"numbers"`
}

type Onlinesim

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

func NewClient

func NewClient(apiKey string, lang string, dev_id string) *Onlinesim

func (*Onlinesim) Free

func (c *Onlinesim) Free() *GetFree

func (*Onlinesim) Numbers

func (c *Onlinesim) Numbers() *GetNumbers

func (*Onlinesim) Proxy

func (c *Onlinesim) Proxy() *GetProxy

func (*Onlinesim) Rent

func (c *Onlinesim) Rent() *GetRent

func (*Onlinesim) SetRateLimit

func (at *Onlinesim) SetRateLimit(customRateLimit int)

SetRateLimit rate limit setter for custom usage Onlinesim limit is 5 requests per second (we use 2)

func (*Onlinesim) User

func (c *Onlinesim) User() *GetUser

type Order

type Order string
const (
	ASC  Order = "ASC"
	DESC Order = "DESC"
)

type PriceResponse

type PriceResponse struct {
	Response interface{} `json:"response"`
	Price    float64     `json:"price"`
}

type Profile

type Profile struct {
	ID            int         `json:"id"`
	Name          string      `json:"name"`
	Username      string      `json:"username"`
	Email         string      `json:"email"`
	Apikey        string      `json:"apikey"`
	APIAccess     bool        `json:"api_access"`
	Locale        string      `json:"locale"`
	NumberRegion  interface{} `json:"number_region"`
	NumberCountry string      `json:"number_country"`
	NumberReject  interface{} `json:"number_reject"`
	CreatedAt     string      `json:"created_at"`
	Payment       struct {
		Payment  float64 `json:"payment"`
		Spent    int     `json:"spent"`
		Now      int     `json:"now"`
		Income   float64 `json:"income"`
		SmsCount int     `json:"sms_count"`
	} `json:"payment"`
}

type ProfileResponse

type ProfileResponse struct {
	Response interface{} `json:"response"`
	Profile  Profile     `json:"profile"`
}

type Proxy

type Proxy struct {
	Type           string      `json:"type"`
	ConnectType    string      `json:"connect_type"`
	Host           string      `json:"host"`
	Port           int         `json:"port"`
	User           string      `json:"user"`
	Pass           string      `json:"pass"`
	Operator       string      `json:"operator"`
	Rent           interface{} `json:"rent"`
	GeneralTraffic int         `json:"general_traffic"`
	Traffic        int         `json:"traffic"`
	Country        string      `json:"country"`
	City           string      `json:"city"`
	Session        bool        `json:"session"`
	PortCount      int         `json:"port_count"`
	Rotate         interface{} `json:"rotate"`
	StopAt         string      `json:"stop_at"`
	UpdatedAt      string      `json:"updated_at"`
	CreatedAt      string      `json:"created_at"`
	Tzid           int         `json:"tzid"`
	Time           int         `json:"time"`
	Days           int         `json:"days"`
	Hours          int         `json:"hours"`
	ChangeIP       bool        `json:"change_ip"`
	ChangeType     bool        `json:"change_type"`
}

type ProxyResponse

type ProxyResponse struct {
	Response interface{} `json:"response"`
	Item     Proxy       `json:"item"`
}

type ProxyStateResponse

type ProxyStateResponse struct {
	Response interface{} `json:"response"`
	List     []Proxy     `json:"list"`
}

type Rent

type Rent struct {
	Status    int `json:"status"`
	Extension int `json:"extension"`
	Messages  []struct {
		ID        int    `json:"id"`
		Service   string `json:"service"`
		Text      string `json:"text"`
		Code      string `json:"code"`
		CreatedAt string `json:"created_at"`
	} `json:"messages"`
	Sum       string        `json:"sum"`
	Country   int           `json:"country"`
	Number    string        `json:"number"`
	Rent      int           `json:"rent"`
	Tzid      int           `json:"tzid"`
	Time      int           `json:"time"`
	Days      int           `json:"days"`
	Hours     int           `json:"hours"`
	Extend    []interface{} `json:"extend"`
	Checked   bool          `json:"checked"`
	Reload    int           `json:"reload"`
	DayExtend int           `json:"day_extend"`
}

type Service

type Service struct {
	Count   interface{} `json:"count"`
	Popular bool        `json:"popular"`
	Code    int         `json:"code"`
	Price   float64     `json:"price"`
	ID      int         `json:"id"`
	Service string      `json:"service"`
	Slug    interface{} `json:"slug"`
}

type ServiceNumberResponse

type ServiceNumberResponse struct {
	Number   []string    `json:"number"`
	Response interface{} `json:"response"`
}

type ServiceResponse

type ServiceResponse struct {
	Service  []string    `json:"service"`
	Response interface{} `json:"response"`
}

type State

type State struct {
	Tzid   int    `json:"tzid"`
	Form   string `json:"form"`
	Time   int    `json:"time"`
	Number string `json:"number"`
	Msg    []struct {
		Service string `json:"service"`
		Msg     string `json:"msg"`
	} `json:"msg,omitempty"`
	Service  string      `json:"service"`
	Country  int         `json:"country"`
	Response interface{} `json:"response"`
	Sum      int         `json:"sum,omitempty"`
}

type StateRentResponse

type StateRentResponse struct {
	Response interface{} `json:"response"`
	List     []Rent      `json:"list"`
}

type StateResponse

type StateResponse []State

type TariffsRent

type TariffsRent struct {
	Code     int            `json:"code"`
	Enabled  bool           `json:"enabled"`
	Name     string         `json:"name"`
	New      bool           `json:"new"`
	Position int            `json:"position"`
	Count    map[string]int `json:"count"`
	Days     map[string]int `json:"days"`
	Extend   int            `json:"extend"`
}

type TariffsResponse

type TariffsResponse struct {
	Name     string             `json:"name"`
	Position int                `json:"position"`
	Code     int                `json:"code"`
	Other    interface{}        `json:"other"`
	New      bool               `json:"new"`
	Enabled  bool               `json:"enabled"`
	Services map[string]Service `json:"services"`
}

Jump to

Keyboard shortcuts

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