{"id":19133561,"url":"https://github.com/aciiverse/fetcii","last_synced_at":"2026-02-02T13:13:34.399Z","repository":{"id":254564584,"uuid":"846895849","full_name":"aciiverse/fetcii","owner":"aciiverse","description":"Simple fetch module primary designed for the aciifx backend","archived":false,"fork":false,"pushed_at":"2024-11-21T20:42:41.000Z","size":100,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-31T02:04:58.227Z","etag":null,"topics":["acii","api","fetch","frontend","handle","simple","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aciiverse.png","metadata":{"files":{"readme":"README.de.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-24T08:56:18.000Z","updated_at":"2025-02-26T20:43:50.000Z","dependencies_parsed_at":"2024-11-09T06:25:26.562Z","dependency_job_id":"a2f01ad6-2e26-49a0-81d8-6b2a903350cc","html_url":"https://github.com/aciiverse/fetcii","commit_stats":null,"previous_names":["aciiverse/fetcii"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aciiverse%2Ffetcii","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aciiverse%2Ffetcii/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aciiverse%2Ffetcii/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aciiverse%2Ffetcii/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aciiverse","download_url":"https://codeload.github.com/aciiverse/fetcii/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249638250,"owners_count":21304305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acii","api","fetch","frontend","handle","simple","typescript"],"created_at":"2024-11-09T06:22:55.788Z","updated_at":"2026-02-02T13:13:29.349Z","avatar_url":"https://github.com/aciiverse.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fetcii\n\n\u003e Einfaches Fetch-Modul primär für das aciiFX-Backend designed\n\n\u003e [Here](/README.md) is the doc also in english.\n\n## Entwickler\\*Innen\n\n-   [Flowtastisch](https://flowtastisch.com)\n\n## Credits\n\n### fetcii\n\n-   [javascript](https://www.javascript.com/)\n-   [typescript](https://github.com/Microsoft/TypeScript)\n\n### fetcii (dev)\n\n-   [concurrently](https://github.com/open-cli-tools/concurrently)\n-   [express](https://github.com/expressjs/express)\n\n## Features\n\n-   einfaches fetch Modul 🎲\n-   inspiriert von odata v2 👀\n-   Unterstützung der vier Haupt CRUD Methoden 📓\n-   eingebautes error handling -\u003e immer eine message 💬\n-   unterstützt automatisiert filter, top, skip, select query parameter ✨\n-   designed für aciiFX, aber auch anders nutzbar 🥑\n\n## Entwickeln mit fetcii\n\n### Was du brauchst\n\n-   NodeJS\n-   TypeScript `npm install -g typescript`\n\n### Installation\n\n1.  Installiere das fetcii Paket (Bsp.: yarn **oder** npm)\n\n        yarn add @aciiverse/fetcii\n\n        npm i @aciiverse/fetcii\n\n2.  Jetzt kannst du fetcii einfach importieren zB.:\n\n        import { fetcii } from \"@aciiverse/fetcii\";\n\n    Damit siehst du alle Funktionen und Module innerhalb von fetcii. Module kannst du aber ebenfalls direkt importieren zB.: `import { users } from \"@aciiverse/fetcii\";`\n\n## Entwickeln\n\n\u003e Hier sind ein paar Beispiele, wie man die Funktionen benutzen kann:\n\n### getcii\n\n#### Hole dir alle Spiele\n\n        import { fetcii } from \"@aciiverse/fetcii\";\n\n        const url = 'http://localhost:3000/api/games'; // api url\n\n        const result = await fetcii.getcii(url); // fetching (async await)\n\n        if (result.err) {\n            // -\u003e error occured while fetching (frontend or backend)\n            console.error(result.err?.message); // log error\n        } else {\n            // -\u003e Success\n            const games: Game[] = result.data?.data; // set data \u0026 assign own type (for typescript)\n\n            // do what ever you want...\n\n            console.log(result.data?.message); // log success message\n        }\n\n\u003e Wenn nur Spiel 6 - 20 ausgegeben werden soll, kannst du `top` \u0026 `skip` nutzen:\n\n        const result = await fetcii.getcii(url, {\n            top:    15, // get 15 games max\n            skip:   5   // skip the first 5 games\n        });\n\n-   Die Queryparameter kommen als `$top` und `$skip` an\n\n\u003e Wenn alle Spiele absteigend nach dem `release` sortiert werden sollen:\n\n        const orderBy: OrderByType = {\n            property: 'release',\n            ascending: false\n        };\n\n        const result = await fetcii.getcii(url, {\n            orderBy: orderBy\n        });\n\n-   Der Queryparameter kommt als `$orderBy` an\n\n\u003e Wenn alle Spiele aufsteigend nach dem `title` -\u003e aufsteigend nach der `id` sortiert werden sollen:\n\n        const orderBy: OrderByType = [\n            { property: 'title', ascending: true },\n            { property: 'id', ascending: true }\n        ];\n\n        const result = await fetcii.getcii(url, {\n            orderBy: orderBy\n        });\n\n-   Der Queryparameter kommt als `$orderBy` an\n\n\u003e Wenn nur der `title` und die `id` selektiert werden soll, kannst du `select` nutzen:\n\n        const result = await fetcii.getcii(url, {\n            select: ['title', 'id'] // select only the 'title' and 'id'\n        });\n\n-   Der Queryparameter kommt als `$select` an\n\n\u003e Wenn gefiltert werden soll, kann der neue Filtertyp mit dem Property `filter` verwendet werden:\n\n-   Alle Spiele mit der id 1:\n\n        const filters = new FilterCollection();\n\n        filters.add(\"id\", [\n            { operator: CompareOperator.Equal, value: 1 },\n        ]);\n\n-   Alle Spiele namens 'Minecraft' **oder** 'Portal 2':\n\n        const filters = new FilterCollection();\n\n        filters.add(\n            \"title\",\n            [\n                { operator: CompareOperator.Equal, value: \"Minecraft\" },\n                { operator: CompareOperator.Equal, value: \"Portal 2\" },\n            ],\n            false\n        );\n\n-   Alle Spiele namens 'Minecraft' **oder** (Logik in aciiFX) zwischen 2020 **und** 2028 erschienen\n\n        const filters = new FilterCollection();\n\n        filters.add(\"title\", [\n                { operator: CompareOperator.Equal, value: \"Minecraft\" },\n        ]);\n        filters.add(\n            \"release\",\n            [\n                { operator: CompareOperator.GreaterEqual, value: 2020 },\n                { operator: CompareOperator.LessEqual, value: 2028 },\n            ],\n            false\n        );\n\n-   Filter zuweisen:\n\n        const result = await fetcii.getcii(url, {\n            filters: filters.getAllFilters(), // set filters\n        });\n\n-   Der Queryparameter kommt als `$filters` an\n\n#### Hole dir ein einzelnes Spiel\n\n        import { fetcii } from \"@aciiverse/fetcii\";\n\n        const url = 'http://localhost:3000/api/games/:id'; // api url\n\n        const result = await fetcii.getcii(url); // fetching (async await)\n\n        if (result.err) {\n            // -\u003e error occured while fetching (frontend or backend)\n            console.error(result.err?.message); // log error\n        } else {\n            // -\u003e success\n            const game: Game = result.data?.data; // set data \u0026 assign own type (for typescript)\n\n            // do what ever you want...\n\n            console.log(result.data?.message); // log success message\n        }\n\n### createcii\n\n#### Erstelle ein Spiel\n\n        import { fetcii } from \"@aciiverse/fetcii\";\n\n        const   url = 'http://localhost:3000/api/games', // api url\n                data: Omit\u003cGame, 'id'\u003e = { // 'Omit' bewirkt, dass der type 'Game' ohne das property 'id' benutzt wird (typescript)\n                    title: 'Minecraft',\n                    language: 'Java',\n                    release: 2011\n                };\n\n        const result = await fetcii.createcii(url, data); // fetching (async await)\n\n        if (result.err) {\n            // -\u003e error occured while fetching (frontend or backend)\n            console.error(result.err?.message); // log error\n        } else {\n            // -\u003e success\n            const game: Game = result.data?.data; // set data \u0026 assign own type (for typescript)\n\n            // do what ever you want...\n\n            console.log(result.data?.message); // log success message\n        }\n\n### updatecii\n\n#### Bearbeite ein Spiel\n\n        import { fetcii } from \"@aciiverse/fetcii\";\n\n        const   url = 'http://localhost:3000/api/games/:id', // api url\n                data: Game = {\n                    title: 'Portal 2',\n                    language: 'C++',\n                    release: 2011\n                };\n\n        const result = await fetcii.updatecii(url, data); // fetching (async await)\n\n        if (result.err) {\n            // -\u003e error occured while fetching (frontend or backend)\n            console.error(result.err?.message); // log error\n        } else {\n            // -\u003e success\n            const game: Game = result.data?.data; // set data \u0026 assign own type (for typescript)\n\n            // do what ever you want...\n\n            console.log(result.data?.message); // log success message\n        }\n\n### deletecii\n\n#### Lösche ein Spiel\n\n        import { fetcii } from \"@aciiverse/fetcii\";\n\n        const   url = 'http://localhost:3000/api/games/:id'; // api url\n\n        const result = await removecii(url); // fetching (async await)\n\n        if (result.err) {\n            // -\u003e error occured while fetching (frontend or backend)\n            console.error(result.err?.message); // log error\n        } else {\n            // -\u003e success\n\n            // do what ever you want...\n\n            console.log(result.data?.message); // log success message\n        }\n\n### Usermodul (best use with aciiFX) (user)\n\n#### users.saveData()\n\n-   Nach einem Login kannst du den Token, Tokenverfallsdatum und die Userdaten speichern:\n\n        const url = 'http://localhost:3000/api/users/login';\n\n        const result = await fetcii.createcii(url, {\n            username: 'ezio',\n            password: 'mySecretPassword'\n        });\n\n        // validation\n        if (result.err) {\n            // -\u003e error occured\n            console.error(result.err?.message); // log error\n            return;\n        }\n        const data = result.data;\n\n        // save data\n        users.saveData({\n            accessToken: data.token,\n            userData: data.user,\n            tokenExp: data.tokenExp\n        });\n\n#### users.getData()\n\n-   Die Userdaten erhalten\n\n        export interface UserData {\n            uuid: string;\n            username: string;\n            email: string;\n            registered: Date;\n            lastLogin?: Date;\n            verified: boolean;\n            isAdmin: boolean;\n        }\n\n        const data: UserData = users.getData();\n\n        if (!data) return; // no data found\n\n#### users.getToken()\n\n-   Den Access Token erhalten\n\n        const token = users.getToken();\n\n        if (!token) return; // no token found\n\n-   Mit dem Token kannst du getcii(), createcii(), updatecii() oder deletecii() ausführen.\n-   `aciiFX` hat eingebaute middlewares, die den Token automatisch konsumieren\n\n        const token = users.getToken();\n\n        if (!token) return; // no token found\n\n        const url = 'http://localhost:3000/api/games',\n            result = await fetcii.getcii(url, {}, token); // fetching (async await);\n\n#### users.deleteData()\n\n-   Lösche die Daten, die du abgespeichert hast\n\n        users.deleteData();\n\n-   Wenn du zB. initial beim Appstart prüfen willst, ob der Token abgelaufen ist, kannst du folgendes nutzen\n-   Es kommt zurück, ob der Token abgelaufen ist\n-   Wenn du nichts mitgibst, löscht er automatisch die Daten\n\n        users.checkTokenExpired();\n\n    oder\n\n        const expired = users.checkTokenExpired();\n\n    oder\n\n        const expired = users.checkTokenExpired(true);\n\n    oder\n\n        users.checkTokenExpired(true);\n\n-   Wenn die Daten nicht gelöscht werden sollen:\n\n        const expired = users.checkTokenExpired(false);\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faciiverse%2Ffetcii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faciiverse%2Ffetcii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faciiverse%2Ffetcii/lists"}