Skip to content

flowline-io/sdk-adguard-home-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for openapi

AdGuard Home REST-ish API. Our admin web interface is built on top of this REST-ish API.

API documentation

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: 0.107
  • Package version: 1.0.0
  • Generator version: 7.10.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://github.com/AdguardTeam/AdGuardHome

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 openapi.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 openapi.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 openapi.ContextOperationServerIndices and openapi.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 /control

Class Method HTTP request Description
BlockedServicesAPI BlockedServicesAll Get /blocked_services/all Get available services to use for blocking
BlockedServicesAPI BlockedServicesAvailableServices Get /blocked_services/services Get available services to use for blocking
BlockedServicesAPI BlockedServicesList Get /blocked_services/list Get blocked services list
BlockedServicesAPI BlockedServicesSchedule Get /blocked_services/get Get blocked services
BlockedServicesAPI BlockedServicesScheduleUpdate Put /blocked_services/update Update blocked services
BlockedServicesAPI BlockedServicesSet Post /blocked_services/set Set blocked services list
ClientsAPI AccessList Get /access/list List (dis)allowed clients, blocked hosts, etc.
ClientsAPI AccessSet Post /access/set Set (dis)allowed clients, blocked hosts, etc.
ClientsAPI ClientsAdd Post /clients/add Add a new client
ClientsAPI ClientsDelete Post /clients/delete Remove a client
ClientsAPI ClientsFind Get /clients/find Get information about clients by their IP addresses or ClientIDs.
ClientsAPI ClientsStatus Get /clients Get information about configured clients
ClientsAPI ClientsUpdate Post /clients/update Update client information
DhcpAPI CheckActiveDhcp Post /dhcp/find_active_dhcp Searches for an active DHCP server on the network
DhcpAPI DhcpAddStaticLease Post /dhcp/add_static_lease Adds a static lease
DhcpAPI DhcpInterfaces Get /dhcp/interfaces Gets the available interfaces
DhcpAPI DhcpRemoveStaticLease Post /dhcp/remove_static_lease Removes a static lease
DhcpAPI DhcpReset Post /dhcp/reset Reset DHCP configuration
DhcpAPI DhcpResetLeases Post /dhcp/reset_leases Reset DHCP leases
DhcpAPI DhcpSetConfig Post /dhcp/set_config Updates the current DHCP server configuration
DhcpAPI DhcpStatus Get /dhcp/status Gets the current DHCP settings and status
DhcpAPI DhcpUpdateStaticLease Post /dhcp/update_static_lease Updates a static lease
FilteringAPI FilteringAddURL Post /filtering/add_url Add filter URL or an absolute file path
FilteringAPI FilteringCheckHost Get /filtering/check_host Check if host name is filtered
FilteringAPI FilteringConfig Post /filtering/config Set filtering parameters
FilteringAPI FilteringRefresh Post /filtering/refresh Reload filtering rules from URLs. This might be needed if new URL was just added and you don't want to wait for automatic refresh to kick in. This API request is ratelimited, so you can call it freely as often as you like, it wont create unnecessary burden on servers that host the URL. This should work as intended, a `force` parameter is offered as last-resort attempt to make filter lists fresh. If you ever find yourself using `force` to make something work that otherwise wont, this is a bug and report it accordingly.
FilteringAPI FilteringRemoveURL Post /filtering/remove_url Remove filter URL
FilteringAPI FilteringSetRules Post /filtering/set_rules Set user-defined filter rules
FilteringAPI FilteringSetURL Post /filtering/set_url Set URL parameters
FilteringAPI FilteringStatus Get /filtering/status Get filtering parameters
GlobalAPI BeginUpdate Post /update Begin auto-upgrade procedure
GlobalAPI CacheClear Post /cache_clear Clear DNS cache
GlobalAPI DnsConfig Post /dns_config Set general DNS parameters
GlobalAPI DnsInfo Get /dns_info Get general DNS parameters
GlobalAPI GetProfile Get /profile
GlobalAPI GetVersionJson Post /version.json Gets information about the latest available version of AdGuard
GlobalAPI Login Post /login Perform administrator log-in
GlobalAPI Logout Get /logout Perform administrator log-out
GlobalAPI MobileConfigDoH Get /apple/doh.mobileconfig Get DNS over HTTPS .mobileconfig.
GlobalAPI MobileConfigDoT Get /apple/dot.mobileconfig Get DNS over TLS .mobileconfig.
GlobalAPI SetProtection Post /protection Set protection state and duration
GlobalAPI Status Get /status Get DNS server current status and general settings
GlobalAPI TestUpstreamDNS Post /test_upstream_dns Test upstream configuration
GlobalAPI UpdateProfile Put /profile/update Updates current user info
I18nAPI ChangeLanguage Post /i18n/change_language Change current language. Argument must be an ISO 639-1 two-letter code.
I18nAPI CurrentLanguage Get /i18n/current_language Get currently set language. Result is ISO 639-1 two-letter code. Empty result means default language.
InstallAPI InstallCheckConfig Post /install/check_config Checks configuration
InstallAPI InstallConfigure Post /install/configure Applies the initial configuration.
InstallAPI InstallGetAddresses Get /install/get_addresses Gets the network interfaces information.
LogAPI GetQueryLogConfig Get /querylog/config Get query log parameters
LogAPI PutQueryLogConfig Put /querylog/config/update Set query log parameters
LogAPI QueryLog Get /querylog Get DNS server query log.
LogAPI QueryLogConfig Post /querylog_config Set query log parameters
LogAPI QueryLogInfo Get /querylog_info Get query log parameters
LogAPI QuerylogClear Post /querylog_clear Clear query log
MobileconfigAPI MobileConfigDoH Get /apple/doh.mobileconfig Get DNS over HTTPS .mobileconfig.
MobileconfigAPI MobileConfigDoT Get /apple/dot.mobileconfig Get DNS over TLS .mobileconfig.
ParentalAPI ParentalDisable Post /parental/disable Disable parental filtering
ParentalAPI ParentalEnable Post /parental/enable Enable parental filtering
ParentalAPI ParentalStatus Get /parental/status Get parental filtering status
RewriteAPI RewriteAdd Post /rewrite/add Add a new Rewrite rule
RewriteAPI RewriteDelete Post /rewrite/delete Remove a Rewrite rule
RewriteAPI RewriteList Get /rewrite/list Get list of Rewrite rules
RewriteAPI RewriteUpdate Put /rewrite/update Update a Rewrite rule
SafebrowsingAPI SafebrowsingDisable Post /safebrowsing/disable Disable safebrowsing
SafebrowsingAPI SafebrowsingEnable Post /safebrowsing/enable Enable safebrowsing
SafebrowsingAPI SafebrowsingStatus Get /safebrowsing/status Get safebrowsing status
SafesearchAPI SafesearchDisable Post /safesearch/disable Disable safesearch
SafesearchAPI SafesearchEnable Post /safesearch/enable Enable safesearch
SafesearchAPI SafesearchSettings Put /safesearch/settings Update safesearch settings
SafesearchAPI SafesearchStatus Get /safesearch/status Get safesearch status
StatsAPI GetStatsConfig Get /stats/config Get statistics parameters
StatsAPI PutStatsConfig Put /stats/config/update Set statistics parameters
StatsAPI Stats Get /stats Get DNS server statistics
StatsAPI StatsConfig Post /stats_config Set statistics parameters
StatsAPI StatsInfo Get /stats_info Get statistics parameters
StatsAPI StatsReset Post /stats_reset Reset all statistics to zeroes
TlsAPI TlsConfigure Post /tls/configure Updates current TLS configuration
TlsAPI TlsStatus Get /tls/status Returns TLS configuration and its status
TlsAPI TlsValidate Post /tls/validate Checks if the current TLS configuration is valid

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), openapi.ContextBasicAuth, openapi.BasicAuth{
	UserName: "username",
	Password: "password",
})
r, err := client.Service.Operation(auth, args)

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

About

adguard home api sdk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages