apiclient

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIRequest

type APIRequest struct {
	Command   string `json:"command"`
	Token     string `json:"token"`
	SiteID    uint   `json:"site_id,omitempty"`
	AccountID uint   `json:"account_id,omitempty"`
	// Additional fields can be added as json.RawMessage
	Extra map[string]interface{} `json:"-"`
}

APIRequest represents the JSON body sent to the CaptainCore API.

type Client

type Client struct {
	APIURL  string
	Token   string
	SkipSSL bool
	Timeout time.Duration
}

Client wraps HTTP calls to the CaptainCore API, replacing wp_remote_post().

func NewClient

func NewClient(apiURL, token string, skipSSL bool) *Client

NewClient creates a new API client.

func (*Client) Post

func (c *Client) Post(command string, payload map[string]interface{}) ([]byte, error)

Post sends a POST request to the CaptainCore API.

func (*Client) PostAccountGetRaw

func (c *Client) PostAccountGetRaw(accountID uint) ([]byte, error)

PostAccountGetRaw fetches raw account data from the API.

func (*Client) PostProvidersListRaw

func (c *Client) PostProvidersListRaw() ([]byte, error)

PostProvidersListRaw fetches all provider records from the API.

func (*Client) PostSiteGetRaw

func (c *Client) PostSiteGetRaw(siteID uint) ([]byte, error)

PostSiteGetRaw fetches raw site data from the API.

func (*Client) PostSyncData

func (c *Client) PostSyncData(payload map[string]interface{}) ([]byte, error)

PostSyncData sends sync data to the API.

Jump to

Keyboard shortcuts

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