api

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRecord = errors.New("no record found")

ErrNoRecord indicates no record found error

View Source
var ErrOperationExists = errors.New("operation exists")

ErrOperationExists indicates existing operation for the record

Functions

This section is empty.

Types

type Changes

type Changes struct {
	From *time.Time `json:"from,omitempty"`
	Till *time.Time `json:"till,omitempty"`
	Data []*Key     `json:"data,omitempty"`
}

Changes response

type CreateInput

type CreateInput struct {
	ID           string     `json:"id,omitempty"`
	OperationID  string     `json:"operationID,omitempty"`
	Service      string     `json:"service,omitempty"`
	Credits      float64    `json:"credits,omitempty"`
	ValidTo      *time.Time `json:"validTo,omitempty"`
	SaveRequests bool       `json:"saveRequests,omitempty"`
}

CreateInput for create key request

type CreditsInput

type CreditsInput struct {
	OperationID string  `json:"operationID,omitempty"`
	Credits     float64 `json:"credits,omitempty"`
	Msg         string  `json:"msg,omitempty"`
}

CreditsInput for add credits

type ErrField

type ErrField struct {
	Field, Msg string
}

ErrField error indicating input field problem

func (*ErrField) Error

func (r *ErrField) Error() string

type Key

type Key struct {
	ID           string     `json:"id,omitempty"`
	Key          string     `json:"key,omitempty"`
	Service      string     `json:"service,omitempty"`
	ValidTo      *time.Time `json:"validTo,omitempty"`
	Disabled     bool       `json:"disabled,omitempty"`
	IPWhiteList  string     `json:"IPWhiteList,omitempty"`
	SaveRequests bool       `json:"saveRequests,omitempty"`

	TotalCredits  float64 `json:"totalCredits,omitempty"`
	UsedCredits   float64 `json:"usedCredits,omitempty"`
	FailedCredits float64 `json:"failedCredits,omitempty"`

	Created  *time.Time `json:"created,omitempty"`
	Updated  *time.Time `json:"updated,omitempty"`
	LastUsed *time.Time `json:"lastUsed,omitempty"`
	LastIP   string     `json:"lastIP,omitempty"`
}

Key structure for key data

type KeyID

type KeyID struct {
	ID      string `json:"id,omitempty"`
	Service string `json:"service,omitempty"`
}

KeyID provides key ID by key, response structure

type Log

type Log struct {
	UsedCredits float64    `json:"usedCredits,omitempty"`
	Date        *time.Time `json:"date,omitempty"`
	IP          string     `json:"ip,omitempty"`
	Fail        bool       `json:"fail,omitempty"`
	Response    int        `json:"response,omitempty"`
}

Log detailed usage record

type Usage

type Usage struct {
	RequestCount  int     `json:"requestCount"`
	UsedCredits   float64 `json:"usedCredits,omitempty"`
	FailedCredits float64 `json:"failedCredits,omitempty"`
	Logs          []*Log  `json:"logs,omitempty"`
}

Usage response

Jump to

Keyboard shortcuts

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