• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

blockexchange / blockexchange / 13110168475

03 Feb 2025 09:18AM UTC coverage: 48.213% (+0.6%) from 47.564%
13110168475

push

github

BuckarooBanzay
http/json overhaul

51 of 102 new or added lines in 14 files covered. (50.0%)

1 existing line in 1 file now uncovered.

985 of 2043 relevant lines covered (48.21%)

1734.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.5
/api/schemapart.lua
1
local http, url = ...
1✔
2

3
function blockexchange.api.create_schemapart(token, data)
2✔
4
  return Promise.json(http, url .. "/api/schemapart", {
8✔
5
    method = "POST",
6
    data = data,
8✔
7
    headers = {
8✔
8
      "Authorization: " .. token
8✔
9
    }
8✔
10
  })
8✔
11
end
12

13
function blockexchange.api.remove_schemapart(token, schema_uid, pos)
2✔
NEW
14
  local del_url = url .. "/api/schemapart/" .. schema_uid .. "/" .. pos.x .. "/" .. pos.y .. "/" .. pos.z .. "/delete"
×
NEW
15
  return Promise.http(http, del_url, {
×
16
    method = "POST",
17
    data = "delete",
NEW
18
    headers = {
×
NEW
19
      "Authorization: " .. token
×
20
    }
NEW
21
  }):next(function(res)
×
NEW
22
    if res.code ~= 200 then
×
NEW
23
      return Promise.rejected("unexpected http code: " .. res.code)
×
24
    end
NEW
25
    return true
×
26
  end)
27
end
28

29
local function response_handler(res)
30
  if res.code == 200 then
9✔
31
    return res.json()
8✔
32
  elseif res.code == 404 or res.code == 204 then
1✔
33
    return false
1✔
34
  else
NEW
35
    return Promise.rejected("unexpected http code: " .. res.code)
×
36
  end
37
end
38

39

40
function blockexchange.api.get_schemapart(schema_uid, pos)
2✔
NEW
41
  return Promise.http(
×
42
    http,
NEW
43
    url .. "/api/schemapart/" .. schema_uid .. "/" .. pos.x .. "/" .. pos.y .. "/" .. pos.z
×
NEW
44
  ):next(response_handler)
×
45
end
46

47
function blockexchange.api.get_schemapart_chunk(schema_uid, pos)
2✔
NEW
48
  return Promise.http(
×
49
    http,
NEW
50
    url .. "/api/schemapart_chunk/" .. schema_uid .. "/" .. pos.x .. "/" .. pos.y .. "/" .. pos.z
×
NEW
51
  ):next(response_handler)
×
52
end
53

54
function blockexchange.api.get_first_schemapart(schema_uid)
2✔
55
  return Promise.http(
2✔
56
    http,
1✔
57
    url .. "/api/schemapart_first/" .. schema_uid
1✔
58
  ):next(response_handler)
1✔
59
end
60

61
function blockexchange.api.get_next_schemapart(schema_uid, pos)
2✔
62
  return Promise.http(
16✔
63
    http,
8✔
64
    url .. "/api/schemapart_next/" .. schema_uid .. "/" .. pos.x .. "/" .. pos.y .. "/" .. pos.z
8✔
65
  ):next(response_handler)
8✔
66
end
67

68
function blockexchange.api.get_next_schemapart_by_mtime(schema_uid, mtime)
2✔
NEW
69
  return Promise.http(
×
70
    http,
NEW
71
    url .. "/api/schemapart_next/by-mtime/" .. schema_uid .. "/" .. mtime
×
NEW
72
  ):next(response_handler)
×
73
end
74

75
function blockexchange.api.count_next_schemapart_by_mtime(schema_uid, mtime)
2✔
76
  return Promise.http(
2✔
77
    http,
1✔
78
    url .. "/api/schemapart_count/by-mtime/" .. schema_uid .. "/" .. mtime
1✔
79
  ):next(function(res)
2✔
80
    if res.code == 200 then
1✔
81
      return res.text()
1✔
NEW
82
    elseif res.code == 404 or res.code == 204 then
×
NEW
83
      return false
×
84
    else
NEW
85
      return Promise.rejected("unexpected http code: " .. res.code)
×
86
    end
87
  end):next(function(txt)
2✔
88
    return tonumber(txt)
1✔
89
  end)
90
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc