feat(client): net primitives — DmResponse, NarrateResult, DmTransport, ProxyConfig
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
25
client/scripts/net/dm_response.gd
Normal file
25
client/scripts/net/dm_response.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
class_name DmResponse
|
||||
extends RefCounted
|
||||
## The raw outcome of one HTTP attempt, independent of any game meaning.
|
||||
## `status` is 0 when the transport never reached the server; `body` is the
|
||||
## parsed JSON dict, or null when the body was absent or not JSON.
|
||||
|
||||
var status: int
|
||||
var body # Variant: parsed JSON (Dictionary) or null
|
||||
var transport_ok: bool
|
||||
var error: String
|
||||
|
||||
|
||||
func _init(p_status := 0, p_body = null, p_transport_ok := false, p_error := "") -> void:
|
||||
status = p_status
|
||||
body = p_body
|
||||
transport_ok = p_transport_ok
|
||||
error = p_error
|
||||
|
||||
|
||||
static func ok(p_status: int, p_body) -> DmResponse:
|
||||
return DmResponse.new(p_status, p_body, true, "")
|
||||
|
||||
|
||||
static func failed(p_error: String) -> DmResponse:
|
||||
return DmResponse.new(0, null, false, p_error)
|
||||
Reference in New Issue
Block a user