diff --git a/src/MarcSync/Objects/Collection.lua b/src/MarcSync/Objects/Collection.lua index 73c0d79..7c8efc8 100644 --- a/src/MarcSync/Objects/Collection.lua +++ b/src/MarcSync/Objects/Collection.lua @@ -2,18 +2,18 @@ local Utils = require(script.Parent.Parent.Utils) local Entry = require(script.Parent.Entry) local types = { - EntryData = require(script.Parent.Parent.Types.EntryData).getType() + EntryData = require(script.Parent.Parent.Types.EntryData).bekommeRassenindentifikationsspezifizierunginstanztextaufzaehlbar() } local Collection = {} -Collection.createEntry = function(self:typeof(Collection), data:typeof(types.EntryData)):typeof(Entry.new()) - if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end - local result = Utils.makeHTTPRequest("entry", "POST", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["data"]=data}, self._accessToken); +Collection.erzeugeEintrag = function(self:typeof(Collection), data:typeof(types.EntryData)):typeof(Entry.new()) + if not self._collectionName then error("[MarkSynchronisation: Sammlung] Ungültiges Objekt erstellt oder versucht, auf ein zerstörtes Objekt zuzugreifen.") end + local result = Utils.macheHypertexttransferprotokollAnfrage("entry", "POST", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["data"]=data}, self._accessToken); if result["success"] and result["objectId"] then data["_id"] = result["objectId"] - result = require(script.Parent.Entry).new(self._collectionName, data, self._accessToken) + result = require(script.Parent.Entry).neu(self._collectionName, data, self._accessToken) else error(result["errorMessage"]) end @@ -21,22 +21,22 @@ Collection.createEntry = function(self:typeof(Collection), data:typeof(types.Ent return result end -Collection.updateEntries = function(self:typeof(Collection), filters:typeof(types.EntryData), data:typeof(types.EntryData)):number - if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end - local result = Utils.makeHTTPRequest("entry", "PUT", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["filters"]=filters,["data"]=data}, self._accessToken); +Collection.aktualisiereEintrag = function(self:typeof(Collection), filters:typeof(types.EntryData), data:typeof(types.EntryData)):number + if not self._collectionName then error("[MarkSynchronisation: Sammlung] Ungültiges Objekt erstellt oder versucht, auf ein zerstörtes Objekt zuzugreifen.") end + local result = Utils.macheHypertexttransferprotokollAnfrage("eintrag", "PUT", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["filters"]=filters,["data"]=data}, self._accessToken); if not result["success"] then error(result["errorMessage"]) end return result["modifiedEntries"] end -Collection.getEntries = function(self:typeof(Collection), filters:typeof(types.EntryData)):{[number]:typeof(Entry.new())} - if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end +Collection.bekommeEintraege = function(self:typeof(Collection), filters:typeof(types.EntryData)):{[number]:typeof(Entry.new())} + if not self._collectionName then error("[MarkSynchronisation: Sammlung] Ungültiges Objekt erstellt oder versucht, auf ein zerstörtes Objekt zuzugreifen.") end if not filters then filters = {} end - local result = Utils.makeHTTPRequest("entry", "DELETE", "https://api.marcsync.dev/v0/entries/"..self._collectionName.."?isQuery=true", {["filters"]=filters}, self._accessToken); + local result = Utils.macheHypertexttransferprotokollAnfrage("eintrag", "DELETE", "https://api.marcsync.dev/v0/entries/"..self._collectionName.."?isQuery=true", {["filters"]=filters}, self._accessToken); if result["success"] and result["entries"] then local _result = {} for index,entry in pairs(result["entries"]) do - _result[index] = require(script.Parent.Entry).new(self._collectionName, entry, self._accessToken) + _result[index] = require(script.Parent.Entry).neu(self._collectionName, entry, self._accessToken) end result = _result else @@ -46,23 +46,23 @@ Collection.getEntries = function(self:typeof(Collection), filters:typeof(types.E return result end -Collection.deleteEntries = function(self:typeof(Collection), filters:typeof(types.EntryData)):number - if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end - local result = Utils.makeHTTPRequest("DELETE", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["filters"]=filters}, self._accessToken); +Collection.loescheEintrag = function(self:typeof(Collection), filters:typeof(types.EntryData)):number + if not self._collectionName then error("[MarkSynchronisation: Sammlung] Ungültiges Objekt erstellt oder versucht, auf ein zerstörtes Objekt zuzugreifen.") end + local result = Utils.macheHypertexttransferprotokollAnfrage("eintrag", "DELETE", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["filters"]=filters}, self._accessToken); if not result["success"] then error(result["errorMessage"]) end return result["deletedEntries"] end -Collection.drop = function(self:typeof(Collection)) - if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end - local result = Utils.makeHTTPRequest("collection", "DELETE", "https://api.marcsync.dev/v0/collection/"..self._collectionName, {}, self._accessToken); +Collection.fallenlassen = function(self:typeof(Collection)) + if not self._collectionName then error("[MarkSynchronisation: Sammlung] Ungültiges Objekt erstellt oder versucht, auf ein zerstörtes Objekt zuzugreifen.") end + local result = Utils.macheHypertexttransferprotokollAnfrage("sammlung", "DELETE", "https://api.marcsync.dev/v0/collection/"..self._collectionName, {}, self._accessToken); if not result["success"] then error(result["errorMessage"]) end self = nil end return { - new = function(collectionName: string, accessToken: string):typeof(Collection) + neu = function(collectionName: string, accessToken: string):typeof(Collection) local self = {} self._collectionName = collectionName self._accessToken = accessToken @@ -73,4 +73,4 @@ return { return self end -} \ No newline at end of file +}