api

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package api implements API method-specific functionality. Package contains:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicMethod

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

BasicMethod is the basis of other api methods.

It implements the general core operation from github.com/ThCompiler/go.beget.api/core.APIMethod interface. It implements GetURL and Error methods and general operations of storing error or of creating method information. Other methods embed the basic one and use CallError and CallMethod to build specific information about itself.

The github.com/ThCompiler/go.beget.api/api/dns.CallGetData can be used as an example.

func CallError

func CallError(err error) *BasicMethod

CallError stores any errors that occurred as a result of the method build

func CallMethod

func CallMethod(methodPath string, requestBody any, urlVales url.Values) *BasicMethod

CallMethod creates an url.URL and saves it as the result of the method build. As parameters, it expects the suffix of a specific method endpoint (methodPath) and the request body (requestBody) if it is necessary for this method (otherwise nil). It's expected that requestBody can be marshaled. If requestBody isn't nil, it will be marshaled and added to query params. Also, a field describing the type of input data will also be added with the "json" value.

func (*BasicMethod) Error

func (b *BasicMethod) Error() error

Error returns any errors when generating information about the request to the method

func (*BasicMethod) GetURL

func (b *BasicMethod) GetURL() *url.URL

GetURL returns suffix url of api method. The url is expected to contain the required query parameters

Directories

Path Synopsis
Package backup implements the functionality of [Backup methods].
Package backup implements the functionality of [Backup methods].
dns
Package dns implements the functionality of [Dns methods].
Package dns implements the functionality of [Dns methods].
build
Package build implements builders of github.com/ThCompiler/go.beget.api/api/dns.BasicRecords, github.com/ThCompiler/go.beget.api/api/dns.DNSRecords, github.com/ThCompiler/go.beget.api/api/dns.CNAMERecords and github.com/ThCompiler/go.beget.api/api/dns.NSRecords.
Package build implements builders of github.com/ThCompiler/go.beget.api/api/dns.BasicRecords, github.com/ThCompiler/go.beget.api/api/dns.DNSRecords, github.com/ThCompiler/go.beget.api/api/dns.CNAMERecords and github.com/ThCompiler/go.beget.api/api/dns.NSRecords.
general
Package general implements structures with a generalized representation of the DNS server records supported by Beget.
Package general implements structures with a generalized representation of the DNS server records supported by Beget.
record
Package record implements structures representing records from [getData] response.
Package record implements structures representing records from [getData] response.
Package result implements structures representing the result of API method responses.
Package result implements structures representing the result of API method responses.
Package test implements the functionality of test server emulating the work of a Beget server.
Package test implements the functionality of test server emulating the work of a Beget server.
Package user implements the functionality of [User methods].
Package user implements the functionality of [User methods].

Jump to

Keyboard shortcuts

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