Go API client for openapi

The API collection for listmonk

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost:9000/api

Class Method HTTP request Description
AdminApi ReloadApp Post /admin/reload
BouncesApi DeleteBounceById Delete /bounces/{id}
BouncesApi DeleteBounces Delete /bounces
BouncesApi GetBounceById Get /bounces/{id}
BouncesApi GetBounces Get /bounces
CampaignsApi CreateCampaign Post /campaigns
CampaignsApi CreateCampaignContentById Post /campaigns/{id}/content
CampaignsApi DeleteCampaignById Delete /campaigns/{id}
CampaignsApi GetCampaignAnalytics Get /campaigns/analytics/{type}
CampaignsApi GetCampaignById Get /campaigns/{id}
CampaignsApi GetCampaigns Get /campaigns
CampaignsApi GetRunningCampaignStats Get /campaigns/running/stats
CampaignsApi PreviewCampaignById Get /campaigns/{id}/preview
CampaignsApi PreviewCampaignTextById Post /campaigns/{id}/text
CampaignsApi TestCampaignById Post /campaigns/{id}/test
CampaignsApi UpdateCampaignArchiveById Put /campaigns/{id}/archive
CampaignsApi UpdateCampaignById Put /campaigns/{id}
CampaignsApi UpdateCampaignStatusById Put /campaigns/{id}/status
CampaignsApi UpdatePreviewCampaignById Post /campaigns/{id}/preview
ImportApi GetImportSubscriberStats Get /import/subscribers/logs
ImportApi GetImportSubscribers Get /import/subscribers
ImportApi ImportSubscribers Post /import/subscribers
ImportApi StopImportSubscribers Delete /import/subscribers
ListsApi CreateList Post /lists
ListsApi DeleteListById Delete /lists/{list_id}
ListsApi GetListById Get /lists/{list_id}
ListsApi GetLists Get /lists
ListsApi UpdateListById Put /lists/{list_id}
LogsApi GetLogs Get /logs
MaintenanceApi DeleteCampaignAnalyticsByType Delete /maintenance/analytics/{type}
MaintenanceApi DeleteGCSubscribers Delete /maintenance/subscribers/{type}
MaintenanceApi DeleteUnconfirmedSubscriptions Delete /maintenance/subscriptions/unconfirmed
MediaApi DeleteMediaById Delete /media/{id}
MediaApi GetMedia Get /media
MediaApi GetMediaById Get /media/{id}
MediaApi UploadMedia Post /media
MiscellaneousApi GetDashboardCharts Get /dashboard/charts
MiscellaneousApi GetDashboardCounts Get /dashboard/counts
MiscellaneousApi GetHealthCheck Get /health
MiscellaneousApi GetI18nLang Get /lang/{lang}
MiscellaneousApi GetServerConfig Get /config
PublicApi GetPublicLists Get /public/lists
PublicApi HandlePublicSubscription Post /public/subscription
SettingsApi GetSettings Get /settings
SettingsApi TestSMTPSettings Post /settings/smtp/test
SettingsApi UpdateSettings Put /settings
SubscribersApi BlocklistSubscribersQuery Put /subscribers/query/blocklist
SubscribersApi CreateSubscriber Post /subscribers
SubscribersApi DeleteSubscriberBouncesById Delete /subscribers/{id}/bounces
SubscribersApi DeleteSubscriberById Delete /subscribers/{id}
SubscribersApi DeleteSubscriberByList Delete /subscribers
SubscribersApi DeleteSubscriberByQuery Post /subscribers/query/delete
SubscribersApi ExportSubscriberDataByID Get /subscribers/{id}/export
SubscribersApi GetSubscriberBouncesById Get /subscribers/{id}/bounces
SubscribersApi GetSubscriberById Get /subscribers/{id}
SubscribersApi GetSubscribers Get /subscribers
SubscribersApi ManageBlocklistBySubscriberList Put /subscribers/blocklist
SubscribersApi ManageBlocklistSubscribersById Put /subscribers/{id}/blocklist
SubscribersApi ManageSubscriberListById Put /subscribers/lists/{id}
SubscribersApi ManageSubscriberLists Put /subscribers/lists
SubscribersApi ManageSubscriberListsByQuery Put /subscribers/query/lists
SubscribersApi SubscriberSendOptinById Post /subscribers/{id}/optin
SubscribersApi UpdateSubscriberById Put /subscribers/{id}
TemplatesApi DeleteTemplateById Delete /templates/{id}
TemplatesApi GetTemplateById Get /templates/{id}
TemplatesApi GetTemplates Get /templates
TemplatesApi PreviewTemplate Post /templates/preview
TemplatesApi PreviewTemplateById Get /templates/{id}/preview
TemplatesApi UpdateTemplateById Put /templates/{id}/default
TransactionalApi TransactWithSubscriber Post /tx

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author