Changed Syntax, updated Utils implementation
This commit is contained in:
parent
df41bf428b
commit
6033e8fc14
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
local tokens = {
|
local tokens = {
|
||||||
["exampleToken"] = ""
|
["exampleToken"] = ""
|
||||||
}
|
}
|
||||||
@ -7,88 +6,48 @@ local tokens = {
|
|||||||
-- DO NOT EDIT THE FOLLOWING LINES BELOW, UNLESS YOU KNOW WHAT YOU ARE DOING!
|
-- DO NOT EDIT THE FOLLOWING LINES BELOW, UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
|
|
||||||
local Utils = require(script.Parent.Utils)
|
local Utils = require(script.Parent.Utils)
|
||||||
|
|
||||||
type Function = () -> ()
|
|
||||||
type DefaultResultType = (success: boolean, errorMessage: string) -> ()
|
|
||||||
type DefaultResult = {
|
|
||||||
["onResult"]: {
|
|
||||||
["Connect"]:DefaultResultType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
local HttpService = game:GetService("HttpService")
|
|
||||||
|
|
||||||
function signal()
|
|
||||||
local RBXSignal = {}
|
|
||||||
RBXSignal._bindableEvent = Instance.new("BindableEvent")
|
|
||||||
function RBXSignal:_Fire(...)
|
|
||||||
RBXSignal._bindableEvent:Fire(...)
|
|
||||||
end
|
|
||||||
function RBXSignal:Connect(handler: ({success: boolean, result: {}}) -> ({success: boolean, result: {}}))
|
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
|
||||||
if not (type(handler) == "function") then
|
|
||||||
error(("connect(%s)"):format(typeof(handler)), 2)
|
|
||||||
end
|
|
||||||
RBXSignal._bindableEvent.Event:Connect(function(...)
|
|
||||||
handler(...)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
return RBXSignal
|
|
||||||
end
|
|
||||||
|
|
||||||
local MarcSyncClient = {}
|
local MarcSyncClient = {}
|
||||||
|
|
||||||
MarcSyncClient.getVersion = function(self:typeof(MarcSyncClient), clientId: number?):{["success"]:boolean,["version"]:string,["update_server"]:string}
|
MarcSyncClient.getVersion = function(self:typeof(MarcSyncClient), clientId: number?):{["success"]:boolean,["version"]:string,["update_server"]:string}
|
||||||
self:_checkInstallation()
|
self:_checkInstallation()
|
||||||
local url = ""
|
local url = ""
|
||||||
if clientId then url = "/"..clientId end
|
if clientId then url = "/"..clientId end
|
||||||
local result = nil;
|
local result = Utils.makeHTTPRequest("GET", "https://api.marcsync.dev/v0/utils/version"..url);
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("GET", "https://api.marcsync.dev/v0/utils/version"..url)).onResult:Connect(function(any)
|
|
||||||
result = any
|
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
task.wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
MarcSyncClient.createCollection = function(self:typeof(MarcSyncClient), collectionName: string):typeof(require(script.Parent.Objects.Collection))
|
MarcSyncClient.createCollection = function(self:typeof(MarcSyncClient), collectionName: string):typeof(require(script.Parent.Objects.Collection).new())
|
||||||
if not self._accessToken then error("[MarcSync] Please set a Token before using MarcSync.") end
|
if not self._accessToken then error("[MarcSync] Please set a Token before using MarcSync.") end
|
||||||
if not collectionName then error("No CollectionName Provided") end
|
if not collectionName then error("No CollectionName Provided") end
|
||||||
local result = nil;
|
local result = Utils.makeHTTPRequest("collection", "POST", "https://api.marcsync.dev/v0/collection/"..collectionName, {}, self._accessToken);
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("POST", "https://api.marcsync.dev/v0/collection/"..collectionName, {}, self._accessToken)).onResult:Connect(function(any)
|
|
||||||
if not any["success"] then result = false return end
|
if not result["success"] then error(result["errorMessage"]) end
|
||||||
result = require(script.Parent.Objects.Collection)._new(collectionName, self._accessToken)
|
result = require(script.Parent.Objects.Collection).new(collectionName, self._accessToken)
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
task.wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
MarcSyncClient.fetchCollection = function(self:typeof(MarcSyncClient), collectionName: string):typeof(require(script.Parent.Objects.Collection))
|
MarcSyncClient.fetchCollection = function(self:typeof(MarcSyncClient), collectionName: string):typeof(require(script.Parent.Objects.Collection).new())
|
||||||
self:_checkInstallation()
|
self:_checkInstallation()
|
||||||
if not collectionName then error("No CollectionName Provided") end
|
if not collectionName then error("No CollectionName Provided") end
|
||||||
local result = nil;
|
local result = Utils.makeHTTPRequest("collection", "GET", "https://api.marcsync.dev/v0/collection/"..collectionName, {}, self._accessToken);
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("GET", "https://api.marcsync.dev/v0/collection/"..collectionName, {}, self._accessToken)).onResult:Connect(function(any)
|
|
||||||
if not any["success"] then result = false return end
|
if not result["success"] then error(result["errorMessage"]) end
|
||||||
result = require(script.Parent.Objects.Collection)._new(collectionName, self._accessToken)
|
result = require(script.Parent.Objects.Collection).new(collectionName, self._accessToken)
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
task.wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
MarcSyncClient.getCollection = function(self:typeof(MarcSyncClient), collectionName: string):typeof(require(script.Parent.Objects.Collection))
|
MarcSyncClient.getCollection = function(self:typeof(MarcSyncClient), collectionName: string):typeof(require(script.Parent.Objects.Collection).new())
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
||||||
self:_checkInstallation()
|
self:_checkInstallation()
|
||||||
if not collectionName then error("No CollectionName Provided") end
|
if not collectionName then error("No CollectionName Provided") end
|
||||||
return require(script.Parent.Objects.Collection)._new(collectionName, self._accessToken)
|
return require(script.Parent.Objects.Collection).new(collectionName, self._accessToken)
|
||||||
end
|
end
|
||||||
|
|
||||||
return function(accessToken: string):typeof(MarcSyncClient)
|
return {
|
||||||
|
new = function(accessToken: string):typeof(MarcSyncClient)
|
||||||
if not accessToken then warn("Token not provided while creating a new MarcSync Object.") end
|
if not accessToken then warn("Token not provided while creating a new MarcSync Object.") end
|
||||||
if not tokens[accessToken] then warn("Token provided for creating a new MarcSync Object not Found in Token Table, using it as token instead.") else accessToken = tokens[accessToken] end
|
if not tokens[accessToken] then warn("Token provided for creating a new MarcSync Object not Found in Token Table, using it as token instead.") else accessToken = tokens[accessToken] end
|
||||||
local self = setmetatable({}, MarcSyncClient)
|
local self = {}
|
||||||
self._accessToken = accessToken
|
self._accessToken = accessToken
|
||||||
self._checkInstallation = function()
|
self._checkInstallation = function()
|
||||||
if not self then error("Please Setup MarcSync before using MarcSync.") end
|
if not self then error("Please Setup MarcSync before using MarcSync.") end
|
||||||
@ -96,33 +55,11 @@ return function(accessToken: string):typeof(MarcSyncClient)
|
|||||||
--print(HttpService.HttpEnabled)
|
--print(HttpService.HttpEnabled)
|
||||||
--if not HttpService.HttpEnabled then error("Please Enable HTTPService in order to use MarcSync.") end
|
--if not HttpService.HttpEnabled then error("Please Enable HTTPService in order to use MarcSync.") end
|
||||||
end
|
end
|
||||||
self._errorHandler = function(RBXSignal: {}, Error: string)
|
|
||||||
task.spawn(function()
|
self = setmetatable(self, {
|
||||||
RBXSignal:_Fire({
|
__index = MarcSyncClient
|
||||||
["success"] = false,
|
|
||||||
["errorMessage"] = Error
|
|
||||||
})
|
})
|
||||||
end)
|
|
||||||
return {["onResult"] = RBXSignal}
|
|
||||||
end
|
|
||||||
self._requestHandler = function(result: {}, Error: string):{["onResult"]: {}}
|
|
||||||
if result == nil then return self._errorHandler(signal(), Error) end
|
|
||||||
local errorResult;
|
|
||||||
local signalevent;
|
|
||||||
if #result.Body == 0 and not result.Success then
|
|
||||||
errorResult = "HTTP "..result.StatusCode.." ("..result.StatusMessage..")" result = false
|
|
||||||
elseif not pcall(function() HttpService:JSONDecode(result.Body) end) then
|
|
||||||
error("Unexpected MarcSync Result.")
|
|
||||||
else
|
|
||||||
result = result.Body
|
|
||||||
signalevent = {["onResult"]=signal()}
|
|
||||||
end
|
|
||||||
task.spawn(function()
|
|
||||||
if not result then return end
|
|
||||||
signalevent.onResult:_Fire(result)
|
|
||||||
end)
|
|
||||||
return signalevent or self._errorHandler(signal(), errorResult)
|
|
||||||
end
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
}
|
@ -1,109 +1,78 @@
|
|||||||
|
local HttpService = game:GetService("HttpService")
|
||||||
local Utils = require(script.Parent.Parent.Utils)
|
local Utils = require(script.Parent.Parent.Utils)
|
||||||
local Entry = require(script.Parent.Entry)
|
local Entry = require(script.Parent.Entry)
|
||||||
|
|
||||||
local collection = {}
|
local types = {
|
||||||
collection.__index = collection
|
EntryData = require(script.Parent.Parent.Types.EntryData).getType()
|
||||||
|
|
||||||
local filterSheme = {
|
|
||||||
["values"]=typeof({ ["key"]=... }),
|
|
||||||
["startsWith"]=typeof({ "key" }),
|
|
||||||
["ignoreCases"]=typeof({ "key" })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function collection:insert(data:{key:any}):typeof(Entry)?
|
local Collection = {}
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
|
||||||
|
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
|
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
||||||
local result = nil;
|
local result = Utils.makeHTTPRequest("entry", "POST", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["data"]=data}, self._accessToken);
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("POST", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["data"]=data}, self._token)).onResult:Connect(function(any)
|
|
||||||
if any["success"] and any["objectId"] then
|
if result["success"] and result["objectId"] then
|
||||||
data["_id"] = any["objectId"]
|
data["_id"] = result["objectId"]
|
||||||
result = require(script.Parent.Entry)._new(self._collectionName, data, self._token)
|
result = require(script.Parent.Entry).new(self._collectionName, data, self._accessToken)
|
||||||
return
|
else
|
||||||
|
error(result["errorMessage"])
|
||||||
end
|
end
|
||||||
result = any
|
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function collection:update(filters:typeof(filterSheme),data:{key:any}):{message:string?,errorMessage:string?,success:boolean,modifiedEntries:number?}
|
Collection.updateEntries = function(self:typeof(Collection), filters:typeof(types.EntryData), data:typeof(types.EntryData)):number
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
|
||||||
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
||||||
local result = nil;
|
local result = Utils.makeHTTPRequest("entry", "PUT", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["filters"]=filters,["data"]=data}, self._accessToken);
|
||||||
if not filters.values then error("[MarcSync: Collection] Invalid arguments given for collection:select(). Expected filters.values, got nil") end
|
if not result["success"] then error(result["errorMessage"]) end
|
||||||
filters.values["_startsWith"] = filters.startsWith or {}
|
|
||||||
filters.values["_ignoreCases"] = filters.ignoreCases or {}
|
return result["modifiedEntries"]
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("PUT", "https://api.marcsync.dev/v1/entries/"..self._collectionName, {["filters"]=filters.values,["data"]=data}, self._token)).onResult:Connect(function(any)
|
|
||||||
result = any
|
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function collection:select(filters:typeof(filterSheme),limit:number):{entries:{a:typeof(Entry)?,b:typeof(Entry)?,c:typeof(Entry)?}?,success:boolean,message:string?,errorMessage:string?}
|
Collection.getEntries = function(self:typeof(Collection), filters:typeof(types.EntryData)):{[number]:typeof(Entry.new())}
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
|
||||||
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
||||||
local result = nil;
|
if not filters then filters = {} end
|
||||||
if not filters.values then error("[MarcSync: Collection] Invalid arguments given for collection:select(). Expected filters.values, got nil") end
|
local result = Utils.makeHTTPRequest("entry", "DELETE", "https://api.marcsync.dev/v0/entries/"..self._collectionName.."?isQuery=true", {["filters"]=filters}, self._accessToken);
|
||||||
filters.values["_startsWith"] = filters.startsWith or {}
|
if result["success"] and result["entries"] then
|
||||||
filters.values["_ignoreCases"] = filters.ignoreCases or {}
|
local _result = {}
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("PATCH", "https://api.marcsync.dev/v1/entries/"..self._collectionName.."?methodOverwrite=GET", {["filters"]=filters.values, ["limit"]=limit}, self._token)).onResult:Connect(function(any)
|
for index,entry in pairs(result["entries"]) do
|
||||||
if any["success"] and any["entries"] then
|
_result[index] = require(script.Parent.Entry).new(self._collectionName, entry, self._accessToken)
|
||||||
local _result = {["entries"]={},["success"]=true}
|
|
||||||
for index,entry in pairs(any["entries"]) do
|
|
||||||
_result["entries"][index] = require(script.Parent.Entry)._new(self._collectionName, entry, self._token)
|
|
||||||
end
|
end
|
||||||
result = _result
|
result = _result
|
||||||
return
|
else
|
||||||
|
error(result["errorMessage"])
|
||||||
end
|
end
|
||||||
result = any
|
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function collection:delete(filters:typeof(filterSheme)):{message:string?,errorMessage:string?,success:boolean,deletedEntries:number?}
|
Collection.deleteEntries = function(self:typeof(Collection), filters:typeof(types.EntryData)):number
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
|
||||||
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
||||||
local result = nil;
|
local result = Utils.makeHTTPRequest("DELETE", "https://api.marcsync.dev/v0/entries/"..self._collectionName, {["filters"]=filters}, self._accessToken);
|
||||||
if not filters.values then error("[MarcSync: Collection] Invalid arguments given for collection:select(). Expected filters.values, got nil") end
|
if not result["success"] then error(result["errorMessage"]) end
|
||||||
filters.values["_startsWith"] = filters.startsWith or {}
|
|
||||||
filters.values["_ignoreCases"] = filters.ignoreCases or {}
|
return result["deletedEntries"]
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("DELETE", "https://api.marcsync.dev/v1/entries/"..self._collectionName, {["filters"]=filters.values}, self._token)).onResult:Connect(function(any)
|
|
||||||
result = any
|
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function collection:drop():{success:boolean,message:string?,errorMessage:string?}
|
Collection.drop = function(self:typeof(Collection))
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
|
||||||
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
if not self._collectionName then error("[MarcSync: Collection] Invalid Object created or trying to access an destroied object.") end
|
||||||
local result = nil;
|
local result = Utils.makeHTTPRequest("collection", "DELETE", "https://api.marcsync.dev/v0/collection/"..self._collectionName, {}, self._accessToken);
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("DELETE", "https://api.marcsync.dev/v0/collection/"..self._collectionName, {}, self._token)).onResult:Connect(function(any)
|
if not result["success"] then error(result["errorMessage"]) end
|
||||||
result = any
|
self._collectionName = nil
|
||||||
end)
|
self._accessToken = nil
|
||||||
repeat
|
|
||||||
wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
collection._collectionName = nil
|
return {
|
||||||
|
new = function(collectionName: string, accessToken: string):typeof(Collection)
|
||||||
|
local self = {}
|
||||||
|
self._collectionName = collectionName
|
||||||
|
self._accessToken = accessToken
|
||||||
|
|
||||||
|
self = setmetatable(self, {
|
||||||
|
__index = Collection
|
||||||
|
})
|
||||||
|
|
||||||
function collection._new(_collectionName: string, _token: string):typeof(collection)
|
|
||||||
local self = setmetatable({}, collection)
|
|
||||||
self._collectionName = _collectionName
|
|
||||||
self._token = _token
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
}
|
||||||
return collection
|
|
@ -1,62 +1,56 @@
|
|||||||
local Utils = require(script.Parent.Parent.Utils)
|
local Utils = require(script.Parent.Parent.Utils)
|
||||||
|
|
||||||
local entry = {}
|
local types = {
|
||||||
entry.__index = entry
|
EntryData = require(script.Parent.Parent.Types.EntryData).getType()
|
||||||
|
}
|
||||||
|
|
||||||
function entry:getValue(value:string):any
|
local Entry = {}
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
|
||||||
|
Entry.getValue = function(self:typeof(Entry), value:string):any
|
||||||
if not value then return nil end
|
if not value then return nil end
|
||||||
return self._values[value]
|
return self._entryData[value]
|
||||||
end
|
end
|
||||||
|
|
||||||
function entry:getValues():{}
|
Entry.getValues = function(self:typeof(Entry)):typeof(types.EntryData)
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
return self._entryData
|
||||||
return self._values
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function entry:update(newData:{key:any}):{success:boolean,errorMessage:string?,message:string?,modifiedEntries:IntValue?}
|
Entry.updateValues = function(self:typeof(Entry), values:typeof(types.EntryData)):number
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
local result = Utils.makeHTTPRequest("entryId", "PUT", "https://api.marcsync.dev/v0/entries/"..self._tableId, {["filters"]={["_id"]=self._objectId},["data"]=values}, self._accessToken);
|
||||||
local result = nil;
|
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("PUT", "https://api.marcsync.dev/v0/entries/"..self._tableId, {["filters"]={["_id"]=self._objectId},["data"]=newData}, self._token)).onResult:Connect(function(any)
|
if result["success"] and result["modifiedEntries"] and result["modifiedEntries"] > 0 then
|
||||||
if any["success"] and any["modifiedEntries"] and any["modifiedEntries"] > 0 then
|
for i,v in pairs(values) do
|
||||||
for i,v in pairs(newData) do
|
self._entryData[i] = v
|
||||||
self._values[i] = v
|
|
||||||
end
|
end
|
||||||
end
|
elseif not result["success"] then
|
||||||
result = any
|
error(result["errorMessage"])
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function entry:delete():{success:boolean,errorMessage:string?,message:string?,deletedEntries:IntValue?}
|
return result["modifiedEntries"]
|
||||||
|
end
|
||||||
|
|
||||||
|
Entry.delete = function(self:typeof(Entry))
|
||||||
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
if typeof(self) ~= "table" then error("Please use : instead of .") end
|
||||||
local result = nil;
|
local result = Utils.makeHTTPRequest("entryId", "DELETE", "https://api.marcsync.dev/v0/entries/"..self._tableId, {["filters"]={["_id"]=self._objectId}}, self._accessToken);
|
||||||
Utils.handleResponse(Utils.makeHTTPRequest("DELETE", "https://api.marcsync.dev/v0/entries/"..self._tableId, {["filters"]={["_id"]=self._objectId}}, self._token)).onResult:Connect(function(any)
|
|
||||||
if any["success"] and any["deletedEntries"] then
|
if not result["success"] then error(result["errorMessage"]) end
|
||||||
if any["deletedEntries"] < 1 then result = false return end
|
|
||||||
spawn(function()
|
|
||||||
self = nil
|
self = nil
|
||||||
end)
|
|
||||||
end
|
|
||||||
result = any
|
|
||||||
end)
|
|
||||||
repeat
|
|
||||||
wait()
|
|
||||||
until result ~= nil
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function entry._new(_tableId:string, _values:{}, _token:string):typeof(entry)
|
return {
|
||||||
if not _tableId or not _values or not _values["_id"] then error("[MarcSync: Entry] Tried creating invalid Entry Object.") end
|
new = function(tableId:string, entryData:typeof(types.EntryData), accessToken:string):typeof(Entry)
|
||||||
local self = setmetatable({}, entry)
|
if not tableId or not entryData or not entryData["_id"] or not accessToken then error("[MarcSync: Entry] Tried creating invalid Entry Object.") end
|
||||||
self._tableId = _tableId
|
local self = {}
|
||||||
self._values = _values
|
self._tableId = tableId
|
||||||
self._objectId = _values["_id"]
|
self._entryData = entryData
|
||||||
self._token = _token
|
self._objectId = entryData["_id"]
|
||||||
|
self._accessToken = accessToken
|
||||||
|
|
||||||
|
self = setmetatable(self, {
|
||||||
|
__index = Entry
|
||||||
|
})
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
}
|
||||||
return entry
|
|
Loading…
x
Reference in New Issue
Block a user