Skip to content

Instantly share code, notes, and snippets.

@Sillium
Sillium / TelekomDataService.js
Last active March 1, 2023 13:40
Library to fetch data from Telekom API
console.log("Test");
class TelekomDataService {
/*---
/ STATIC PROPERTIES
/---*/
static fileManager = FileManager.iCloud();
static scriptDir = module.filename.replace(TelekomDataService.fileManager.fileName(module.filename, true), '');
static cacheFile = TelekomDataService.fileManager.joinPath(TelekomDataService.scriptDir, "cache.json");
static historyDir = TelekomDataService.fileManager.joinPath(TelekomDataService.scriptDir, "history");
@Sillium
Sillium / TelekomWidget.js
Created July 5, 2022 21:24
Updated scriptable widget for Telekom data usage
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: purple; icon-glyph: magic;
const DEBUG = false
const log = DEBUG ? console.log.bind(console) : function () { };
const fontSizeBig = 12
const padding = 10
const fontSizeHuge = 36
await createDirectory()
@Sillium
Sillium / TelekomDataUsage.js
Last active March 1, 2023 13:41
Telekom Data Usage - iOS 14 Widget for Scriptable app
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: pink; icon-glyph: exchange-alt;
const DEBUG = false
const log = DEBUG ? console.log.bind(console) : function () { };
// configure the library
const libraryInfo = {
name: 'TelekomDataUsageLibrary',
version: '1.0.3',
const apiUrl = "https://pass.telekom.de/api/service/generic/v1/status"
let widget = await createWidget()
widget.backgroundColor = new Color("#777777")
if (!config.runsInWidget) {
await widget.presentSmall()
}
Script.setWidget(widget)
Script.complete()