Commit 8e62602f authored by runner's avatar runner
Browse files

馃 makedoc [skip ci]

parent cd854675
# Powerdns API
<img draggable="none" src="https://git.y.gy/firstdorsal/powerdns-api/-/raw/master/logo.jpg" style="float:left; margin-right:10px;" height="100">
<img draggable="none" src="https://git.y.gy/firstdorsal/powerdns-api/-/raw/master/logo.jpg" style="float:left; margin-right:10px;" height="100">
## A Nodejs client for the PowerDns API with the most relevant functions.
......@@ -9,69 +10,82 @@
[![Website](https://ico.y.gy/website?down_color=red&down_message=offline&label=documentation&up_color=success&up_message=online&url=https%3A%2F%2Fdoc.y.gy%2Fpowerdns-api&style=flat-square)](https://doc.y.gy/powerdns-api/)
[![Website](https://ico.y.gy/website?down_color=red&down_message=offline&label=repository&up_color=success&up_message=online&url=https%3A%2F%2Fgit.y.gy%2Ffirstdorsal%2Fpowerdns-api&style=flat-square&logo=gitlab)](https://git.y.gy/firstdorsal/powerdns-api/)
# Install
```
npm i @firstdorsal/powerdns-api
```
# Usage
```js
(async () => {
//get enviroment variables from the .env file
require('dotenv').config();
require("dotenv").config();
//import the module
const {
PowerdnsClient
} = require('@firstdorsal/powerdns-api');
//create a powerdns client object
const { PowerdnsClient } = require("@firstdorsal/powerdns-api");
//create a powerdns client object
const pdns = new PowerdnsClient(process.env.PDNS_API_ENDPOINT, process.env.PDNS_API_KEY);
//use a function and return the results to console
console.log(await pdns.getZone('example.com'));
console.log(await pdns.getZone("example.com"));
})();
```
## What is dotenv?
The line "require('dotenv').config();" gets the contents of a file called ".env" in which you should store your global and secret variables.
**1. Install the module "dotenv" with**
```
npm i dotenv
```
**2. Create a file named ".env" in your applications root directory**
*.env*
_.env_
```c
PDNS_API_KEY='YOUR PDNS API KEY'
PDNS_API_ENDPOINT='https://example.com/api/v1/servers/localhost'
```
**3. Use your secret variables**
```
process.env.PDNS_API_ENDPOINT
process.env.PDNS_API_KEY
```
# IMPORTANT
if you are using domains with two labels for the TLD like yourdomain.com.au please use the setHomogeneousRecords function instead of setRecords
# Documentation
**[Here](https://doc.y.gy/powerdns-api/)**
# Need help or missing a feature?
Feel free to contact me via [xl9jthv_7bvgakv9o9wg0jabn2ylm91xxrzzgt0e@y.gy](mailto:xl9jthv_7bvgakv9o9wg0jabn2ylm91xxrzzgt0e@y.gy) in english or german
## Automatic Let's Encrypt certificates via DNS with greenlock and PDNS
[acme-dns-01-powerdns](https://www.npmjs.com/package/acme-dns-01-powerdns)
## PDNS WEB API Documentation
[On the Web](https://doc.powerdns.com/authoritative/http-api/index.html)
[And in full detail (Swagger)](https://raw.githubusercontent.com/PowerDNS/pdns/master/docs/http-api/swagger/authoritative-api-swagger.yaml)
## Links
[NPM](https://www.npmjs.com/package/@firstdorsal/powerdns-api)
[Documentation](https://doc.y.gy/powerdns-api/)
[Code](https://git.y.gy/firstdorsal/powerdns-api)
## Modules
<dl>
......@@ -104,7 +118,7 @@ Feel free to contact me via [xl9jthv_7bvgakv9o9wg0jabn2ylm91xxrzzgt0e@y.gy](mail
* [.getZoneWithMeta(zoneName)](#module_powerdns-api.PowerdnsClient+getZoneWithMeta)<code>object</code>
* [.getZone(zoneName)](#module_powerdns-api.PowerdnsClient+getZone)<code>object</code>
* [.deleteZone(zoneName)](#module_powerdns-api.PowerdnsClient+deleteZone)<code>boolean</code>
* [.setHomogeneousRecords(records)](#module_powerdns-api.PowerdnsClient+setHomogeneousRecords)<code>boolean</code>
* [.setHomogeneousRecords(records, [domain])](#module_powerdns-api.PowerdnsClient+setHomogeneousRecords)<code>boolean</code>
* [.deleteRecords(records)](#module_powerdns-api.PowerdnsClient+deleteRecords)<code>boolean</code>
* [.search(search)](#module_powerdns-api.PowerdnsClient+search)<code>object</code>
* [.appendRecord(record)](#module_powerdns-api.PowerdnsClient+appendRecord)<code>boolean</code>
......@@ -132,7 +146,7 @@ Class representing the powerdns client
* [.getZoneWithMeta(zoneName)](#module_powerdns-api.PowerdnsClient+getZoneWithMeta)<code>object</code>
* [.getZone(zoneName)](#module_powerdns-api.PowerdnsClient+getZone)<code>object</code>
* [.deleteZone(zoneName)](#module_powerdns-api.PowerdnsClient+deleteZone)<code>boolean</code>
* [.setHomogeneousRecords(records)](#module_powerdns-api.PowerdnsClient+setHomogeneousRecords)<code>boolean</code>
* [.setHomogeneousRecords(records, [domain])](#module_powerdns-api.PowerdnsClient+setHomogeneousRecords)<code>boolean</code>
* [.deleteRecords(records)](#module_powerdns-api.PowerdnsClient+deleteRecords)<code>boolean</code>
* [.search(search)](#module_powerdns-api.PowerdnsClient+search)<code>object</code>
* [.appendRecord(record)](#module_powerdns-api.PowerdnsClient+appendRecord)<code>boolean</code>
......@@ -249,7 +263,7 @@ await pdns.deleteZone('example.com');
```
<a name="module_powerdns-api.PowerdnsClient+setHomogeneousRecords"></a>
#### powerdnsClient.setHomogeneousRecords(records) 鈬 <code>boolean</code>
#### powerdnsClient.setHomogeneousRecords(records, [domain]) 鈬 <code>boolean</code>
Takes records for a SINGLE domain as array and sets them. If records exist it replaces them.
**Kind**: instance method of [<code>PowerdnsClient</code>](#module_powerdns-api.PowerdnsClient)
......@@ -258,6 +272,7 @@ Takes records for a SINGLE domain as array and sets them. If records exist it re
| Param | Type | Description |
| --- | --- | --- |
| records | [<code>Records</code>](#Records) | array containing the records |
| [domain] | <code>string</code> | optional domain name |
**Example**
```js
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment