~james/core

core/api/org_tangled/trackticket.go -rw-r--r-- 5.2 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 16 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package org_tangled

// schema: org.tangled.track.ticket

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"

	comatprototypes "github.com/bluesky-social/indigo/api/atproto"
	"github.com/bluesky-social/indigo/lex/util"
	cbg "github.com/whyrusleeping/cbor-gen"
)

const (
	TrackTicketNSID = "org.tangled.track.ticket"
)

func init() {
	util.RegisterType("org.tangled.track.ticket", &TrackTicket{})
} //
// RECORDTYPE: TrackTicket
type TrackTicket struct {
	LexiconTypeID string            `json:"$type,const=org.tangled.track.ticket" cborgen:"$type,const=org.tangled.track.ticket"`
	Assignees     []string          `json:"assignees,omitempty" cborgen:"assignees,omitempty"`
	Body          *TrackTicket_Body `json:"body,omitempty" cborgen:"body,omitempty"`
	CreatedAt     string            `json:"createdAt" cborgen:"createdAt"`
	// labels: Self-label values for this record.
	Labels        *comatprototypes.LabelDefs_SelfLabels `json:"labels,omitempty" cborgen:"labels,omitempty"`
	State         *string                               `json:"state" cborgen:"state"`
	TangledLabels []*TrackTicket_TangledLabels_Elem     `json:"tangledLabels,omitempty" cborgen:"tangledLabels,omitempty"`
	// targetBranch: Target branch name. Must not include the `refs/heads/` prefix.
	TargetBranch *string            `json:"targetBranch,omitempty" cborgen:"targetBranch,omitempty"`
	Title        *TrackTicket_Title `json:"title" cborgen:"title"`
}

type TrackTicket_Body struct {
	MarkupMarkdown *MarkupMarkdown
}

func (t *TrackTicket_Body) MarshalJSON() ([]byte, error) {
	if t.MarkupMarkdown != nil {
		t.MarkupMarkdown.LexiconTypeID = "org.tangled.markup.markdown"
		return json.Marshal(t.MarkupMarkdown)
	}
	return nil, fmt.Errorf("cannot marshal empty enum")
}
func (t *TrackTicket_Body) UnmarshalJSON(b []byte) error {
	typ, err := util.TypeExtract(b)
	if err != nil {
		return err
	}

	switch typ {
	case "org.tangled.markup.markdown":
		t.MarkupMarkdown = new(MarkupMarkdown)
		return json.Unmarshal(b, t.MarkupMarkdown)

	default:
		return nil
	}
}

func (t *TrackTicket_Body) MarshalCBOR(w io.Writer) error {

	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}
	if t.MarkupMarkdown != nil {
		return t.MarkupMarkdown.MarshalCBOR(w)
	}
	return fmt.Errorf("cannot cbor marshal empty enum")
}
func (t *TrackTicket_Body) UnmarshalCBOR(r io.Reader) error {
	typ, b, err := util.CborTypeExtractReader(r)
	if err != nil {
		return err
	}

	switch typ {
	case "org.tangled.markup.markdown":
		t.MarkupMarkdown = new(MarkupMarkdown)
		return t.MarkupMarkdown.UnmarshalCBOR(bytes.NewReader(b))

	default:
		return nil
	}
}

type TrackTicket_TangledLabels_Elem struct {
	LabelDefs_LabelToken *LabelDefs_LabelToken
}

func (t *TrackTicket_TangledLabels_Elem) MarshalJSON() ([]byte, error) {
	if t.LabelDefs_LabelToken != nil {
		t.LabelDefs_LabelToken.LexiconTypeID = "org.tangled.label.defs#labelToken"
		return json.Marshal(t.LabelDefs_LabelToken)
	}
	return nil, fmt.Errorf("cannot marshal empty enum")
}
func (t *TrackTicket_TangledLabels_Elem) UnmarshalJSON(b []byte) error {
	typ, err := util.TypeExtract(b)
	if err != nil {
		return err
	}

	switch typ {
	case "org.tangled.label.defs#labelToken":
		t.LabelDefs_LabelToken = new(LabelDefs_LabelToken)
		return json.Unmarshal(b, t.LabelDefs_LabelToken)

	default:
		return nil
	}
}

func (t *TrackTicket_TangledLabels_Elem) MarshalCBOR(w io.Writer) error {

	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}
	if t.LabelDefs_LabelToken != nil {
		return t.LabelDefs_LabelToken.MarshalCBOR(w)
	}
	return fmt.Errorf("cannot cbor marshal empty enum")
}
func (t *TrackTicket_TangledLabels_Elem) UnmarshalCBOR(r io.Reader) error {
	typ, b, err := util.CborTypeExtractReader(r)
	if err != nil {
		return err
	}

	switch typ {
	case "org.tangled.label.defs#labelToken":
		t.LabelDefs_LabelToken = new(LabelDefs_LabelToken)
		return t.LabelDefs_LabelToken.UnmarshalCBOR(bytes.NewReader(b))

	default:
		return nil
	}
}

type TrackTicket_Title struct {
	MarkupMarkdown_Inline *MarkupMarkdown_Inline
}

func (t *TrackTicket_Title) MarshalJSON() ([]byte, error) {
	if t.MarkupMarkdown_Inline != nil {
		t.MarkupMarkdown_Inline.LexiconTypeID = "org.tangled.markup.markdown#inline"
		return json.Marshal(t.MarkupMarkdown_Inline)
	}
	return nil, fmt.Errorf("cannot marshal empty enum")
}
func (t *TrackTicket_Title) UnmarshalJSON(b []byte) error {
	typ, err := util.TypeExtract(b)
	if err != nil {
		return err
	}

	switch typ {
	case "org.tangled.markup.markdown#inline":
		t.MarkupMarkdown_Inline = new(MarkupMarkdown_Inline)
		return json.Unmarshal(b, t.MarkupMarkdown_Inline)

	default:
		return nil
	}
}

func (t *TrackTicket_Title) MarshalCBOR(w io.Writer) error {

	if t == nil {
		_, err := w.Write(cbg.CborNull)
		return err
	}
	if t.MarkupMarkdown_Inline != nil {
		return t.MarkupMarkdown_Inline.MarshalCBOR(w)
	}
	return fmt.Errorf("cannot cbor marshal empty enum")
}
func (t *TrackTicket_Title) UnmarshalCBOR(r io.Reader) error {
	typ, b, err := util.CborTypeExtractReader(r)
	if err != nil {
		return err
	}

	switch typ {
	case "org.tangled.markup.markdown#inline":
		t.MarkupMarkdown_Inline = new(MarkupMarkdown_Inline)
		return t.MarkupMarkdown_Inline.UnmarshalCBOR(bytes.NewReader(b))

	default:
		return nil
	}
}