~james/core

core/api/org_tangled/feeddefs.go -rw-r--r-- 2.4 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
// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package org_tangled

// schema: org.tangled.feed.defs

import (
	"encoding/json"
	"fmt"

	comatprototypes "github.com/bluesky-social/indigo/api/atproto"
	"github.com/bluesky-social/indigo/lex/util"
)

const ()

// FeedDefs_CommentView is a "commentView" in the org.tangled.feed.defs schema.
type FeedDefs_CommentView struct {
	Body      *FeedDefs_CommentView_Body `json:"body" cborgen:"body"`
	Cid       string                     `json:"cid" cborgen:"cid"`
	CreatedAt string                     `json:"createdAt" cborgen:"createdAt"`
	// editor: Who wrote this version (`x-tngl-editor`). A knot-hosted comment's uri names the repo, not the writer.
	Editor  *string                        `json:"editor,omitempty" cborgen:"editor,omitempty"`
	Embed   *FeedDefs_CommentView_Embed    `json:"embed,omitempty" cborgen:"embed,omitempty"`
	ReplyTo *comatprototypes.RepoStrongRef `json:"replyTo,omitempty" cborgen:"replyTo,omitempty"`
	Subject *comatprototypes.RepoStrongRef `json:"subject" cborgen:"subject"`
	Uri     string                         `json:"uri" cborgen:"uri"`
}

type FeedDefs_CommentView_Body struct {
	MarkupMarkdown *MarkupMarkdown
}

func (t *FeedDefs_CommentView_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 *FeedDefs_CommentView_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
	}
}

type FeedDefs_CommentView_Embed struct {
	EmbedCommit_View *EmbedCommit_View
}

func (t *FeedDefs_CommentView_Embed) MarshalJSON() ([]byte, error) {
	if t.EmbedCommit_View != nil {
		t.EmbedCommit_View.LexiconTypeID = "org.tangled.embed.commit#view"
		return json.Marshal(t.EmbedCommit_View)
	}
	return nil, fmt.Errorf("cannot marshal empty enum")
}
func (t *FeedDefs_CommentView_Embed) UnmarshalJSON(b []byte) error {
	typ, err := util.TypeExtract(b)
	if err != nil {
		return err
	}

	switch typ {
	case "org.tangled.embed.commit#view":
		t.EmbedCommit_View = new(EmbedCommit_View)
		return json.Unmarshal(b, t.EmbedCommit_View)

	default:
		return nil
	}
}