Documentation
¶
Overview ¶
Package ipsonar provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
Index ¶
- Constants
- func NewBatchLookupRequest(server string, params *BatchLookupParams, body BatchLookupJSONRequestBody) (*http.Request, error)
- func NewBatchLookupRequestWithBody(server string, params *BatchLookupParams, contentType string, body io.Reader) (*http.Request, error)
- func NewLookupMyRequest(server string, params *LookupMyParams) (*http.Request, error)
- func NewLookupRequest(server string, ip string, params *LookupParams) (*http.Request, error)
- type BatchLookupIPResponse
- type BatchLookupJSONBody
- type BatchLookupJSONRequestBody
- type BatchLookupParams
- type BatchLookupRequest
- type BatchLookupResponse
- type Client
- func (c *Client) BatchLookup(ctx context.Context, params *BatchLookupParams, ...) (*http.Response, error)
- func (c *Client) BatchLookupWithBody(ctx context.Context, params *BatchLookupParams, contentType string, ...) (*http.Response, error)
- func (c *Client) Lookup(ctx context.Context, ip string, params *LookupParams, ...) (*http.Response, error)
- func (c *Client) LookupMy(ctx context.Context, params *LookupMyParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) BatchLookupWithBodyWithResponse(ctx context.Context, params *BatchLookupParams, contentType string, ...) (*BatchLookupResponse, error)
- func (c *ClientWithResponses) BatchLookupWithResponse(ctx context.Context, params *BatchLookupParams, ...) (*BatchLookupResponse, error)
- func (c *ClientWithResponses) LookupMyWithResponse(ctx context.Context, params *LookupMyParams, reqEditors ...RequestEditorFn) (*LookupMyResponse, error)
- func (c *ClientWithResponses) LookupWithResponse(ctx context.Context, ip string, params *LookupParams, ...) (*LookupResponse, error)
- type ClientWithResponsesInterface
- type ErrorMessageResponse
- type Fields
- type HttpRequestDoer
- type IPGeolocation
- type Locale
- type LookupIPResponse
- type LookupMyParams
- type LookupMyResponse
- type LookupParams
- type LookupResponse
- type RequestEditorFn
Constants ¶
const ( API_SERVER = "https://api.ip-sonar.com" API_KEY_HEADER = "X-API-Key" )
const (
ApiKeyScopes = "apiKey.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func NewBatchLookupRequest ¶
func NewBatchLookupRequest(server string, params *BatchLookupParams, body BatchLookupJSONRequestBody) (*http.Request, error)
NewBatchLookupRequest calls the generic BatchLookup builder with application/json body
func NewBatchLookupRequestWithBody ¶
func NewBatchLookupRequestWithBody(server string, params *BatchLookupParams, contentType string, body io.Reader) (*http.Request, error)
NewBatchLookupRequestWithBody generates requests for BatchLookup with any type of body
func NewLookupMyRequest ¶
func NewLookupMyRequest(server string, params *LookupMyParams) (*http.Request, error)
NewLookupMyRequest generates requests for LookupMy
func NewLookupRequest ¶
NewLookupRequest generates requests for Lookup
Types ¶
type BatchLookupIPResponse ¶
type BatchLookupIPResponse struct {
Data []IPGeolocation `json:"data"`
}
BatchLookupIPResponse defines model for BatchLookupIPResponse.
type BatchLookupJSONBody ¶
type BatchLookupJSONBody struct {
// Data Array of IP Addresses
Data []string `json:"data"`
}
BatchLookupJSONBody defines parameters for BatchLookup.
type BatchLookupJSONRequestBody ¶
type BatchLookupJSONRequestBody BatchLookupJSONBody
BatchLookupJSONRequestBody defines body for BatchLookup for application/json ContentType.
type BatchLookupParams ¶
type BatchLookupParams struct {
Fields *Fields `form:"fields,omitempty" json:"fields,omitempty"`
// LocaleCode Geolocation names language code. One of: de, en, es, fr, ja, pt-br, ru, zh-cn
LocaleCode *Locale `form:"locale_code,omitempty" json:"locale_code,omitempty"`
}
BatchLookupParams defines parameters for BatchLookup.
type BatchLookupRequest ¶
type BatchLookupRequest struct {
// Data Array of IP Addresses
Data []string `json:"data"`
}
BatchLookupRequest defines model for BatchLookupRequest.
type BatchLookupResponse ¶
type BatchLookupResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *BatchLookupIPResponse
JSON401 *ErrorMessageResponse
JSON429 *ErrorMessageResponse
JSON500 *ErrorMessageResponse
}
func ParseBatchLookupResponse ¶
func ParseBatchLookupResponse(rsp *http.Response) (*BatchLookupResponse, error)
ParseBatchLookupResponse parses an HTTP response from a BatchLookupWithResponse call
func (BatchLookupResponse) Status ¶
func (r BatchLookupResponse) Status() string
Status returns HTTPResponse.Status
func (BatchLookupResponse) StatusCode ¶
func (r BatchLookupResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) BatchLookup ¶
func (c *Client) BatchLookup(ctx context.Context, params *BatchLookupParams, body BatchLookupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) BatchLookupWithBody ¶
func (*Client) Lookup ¶
func (c *Client) Lookup(ctx context.Context, ip string, params *LookupParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) LookupMy ¶
func (c *Client) LookupMy(ctx context.Context, params *LookupMyParams, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface {
// BatchLookupWithBody request with any body
BatchLookupWithBody(ctx context.Context, params *BatchLookupParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
BatchLookup(ctx context.Context, params *BatchLookupParams, body BatchLookupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// LookupMy request
LookupMy(ctx context.Context, params *LookupMyParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// Lookup request
Lookup(ctx context.Context, ip string, params *LookupParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) BatchLookupWithBodyWithResponse ¶
func (c *ClientWithResponses) BatchLookupWithBodyWithResponse(ctx context.Context, params *BatchLookupParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BatchLookupResponse, error)
BatchLookupWithBodyWithResponse request with arbitrary body returning *BatchLookupResponse
func (*ClientWithResponses) BatchLookupWithResponse ¶
func (c *ClientWithResponses) BatchLookupWithResponse(ctx context.Context, params *BatchLookupParams, body BatchLookupJSONRequestBody, reqEditors ...RequestEditorFn) (*BatchLookupResponse, error)
func (*ClientWithResponses) LookupMyWithResponse ¶
func (c *ClientWithResponses) LookupMyWithResponse(ctx context.Context, params *LookupMyParams, reqEditors ...RequestEditorFn) (*LookupMyResponse, error)
LookupMyWithResponse request returning *LookupMyResponse
func (*ClientWithResponses) LookupWithResponse ¶
func (c *ClientWithResponses) LookupWithResponse(ctx context.Context, ip string, params *LookupParams, reqEditors ...RequestEditorFn) (*LookupResponse, error)
LookupWithResponse request returning *LookupResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// BatchLookupWithBodyWithResponse request with any body
BatchLookupWithBodyWithResponse(ctx context.Context, params *BatchLookupParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BatchLookupResponse, error)
BatchLookupWithResponse(ctx context.Context, params *BatchLookupParams, body BatchLookupJSONRequestBody, reqEditors ...RequestEditorFn) (*BatchLookupResponse, error)
// LookupMyWithResponse request
LookupMyWithResponse(ctx context.Context, params *LookupMyParams, reqEditors ...RequestEditorFn) (*LookupMyResponse, error)
// LookupWithResponse request
LookupWithResponse(ctx context.Context, ip string, params *LookupParams, reqEditors ...RequestEditorFn) (*LookupResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type ErrorMessageResponse ¶
type ErrorMessageResponse struct {
Message string `json:"message"`
}
ErrorMessageResponse defines model for ErrorMessageResponse.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type IPGeolocation ¶
type IPGeolocation struct {
// AccuracyRadius The geographic radius, measured in kilometers, within which the IP address is expected to be located.
AccuracyRadius *int32 `json:"accuracy_radius,omitempty"`
CityName *string `json:"city_name,omitempty"`
// ContinentCode AF - Africa
// AN - Antarctica
// AS - Asia
// EU - Europe
// NA - North America
// OC - Oceania
// SA - South America
ContinentCode *string `json:"continent_code,omitempty"`
ContinentName *string `json:"continent_name,omitempty"`
// CountryCode ISO 3166-1
CountryCode *string `json:"country_code,omitempty"`
CountryName *string `json:"country_name,omitempty"`
IP *string `json:"ip,omitempty"`
// IsInEu A binary indicator (1 or 0) showing whether the IP address's country belongs to the European Union.
IsInEu *bool `json:"is_in_eu,omitempty"`
Latitude *float32 `json:"latitude,omitempty"`
Longitude *float32 `json:"longitude,omitempty"`
PostalCode *string `json:"postal_code,omitempty"`
// Subdivision1Code ISO 3166-2 region code
Subdivision1Code *string `json:"subdivision_1_code,omitempty"`
Subdivision1Name *string `json:"subdivision_1_name,omitempty"`
// Subdivision2Code ISO 3166-2 region code
Subdivision2Code *string `json:"subdivision_2_code,omitempty"`
Subdivision2Name *string `json:"subdivision_2_name,omitempty"`
// Timezone IANA Timezone https://www.iana.org/time-zones
Timezone *string `json:"timezone,omitempty"`
}
IPGeolocation defines model for IPGeolocation.
type LookupIPResponse ¶
type LookupIPResponse = IPGeolocation
LookupIPResponse defines model for LookupIPResponse.
type LookupMyParams ¶
type LookupMyParams struct {
Fields *Fields `form:"fields,omitempty" json:"fields,omitempty"`
// LocaleCode Geolocation names language code. One of: de, en, es, fr, ja, pt-br, ru, zh-cn
LocaleCode *Locale `form:"locale_code,omitempty" json:"locale_code,omitempty"`
}
LookupMyParams defines parameters for LookupMy.
type LookupMyResponse ¶
type LookupMyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON401 *ErrorMessageResponse
JSON404 *ErrorMessageResponse
JSON429 *ErrorMessageResponse
}
func ParseLookupMyResponse ¶
func ParseLookupMyResponse(rsp *http.Response) (*LookupMyResponse, error)
ParseLookupMyResponse parses an HTTP response from a LookupMyWithResponse call
func (LookupMyResponse) Status ¶
func (r LookupMyResponse) Status() string
Status returns HTTPResponse.Status
func (LookupMyResponse) StatusCode ¶
func (r LookupMyResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type LookupParams ¶
type LookupParams struct {
Fields *Fields `form:"fields,omitempty" json:"fields,omitempty"`
// LocaleCode Geolocation names language code. One of: de, en, es, fr, ja, pt-br, ru, zh-cn
LocaleCode *Locale `form:"locale_code,omitempty" json:"locale_code,omitempty"`
}
LookupParams defines parameters for Lookup.
type LookupResponse ¶
type LookupResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *LookupIPResponse
JSON401 *ErrorMessageResponse
JSON404 *ErrorMessageResponse
JSON429 *ErrorMessageResponse
}
func ParseLookupResponse ¶
func ParseLookupResponse(rsp *http.Response) (*LookupResponse, error)
ParseLookupResponse parses an HTTP response from a LookupWithResponse call
func (LookupResponse) Status ¶
func (r LookupResponse) Status() string
Status returns HTTPResponse.Status
func (LookupResponse) StatusCode ¶
func (r LookupResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode