aboutsummaryrefslogtreecommitdiff
path: root/pkg/rest/gnsregistrar.go
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2024-01-13 12:48:25 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2024-01-13 12:48:25 +0100
commit5ed1673d40847153e01d5c83efe6fc373d0062da (patch)
treec688228f3de6c9fec208d2017eedc1638643759e /pkg/rest/gnsregistrar.go
parent84c4dce194d9fbcc29aabd63a192ba6cddb12274 (diff)
downloadgnunet-gns-registrar-5ed1673d40847153e01d5c83efe6fc373d0062da.tar.gz
gnunet-gns-registrar-5ed1673d40847153e01d5c83efe6fc373d0062da.zip
Add struct documentation and references
Diffstat (limited to 'pkg/rest/gnsregistrar.go')
-rw-r--r--pkg/rest/gnsregistrar.go45
1 files changed, 42 insertions, 3 deletions
diff --git a/pkg/rest/gnsregistrar.go b/pkg/rest/gnsregistrar.go
index faa6c4f..b119300 100644
--- a/pkg/rest/gnsregistrar.go
+++ b/pkg/rest/gnsregistrar.go
@@ -41,39 +41,78 @@ import (
41 talerutil "github.com/schanzen/taler-go/pkg/util" 41 talerutil "github.com/schanzen/taler-go/pkg/util"
42) 42)
43 43
44type RegistrationMetadata struct { 44// This is metadata stored in the namestore next to a registered zone key.
45// It is always stored in a private metadata record and holds registration information such
46// as payment status and expiration.
47type RegistrationMetadata struct {
48 // The expiration in GNS-compatible 64-bit microseconds epoch.
45 Expiration uint64 `json:"expiration"` 49 Expiration uint64 `json:"expiration"`
46 Paid bool `json:"paid"` 50
51 // Indication if this registration is already paid and active.
52 Paid bool `json:"paid"`
53
54 // The unique order identifier (as received through https://docs.taler.net/core/api-merchant.html).
47 OrderID string `json:"order_id"` 55 OrderID string `json:"order_id"`
56
57 // The unique registration identifier used as token for registration management by customer.
48 RegistrationID string `json:"registration_id"` 58 RegistrationID string `json:"registration_id"`
59
60 // The payment deadline. FIXME this may also be part of the order somehow in the Taler API.
49 NeedsPaymentUntil time.Time `json:"needs_payment_until"` 61 NeedsPaymentUntil time.Time `json:"needs_payment_until"`
50} 62}
51 63
64// See https://docs.gnunet.org/latest/developers/rest-api/identity.html
52type IdentityInfo struct { 65type IdentityInfo struct {
66 // Base32-encoded GNS zone key
53 Pubkey string `json:"pubkey"` 67 Pubkey string `json:"pubkey"`
68
69 // The name of the zone/identity
54 Name string `json:"name"` 70 Name string `json:"name"`
55} 71}
56 72
57 73// See https://gana.gnunet.org/gnunet-error-codes/gnunet_error_codes.html
58type GnunetError struct { 74type GnunetError struct {
75 // Error description
59 Description string `json:"error"` 76 Description string `json:"error"`
77
78 // Error code
60 Code uint32 `json:"error_code"` 79 Code uint32 `json:"error_code"`
61} 80}
62 81
82// See https://docs.gnunet.org/latest/developers/rest-api/namestore.html
63type RecordData struct { 83type RecordData struct {
84 // The string representation of the record data value, e.g. "1.2.3.4" for an A record
64 Value string `json:"value"` 85 Value string `json:"value"`
86
87 // The string representation of the record type, e.g. "A" for an IPv4 address
65 RecordType string `json:"record_type"` 88 RecordType string `json:"record_type"`
89
90 // The relative expiration time, in microseconds. Set if is_relative_expiration: true
66 RelativeExpiration uint64 `json:"relative_expiration"` 91 RelativeExpiration uint64 `json:"relative_expiration"`
92
93 // Whether or not this is a private record
67 IsPrivate bool `json:"is_private"` 94 IsPrivate bool `json:"is_private"`
95
96 // Whether or not the expiration time is relative (else absolute)
68 IsRelativeExpiration bool `json:"is_relative_expiration"` 97 IsRelativeExpiration bool `json:"is_relative_expiration"`
98
99 // Whether or not this is a supplemental record
69 IsSupplemental bool `json:"is_supplemental"` 100 IsSupplemental bool `json:"is_supplemental"`
101
102 // Whether or not this is a shadow record
70 IsShadow bool `json:"is_shadow"` 103 IsShadow bool `json:"is_shadow"`
104
105 // Whether or not this is a maintenance record
71 IsMaintenance bool `json:"is_maintenance"` 106 IsMaintenance bool `json:"is_maintenance"`
72 107
73} 108}
74 109
110// See https://docs.gnunet.org/latest/developers/rest-api/namestore.html
75type NamestoreRecord struct { 111type NamestoreRecord struct {
112 // Name of the record set
76 RecordName string `json:"record_name"` 113 RecordName string `json:"record_name"`
114
115 // The record set
77 Records []RecordData `json:"data"` 116 Records []RecordData `json:"data"`
78} 117}
79 118