UNPKG

@piarre/ts-freebox

Version:

69 lines (66 loc) 2.23 kB
import { submodule_default } from "./chunk-3GGSTR2F.mjs"; import { fetch_default } from "./chunk-4JVQES7H.mjs"; // src/lib/connection.ts var Connection = class extends submodule_default { constructor(freebox) { super(freebox); } /** * Get the current Connection status * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#connection-status-object * @returns {Promise<Response<ConnectionStatus>>} */ async status() { return await fetch_default(`${this.baseUrl}/connection/`, this.token); } /** * Get the current Connection configuration * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#get-the-current-connection-configuration * @returns {Promise<Response<ConnectionConfig>>} */ async config() { return await fetch_default(`${this.baseUrl}/connection/config/`, this.token); } /** * Update the Connection configuration * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#update-the-connection-configuration * @param body The new configuration * @returns {Promise<Response<ConnectionConfig>>} */ async updateConfig(body) { return await fetch_default(`${this.baseUrl}/connection/config/`, this.token, { body }); } /** * Get the current IPv6 Connection configuration * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#get-the-current-ipv6-connection-configuration * @returns {Promise<Response<IPv6ConnectionConfiguration>>} */ async IPv6config() { return await fetch_default(`${this.baseUrl}/connection/ipv6/config/`, this.token); } /** * Update the IPv6 Connection configuration * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#update-the-ipv6-connection-configuration * @param body The new configuration * @returns {Promise<Response<IPv6ConnectionConfiguration>>} */ async updateIPv6Config(body) { return await fetch_default( `${this.baseUrl}/connection/ipv6/config/`, this.token, { body }, "PUT" ); } }; export { Connection };