-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
local DS = os.DIRECTORY_SEPARATOR | ||
local mod_path = minetest.get_modpath(minetest.get_current_modname()) | ||
local old_require = require | ||
require = function(name) return dofile(mod_path .. DS .. "src" .. DS .. name:gsub("%.", DS) .. ".lua") end | ||
|
||
|
||
require("lord_web_api").init() | ||
|
||
|
||
require = old_require |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name = lord_web_api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local Api = require("lord_web_api.Api") | ||
|
||
|
||
--- @return http_client.Client | ||
local function init_client() | ||
return http_client.Client:new( | ||
-- TODO | ||
) | ||
end | ||
|
||
--- @param client http_client.Client | ||
local function register_api(client) | ||
_G.lord_web_api = Api:new(client) | ||
end | ||
|
||
|
||
return { | ||
init = function() | ||
local client = init_client() | ||
register_api(client) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
local Players = require("lord_web_api.api.Players") | ||
local Clans = require("lord_web_api.api.Plans") | ||
|
||
|
||
--- @class lord_web_api.Api | ||
local Api = { | ||
--- @type lord_web_api.api.Players | ||
players = nil, | ||
--- @type lord_web_api.api.Clans | ||
clans = nil, | ||
} | ||
|
||
--- @param client http_client.Client | ||
function Api:new(client) | ||
local class = self | ||
self = {} | ||
|
||
self.players = Players:new(client) | ||
self.clans = Clans:new(client) | ||
|
||
return setmetatable(self, {__index = class}) | ||
end | ||
|
||
|
||
return Api |
39 changes: 39 additions & 0 deletions
39
mods/lord/Game/lord_web_api/src/lord_web_api/api/Clans.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
--- @class lord_web_api.api.Clans | ||
local Clans = { | ||
--- @type http_client.Client | ||
client = nil, | ||
} | ||
|
||
--- @param client http_client.Client | ||
function Clans:new(client) | ||
local class = self | ||
self = {} | ||
|
||
self.client = client | ||
|
||
return setmetatable(self, {__index = class}) | ||
end | ||
|
||
function Clans:list() | ||
-- TODO | ||
end | ||
|
||
function Clans:get() | ||
-- TODO | ||
end | ||
|
||
function Clans:create() | ||
-- TODO | ||
end | ||
|
||
function Clans:update() | ||
-- TODO | ||
end | ||
|
||
function Clans:delete() | ||
-- TODO | ||
end | ||
|
||
|
||
return Clans |
39 changes: 39 additions & 0 deletions
39
mods/lord/Game/lord_web_api/src/lord_web_api/api/Players.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
--- @class lord_web_api.api.Players | ||
local Players = { | ||
--- @type http_client.Client | ||
client = nil, | ||
} | ||
|
||
--- @param client http_client.Client | ||
function Players:new(client) | ||
local class = self | ||
self = {} | ||
|
||
self.client = client | ||
|
||
return setmetatable(self, {__index = class}) | ||
end | ||
|
||
function Players:list() | ||
-- TODO | ||
end | ||
|
||
function Players:get() | ||
-- TODO | ||
end | ||
|
||
function Players:create() | ||
-- TODO | ||
end | ||
|
||
function Players:update() | ||
-- TODO | ||
end | ||
|
||
function Players:delete() | ||
-- TODO | ||
end | ||
|
||
|
||
return Players |