From 44dbe8c93471178519dcd39f869975e3bfde6afb Mon Sep 17 00:00:00 2001 From: Elara Musayelyan Date: Sun, 24 Sep 2023 19:28:46 -0700 Subject: [PATCH] Rewrite generator and update for Lemmy 0.18.3 --- README.md | 24 +- cmd/gen/extractor/extractor.go | 192 +++ cmd/gen/generator/routes.go | 54 +- cmd/gen/generator/struct.go | 93 +- cmd/gen/main.go | 162 +- cmd/gen/parser/impl.go | 62 - cmd/gen/parser/routes.go | 121 -- cmd/gen/parser/struct.go | 274 ---- cmd/gen/parser/struct_test.go | 49 - go.mod | 5 +- go.sum | 10 +- routes.gen.go | 2006 ++++++++++++++----------- types/activity.gen.go | 27 - types/actor_language.gen.go | 32 - types/build_response.gen.go | 4 - types/comment.1.gen.go | 67 - types/comment.gen.go | 98 -- types/comment_reply.gen.go | 20 - types/comment_report.gen.go | 22 - types/community.1.gen.go | 113 -- types/community.gen.go | 117 -- types/community_block.gen.go | 15 - types/custom_emoji.1.gen.go | 28 - types/custom_emoji.gen.go | 34 - types/custom_emoji_keyword.gen.go | 14 - types/email_verification.gen.go | 17 - types/federation_allowlist.gen.go | 15 - types/federation_blocklist.gen.go | 15 - types/instance.gen.go | 19 - types/language.gen.go | 10 - types/lib.1.gen.go | 95 -- types/lib.gen.go | 4 - types/local_site.gen.go | 77 - types/local_site_rate_limit.gen.go | 53 - types/local_user.gen.go | 66 - types/mod.gen.go | 4 - types/moderator.gen.go | 205 --- types/password_reset_request.gen.go | 15 - types/person.1.gen.go | 84 -- types/person.gen.go | 212 --- types/person_block.gen.go | 15 - types/person_mention.gen.go | 20 - types/post.1.gen.go | 102 -- types/post.gen.go | 129 -- types/post_report.gen.go | 26 - types/private_message.1.gen.go | 37 - types/private_message.gen.go | 63 - types/private_message_report.gen.go | 22 - types/registration_application.gen.go | 21 - types/request.gen.go | 4 - types/secret.gen.go | 9 - types/sensitive.gen.go | 4 - types/site.1.gen.go | 48 - types/site.gen.go | 243 --- types/structs.1.gen.go | 86 -- types/structs.2.gen.go | 95 -- types/structs.3.gen.go | 76 - types/structs.gen.go | 63 - types/tagline.gen.go | 17 - types/types.gen.go | 1596 ++++++++++++++++++++ types/types.go | 4 + types/utils.gen.go | 14 - 62 files changed, 3034 insertions(+), 4194 deletions(-) create mode 100644 cmd/gen/extractor/extractor.go delete mode 100644 cmd/gen/parser/impl.go delete mode 100644 cmd/gen/parser/routes.go delete mode 100644 cmd/gen/parser/struct.go delete mode 100644 cmd/gen/parser/struct_test.go delete mode 100644 types/activity.gen.go delete mode 100644 types/actor_language.gen.go delete mode 100644 types/build_response.gen.go delete mode 100644 types/comment.1.gen.go delete mode 100644 types/comment.gen.go delete mode 100644 types/comment_reply.gen.go delete mode 100644 types/comment_report.gen.go delete mode 100644 types/community.1.gen.go delete mode 100644 types/community.gen.go delete mode 100644 types/community_block.gen.go delete mode 100644 types/custom_emoji.1.gen.go delete mode 100644 types/custom_emoji.gen.go delete mode 100644 types/custom_emoji_keyword.gen.go delete mode 100644 types/email_verification.gen.go delete mode 100644 types/federation_allowlist.gen.go delete mode 100644 types/federation_blocklist.gen.go delete mode 100644 types/instance.gen.go delete mode 100644 types/language.gen.go delete mode 100644 types/lib.1.gen.go delete mode 100644 types/lib.gen.go delete mode 100644 types/local_site.gen.go delete mode 100644 types/local_site_rate_limit.gen.go delete mode 100644 types/local_user.gen.go delete mode 100644 types/mod.gen.go delete mode 100644 types/moderator.gen.go delete mode 100644 types/password_reset_request.gen.go delete mode 100644 types/person.1.gen.go delete mode 100644 types/person.gen.go delete mode 100644 types/person_block.gen.go delete mode 100644 types/person_mention.gen.go delete mode 100644 types/post.1.gen.go delete mode 100644 types/post.gen.go delete mode 100644 types/post_report.gen.go delete mode 100644 types/private_message.1.gen.go delete mode 100644 types/private_message.gen.go delete mode 100644 types/private_message_report.gen.go delete mode 100644 types/registration_application.gen.go delete mode 100644 types/request.gen.go delete mode 100644 types/secret.gen.go delete mode 100644 types/sensitive.gen.go delete mode 100644 types/site.1.gen.go delete mode 100644 types/site.gen.go delete mode 100644 types/structs.1.gen.go delete mode 100644 types/structs.2.gen.go delete mode 100644 types/structs.3.gen.go delete mode 100644 types/structs.gen.go delete mode 100644 types/tagline.gen.go create mode 100644 types/types.gen.go delete mode 100644 types/utils.gen.go diff --git a/README.md b/README.md index 303239c..0003e3b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Go Reference](https://pkg.go.dev/badge/go.arsenm.dev/go-lemmy.svg)](https://pkg.go.dev/go.elara.ws/go-lemmy) -Go bindings to the [Lemmy](https://join-lemmy.org) API, automatically generated directly from Lemmy's source code using the generator in [cmd/gen](cmd/gen). +Go bindings to the [Lemmy](https://join-lemmy.org) API, automatically generated from Lemmy's source code using the generator in [cmd/gen](cmd/gen). Examples: @@ -10,18 +10,24 @@ Examples: ### How to generate -First, build the generator: +First, clone the [lemmy-js-client](https://github.com/LemmyNet/lemmy-js-client) repo at whatever version you need: + +```bash +git clone https://github.com/LemmyNet/lemmy-js-client -b 0.18.3 +``` + +Inside it, build the JSON docs file: + +```bash +npm run docs -- --json docs.json +``` + +Next, build the generator: ```bash go build ./cmd/gen ``` -Clone Lemmy's source code at whatever version you need: - -```bash -git clone https://github.com/LemmyNet/lemmy -b 0.16.7 -``` - Remove all the existing generated code: ```bash @@ -31,7 +37,7 @@ rm **/*.gen.go Execute the generator: ```bash -./gen -out-dir . +./gen -json-file -out-dir . ``` And that's it! Your generated code should be ready for use. diff --git a/cmd/gen/extractor/extractor.go b/cmd/gen/extractor/extractor.go new file mode 100644 index 0000000..608a116 --- /dev/null +++ b/cmd/gen/extractor/extractor.go @@ -0,0 +1,192 @@ +package extractor + +import ( + "fmt" + "os" + "strings" + + "github.com/tidwall/gjson" +) + +type Route struct { + Name string + Summary string + Method string + Path string + ParamsName string + ParamsID int64 + ReturnName string + ReturnID int64 +} + +type Struct struct { + Name string + Fields []Field + UnionNames []string +} + +type Field struct { + Name string + IsArray bool + IsOptional bool + Type string +} + +type Extractor struct { + root gjson.Result +} + +func New(path string) (*Extractor, error) { + data, err := os.ReadFile(path) + if err != nil { + return nil, err + } + + return &Extractor{gjson.ParseBytes(data)}, nil +} + +func (e *Extractor) Routes() []Route { + var out []Route + routes := e.root.Get("children.#.children.#(kind==2048)#|@flatten") + for _, route := range routes.Array() { + name := route.Get("name").String() + signature := route.Get(`signatures.0`) + + httpInfo := signature.Get(`comment.summary.#(kind=="code").text`).String() + if !strings.HasPrefix(httpInfo, "`HTTP") { + continue + } + method, path := parseHTTPInfo(httpInfo) + + summary := strings.TrimSpace(signature.Get(`comment.summary.#(kind=="text").text`).String()) + if summary == "" { + continue + } + + paramsID := signature.Get("parameters.0.type.target").Int() + paramsName := signature.Get("parameters.0.type.name").String() + returnID := signature.Get("type.typeArguments.0.target").Int() + returnName := signature.Get("type.typeArguments.0.name").String() + + out = append(out, Route{ + Name: name, + Summary: summary, + Method: method, + Path: path, + ParamsName: paramsName, + ParamsID: paramsID, + ReturnName: returnName, + ReturnID: returnID, + }) + } + return out +} + +func (e *Extractor) Structs(routes []Route) []Struct { + var ids []int64 + for _, route := range routes { + ids = append(ids, route.ParamsID) + if route.ReturnID != 0 { + ids = append(ids, route.ReturnID) + } + } + + structs := map[int64]Struct{} + e.getStructs(ids, structs) + return getKeys(structs) +} + +func (e *Extractor) getStructs(ids []int64, structs map[int64]Struct) { + for _, id := range ids { + if _, ok := structs[id]; ok { + continue + } + + jstruct := e.root.Get(fmt.Sprintf("children.#(id==%d)", id)) + if !jstruct.Exists() { + continue + } + + name := jstruct.Get("name").String() + + if jstruct.Get("type.type").String() == "union" { + structs[id] = Struct{ + Name: name, + UnionNames: e.unionNames(jstruct), + } + } else { + fields, newIDs := e.fields(jstruct) + + structs[id] = Struct{ + Name: name, + Fields: fields, + } + + e.getStructs(newIDs, structs) + } + + } +} + +func (e *Extractor) unionNames(jstruct gjson.Result) []string { + jnames := jstruct.Get("type.types").Array() + out := make([]string, len(jnames)) + for i, name := range jnames { + out[i] = name.Get("value").String() + } + return out +} + +func (e *Extractor) fields(jstruct gjson.Result) ([]Field, []int64) { + var fields []Field + var ids []int64 + jfields := jstruct.Get("children").Array() + for _, jfield := range jfields { + var field Field + + field.Name = jfield.Get("name").String() + field.IsOptional = jfield.Get("flags.isOptional").Bool() + + if jfield.Get("type.type").String() == "array" { + field.IsArray = true + field.Type = jfield.Get("type.elementType.name").String() + + switch jfield.Get("type.elementType.type").String() { + case "reference": + ids = append(ids, jfield.Get("type.elementType.target").Int()) + case "union": + field.Type = "string" + } + } else { + field.Type = jfield.Get("type.name").String() + + switch jfield.Get("type.type").String() { + case "reference": + ids = append(ids, jfield.Get("type.target").Int()) + case "union": + field.Type = "string" + } + } + + fields = append(fields, field) + } + return fields, ids +} + +func parseHTTPInfo(httpInfo string) (method, path string) { + httpInfo = strings.Trim(httpInfo, "`") + method, path, _ = strings.Cut(httpInfo, " ") + method = strings.TrimPrefix(method, "HTTP.") + method = strings.ToUpper(method) + return method, path +} + +func getKeys(m map[int64]Struct) []Struct { + out := make([]Struct, len(m)) + i := 0 + for _, s := range m { + out[i] = s + i++ + } + return out +} diff --git a/cmd/gen/generator/routes.go b/cmd/gen/generator/routes.go index d0048e7..2ba9286 100644 --- a/cmd/gen/generator/routes.go +++ b/cmd/gen/generator/routes.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/dave/jennifer/jen" - "go.elara.ws/go-lemmy/cmd/gen/parser" + "go.elara.ws/go-lemmy/cmd/gen/extractor" ) type RoutesGenerator struct { @@ -17,23 +17,30 @@ func NewRoutes(w io.Writer, pkgName string) *RoutesGenerator { return &RoutesGenerator{w, pkgName} } -func (r *RoutesGenerator) Generate(routes []parser.Route, impls map[string]string) error { +func (r *RoutesGenerator) Generate(routes []extractor.Route) error { f := jen.NewFile(r.PkgName) f.HeaderComment("Code generated by go.elara.ws/go-lemmy/cmd/gen (routes generator). DO NOT EDIT.") for _, r := range routes { - resStruct := impls[r.Struct] + f.Comment(r.Summary) f.Func().Params( jen.Id("c").Id("*Client"), - ).Id(transformName(r.Struct)).Params( + ).Id(transformName(r.Name)).Params( jen.Id("ctx").Qual("context", "Context"), - jen.Id("data").Qual("go.elara.ws/go-lemmy/types", r.Struct), - ).Params( - jen.Op("*").Qual("go.elara.ws/go-lemmy/types", resStruct), - jen.Error(), - ).BlockFunc(func(g *jen.Group) { - g.Id("resData").Op(":=").Op("&").Qual("go.elara.ws/go-lemmy/types", resStruct).Block() + jen.Id("data").Qual("go.elara.ws/go-lemmy/types", r.ParamsName), + ).ParamsFunc(func(g *jen.Group) { + if r.ReturnName != "" { + g.Op("*").Qual("go.elara.ws/go-lemmy/types", r.ReturnName) + } + g.Error() + }).BlockFunc(func(g *jen.Group) { + returnName := r.ReturnName + if returnName == "" { + returnName = "EmptyResponse" + } + + g.Id("resData").Op(":=").Op("&").Qual("go.elara.ws/go-lemmy/types", returnName).Block() var funcName string switch r.Method { @@ -46,16 +53,28 @@ func (r *RoutesGenerator) Generate(routes []parser.Route, impls map[string]strin g.List(jen.Id("res"), jen.Err()).Op(":=").Id("c").Dot(funcName).Params( jen.Id("ctx"), jen.Lit(r.Method), jen.Lit(r.Path), jen.Id("data"), jen.Op("&").Id("resData"), ) - g.If(jen.Err().Op("!=").Nil()).Block( - jen.Return(jen.Nil(), jen.Err()), - ) + g.If(jen.Err().Op("!=").Nil()).BlockFunc(func(g *jen.Group) { + if returnName == "EmptyResponse" { + g.Return(jen.Err()) + } else { + g.Return(jen.Nil(), jen.Err()) + } + }) g.Err().Op("=").Id("resError").Params(jen.Id("res"), jen.Id("resData").Dot("LemmyResponse")) - g.If(jen.Err().Op("!=").Nil()).Block( - jen.Return(jen.Nil(), jen.Err()), - ) + g.If(jen.Err().Op("!=").Nil()).BlockFunc(func(g *jen.Group) { + if returnName == "EmptyResponse" { + g.Return(jen.Err()) + } else { + g.Return(jen.Nil(), jen.Err()) + } + }) - g.Return(jen.Id("resData"), jen.Nil()) + if returnName == "EmptyResponse" { + g.Return(jen.Nil()) + } else { + g.Return(jen.Id("resData"), jen.Nil()) + } }) } @@ -63,6 +82,7 @@ func (r *RoutesGenerator) Generate(routes []parser.Route, impls map[string]strin } func transformName(s string) string { + s = strings.ToUpper(s[:1]) + s[1:] s = strings.TrimPrefix(s, "Get") s = strings.TrimPrefix(s, "List") return s diff --git a/cmd/gen/generator/struct.go b/cmd/gen/generator/struct.go index 857b553..61242c4 100644 --- a/cmd/gen/generator/struct.go +++ b/cmd/gen/generator/struct.go @@ -3,9 +3,10 @@ package generator import ( "io" "strings" + "unicode" "github.com/dave/jennifer/jen" - "go.elara.ws/go-lemmy/cmd/gen/parser" + "go.elara.ws/go-lemmy/cmd/gen/extractor" ) type StructGenerator struct { @@ -17,36 +18,88 @@ func NewStruct(w io.Writer, pkgName string) *StructGenerator { return &StructGenerator{w, pkgName} } -func (s *StructGenerator) Generate(items []parser.Item) error { +func (s *StructGenerator) Generate(items []extractor.Struct) error { f := jen.NewFile(s.PkgName) f.HeaderComment("Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.") - + for _, item := range items { - if item.Struct != nil { - st := item.Struct - f.Type().Id(st.Name).StructFunc(func(g *jen.Group) { - for _, field := range st.Fields { - g.Id(field.Name).Id(field.Type).Tag(map[string]string{ - "json": field.OrigName, - "url": field.OrigName + ",omitempty", + if len(item.UnionNames) > 0 { + f.Type().Id(item.Name).String() + + f.Const().DefsFunc(func(g *jen.Group) { + for _, member := range item.UnionNames { + constName := strings.Replace(item.Name+string(member), " ", "", -1) + g.Id(constName).Id(item.Name).Op("=").Lit(string(member)) + } + }) + } else { + f.Type().Id(item.Name).StructFunc(func(g *jen.Group) { + for _, field := range item.Fields { + g.Id(transformFieldName(field.Name)).Id(getType(field)).Tag(map[string]string{ + "json": field.Name, + "url": field.Name + ",omitempty", }) } - if strings.HasSuffix(st.Name, "Response") { + if strings.HasSuffix(item.Name, "Response") { g.Id("LemmyResponse") } }) - } else if item.Enum != nil { - e := item.Enum - f.Type().Id(e.Name).String() - - f.Const().DefsFunc(func(g *jen.Group) { - for _, member := range e.Members { - g.Id(e.Name + string(member)).Id(e.Name).Op("=").Lit(string(member)) - } - }) } } return f.Render(s.w) } + +func getType(f extractor.Field) string { + t := transformType(f.Type) + if f.IsArray { + t = "[]" + t + } + if f.IsOptional { + t = "Optional[" + t + "]" + } + return t +} + +func transformType(s string) string { + switch s { + case "number": + return "float64" + case "boolean": + return "bool" + default: + return s + } +} + +func transformFieldName(s string) string { + s = snakeToCamel(s) + s = strings.NewReplacer( + "Id", "ID", + "Url", "URL", + "Nsfw", "NSFW", + "Jwt", "JWT", + "Crud", "CRUD", + ).Replace(s) + return s +} + +func snakeToCamel(s string) string { + sb := &strings.Builder{} + capitalizeNext := true + for _, char := range s { + if char == '_' { + capitalizeNext = true + continue + } + + if capitalizeNext { + sb.WriteRune(unicode.ToUpper(char)) + capitalizeNext = false + } else { + sb.WriteRune(char) + } + } + return sb.String() +} diff --git a/cmd/gen/main.go b/cmd/gen/main.go index 386985c..e7f74db 100644 --- a/cmd/gen/main.go +++ b/cmd/gen/main.go @@ -2,14 +2,11 @@ package main import ( "flag" - "io/fs" "os" "path/filepath" - "strconv" - "strings" + "go.elara.ws/go-lemmy/cmd/gen/extractor" "go.elara.ws/go-lemmy/cmd/gen/generator" - "go.elara.ws/go-lemmy/cmd/gen/parser" "go.elara.ws/logger" "go.elara.ws/logger/log" ) @@ -18,145 +15,33 @@ func init() { log.Logger = logger.NewPretty(os.Stderr) } -var implDirs = [...]string{ - "crates/api_crud/src", - "crates/apub/src/api", - "crates/api/src", -} - -var structDirs = [...]string{ - "crates/api_common", - "crates/db_schema/src/source", - "crates/db_views_actor/src/structs.rs", - "crates/db_views/src/structs.rs", - "crates/db_views_moderator/src/structs.rs", - "crates/db_schema/src/aggregates/structs.rs", - "crates/db_schema/src/lib.rs", - "crates/websocket/src/lib.rs", -} - -const routesFile = "src/api_routes_http.rs" - func main() { - lemmyDir := flag.String("lemmy-dir", "lemmy", "Path to Lemmy repository") + jsonFile := flag.String("json-file", "lemmy.json", "Path to the JSON file generated from lemmy's docs") outDir := flag.String("out-dir", "out", "Directory to write output in") flag.Parse() - baseStructDir := filepath.Join(*outDir, "types") - sp := parser.NewStruct(nil) - sp.Skip = []string{"LemmyContext", "Recipient", "WsMessage", "Connect", "SessionInfo"} - for _, structDir := range structDirs { - dir := filepath.Join(*lemmyDir, structDir) - err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { - if err != nil { - return nil - } - - if d.IsDir() { - return nil - } - if filepath.Ext(path) != ".rs" { - return nil - } - - name := d.Name() - if name == "context.rs" || - name == "local_user_language.rs" || - name == "chat_server.rs" { - return nil - } - - fl, err := os.Open(path) - if err != nil { - return err - } - defer fl.Close() - - sp.Reset(fl) - fileStructs, err := sp.Parse() - if err != nil { - return err - } - - nameNoExt := strings.TrimSuffix(d.Name(), ".rs") - goFilePath := filepath.Join(baseStructDir, nameNoExt+".gen.go") - - i := 1 - _, err = os.Stat(goFilePath) - for err == nil { - goFilePath = filepath.Join(baseStructDir, nameNoExt+"."+strconv.Itoa(i)+".gen.go") - _, err = os.Stat(goFilePath) - i++ - } - - outFl, err := os.Create(goFilePath) - if err != nil { - return err - } - defer outFl.Close() - - _, err = outFl.WriteString("// Source: " + path + "\n") - if err != nil { - return err - } - - return generator.NewStruct(outFl, "types").Generate(fileStructs) - }) - if err != nil { - log.Fatal("Error walking directory while parsing structs").Err(err).Str("dir", dir).Send() - } - } - - ip := parser.NewImpl(nil) - impls := map[string]string{} - for _, implDir := range implDirs { - dir := filepath.Join(*lemmyDir, implDir) - err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { - if err != nil { - return nil - } - - if d.IsDir() { - return nil - } - if filepath.Ext(path) != ".rs" { - return nil - } - - fl, err := os.Open(path) - if err != nil { - return err - } - defer fl.Close() - - ip.Reset(fl) - implMap, err := ip.Parse() - if err != nil { - return err - } - - for reqStruct, resStruct := range implMap { - impls[reqStruct] = resStruct - } - - return nil - }) - if err != nil { - log.Fatal("Error walking directory while parsing impls").Err(err).Str("dir", dir).Send() - } - } - - routesPath := filepath.Join(*lemmyDir, routesFile) - rf, err := os.Open(routesPath) + e, err := extractor.New(*jsonFile) if err != nil { - log.Fatal("Error opening routes file").Err(err).Send() + log.Fatal("Error creating extractor").Err(err).Send() } - defer rf.Close() - rp := parser.NewRoutes(rf) - routes, err := rp.Parse() + routes := e.Routes() + structs := e.Structs(routes) + + err = os.MkdirAll(filepath.Join(*outDir, "types"), 0o755) if err != nil { - log.Fatal("Error parsing routes file").Err(err).Send() + log.Fatal("Error creating types directory").Err(err).Send() + } + + otf, err := os.Create(filepath.Join(*outDir, "types/types.gen.go")) + if err != nil { + log.Fatal("Error creating types output file").Err(err).Send() + } + defer otf.Close() + + err = generator.NewStruct(otf, "types").Generate(structs) + if err != nil { + log.Fatal("Error generating output routes file").Err(err).Send() } orf, err := os.Create(filepath.Join(*outDir, "routes.gen.go")) @@ -165,12 +50,7 @@ func main() { } defer orf.Close() - _, err = orf.WriteString("// Source: " + routesPath + "\n") - if err != nil { - log.Fatal("Error writing source string to routes file").Err(err).Send() - } - - err = generator.NewRoutes(orf, "lemmy").Generate(routes, impls) + err = generator.NewRoutes(orf, "lemmy").Generate(routes) if err != nil { log.Fatal("Error generating output routes file").Err(err).Send() } diff --git a/cmd/gen/parser/impl.go b/cmd/gen/parser/impl.go deleted file mode 100644 index f9f7352..0000000 --- a/cmd/gen/parser/impl.go +++ /dev/null @@ -1,62 +0,0 @@ -package parser - -import ( - "bufio" - "errors" - "io" - "regexp" -) - -var ( - implRegex = regexp.MustCompile(`impl Perform.* for (.+) {`) - respTypeRegex = regexp.MustCompile(`type Response = (.+);`) -) - -var ErrNoType = errors.New("type line not found") - -type ImplParser struct { - r *bufio.Reader -} - -func NewImpl(r io.Reader) *ImplParser { - return &ImplParser{ - r: bufio.NewReader(r), - } -} - -func (i *ImplParser) Parse() (map[string]string, error) { - out := map[string]string{} - for { - line, err := i.r.ReadString('\n') - if errors.Is(err, io.EOF) { - break - } else if err != nil { - return nil, err - } - - if implRegex.MatchString(line) { - im := implRegex.FindStringSubmatch(line) - - line, err := i.r.ReadString('\n') - if errors.Is(err, io.EOF) { - return nil, io.ErrUnexpectedEOF - } else if err != nil { - return nil, err - } - - if !respTypeRegex.MatchString(line) { - return nil, ErrNoType - } - - rtm := respTypeRegex.FindStringSubmatch(line) - - out[im[1]] = rtm[1] - } - } - - return out, nil -} - -func (i *ImplParser) Reset(r io.Reader) { - i.r.Reset(r) -} diff --git a/cmd/gen/parser/routes.go b/cmd/gen/parser/routes.go deleted file mode 100644 index eb7c7d6..0000000 --- a/cmd/gen/parser/routes.go +++ /dev/null @@ -1,121 +0,0 @@ -package parser - -import ( - "bufio" - "errors" - "io" - "net/url" - "regexp" - "strings" -) - -var ( - scopeRegex = regexp.MustCompile(`web::(?:scope|resource)\("(.*)"\)\n`) - routeRegex = regexp.MustCompile(`\.route\(\n?\s*(?:"(.*)",[ \n])?\s*web::(.+)\(\)\.to\(route_.*::<(.+)>`) -) - -type Route struct { - Path string - Method string - Struct string -} - -type RoutesParser struct { - r *bufio.Reader -} - -func NewRoutes(r io.Reader) *RoutesParser { - return &RoutesParser{ - r: bufio.NewReader(r), - } -} - -func (r *RoutesParser) Parse() ([]Route, error) { - var out []Route - for { - line, err := r.r.ReadString('\n') - if errors.Is(err, io.EOF) { - break - } else if err != nil { - return nil, err - } - - if scopeRegex.MatchString(line) { - scopePath := scopeRegex.FindStringSubmatch(line)[1] - if scopePath == "/api/v3" { - continue - } - - routes, err := r.parseRoutes() - if err != nil { - return nil, err - } - - for i := range routes { - path, err := url.JoinPath(scopePath, routes[i].Path) - if err != nil { - return nil, err - } - routes[i].Path = path - } - - out = append(out, routes...) - } - } - return out, nil -} - -func (r *RoutesParser) parseRoutes() ([]Route, error) { - var out []Route - for { - line, err := r.r.ReadString('\n') - if errors.Is(err, io.EOF) { - if strings.TrimSpace(line)[:1] == ")" { - return out, nil - } else { - return nil, io.ErrUnexpectedEOF - } - } else if err != nil { - return nil, err - } - - if strings.TrimSpace(line) == ".route(" { - lines, err := r.readLines(3) - if err != nil { - return nil, err - } - line += lines - } - - if strings.TrimSpace(line)[:1] == ")" { - return out, nil - } else if strings.HasPrefix(line, "//") { - continue - } else if !routeRegex.MatchString(line) { - continue - } - - sm := routeRegex.FindStringSubmatch(line) - out = append(out, Route{ - Path: sm[1], - Method: strings.ToUpper(sm[2]), - Struct: sm[3], - }) - } -} - -func (r *RoutesParser) readLines(n int) (string, error) { - out := "" - for i := 0; i < n; i++ { - line, err := r.r.ReadString('\n') - if err != nil { - return "", err - } - out += line - } - return out, nil -} - -func (r *RoutesParser) Reset(rd io.Reader) { - r.r.Reset(rd) -} diff --git a/cmd/gen/parser/struct.go b/cmd/gen/parser/struct.go deleted file mode 100644 index 32261a6..0000000 --- a/cmd/gen/parser/struct.go +++ /dev/null @@ -1,274 +0,0 @@ -package parser - -import ( - "bufio" - "errors" - "io" - "regexp" - "strings" - - "golang.org/x/exp/slices" -) - -var ( - structRegex = regexp.MustCompile(`pub struct (.+) \{`) - fieldRegex = regexp.MustCompile(`(?U) {1,1}([^ ]+): (.+),`) - - enumRegex = regexp.MustCompile(`pub enum (.+) \{`) - memberRegex = regexp.MustCompile(` ([^ #]+),\n`) -) - -type Item struct { - Struct *Struct - Enum *Enum -} - -type Struct struct { - Name string - Fields []Field -} - -type Field struct { - OrigName string - Name string - Type string -} - -type Enum struct { - Name string - Members []Member -} - -type Member string - -type StructParser struct { - r *bufio.Reader - Skip []string - TransformName func(string) string - TransformType func(string) string -} - -func NewStruct(r io.Reader) *StructParser { - return &StructParser{ - r: bufio.NewReader(r), - TransformName: TransformNameGo, - TransformType: TransformTypeGo, - } -} - -func (s *StructParser) Parse() ([]Item, error) { - var out []Item - for { - line, err := s.r.ReadString('\n') - if errors.Is(err, io.EOF) { - break - } else if err != nil { - return nil, err - } - - if structRegex.MatchString(line) { - structName := structRegex.FindStringSubmatch(line)[1] - if slices.Contains(s.Skip, structName) { - continue - } - structName = s.TransformName(structName) - - // If the line ends with "}", this is a struct with no fields - if strings.HasSuffix(line, "}\n") { - out = append(out, Item{ - Struct: &Struct{ - Name: structRegex.FindStringSubmatch(line)[1], - }, - }) - continue - } - - fields, err := s.parseStructFields() - if err != nil { - return nil, err - } - - out = append(out, Item{ - Struct: &Struct{ - Name: structName, - Fields: fields, - }, - }) - } else if enumRegex.MatchString(line) { - enumName := enumRegex.FindStringSubmatch(line)[1] - if slices.Contains(s.Skip, enumName) { - continue - } - enumName = s.TransformName(enumName) - - members, err := s.parseEnumMemebers() - if err != nil { - return nil, err - } - - out = append(out, Item{ - Enum: &Enum{ - Name: enumName, - Members: members, - }, - }) - } - } - return out, nil -} - -func (s *StructParser) parseStructFields() ([]Field, error) { - encountered := map[string]struct{}{} - var out []Field - for { - line, err := s.r.ReadString('\n') - if errors.Is(err, io.EOF) { - if strings.HasPrefix(line, "}") { - return out, nil - } else { - return nil, io.ErrUnexpectedEOF - } - } else if err != nil { - return nil, err - } - - if strings.HasPrefix(line, "}") { - return out, nil - } else if strings.HasPrefix(line, "//") { - continue - } else if !fieldRegex.MatchString(line) { - continue - } - - sm := fieldRegex.FindStringSubmatch(line) - if sm[1] == "Example" { - continue - } - - if _, ok := encountered[sm[1]]; ok { - continue - } else { - encountered[sm[1]] = struct{}{} - } - - out = append(out, Field{ - OrigName: sm[1], - Name: s.TransformName(sm[1]), - Type: s.TransformType(sm[2]), - }) - } -} - -func (s *StructParser) parseEnumMemebers() ([]Member, error) { - var out []Member - for { - line, err := s.r.ReadString('\n') - if errors.Is(err, io.EOF) { - if strings.HasPrefix(line, "}") { - return out, nil - } else { - return nil, io.ErrUnexpectedEOF - } - } else if err != nil { - return nil, err - } - - if strings.HasPrefix(line, "}") { - return out, nil - } else if strings.HasPrefix(line, "//") { - continue - } else if !memberRegex.MatchString(line) { - continue - } - - sm := memberRegex.FindStringSubmatch(line) - - out = append(out, Member(sm[1])) - } -} - -// TransformTypeGo transforms Rust types to Go -// -// Example: TransformTypeGo("Option>") // returns "Optional[[]int64]" -func TransformTypeGo(t string) string { - prefix := "" - suffix := "" - - for strings.HasPrefix(t, "Option<") { - t = strings.TrimPrefix(strings.TrimSuffix(t, ">"), "Option<") - prefix += "Optional[" - suffix += "]" - } - - for strings.HasPrefix(t, "Vec<") { - t = strings.TrimPrefix(strings.TrimSuffix(t, ">"), "Vec<") - prefix += "[]" - } - - for strings.HasPrefix(t, "Sensitive<") { - t = strings.TrimPrefix(strings.TrimSuffix(t, ">"), "Sensitive<") - } - - if strings.HasSuffix(t, "Id") { - t = "int" - } - - switch t { - case "String", "Url", "DbUrl", "Ltree": - t = "string" - case "usize": - t = "uint" - case "i64": - t = "int64" - case "i32": - t = "int32" - case "i16": - t = "int16" - case "i8": - t = "int8" - case "chrono::NaiveDateTime": - return "LemmyTime" - case "Value": - return "any" - } - - return prefix + t + suffix -} - -// TransformNameGo transforms conventional Rust naming to -// conventional Go naming. -// -// Example: TransformNameGo("post_id") // returns "PostID" -func TransformNameGo(s string) string { - out := "" - - s = strings.ReplaceAll(s, "Crud", "CRUD") - - splitName := strings.Split(s, "_") - for _, segment := range splitName { - switch segment { - case "id": - out += "ID" - case "url": - out += "URL" - case "nsfw": - out += "NSFW" - case "jwt": - out += "JWT" - case "crud": - out += "CRUD" - default: - if len(segment) == 0 { - continue - } - - out += strings.ToUpper(segment[:1]) + segment[1:] - } - } - - return out -} - -func (s *StructParser) Reset(r io.Reader) { - s.r.Reset(r) -} diff --git a/cmd/gen/parser/struct_test.go b/cmd/gen/parser/struct_test.go deleted file mode 100644 index de23411..0000000 --- a/cmd/gen/parser/struct_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package parser - -import "testing" - -func TestTransformNameGo(t *testing.T) { - type testcase struct { - name string - expect string - } - - cases := []testcase{ - {"post_id", "PostID"}, - {"nsfw", "NSFW"}, - {"test_url", "TestURL"}, - {"some_complex_name_with_id_and_nsfw_and_url", "SomeComplexNameWithIDAndNSFWAndURL"}, - } - - for _, testcase := range cases { - t.Run(testcase.name, func(t *testing.T) { - got := TransformNameGo(testcase.name) - if got != testcase.expect { - t.Errorf("Expected %s, got %s", testcase.expect, got) - } - }) - } -} - -func TestTransformTypeGo(t *testing.T) { - type testcase struct { - typeName string - expect string - } - - cases := []testcase{ - {"i16", "int16"}, - {"Option>", "Optional[[]int64]"}, - {"Url", "string"}, - {"Sensitive", "string"}, - } - - for _, testcase := range cases { - t.Run(testcase.typeName, func(t *testing.T) { - got := TransformTypeGo(testcase.typeName) - if got != testcase.expect { - t.Errorf("Expected %s, got %s", testcase.expect, got) - } - }) - } -} diff --git a/go.mod b/go.mod index 4561fc1..a61d6cb 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,9 @@ module go.elara.ws/go-lemmy go 1.19 require ( - github.com/cenkalti/backoff/v4 v4.2.0 github.com/dave/jennifer v1.6.0 github.com/google/go-querystring v1.1.0 - github.com/gorilla/websocket v1.4.2 + github.com/tidwall/gjson v1.17.0 go.elara.ws/logger v0.0.0-20230421022458-e80700db2090 golang.org/x/exp v0.0.0-20230105000112-eab7a2c85304 ) @@ -14,6 +13,8 @@ require ( require ( github.com/gookit/color v1.5.1 // indirect github.com/mattn/go-isatty v0.0.14 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect golang.org/x/sys v0.1.0 // indirect ) diff --git a/go.sum b/go.sum index b09c8de..16fb61a 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/dave/jennifer v1.6.0 h1:MQ/6emI2xM7wt0tJzJzyUik2Q3Tcn2eE0vtYgh4GPVI= github.com/dave/jennifer v1.6.0/go.mod h1:AxTG893FiZKqxy3FP1kL80VMshSMuz2G+EgvszgGRnk= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= @@ -10,8 +8,6 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/gookit/color v1.5.1 h1:Vjg2VEcdHpwq+oY63s/ksHrgJYCTo0bwWvmmYWdE9fQ= github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -19,6 +15,12 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= +github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= go.elara.ws/logger v0.0.0-20230421022458-e80700db2090 h1:RVC8XvWo6Yw4HUshqx4TSzuBDScDghafU6QFRJ4xPZg= diff --git a/routes.gen.go b/routes.gen.go index 3faa765..b2f52fa 100644 --- a/routes.gen.go +++ b/routes.gen.go @@ -1,4 +1,3 @@ -// Source: lemmy/src/api_routes_http.rs // Code generated by go.elara.ws/go-lemmy/cmd/gen (routes generator). DO NOT EDIT. package lemmy @@ -8,894 +7,7 @@ import ( types "go.elara.ws/go-lemmy/types" ) -func (c *Client) Site(ctx context.Context, data types.GetSite) (*types.GetSiteResponse, error) { - resData := &types.GetSiteResponse{} - res, err := c.getReq(ctx, "GET", "/site", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreateSite(ctx context.Context, data types.CreateSite) (*types.SiteResponse, error) { - resData := &types.SiteResponse{} - res, err := c.req(ctx, "POST", "/site", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) EditSite(ctx context.Context, data types.EditSite) (*types.SiteResponse, error) { - resData := &types.SiteResponse{} - res, err := c.req(ctx, "PUT", "/site", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Modlog(ctx context.Context, data types.GetModlog) (*types.GetModlogResponse, error) { - resData := &types.GetModlogResponse{} - res, err := c.getReq(ctx, "GET", "/modlog", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Search(ctx context.Context, data types.Search) (*types.SearchResponse, error) { - resData := &types.SearchResponse{} - res, err := c.getReq(ctx, "GET", "/search", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) ResolveObject(ctx context.Context, data types.ResolveObject) (*types.ResolveObjectResponse, error) { - resData := &types.ResolveObjectResponse{} - res, err := c.getReq(ctx, "GET", "/resolve_object", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreateCommunity(ctx context.Context, data types.CreateCommunity) (*types.CommunityResponse, error) { - resData := &types.CommunityResponse{} - res, err := c.req(ctx, "POST", "/community", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Community(ctx context.Context, data types.GetCommunity) (*types.GetCommunityResponse, error) { - resData := &types.GetCommunityResponse{} - res, err := c.getReq(ctx, "GET", "/community", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) EditCommunity(ctx context.Context, data types.EditCommunity) (*types.CommunityResponse, error) { - resData := &types.CommunityResponse{} - res, err := c.req(ctx, "PUT", "/community", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) HideCommunity(ctx context.Context, data types.HideCommunity) (*types.CommunityResponse, error) { - resData := &types.CommunityResponse{} - res, err := c.req(ctx, "PUT", "/community/hide", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Communities(ctx context.Context, data types.ListCommunities) (*types.ListCommunitiesResponse, error) { - resData := &types.ListCommunitiesResponse{} - res, err := c.getReq(ctx, "GET", "/community/list", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) FollowCommunity(ctx context.Context, data types.FollowCommunity) (*types.CommunityResponse, error) { - resData := &types.CommunityResponse{} - res, err := c.req(ctx, "POST", "/community/follow", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) BlockCommunity(ctx context.Context, data types.BlockCommunity) (*types.BlockCommunityResponse, error) { - resData := &types.BlockCommunityResponse{} - res, err := c.req(ctx, "POST", "/community/block", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) DeleteCommunity(ctx context.Context, data types.DeleteCommunity) (*types.CommunityResponse, error) { - resData := &types.CommunityResponse{} - res, err := c.req(ctx, "POST", "/community/delete", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) RemoveCommunity(ctx context.Context, data types.RemoveCommunity) (*types.CommunityResponse, error) { - resData := &types.CommunityResponse{} - res, err := c.req(ctx, "POST", "/community/remove", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) TransferCommunity(ctx context.Context, data types.TransferCommunity) (*types.GetCommunityResponse, error) { - resData := &types.GetCommunityResponse{} - res, err := c.req(ctx, "POST", "/community/transfer", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) BanFromCommunity(ctx context.Context, data types.BanFromCommunity) (*types.BanFromCommunityResponse, error) { - resData := &types.BanFromCommunityResponse{} - res, err := c.req(ctx, "POST", "/community/ban_user", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommunity) (*types.AddModToCommunityResponse, error) { - resData := &types.AddModToCommunityResponse{} - res, err := c.req(ctx, "POST", "/community/mod", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) FederatedInstances(ctx context.Context, data types.GetFederatedInstances) (*types.GetFederatedInstancesResponse, error) { - resData := &types.GetFederatedInstancesResponse{} - res, err := c.getReq(ctx, "GET", "/federated_instances", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreatePost(ctx context.Context, data types.CreatePost) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "POST", "/post", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Post(ctx context.Context, data types.GetPost) (*types.GetPostResponse, error) { - resData := &types.GetPostResponse{} - res, err := c.getReq(ctx, "GET", "/post", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) EditPost(ctx context.Context, data types.EditPost) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "PUT", "/post", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) DeletePost(ctx context.Context, data types.DeletePost) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "POST", "/post/delete", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) RemovePost(ctx context.Context, data types.RemovePost) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "POST", "/post/remove", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) MarkPostAsRead(ctx context.Context, data types.MarkPostAsRead) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "POST", "/post/mark_as_read", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) LockPost(ctx context.Context, data types.LockPost) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "POST", "/post/lock", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) FeaturePost(ctx context.Context, data types.FeaturePost) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "POST", "/post/feature", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Posts(ctx context.Context, data types.GetPosts) (*types.GetPostsResponse, error) { - resData := &types.GetPostsResponse{} - res, err := c.getReq(ctx, "GET", "/post/list", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreatePostLike(ctx context.Context, data types.CreatePostLike) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "POST", "/post/like", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) SavePost(ctx context.Context, data types.SavePost) (*types.PostResponse, error) { - resData := &types.PostResponse{} - res, err := c.req(ctx, "PUT", "/post/save", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostReport) (*types.PostReportResponse, error) { - resData := &types.PostReportResponse{} - res, err := c.req(ctx, "POST", "/post/report", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) ResolvePostReport(ctx context.Context, data types.ResolvePostReport) (*types.PostReportResponse, error) { - resData := &types.PostReportResponse{} - res, err := c.req(ctx, "PUT", "/post/report/resolve", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) PostReports(ctx context.Context, data types.ListPostReports) (*types.ListPostReportsResponse, error) { - resData := &types.ListPostReportsResponse{} - res, err := c.getReq(ctx, "GET", "/post/report/list", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) SiteMetadata(ctx context.Context, data types.GetSiteMetadata) (*types.GetSiteMetadataResponse, error) { - resData := &types.GetSiteMetadataResponse{} - res, err := c.getReq(ctx, "GET", "/post/site_metadata", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreateComment(ctx context.Context, data types.CreateComment) (*types.CommentResponse, error) { - resData := &types.CommentResponse{} - res, err := c.req(ctx, "POST", "/comment", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Comment(ctx context.Context, data types.GetComment) (*types.CommentResponse, error) { - resData := &types.CommentResponse{} - res, err := c.getReq(ctx, "GET", "/comment", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) EditComment(ctx context.Context, data types.EditComment) (*types.CommentResponse, error) { - resData := &types.CommentResponse{} - res, err := c.req(ctx, "PUT", "/comment", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) DeleteComment(ctx context.Context, data types.DeleteComment) (*types.CommentResponse, error) { - resData := &types.CommentResponse{} - res, err := c.req(ctx, "POST", "/comment/delete", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) RemoveComment(ctx context.Context, data types.RemoveComment) (*types.CommentResponse, error) { - resData := &types.CommentResponse{} - res, err := c.req(ctx, "POST", "/comment/remove", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data types.MarkCommentReplyAsRead) (*types.CommentReplyResponse, error) { - resData := &types.CommentReplyResponse{} - res, err := c.req(ctx, "POST", "/comment/mark_as_read", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) DistinguishComment(ctx context.Context, data types.DistinguishComment) (*types.CommentResponse, error) { - resData := &types.CommentResponse{} - res, err := c.req(ctx, "POST", "/comment/distinguish", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreateCommentLike(ctx context.Context, data types.CreateCommentLike) (*types.CommentResponse, error) { - resData := &types.CommentResponse{} - res, err := c.req(ctx, "POST", "/comment/like", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) SaveComment(ctx context.Context, data types.SaveComment) (*types.CommentResponse, error) { - resData := &types.CommentResponse{} - res, err := c.req(ctx, "PUT", "/comment/save", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Comments(ctx context.Context, data types.GetComments) (*types.GetCommentsResponse, error) { - resData := &types.GetCommentsResponse{} - res, err := c.getReq(ctx, "GET", "/comment/list", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreateCommentReport(ctx context.Context, data types.CreateCommentReport) (*types.CommentReportResponse, error) { - resData := &types.CommentReportResponse{} - res, err := c.req(ctx, "POST", "/comment/report", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) ResolveCommentReport(ctx context.Context, data types.ResolveCommentReport) (*types.CommentReportResponse, error) { - resData := &types.CommentReportResponse{} - res, err := c.req(ctx, "PUT", "/comment/report/resolve", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CommentReports(ctx context.Context, data types.ListCommentReports) (*types.ListCommentReportsResponse, error) { - resData := &types.ListCommentReportsResponse{} - res, err := c.getReq(ctx, "GET", "/comment/report/list", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) PrivateMessages(ctx context.Context, data types.GetPrivateMessages) (*types.PrivateMessagesResponse, error) { - resData := &types.PrivateMessagesResponse{} - res, err := c.getReq(ctx, "GET", "/private_message/list", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreatePrivateMessage(ctx context.Context, data types.CreatePrivateMessage) (*types.PrivateMessageResponse, error) { - resData := &types.PrivateMessageResponse{} - res, err := c.req(ctx, "POST", "/private_message", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) EditPrivateMessage(ctx context.Context, data types.EditPrivateMessage) (*types.PrivateMessageResponse, error) { - resData := &types.PrivateMessageResponse{} - res, err := c.req(ctx, "PUT", "/private_message", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) DeletePrivateMessage(ctx context.Context, data types.DeletePrivateMessage) (*types.PrivateMessageResponse, error) { - resData := &types.PrivateMessageResponse{} - res, err := c.req(ctx, "POST", "/private_message/delete", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, data types.MarkPrivateMessageAsRead) (*types.PrivateMessageResponse, error) { - resData := &types.PrivateMessageResponse{} - res, err := c.req(ctx, "POST", "/private_message/mark_as_read", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) CreatePrivateMessageReport(ctx context.Context, data types.CreatePrivateMessageReport) (*types.PrivateMessageReportResponse, error) { - resData := &types.PrivateMessageReportResponse{} - res, err := c.req(ctx, "POST", "/private_message/report", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) ResolvePrivateMessageReport(ctx context.Context, data types.ResolvePrivateMessageReport) (*types.PrivateMessageReportResponse, error) { - resData := &types.PrivateMessageReportResponse{} - res, err := c.req(ctx, "PUT", "/private_message/report/resolve", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) PrivateMessageReports(ctx context.Context, data types.ListPrivateMessageReports) (*types.ListPrivateMessageReportsResponse, error) { - resData := &types.ListPrivateMessageReportsResponse{} - res, err := c.getReq(ctx, "GET", "/private_message/report/list", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Register(ctx context.Context, data types.Register) (*types.LoginResponse, error) { - resData := &types.LoginResponse{} - res, err := c.req(ctx, "POST", "/user/register", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails) (*types.GetPersonDetailsResponse, error) { - resData := &types.GetPersonDetailsResponse{} - res, err := c.getReq(ctx, "GET", "/user", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) PersonMentions(ctx context.Context, data types.GetPersonMentions) (*types.GetPersonMentionsResponse, error) { - resData := &types.GetPersonMentionsResponse{} - res, err := c.getReq(ctx, "GET", "/user/mention", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) MarkPersonMentionAsRead(ctx context.Context, data types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error) { - resData := &types.PersonMentionResponse{} - res, err := c.req(ctx, "POST", "/user/mention/mark_as_read", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Replies(ctx context.Context, data types.GetReplies) (*types.GetRepliesResponse, error) { - resData := &types.GetRepliesResponse{} - res, err := c.getReq(ctx, "GET", "/user/replies", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) BanPerson(ctx context.Context, data types.BanPerson) (*types.BanPersonResponse, error) { - resData := &types.BanPersonResponse{} - res, err := c.req(ctx, "POST", "/user/ban", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) BannedPersons(ctx context.Context, data types.GetBannedPersons) (*types.BannedPersonsResponse, error) { - resData := &types.BannedPersonsResponse{} - res, err := c.getReq(ctx, "GET", "/user/banned", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) BlockPerson(ctx context.Context, data types.BlockPerson) (*types.BlockPersonResponse, error) { - resData := &types.BlockPersonResponse{} - res, err := c.req(ctx, "POST", "/user/block", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) Login(ctx context.Context, data types.Login) (*types.LoginResponse, error) { - resData := &types.LoginResponse{} - res, err := c.req(ctx, "POST", "/user/login", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) DeleteAccount(ctx context.Context, data types.DeleteAccount) (*types.DeleteAccountResponse, error) { - resData := &types.DeleteAccountResponse{} - res, err := c.req(ctx, "POST", "/user/delete_account", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) PasswordReset(ctx context.Context, data types.PasswordReset) (*types.PasswordResetResponse, error) { - resData := &types.PasswordResetResponse{} - res, err := c.req(ctx, "POST", "/user/password_reset", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) PasswordChangeAfterReset(ctx context.Context, data types.PasswordChangeAfterReset) (*types.LoginResponse, error) { - resData := &types.LoginResponse{} - res, err := c.req(ctx, "POST", "/user/password_change", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) MarkAllAsRead(ctx context.Context, data types.MarkAllAsRead) (*types.GetRepliesResponse, error) { - resData := &types.GetRepliesResponse{} - res, err := c.req(ctx, "POST", "/user/mark_all_as_read", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) SaveUserSettings(ctx context.Context, data types.SaveUserSettings) (*types.LoginResponse, error) { - resData := &types.LoginResponse{} - res, err := c.req(ctx, "PUT", "/user/save_user_settings", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) ChangePassword(ctx context.Context, data types.ChangePassword) (*types.LoginResponse, error) { - resData := &types.LoginResponse{} - res, err := c.req(ctx, "PUT", "/user/change_password", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) ReportCount(ctx context.Context, data types.GetReportCount) (*types.GetReportCountResponse, error) { - resData := &types.GetReportCountResponse{} - res, err := c.getReq(ctx, "GET", "/user/report_count", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) UnreadCount(ctx context.Context, data types.GetUnreadCount) (*types.GetUnreadCountResponse, error) { - resData := &types.GetUnreadCountResponse{} - res, err := c.getReq(ctx, "GET", "/user/unread_count", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) VerifyEmail(ctx context.Context, data types.VerifyEmail) (*types.VerifyEmailResponse, error) { - resData := &types.VerifyEmailResponse{} - res, err := c.req(ctx, "POST", "/user/verify_email", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) LeaveAdmin(ctx context.Context, data types.LeaveAdmin) (*types.GetSiteResponse, error) { - resData := &types.GetSiteResponse{} - res, err := c.req(ctx, "POST", "/user/leave_admin", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} +// Add an admin to your site. func (c *Client) AddAdmin(ctx context.Context, data types.AddAdmin) (*types.AddAdminResponse, error) { resData := &types.AddAdminResponse{} res, err := c.req(ctx, "POST", "/admin/add", data, &resData) @@ -908,21 +20,11 @@ func (c *Client) AddAdmin(ctx context.Context, data types.AddAdmin) (*types.AddA } return resData, nil } -func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context, data types.GetUnreadRegistrationApplicationCount) (*types.GetUnreadRegistrationApplicationCountResponse, error) { - resData := &types.GetUnreadRegistrationApplicationCountResponse{} - res, err := c.getReq(ctx, "GET", "/admin/registration_application/count", data, &resData) - if err != nil { - return nil, err - } - err = resError(res, resData.LemmyResponse) - if err != nil { - return nil, err - } - return resData, nil -} -func (c *Client) RegistrationApplications(ctx context.Context, data types.ListRegistrationApplications) (*types.ListRegistrationApplicationsResponse, error) { - resData := &types.ListRegistrationApplicationsResponse{} - res, err := c.getReq(ctx, "GET", "/admin/registration_application/list", data, &resData) + +// Add a moderator to your community. +func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommunity) (*types.AddModToCommunityResponse, error) { + resData := &types.AddModToCommunityResponse{} + res, err := c.req(ctx, "POST", "/community/mod", data, &resData) if err != nil { return nil, err } @@ -932,6 +34,8 @@ func (c *Client) RegistrationApplications(ctx context.Context, data types.ListRe } return resData, nil } + +// Approve a registration application func (c *Client) ApproveRegistrationApplication(ctx context.Context, data types.ApproveRegistrationApplication) (*types.RegistrationApplicationResponse, error) { resData := &types.RegistrationApplicationResponse{} res, err := c.req(ctx, "PUT", "/admin/registration_application/approve", data, &resData) @@ -944,9 +48,11 @@ func (c *Client) ApproveRegistrationApplication(ctx context.Context, data types. } return resData, nil } -func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*types.PurgeItemResponse, error) { - resData := &types.PurgeItemResponse{} - res, err := c.req(ctx, "POST", "/admin/person", data, &resData) + +// Ban a user from a community. +func (c *Client) BanFromCommunity(ctx context.Context, data types.BanFromCommunity) (*types.BanFromCommunityResponse, error) { + resData := &types.BanFromCommunityResponse{} + res, err := c.req(ctx, "POST", "/community/ban_user", data, &resData) if err != nil { return nil, err } @@ -956,9 +62,11 @@ func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*type } return resData, nil } -func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) (*types.PurgeItemResponse, error) { - resData := &types.PurgeItemResponse{} - res, err := c.req(ctx, "POST", "/admin/community", data, &resData) + +// Ban a person from your site. +func (c *Client) BanPerson(ctx context.Context, data types.BanPerson) (*types.BanPersonResponse, error) { + resData := &types.BanPersonResponse{} + res, err := c.req(ctx, "POST", "/user/ban", data, &resData) if err != nil { return nil, err } @@ -968,9 +76,11 @@ func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) } return resData, nil } -func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.PurgeItemResponse, error) { - resData := &types.PurgeItemResponse{} - res, err := c.req(ctx, "POST", "/admin/post", data, &resData) + +// Block a community. +func (c *Client) BlockCommunity(ctx context.Context, data types.BlockCommunity) (*types.BlockCommunityResponse, error) { + resData := &types.BlockCommunityResponse{} + res, err := c.req(ctx, "POST", "/community/block", data, &resData) if err != nil { return nil, err } @@ -980,9 +90,11 @@ func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.Pu } return resData, nil } -func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*types.PurgeItemResponse, error) { - resData := &types.PurgeItemResponse{} - res, err := c.req(ctx, "POST", "/admin/comment", data, &resData) + +// Block a person. +func (c *Client) BlockPerson(ctx context.Context, data types.BlockPerson) (*types.BlockPersonResponse, error) { + resData := &types.BlockPersonResponse{} + res, err := c.req(ctx, "POST", "/user/block", data, &resData) if err != nil { return nil, err } @@ -992,6 +104,64 @@ func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*ty } return resData, nil } + +// Change your user password. +func (c *Client) ChangePassword(ctx context.Context, data types.ChangePassword) (*types.LoginResponse, error) { + resData := &types.LoginResponse{} + res, err := c.req(ctx, "PUT", "/user/change_password", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Create a comment. +func (c *Client) CreateComment(ctx context.Context, data types.CreateComment) (*types.CommentResponse, error) { + resData := &types.CommentResponse{} + res, err := c.req(ctx, "POST", "/comment", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Report a comment. +func (c *Client) CreateCommentReport(ctx context.Context, data types.CreateCommentReport) (*types.CommentReportResponse, error) { + resData := &types.CommentReportResponse{} + res, err := c.req(ctx, "POST", "/comment/report", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Create a new community. +func (c *Client) CreateCommunity(ctx context.Context, data types.CreateCommunity) (*types.CommunityResponse, error) { + resData := &types.CommunityResponse{} + res, err := c.req(ctx, "POST", "/community", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Create a new custom emoji func (c *Client) CreateCustomEmoji(ctx context.Context, data types.CreateCustomEmoji) (*types.CustomEmojiResponse, error) { resData := &types.CustomEmojiResponse{} res, err := c.req(ctx, "POST", "/custom_emoji", data, &resData) @@ -1004,9 +174,11 @@ func (c *Client) CreateCustomEmoji(ctx context.Context, data types.CreateCustomE } return resData, nil } -func (c *Client) EditCustomEmoji(ctx context.Context, data types.EditCustomEmoji) (*types.CustomEmojiResponse, error) { - resData := &types.CustomEmojiResponse{} - res, err := c.req(ctx, "PUT", "/custom_emoji", data, &resData) + +// Create a post. +func (c *Client) CreatePost(ctx context.Context, data types.CreatePost) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "POST", "/post", data, &resData) if err != nil { return nil, err } @@ -1016,6 +188,106 @@ func (c *Client) EditCustomEmoji(ctx context.Context, data types.EditCustomEmoji } return resData, nil } + +// Report a post. +func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostReport) (*types.PostReportResponse, error) { + resData := &types.PostReportResponse{} + res, err := c.req(ctx, "POST", "/post/report", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Create a private message. +func (c *Client) CreatePrivateMessage(ctx context.Context, data types.CreatePrivateMessage) (*types.PrivateMessageResponse, error) { + resData := &types.PrivateMessageResponse{} + res, err := c.req(ctx, "POST", "/private_message", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Create a report for a private message. +func (c *Client) CreatePrivateMessageReport(ctx context.Context, data types.CreatePrivateMessageReport) (*types.PrivateMessageReportResponse, error) { + resData := &types.PrivateMessageReportResponse{} + res, err := c.req(ctx, "POST", "/private_message/report", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Create your site. +func (c *Client) CreateSite(ctx context.Context, data types.CreateSite) (*types.SiteResponse, error) { + resData := &types.SiteResponse{} + res, err := c.req(ctx, "POST", "/site", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Delete your account. +func (c *Client) DeleteAccount(ctx context.Context, data types.DeleteAccount) error { + resData := &types.EmptyResponse{} + res, err := c.req(ctx, "POST", "/user/delete_account", data, &resData) + if err != nil { + return err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return err + } + return nil +} + +// Delete a comment. +func (c *Client) DeleteComment(ctx context.Context, data types.DeleteComment) (*types.CommentResponse, error) { + resData := &types.CommentResponse{} + res, err := c.req(ctx, "POST", "/comment/delete", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Delete a community. +func (c *Client) DeleteCommunity(ctx context.Context, data types.DeleteCommunity) (*types.CommunityResponse, error) { + resData := &types.CommunityResponse{} + res, err := c.req(ctx, "POST", "/community/delete", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Delete a custom emoji func (c *Client) DeleteCustomEmoji(ctx context.Context, data types.DeleteCustomEmoji) (*types.DeleteCustomEmojiResponse, error) { resData := &types.DeleteCustomEmojiResponse{} res, err := c.req(ctx, "POST", "/custom_emoji/delete", data, &resData) @@ -1028,3 +300,899 @@ func (c *Client) DeleteCustomEmoji(ctx context.Context, data types.DeleteCustomE } return resData, nil } + +// Delete a post. +func (c *Client) DeletePost(ctx context.Context, data types.DeletePost) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "POST", "/post/delete", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Delete a private message. +func (c *Client) DeletePrivateMessage(ctx context.Context, data types.DeletePrivateMessage) (*types.PrivateMessageResponse, error) { + resData := &types.PrivateMessageResponse{} + res, err := c.req(ctx, "POST", "/private_message/delete", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Distinguishes a comment (speak as moderator) +func (c *Client) DistinguishComment(ctx context.Context, data types.DistinguishComment) (*types.CommentResponse, error) { + resData := &types.CommentResponse{} + res, err := c.req(ctx, "POST", "/comment/distinguish", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Edit a comment. +func (c *Client) EditComment(ctx context.Context, data types.EditComment) (*types.CommentResponse, error) { + resData := &types.CommentResponse{} + res, err := c.req(ctx, "PUT", "/comment", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Edit a community. +func (c *Client) EditCommunity(ctx context.Context, data types.EditCommunity) (*types.CommunityResponse, error) { + resData := &types.CommunityResponse{} + res, err := c.req(ctx, "PUT", "/community", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Edit an existing custom emoji +func (c *Client) EditCustomEmoji(ctx context.Context, data types.EditCustomEmoji) (*types.CustomEmojiResponse, error) { + resData := &types.CustomEmojiResponse{} + res, err := c.req(ctx, "PUT", "/custom_emoji", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Edit a post. +func (c *Client) EditPost(ctx context.Context, data types.EditPost) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "PUT", "/post", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Edit a private message. +func (c *Client) EditPrivateMessage(ctx context.Context, data types.EditPrivateMessage) (*types.PrivateMessageResponse, error) { + resData := &types.PrivateMessageResponse{} + res, err := c.req(ctx, "PUT", "/private_message", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Edit your site. +func (c *Client) EditSite(ctx context.Context, data types.EditSite) (*types.SiteResponse, error) { + resData := &types.SiteResponse{} + res, err := c.req(ctx, "PUT", "/site", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// A moderator can feature a community post ( IE stick it to the top of a community ). +func (c *Client) FeaturePost(ctx context.Context, data types.FeaturePost) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "POST", "/post/feature", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Follow / subscribe to a community. +func (c *Client) FollowCommunity(ctx context.Context, data types.FollowCommunity) (*types.CommunityResponse, error) { + resData := &types.CommunityResponse{} + res, err := c.req(ctx, "POST", "/community/follow", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get a list of banned users +func (c *Client) BannedPersons(ctx context.Context, data types.GetBannedPersons) (*types.BannedPersonsResponse, error) { + resData := &types.BannedPersonsResponse{} + res, err := c.getReq(ctx, "GET", "/user/banned", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Fetch a Captcha. +func (c *Client) Captcha(ctx context.Context, data types.GetCaptcha) (*types.GetCaptchaResponse, error) { + resData := &types.GetCaptchaResponse{} + res, err := c.getReq(ctx, "GET", "/user/get_captcha", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get / fetch comment. +func (c *Client) Comment(ctx context.Context, data types.GetComment) (*types.CommentResponse, error) { + resData := &types.CommentResponse{} + res, err := c.getReq(ctx, "GET", "/comment", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get / fetch comments. +func (c *Client) Comments(ctx context.Context, data types.GetComments) (*types.GetCommentsResponse, error) { + resData := &types.GetCommentsResponse{} + res, err := c.getReq(ctx, "GET", "/comment/list", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get / fetch a community. +func (c *Client) Community(ctx context.Context, data types.GetCommunity) (*types.GetCommunityResponse, error) { + resData := &types.GetCommunityResponse{} + res, err := c.getReq(ctx, "GET", "/community", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Fetch federated instances. +func (c *Client) FederatedInstances(ctx context.Context, data types.GetFederatedInstances) (*types.GetFederatedInstancesResponse, error) { + resData := &types.GetFederatedInstancesResponse{} + res, err := c.getReq(ctx, "GET", "/federated_instances", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get the modlog. +func (c *Client) Modlog(ctx context.Context, data types.GetModlog) (*types.GetModlogResponse, error) { + resData := &types.GetModlogResponse{} + res, err := c.getReq(ctx, "GET", "/modlog", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get the details for a person. +func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails) (*types.GetPersonDetailsResponse, error) { + resData := &types.GetPersonDetailsResponse{} + res, err := c.getReq(ctx, "GET", "/user", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get mentions for your user. +func (c *Client) PersonMentions(ctx context.Context, data types.GetPersonMentions) (*types.GetPersonMentionsResponse, error) { + resData := &types.GetPersonMentionsResponse{} + res, err := c.getReq(ctx, "GET", "/user/mention", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get / fetch a post. +func (c *Client) Post(ctx context.Context, data types.GetPost) (*types.GetPostResponse, error) { + resData := &types.GetPostResponse{} + res, err := c.getReq(ctx, "GET", "/post", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get / fetch posts, with various filters. +func (c *Client) Posts(ctx context.Context, data types.GetPosts) (*types.GetPostsResponse, error) { + resData := &types.GetPostsResponse{} + res, err := c.getReq(ctx, "GET", "/post/list", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get / fetch private messages. +func (c *Client) PrivateMessages(ctx context.Context, data types.GetPrivateMessages) (*types.PrivateMessagesResponse, error) { + resData := &types.PrivateMessagesResponse{} + res, err := c.getReq(ctx, "GET", "/private_message/list", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get comment replies. +func (c *Client) Replies(ctx context.Context, data types.GetReplies) (*types.GetRepliesResponse, error) { + resData := &types.GetRepliesResponse{} + res, err := c.getReq(ctx, "GET", "/user/replies", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get counts for your reports +func (c *Client) ReportCount(ctx context.Context, data types.GetReportCount) (*types.GetReportCountResponse, error) { + resData := &types.GetReportCountResponse{} + res, err := c.getReq(ctx, "GET", "/user/report_count", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Gets the site, and your user data. +func (c *Client) Site(ctx context.Context, data types.GetSite) (*types.GetSiteResponse, error) { + resData := &types.GetSiteResponse{} + res, err := c.getReq(ctx, "GET", "/site", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Fetch metadata for any given site. +func (c *Client) SiteMetadata(ctx context.Context, data types.GetSiteMetadata) (*types.GetSiteMetadataResponse, error) { + resData := &types.GetSiteMetadataResponse{} + res, err := c.getReq(ctx, "GET", "/post/site_metadata", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get your unread counts +func (c *Client) UnreadCount(ctx context.Context, data types.GetUnreadCount) (*types.GetUnreadCountResponse, error) { + resData := &types.GetUnreadCountResponse{} + res, err := c.getReq(ctx, "GET", "/user/unread_count", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Get the unread registration applications count. +func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context, data types.GetUnreadRegistrationApplicationCount) (*types.GetUnreadRegistrationApplicationCountResponse, error) { + resData := &types.GetUnreadRegistrationApplicationCountResponse{} + res, err := c.getReq(ctx, "GET", "/admin/registration_application/count", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Leave the Site admins. +func (c *Client) LeaveAdmin(ctx context.Context, data types.LeaveAdmin) (*types.GetSiteResponse, error) { + resData := &types.GetSiteResponse{} + res, err := c.req(ctx, "POST", "/user/leave_admin", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Like / vote on a comment. +func (c *Client) LikeComment(ctx context.Context, data types.CreateCommentLike) (*types.CommentResponse, error) { + resData := &types.CommentResponse{} + res, err := c.req(ctx, "POST", "/comment/like", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Like / vote on a post. +func (c *Client) LikePost(ctx context.Context, data types.CreatePostLike) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "POST", "/post/like", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// List comment reports. +func (c *Client) CommentReports(ctx context.Context, data types.ListCommentReports) (*types.ListCommentReportsResponse, error) { + resData := &types.ListCommentReportsResponse{} + res, err := c.getReq(ctx, "GET", "/comment/report/list", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// List communities, with various filters. +func (c *Client) Communities(ctx context.Context, data types.ListCommunities) (*types.ListCommunitiesResponse, error) { + resData := &types.ListCommunitiesResponse{} + res, err := c.getReq(ctx, "GET", "/community/list", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// List post reports. +func (c *Client) PostReports(ctx context.Context, data types.ListPostReports) (*types.ListPostReportsResponse, error) { + resData := &types.ListPostReportsResponse{} + res, err := c.getReq(ctx, "GET", "/post/report/list", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// List private message reports. +func (c *Client) PrivateMessageReports(ctx context.Context, data types.ListPrivateMessageReports) (*types.ListPrivateMessageReportsResponse, error) { + resData := &types.ListPrivateMessageReportsResponse{} + res, err := c.getReq(ctx, "GET", "/private_message/report/list", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// List the registration applications. +func (c *Client) RegistrationApplications(ctx context.Context, data types.ListRegistrationApplications) (*types.ListRegistrationApplicationsResponse, error) { + resData := &types.ListRegistrationApplicationsResponse{} + res, err := c.getReq(ctx, "GET", "/admin/registration_application/list", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// A moderator can lock a post ( IE disable new comments ). +func (c *Client) LockPost(ctx context.Context, data types.LockPost) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "POST", "/post/lock", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Log into lemmy. +func (c *Client) Login(ctx context.Context, data types.Login) (*types.LoginResponse, error) { + resData := &types.LoginResponse{} + res, err := c.req(ctx, "POST", "/user/login", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Mark all replies as read. +func (c *Client) MarkAllAsRead(ctx context.Context, data types.MarkAllAsRead) (*types.GetRepliesResponse, error) { + resData := &types.GetRepliesResponse{} + res, err := c.req(ctx, "POST", "/user/mark_all_as_read", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Mark a comment as read. +func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data types.MarkCommentReplyAsRead) (*types.CommentReplyResponse, error) { + resData := &types.CommentReplyResponse{} + res, err := c.req(ctx, "POST", "/comment/mark_as_read", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Mark a person mention as read. +func (c *Client) MarkPersonMentionAsRead(ctx context.Context, data types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error) { + resData := &types.PersonMentionResponse{} + res, err := c.req(ctx, "POST", "/user/mention/mark_as_read", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Mark a post as read. +func (c *Client) MarkPostAsRead(ctx context.Context, data types.MarkPostAsRead) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "POST", "/post/mark_as_read", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Mark a private message as read. +func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, data types.MarkPrivateMessageAsRead) (*types.PrivateMessageResponse, error) { + resData := &types.PrivateMessageResponse{} + res, err := c.req(ctx, "POST", "/private_message/mark_as_read", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Change your password from an email / token based reset. +func (c *Client) PasswordChangeAfterReset(ctx context.Context, data types.PasswordChangeAfterReset) (*types.LoginResponse, error) { + resData := &types.LoginResponse{} + res, err := c.req(ctx, "POST", "/user/password_change", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Reset your password. +func (c *Client) PasswordReset(ctx context.Context, data types.PasswordReset) error { + resData := &types.EmptyResponse{} + res, err := c.req(ctx, "POST", "/user/password_reset", data, &resData) + if err != nil { + return err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return err + } + return nil +} + +// Purge / Delete a comment from the database. +func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*types.PurgeItemResponse, error) { + resData := &types.PurgeItemResponse{} + res, err := c.req(ctx, "POST", "/admin/purge/comment", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Purge / Delete a community from the database. +func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) (*types.PurgeItemResponse, error) { + resData := &types.PurgeItemResponse{} + res, err := c.req(ctx, "POST", "/admin/purge/community", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Purge / Delete a person from the database. +func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*types.PurgeItemResponse, error) { + resData := &types.PurgeItemResponse{} + res, err := c.req(ctx, "POST", "/admin/purge/person", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Purge / Delete a post from the database. +func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.PurgeItemResponse, error) { + resData := &types.PurgeItemResponse{} + res, err := c.req(ctx, "POST", "/admin/purge/post", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Register a new user. +func (c *Client) Register(ctx context.Context, data types.Register) (*types.LoginResponse, error) { + resData := &types.LoginResponse{} + res, err := c.req(ctx, "POST", "/user/register", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// A moderator remove for a comment. +func (c *Client) RemoveComment(ctx context.Context, data types.RemoveComment) (*types.CommentResponse, error) { + resData := &types.CommentResponse{} + res, err := c.req(ctx, "POST", "/comment/remove", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// A moderator remove for a community. +func (c *Client) RemoveCommunity(ctx context.Context, data types.RemoveCommunity) (*types.CommunityResponse, error) { + resData := &types.CommunityResponse{} + res, err := c.req(ctx, "POST", "/community/remove", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// A moderator remove for a post. +func (c *Client) RemovePost(ctx context.Context, data types.RemovePost) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "POST", "/post/remove", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Resolve a comment report. Only a mod can do this. +func (c *Client) ResolveCommentReport(ctx context.Context, data types.ResolveCommentReport) (*types.CommentReportResponse, error) { + resData := &types.CommentReportResponse{} + res, err := c.req(ctx, "PUT", "/comment/report/resolve", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Fetch a non-local / federated object. +func (c *Client) ResolveObject(ctx context.Context, data types.ResolveObject) (*types.ResolveObjectResponse, error) { + resData := &types.ResolveObjectResponse{} + res, err := c.getReq(ctx, "GET", "/resolve_object", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Resolve a post report. Only a mod can do this. +func (c *Client) ResolvePostReport(ctx context.Context, data types.ResolvePostReport) (*types.PostReportResponse, error) { + resData := &types.PostReportResponse{} + res, err := c.req(ctx, "PUT", "/post/report/resolve", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Resolve a report for a private message. +func (c *Client) ResolvePrivateMessageReport(ctx context.Context, data types.ResolvePrivateMessageReport) (*types.PrivateMessageReportResponse, error) { + resData := &types.PrivateMessageReportResponse{} + res, err := c.req(ctx, "PUT", "/private_message/report/resolve", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Save a comment. +func (c *Client) SaveComment(ctx context.Context, data types.SaveComment) (*types.CommentResponse, error) { + resData := &types.CommentResponse{} + res, err := c.req(ctx, "PUT", "/comment/save", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Save a post. +func (c *Client) SavePost(ctx context.Context, data types.SavePost) (*types.PostResponse, error) { + resData := &types.PostResponse{} + res, err := c.req(ctx, "PUT", "/post/save", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Save your user settings. +func (c *Client) SaveUserSettings(ctx context.Context, data types.SaveUserSettings) (*types.LoginResponse, error) { + resData := &types.LoginResponse{} + res, err := c.req(ctx, "PUT", "/user/save_user_settings", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Search lemmy. +func (c *Client) Search(ctx context.Context, data types.Search) (*types.SearchResponse, error) { + resData := &types.SearchResponse{} + res, err := c.getReq(ctx, "GET", "/search", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Transfer your community to an existing moderator. +func (c *Client) TransferCommunity(ctx context.Context, data types.TransferCommunity) (*types.GetCommunityResponse, error) { + resData := &types.GetCommunityResponse{} + res, err := c.req(ctx, "POST", "/community/transfer", data, &resData) + if err != nil { + return nil, err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return nil, err + } + return resData, nil +} + +// Verify your email +func (c *Client) VerifyEmail(ctx context.Context, data types.VerifyEmail) error { + resData := &types.EmptyResponse{} + res, err := c.req(ctx, "POST", "/user/verify_email", data, &resData) + if err != nil { + return err + } + err = resError(res, resData.LemmyResponse) + if err != nil { + return err + } + return nil +} diff --git a/types/activity.gen.go b/types/activity.gen.go deleted file mode 100644 index 90a5373..0000000 --- a/types/activity.gen.go +++ /dev/null @@ -1,27 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/activity.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Activity struct { - ID int32 `json:"id" url:"id,omitempty"` - Data any `json:"data" url:"data,omitempty"` - Local bool `json:"local" url:"local,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - ApID string `json:"ap_id" url:"ap_id,omitempty"` - Sensitive bool `json:"sensitive" url:"sensitive,omitempty"` -} -type ActivityInsertForm struct { - Data any `json:"data" url:"data,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - ApID string `json:"ap_id" url:"ap_id,omitempty"` - Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"` -} -type ActivityUpdateForm struct { - Data any `json:"data" url:"data,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"` -} diff --git a/types/actor_language.gen.go b/types/actor_language.gen.go deleted file mode 100644 index 55df048..0000000 --- a/types/actor_language.gen.go +++ /dev/null @@ -1,32 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/actor_language.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type LocalUserLanguage struct { - ID int `json:"id" url:"id,omitempty"` - LocalUserID int `json:"local_user_id" url:"local_user_id,omitempty"` - LanguageID int `json:"language_id" url:"language_id,omitempty"` -} -type LocalUserLanguageForm struct { - LocalUserID int `json:"local_user_id" url:"local_user_id,omitempty"` - LanguageID int `json:"language_id" url:"language_id,omitempty"` -} -type CommunityLanguage struct { - ID int `json:"id" url:"id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - LanguageID int `json:"language_id" url:"language_id,omitempty"` -} -type CommunityLanguageForm struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - LanguageID int `json:"language_id" url:"language_id,omitempty"` -} -type SiteLanguage struct { - ID int `json:"id" url:"id,omitempty"` - SiteID int `json:"site_id" url:"site_id,omitempty"` - LanguageID int `json:"language_id" url:"language_id,omitempty"` -} -type SiteLanguageForm struct { - SiteID int `json:"site_id" url:"site_id,omitempty"` - LanguageID int `json:"language_id" url:"language_id,omitempty"` -} diff --git a/types/build_response.gen.go b/types/build_response.gen.go deleted file mode 100644 index c595f50..0000000 --- a/types/build_response.gen.go +++ /dev/null @@ -1,4 +0,0 @@ -// Source: lemmy/crates/api_common/src/build_response.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types diff --git a/types/comment.1.gen.go b/types/comment.1.gen.go deleted file mode 100644 index abc94d6..0000000 --- a/types/comment.1.gen.go +++ /dev/null @@ -1,67 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/comment.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Comment struct { - ID int `json:"id" url:"id,omitempty"` - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Content string `json:"content" url:"content,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - ApID string `json:"ap_id" url:"ap_id,omitempty"` - Local bool `json:"local" url:"local,omitempty"` - Path string `json:"path" url:"path,omitempty"` - Distinguished bool `json:"distinguished" url:"distinguished,omitempty"` - LanguageID int `json:"language_id" url:"language_id,omitempty"` -} -type CommentInsertForm struct { - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Content string `json:"content" url:"content,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - ApID Optional[string] `json:"ap_id" url:"ap_id,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - Distinguished Optional[bool] `json:"distinguished" url:"distinguished,omitempty"` - LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` -} -type CommentUpdateForm struct { - Content Optional[string] `json:"content" url:"content,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - ApID Optional[string] `json:"ap_id" url:"ap_id,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - Distinguished Optional[bool] `json:"distinguished" url:"distinguished,omitempty"` - LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` -} -type CommentLike struct { - ID int32 `json:"id" url:"id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Score int16 `json:"score" url:"score,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type CommentLikeForm struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Score int16 `json:"score" url:"score,omitempty"` -} -type CommentSaved struct { - ID int32 `json:"id" url:"id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type CommentSavedForm struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` -} diff --git a/types/comment.gen.go b/types/comment.gen.go deleted file mode 100644 index f380aa9..0000000 --- a/types/comment.gen.go +++ /dev/null @@ -1,98 +0,0 @@ -// Source: lemmy/crates/api_common/src/comment.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CreateComment struct { - Content string `json:"content" url:"content,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - ParentID Optional[int] `json:"parent_id" url:"parent_id,omitempty"` - LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` - FormID Optional[string] `json:"form_id" url:"form_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetComment struct { - ID int `json:"id" url:"id,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type EditComment struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Content Optional[string] `json:"content" url:"content,omitempty"` - LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` - FormID Optional[string] `json:"form_id" url:"form_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type DistinguishComment struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Distinguished bool `json:"distinguished" url:"distinguished,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type DeleteComment struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type RemoveComment struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type SaveComment struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Save bool `json:"save" url:"save,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type CommentResponse struct { - CommentView CommentView `json:"comment_view" url:"comment_view,omitempty"` - RecipientIds []int `json:"recipient_ids" url:"recipient_ids,omitempty"` - FormID Optional[string] `json:"form_id" url:"form_id,omitempty"` - LemmyResponse -} -type CreateCommentLike struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Score int16 `json:"score" url:"score,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetComments struct { - Type Optional[ListingType] `json:"type_" url:"type_,omitempty"` - Sort Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` - MaxDepth Optional[int32] `json:"max_depth" url:"max_depth,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - CommunityName Optional[string] `json:"community_name" url:"community_name,omitempty"` - PostID Optional[int] `json:"post_id" url:"post_id,omitempty"` - ParentID Optional[int] `json:"parent_id" url:"parent_id,omitempty"` - SavedOnly Optional[bool] `json:"saved_only" url:"saved_only,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type GetCommentsResponse struct { - Comments []CommentView `json:"comments" url:"comments,omitempty"` - LemmyResponse -} -type CreateCommentReport struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type CommentReportResponse struct { - CommentReportView CommentReportView `json:"comment_report_view" url:"comment_report_view,omitempty"` - LemmyResponse -} -type ResolveCommentReport struct { - ReportID int `json:"report_id" url:"report_id,omitempty"` - Resolved bool `json:"resolved" url:"resolved,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ListCommentReports struct { - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - UnresolvedOnly Optional[bool] `json:"unresolved_only" url:"unresolved_only,omitempty"` - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ListCommentReportsResponse struct { - CommentReports []CommentReportView `json:"comment_reports" url:"comment_reports,omitempty"` - LemmyResponse -} diff --git a/types/comment_reply.gen.go b/types/comment_reply.gen.go deleted file mode 100644 index 855ec5a..0000000 --- a/types/comment_reply.gen.go +++ /dev/null @@ -1,20 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/comment_reply.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CommentReply struct { - ID int `json:"id" url:"id,omitempty"` - RecipientID int `json:"recipient_id" url:"recipient_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Read bool `json:"read" url:"read,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type CommentReplyInsertForm struct { - RecipientID int `json:"recipient_id" url:"recipient_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Read Optional[bool] `json:"read" url:"read,omitempty"` -} -type CommentReplyUpdateForm struct { - Read Optional[bool] `json:"read" url:"read,omitempty"` -} diff --git a/types/comment_report.gen.go b/types/comment_report.gen.go deleted file mode 100644 index 6d73842..0000000 --- a/types/comment_report.gen.go +++ /dev/null @@ -1,22 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/comment_report.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CommentReport struct { - ID int `json:"id" url:"id,omitempty"` - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - OriginalCommentText string `json:"original_comment_text" url:"original_comment_text,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` - Resolved bool `json:"resolved" url:"resolved,omitempty"` - ResolverID Optional[int] `json:"resolver_id" url:"resolver_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} -type CommentReportForm struct { - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - OriginalCommentText string `json:"original_comment_text" url:"original_comment_text,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` -} diff --git a/types/community.1.gen.go b/types/community.1.gen.go deleted file mode 100644 index 1b3bbec..0000000 --- a/types/community.1.gen.go +++ /dev/null @@ -1,113 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/community.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Community struct { - ID int `json:"id" url:"id,omitempty"` - Name string `json:"name" url:"name,omitempty"` - Title string `json:"title" url:"title,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - NSFW bool `json:"nsfw" url:"nsfw,omitempty"` - ActorID string `json:"actor_id" url:"actor_id,omitempty"` - Local bool `json:"local" url:"local,omitempty"` - PrivateKey Optional[string] `json:"private_key" url:"private_key,omitempty"` - PublicKey string `json:"public_key" url:"public_key,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - Icon Optional[string] `json:"icon" url:"icon,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - FollowersURL string `json:"followers_url" url:"followers_url,omitempty"` - InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"` - SharedInboxURL Optional[string] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"` - Hidden bool `json:"hidden" url:"hidden,omitempty"` - PostingRestrictedToMods bool `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` - ModeratorsURL Optional[string] `json:"moderators_url" url:"moderators_url,omitempty"` - FeaturedURL Optional[string] `json:"featured_url" url:"featured_url,omitempty"` -} -type CommunityInsertForm struct { - Name string `json:"name" url:"name,omitempty"` - Title string `json:"title" url:"title,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` - ActorID Optional[string] `json:"actor_id" url:"actor_id,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - PrivateKey Optional[string] `json:"private_key" url:"private_key,omitempty"` - PublicKey string `json:"public_key" url:"public_key,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - Icon Optional[string] `json:"icon" url:"icon,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - FollowersURL Optional[string] `json:"followers_url" url:"followers_url,omitempty"` - InboxURL Optional[string] `json:"inbox_url" url:"inbox_url,omitempty"` - SharedInboxURL Optional[string] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"` - ModeratorsURL Optional[string] `json:"moderators_url" url:"moderators_url,omitempty"` - FeaturedURL Optional[string] `json:"featured_url" url:"featured_url,omitempty"` - Hidden Optional[bool] `json:"hidden" url:"hidden,omitempty"` - PostingRestrictedToMods Optional[bool] `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` -} -type CommunityUpdateForm struct { - Title Optional[string] `json:"title" url:"title,omitempty"` - Description Optional[Optional[string]] `json:"description" url:"description,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` - ActorID Optional[string] `json:"actor_id" url:"actor_id,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - PublicKey Optional[string] `json:"public_key" url:"public_key,omitempty"` - PrivateKey Optional[Optional[string]] `json:"private_key" url:"private_key,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - Icon Optional[Optional[string]] `json:"icon" url:"icon,omitempty"` - Banner Optional[Optional[string]] `json:"banner" url:"banner,omitempty"` - FollowersURL Optional[string] `json:"followers_url" url:"followers_url,omitempty"` - InboxURL Optional[string] `json:"inbox_url" url:"inbox_url,omitempty"` - SharedInboxURL Optional[Optional[string]] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"` - ModeratorsURL Optional[string] `json:"moderators_url" url:"moderators_url,omitempty"` - FeaturedURL Optional[string] `json:"featured_url" url:"featured_url,omitempty"` - Hidden Optional[bool] `json:"hidden" url:"hidden,omitempty"` - PostingRestrictedToMods Optional[bool] `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` -} -type CommunityModerator struct { - ID int32 `json:"id" url:"id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type CommunityModeratorForm struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` -} -type CommunityPersonBan struct { - ID int32 `json:"id" url:"id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Expires LemmyTime `json:"expires" url:"expires,omitempty"` -} -type CommunityPersonBanForm struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Expires LemmyTime `json:"expires" url:"expires,omitempty"` -} -type CommunityFollower struct { - ID int32 `json:"id" url:"id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Pending bool `json:"pending" url:"pending,omitempty"` -} -type CommunityFollowerForm struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Pending bool `json:"pending" url:"pending,omitempty"` -} diff --git a/types/community.gen.go b/types/community.gen.go deleted file mode 100644 index 48835ac..0000000 --- a/types/community.gen.go +++ /dev/null @@ -1,117 +0,0 @@ -// Source: lemmy/crates/api_common/src/community.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type GetCommunity struct { - ID Optional[int] `json:"id" url:"id,omitempty"` - Name Optional[string] `json:"name" url:"name,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type GetCommunityResponse struct { - CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` - Site Optional[Site] `json:"site" url:"site,omitempty"` - Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` - DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"` - LemmyResponse -} -type CreateCommunity struct { - Name string `json:"name" url:"name,omitempty"` - Title string `json:"title" url:"title,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - Icon Optional[string] `json:"icon" url:"icon,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` - PostingRestrictedToMods Optional[bool] `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` - DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type CommunityResponse struct { - CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` - DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"` - LemmyResponse -} -type ListCommunities struct { - Type Optional[ListingType] `json:"type_" url:"type_,omitempty"` - Sort Optional[SortType] `json:"sort" url:"sort,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type ListCommunitiesResponse struct { - Communities []CommunityView `json:"communities" url:"communities,omitempty"` - LemmyResponse -} -type BanFromCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Ban bool `json:"ban" url:"ban,omitempty"` - RemoveData Optional[bool] `json:"remove_data" url:"remove_data,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Expires Optional[int64] `json:"expires" url:"expires,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type BanFromCommunityResponse struct { - PersonView PersonView `json:"person_view" url:"person_view,omitempty"` - Banned bool `json:"banned" url:"banned,omitempty"` - LemmyResponse -} -type AddModToCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Added bool `json:"added" url:"added,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type AddModToCommunityResponse struct { - Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` - LemmyResponse -} -type EditCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Title Optional[string] `json:"title" url:"title,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - Icon Optional[string] `json:"icon" url:"icon,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` - PostingRestrictedToMods Optional[bool] `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` - DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type HideCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Hidden bool `json:"hidden" url:"hidden,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type DeleteCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type RemoveCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Expires Optional[int64] `json:"expires" url:"expires,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type FollowCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Follow bool `json:"follow" url:"follow,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type BlockCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Block bool `json:"block" url:"block,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type BlockCommunityResponse struct { - CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` - Blocked bool `json:"blocked" url:"blocked,omitempty"` - LemmyResponse -} -type TransferCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} diff --git a/types/community_block.gen.go b/types/community_block.gen.go deleted file mode 100644 index 1662822..0000000 --- a/types/community_block.gen.go +++ /dev/null @@ -1,15 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/community_block.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CommunityBlock struct { - ID int `json:"id" url:"id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type CommunityBlockForm struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` -} diff --git a/types/custom_emoji.1.gen.go b/types/custom_emoji.1.gen.go deleted file mode 100644 index 72f4f3f..0000000 --- a/types/custom_emoji.1.gen.go +++ /dev/null @@ -1,28 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/custom_emoji.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CustomEmoji struct { - ID int `json:"id" url:"id,omitempty"` - LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"` - Shortcode string `json:"shortcode" url:"shortcode,omitempty"` - ImageURL string `json:"image_url" url:"image_url,omitempty"` - AltText string `json:"alt_text" url:"alt_text,omitempty"` - Category string `json:"category" url:"category,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} -type CustomEmojiInsertForm struct { - LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"` - Shortcode string `json:"shortcode" url:"shortcode,omitempty"` - ImageURL string `json:"image_url" url:"image_url,omitempty"` - AltText string `json:"alt_text" url:"alt_text,omitempty"` - Category string `json:"category" url:"category,omitempty"` -} -type CustomEmojiUpdateForm struct { - LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"` - ImageURL string `json:"image_url" url:"image_url,omitempty"` - AltText string `json:"alt_text" url:"alt_text,omitempty"` - Category string `json:"category" url:"category,omitempty"` -} diff --git a/types/custom_emoji.gen.go b/types/custom_emoji.gen.go deleted file mode 100644 index 655846a..0000000 --- a/types/custom_emoji.gen.go +++ /dev/null @@ -1,34 +0,0 @@ -// Source: lemmy/crates/api_common/src/custom_emoji.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CreateCustomEmoji struct { - Category string `json:"category" url:"category,omitempty"` - Shortcode string `json:"shortcode" url:"shortcode,omitempty"` - ImageURL string `json:"image_url" url:"image_url,omitempty"` - AltText string `json:"alt_text" url:"alt_text,omitempty"` - Keywords []string `json:"keywords" url:"keywords,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type EditCustomEmoji struct { - ID int `json:"id" url:"id,omitempty"` - Category string `json:"category" url:"category,omitempty"` - ImageURL string `json:"image_url" url:"image_url,omitempty"` - AltText string `json:"alt_text" url:"alt_text,omitempty"` - Keywords []string `json:"keywords" url:"keywords,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type DeleteCustomEmoji struct { - ID int `json:"id" url:"id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type DeleteCustomEmojiResponse struct { - ID int `json:"id" url:"id,omitempty"` - Success bool `json:"success" url:"success,omitempty"` - LemmyResponse -} -type CustomEmojiResponse struct { - CustomEmoji CustomEmojiView `json:"custom_emoji" url:"custom_emoji,omitempty"` - LemmyResponse -} diff --git a/types/custom_emoji_keyword.gen.go b/types/custom_emoji_keyword.gen.go deleted file mode 100644 index 2c3a350..0000000 --- a/types/custom_emoji_keyword.gen.go +++ /dev/null @@ -1,14 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/custom_emoji_keyword.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CustomEmojiKeyword struct { - ID int32 `json:"id" url:"id,omitempty"` - CustomEmojiID int `json:"custom_emoji_id" url:"custom_emoji_id,omitempty"` - Keyword string `json:"keyword" url:"keyword,omitempty"` -} -type CustomEmojiKeywordInsertForm struct { - CustomEmojiID int `json:"custom_emoji_id" url:"custom_emoji_id,omitempty"` - Keyword string `json:"keyword" url:"keyword,omitempty"` -} diff --git a/types/email_verification.gen.go b/types/email_verification.gen.go deleted file mode 100644 index 10ab5f3..0000000 --- a/types/email_verification.gen.go +++ /dev/null @@ -1,17 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/email_verification.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type EmailVerification struct { - ID int32 `json:"id" url:"id,omitempty"` - LocalUserID int `json:"local_user_id" url:"local_user_id,omitempty"` - Email string `json:"email" url:"email,omitempty"` - VerificationCode string `json:"verification_code" url:"verification_code,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type EmailVerificationForm struct { - LocalUserID int `json:"local_user_id" url:"local_user_id,omitempty"` - Email string `json:"email" url:"email,omitempty"` - VerificationToken string `json:"verification_token" url:"verification_token,omitempty"` -} diff --git a/types/federation_allowlist.gen.go b/types/federation_allowlist.gen.go deleted file mode 100644 index 1b711c0..0000000 --- a/types/federation_allowlist.gen.go +++ /dev/null @@ -1,15 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/federation_allowlist.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type FederationAllowList struct { - ID int32 `json:"id" url:"id,omitempty"` - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} -type FederationAllowListForm struct { - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} diff --git a/types/federation_blocklist.gen.go b/types/federation_blocklist.gen.go deleted file mode 100644 index 3c00bf2..0000000 --- a/types/federation_blocklist.gen.go +++ /dev/null @@ -1,15 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/federation_blocklist.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type FederationBlockList struct { - ID int32 `json:"id" url:"id,omitempty"` - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} -type FederationBlockListForm struct { - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} diff --git a/types/instance.gen.go b/types/instance.gen.go deleted file mode 100644 index da7de5e..0000000 --- a/types/instance.gen.go +++ /dev/null @@ -1,19 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/instance.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Instance struct { - ID int `json:"id" url:"id,omitempty"` - Domain string `json:"domain" url:"domain,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Software Optional[string] `json:"software" url:"software,omitempty"` - Version Optional[string] `json:"version" url:"version,omitempty"` -} -type InstanceForm struct { - Domain string `json:"domain" url:"domain,omitempty"` - Software Optional[string] `json:"software" url:"software,omitempty"` - Version Optional[string] `json:"version" url:"version,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} diff --git a/types/language.gen.go b/types/language.gen.go deleted file mode 100644 index e7ae8e9..0000000 --- a/types/language.gen.go +++ /dev/null @@ -1,10 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/language.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Language struct { - ID int `json:"id" url:"id,omitempty"` - Code string `json:"code" url:"code,omitempty"` - Name string `json:"name" url:"name,omitempty"` -} diff --git a/types/lib.1.gen.go b/types/lib.1.gen.go deleted file mode 100644 index 8f9964a..0000000 --- a/types/lib.1.gen.go +++ /dev/null @@ -1,95 +0,0 @@ -// Source: lemmy/crates/db_schema/src/lib.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type SortType string - -const ( - SortTypeActive SortType = "Active" - SortTypeHot SortType = "Hot" - SortTypeNew SortType = "New" - SortTypeOld SortType = "Old" - SortTypeTopDay SortType = "TopDay" - SortTypeTopWeek SortType = "TopWeek" - SortTypeTopMonth SortType = "TopMonth" - SortTypeTopYear SortType = "TopYear" - SortTypeTopAll SortType = "TopAll" - SortTypeMostComments SortType = "MostComments" - SortTypeNewComments SortType = "NewComments" - SortTypeTopHour SortType = "TopHour" - SortTypeTopSixHour SortType = "TopSixHour" - SortTypeTopTwelveHour SortType = "TopTwelveHour" -) - -type CommentSortType string - -const ( - CommentSortTypeHot CommentSortType = "Hot" - CommentSortTypeTop CommentSortType = "Top" - CommentSortTypeNew CommentSortType = "New" - CommentSortTypeOld CommentSortType = "Old" -) - -type ListingType string - -const ( - ListingTypeAll ListingType = "All" - ListingTypeLocal ListingType = "Local" - ListingTypeSubscribed ListingType = "Subscribed" -) - -type RegistrationMode string - -const ( - RegistrationModeClosed RegistrationMode = "Closed" - RegistrationModeRequireApplication RegistrationMode = "RequireApplication" - RegistrationModeOpen RegistrationMode = "Open" -) - -type SearchType string - -const ( - SearchTypeAll SearchType = "All" - SearchTypeComments SearchType = "Comments" - SearchTypePosts SearchType = "Posts" - SearchTypeCommunities SearchType = "Communities" - SearchTypeUsers SearchType = "Users" - SearchTypeUrl SearchType = "Url" -) - -type SubscribedType string - -const ( - SubscribedTypeSubscribed SubscribedType = "Subscribed" - SubscribedTypeNotSubscribed SubscribedType = "NotSubscribed" - SubscribedTypePending SubscribedType = "Pending" -) - -type ModlogActionType string - -const ( - ModlogActionTypeAll ModlogActionType = "All" - ModlogActionTypeModRemovePost ModlogActionType = "ModRemovePost" - ModlogActionTypeModLockPost ModlogActionType = "ModLockPost" - ModlogActionTypeModFeaturePost ModlogActionType = "ModFeaturePost" - ModlogActionTypeModRemoveComment ModlogActionType = "ModRemoveComment" - ModlogActionTypeModRemoveCommunity ModlogActionType = "ModRemoveCommunity" - ModlogActionTypeModBanFromCommunity ModlogActionType = "ModBanFromCommunity" - ModlogActionTypeModAddCommunity ModlogActionType = "ModAddCommunity" - ModlogActionTypeModTransferCommunity ModlogActionType = "ModTransferCommunity" - ModlogActionTypeModAdd ModlogActionType = "ModAdd" - ModlogActionTypeModBan ModlogActionType = "ModBan" - ModlogActionTypeModHideCommunity ModlogActionType = "ModHideCommunity" - ModlogActionTypeAdminPurgePerson ModlogActionType = "AdminPurgePerson" - ModlogActionTypeAdminPurgeCommunity ModlogActionType = "AdminPurgeCommunity" - ModlogActionTypeAdminPurgePost ModlogActionType = "AdminPurgePost" - ModlogActionTypeAdminPurgeComment ModlogActionType = "AdminPurgeComment" -) - -type PostFeatureType string - -const ( - PostFeatureTypeLocal PostFeatureType = "Local" - PostFeatureTypeCommunity PostFeatureType = "Community" -) diff --git a/types/lib.gen.go b/types/lib.gen.go deleted file mode 100644 index 7f9b61c..0000000 --- a/types/lib.gen.go +++ /dev/null @@ -1,4 +0,0 @@ -// Source: lemmy/crates/api_common/src/lib.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types diff --git a/types/local_site.gen.go b/types/local_site.gen.go deleted file mode 100644 index 9d24081..0000000 --- a/types/local_site.gen.go +++ /dev/null @@ -1,77 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/local_site.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type LocalSite struct { - ID int `json:"id" url:"id,omitempty"` - SiteID int `json:"site_id" url:"site_id,omitempty"` - SiteSetup bool `json:"site_setup" url:"site_setup,omitempty"` - EnableDownvotes bool `json:"enable_downvotes" url:"enable_downvotes,omitempty"` - EnableNSFW bool `json:"enable_nsfw" url:"enable_nsfw,omitempty"` - CommunityCreationAdminOnly bool `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` - RequireEmailVerification bool `json:"require_email_verification" url:"require_email_verification,omitempty"` - ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` - PrivateInstance bool `json:"private_instance" url:"private_instance,omitempty"` - DefaultTheme string `json:"default_theme" url:"default_theme,omitempty"` - DefaultPostListingType ListingType `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` - LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` - HideModlogModNames bool `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` - ApplicationEmailAdmins bool `json:"application_email_admins" url:"application_email_admins,omitempty"` - SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` - ActorNameMaxLength int32 `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` - FederationEnabled bool `json:"federation_enabled" url:"federation_enabled,omitempty"` - FederationWorkerCount int32 `json:"federation_worker_count" url:"federation_worker_count,omitempty"` - CaptchaEnabled bool `json:"captcha_enabled" url:"captcha_enabled,omitempty"` - CaptchaDifficulty string `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - RegistrationMode RegistrationMode `json:"registration_mode" url:"registration_mode,omitempty"` - ReportsEmailAdmins bool `json:"reports_email_admins" url:"reports_email_admins,omitempty"` -} -type LocalSiteInsertForm struct { - SiteID int `json:"site_id" url:"site_id,omitempty"` - SiteSetup Optional[bool] `json:"site_setup" url:"site_setup,omitempty"` - EnableDownvotes Optional[bool] `json:"enable_downvotes" url:"enable_downvotes,omitempty"` - EnableNSFW Optional[bool] `json:"enable_nsfw" url:"enable_nsfw,omitempty"` - CommunityCreationAdminOnly Optional[bool] `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` - RequireEmailVerification Optional[bool] `json:"require_email_verification" url:"require_email_verification,omitempty"` - ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` - PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` - DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` - DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` - LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` - HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` - ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` - SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` - ActorNameMaxLength Optional[int32] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` - FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"` - FederationWorkerCount Optional[int32] `json:"federation_worker_count" url:"federation_worker_count,omitempty"` - CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"` - CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` - RegistrationMode Optional[RegistrationMode] `json:"registration_mode" url:"registration_mode,omitempty"` - ReportsEmailAdmins Optional[bool] `json:"reports_email_admins" url:"reports_email_admins,omitempty"` -} -type LocalSiteUpdateForm struct { - SiteSetup Optional[bool] `json:"site_setup" url:"site_setup,omitempty"` - EnableDownvotes Optional[bool] `json:"enable_downvotes" url:"enable_downvotes,omitempty"` - EnableNSFW Optional[bool] `json:"enable_nsfw" url:"enable_nsfw,omitempty"` - CommunityCreationAdminOnly Optional[bool] `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` - RequireEmailVerification Optional[bool] `json:"require_email_verification" url:"require_email_verification,omitempty"` - ApplicationQuestion Optional[Optional[string]] `json:"application_question" url:"application_question,omitempty"` - PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` - DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` - DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` - LegalInformation Optional[Optional[string]] `json:"legal_information" url:"legal_information,omitempty"` - HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` - ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` - SlurFilterRegex Optional[Optional[string]] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` - ActorNameMaxLength Optional[int32] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` - FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"` - FederationWorkerCount Optional[int32] `json:"federation_worker_count" url:"federation_worker_count,omitempty"` - CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"` - CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` - RegistrationMode Optional[RegistrationMode] `json:"registration_mode" url:"registration_mode,omitempty"` - ReportsEmailAdmins Optional[bool] `json:"reports_email_admins" url:"reports_email_admins,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} diff --git a/types/local_site_rate_limit.gen.go b/types/local_site_rate_limit.gen.go deleted file mode 100644 index 1ba674a..0000000 --- a/types/local_site_rate_limit.gen.go +++ /dev/null @@ -1,53 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/local_site_rate_limit.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type LocalSiteRateLimit struct { - ID int32 `json:"id" url:"id,omitempty"` - LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"` - Message int32 `json:"message" url:"message,omitempty"` - MessagePerSecond int32 `json:"message_per_second" url:"message_per_second,omitempty"` - Post int32 `json:"post" url:"post,omitempty"` - PostPerSecond int32 `json:"post_per_second" url:"post_per_second,omitempty"` - Register int32 `json:"register" url:"register,omitempty"` - RegisterPerSecond int32 `json:"register_per_second" url:"register_per_second,omitempty"` - Image int32 `json:"image" url:"image,omitempty"` - ImagePerSecond int32 `json:"image_per_second" url:"image_per_second,omitempty"` - Comment int32 `json:"comment" url:"comment,omitempty"` - CommentPerSecond int32 `json:"comment_per_second" url:"comment_per_second,omitempty"` - Search int32 `json:"search" url:"search,omitempty"` - SearchPerSecond int32 `json:"search_per_second" url:"search_per_second,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} -type LocalSiteRateLimitInsertForm struct { - LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"` - Message Optional[int32] `json:"message" url:"message,omitempty"` - MessagePerSecond Optional[int32] `json:"message_per_second" url:"message_per_second,omitempty"` - Post Optional[int32] `json:"post" url:"post,omitempty"` - PostPerSecond Optional[int32] `json:"post_per_second" url:"post_per_second,omitempty"` - Register Optional[int32] `json:"register" url:"register,omitempty"` - RegisterPerSecond Optional[int32] `json:"register_per_second" url:"register_per_second,omitempty"` - Image Optional[int32] `json:"image" url:"image,omitempty"` - ImagePerSecond Optional[int32] `json:"image_per_second" url:"image_per_second,omitempty"` - Comment Optional[int32] `json:"comment" url:"comment,omitempty"` - CommentPerSecond Optional[int32] `json:"comment_per_second" url:"comment_per_second,omitempty"` - Search Optional[int32] `json:"search" url:"search,omitempty"` - SearchPerSecond Optional[int32] `json:"search_per_second" url:"search_per_second,omitempty"` -} -type LocalSiteRateLimitUpdateForm struct { - Message Optional[int32] `json:"message" url:"message,omitempty"` - MessagePerSecond Optional[int32] `json:"message_per_second" url:"message_per_second,omitempty"` - Post Optional[int32] `json:"post" url:"post,omitempty"` - PostPerSecond Optional[int32] `json:"post_per_second" url:"post_per_second,omitempty"` - Register Optional[int32] `json:"register" url:"register,omitempty"` - RegisterPerSecond Optional[int32] `json:"register_per_second" url:"register_per_second,omitempty"` - Image Optional[int32] `json:"image" url:"image,omitempty"` - ImagePerSecond Optional[int32] `json:"image_per_second" url:"image_per_second,omitempty"` - Comment Optional[int32] `json:"comment" url:"comment,omitempty"` - CommentPerSecond Optional[int32] `json:"comment_per_second" url:"comment_per_second,omitempty"` - Search Optional[int32] `json:"search" url:"search,omitempty"` - SearchPerSecond Optional[int32] `json:"search_per_second" url:"search_per_second,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} diff --git a/types/local_user.gen.go b/types/local_user.gen.go deleted file mode 100644 index b19dfb8..0000000 --- a/types/local_user.gen.go +++ /dev/null @@ -1,66 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/local_user.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type LocalUser struct { - ID int `json:"id" url:"id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - PasswordEncrypted string `json:"password_encrypted" url:"password_encrypted,omitempty"` - Email Optional[string] `json:"email" url:"email,omitempty"` - ShowNSFW bool `json:"show_nsfw" url:"show_nsfw,omitempty"` - Theme string `json:"theme" url:"theme,omitempty"` - DefaultSortType SortType `json:"default_sort_type" url:"default_sort_type,omitempty"` - DefaultListingType ListingType `json:"default_listing_type" url:"default_listing_type,omitempty"` - InterfaceLanguage string `json:"interface_language" url:"interface_language,omitempty"` - ShowAvatars bool `json:"show_avatars" url:"show_avatars,omitempty"` - SendNotificationsToEmail bool `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` - ValidatorTime LemmyTime `json:"validator_time" url:"validator_time,omitempty"` - ShowScores bool `json:"show_scores" url:"show_scores,omitempty"` - ShowBotAccounts bool `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` - ShowReadPosts bool `json:"show_read_posts" url:"show_read_posts,omitempty"` - ShowNewPostNotifs bool `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` - EmailVerified bool `json:"email_verified" url:"email_verified,omitempty"` - AcceptedApplication bool `json:"accepted_application" url:"accepted_application,omitempty"` - Totp2faSecret Optional[string] `json:"totp_2fa_secret" url:"totp_2fa_secret,omitempty"` - Totp2faURL Optional[string] `json:"totp_2fa_url" url:"totp_2fa_url,omitempty"` -} -type LocalUserInsertForm struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - PasswordEncrypted string `json:"password_encrypted" url:"password_encrypted,omitempty"` - Email Optional[string] `json:"email" url:"email,omitempty"` - ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"` - Theme Optional[string] `json:"theme" url:"theme,omitempty"` - DefaultSortType Optional[SortType] `json:"default_sort_type" url:"default_sort_type,omitempty"` - DefaultListingType Optional[ListingType] `json:"default_listing_type" url:"default_listing_type,omitempty"` - InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"` - ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"` - SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` - ShowBotAccounts Optional[bool] `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` - ShowScores Optional[bool] `json:"show_scores" url:"show_scores,omitempty"` - ShowReadPosts Optional[bool] `json:"show_read_posts" url:"show_read_posts,omitempty"` - ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` - EmailVerified Optional[bool] `json:"email_verified" url:"email_verified,omitempty"` - AcceptedApplication Optional[bool] `json:"accepted_application" url:"accepted_application,omitempty"` - Totp2faSecret Optional[Optional[string]] `json:"totp_2fa_secret" url:"totp_2fa_secret,omitempty"` - Totp2faURL Optional[Optional[string]] `json:"totp_2fa_url" url:"totp_2fa_url,omitempty"` -} -type LocalUserUpdateForm struct { - PasswordEncrypted Optional[string] `json:"password_encrypted" url:"password_encrypted,omitempty"` - Email Optional[Optional[string]] `json:"email" url:"email,omitempty"` - ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"` - Theme Optional[string] `json:"theme" url:"theme,omitempty"` - DefaultSortType Optional[SortType] `json:"default_sort_type" url:"default_sort_type,omitempty"` - DefaultListingType Optional[ListingType] `json:"default_listing_type" url:"default_listing_type,omitempty"` - InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"` - ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"` - SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` - ShowBotAccounts Optional[bool] `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` - ShowScores Optional[bool] `json:"show_scores" url:"show_scores,omitempty"` - ShowReadPosts Optional[bool] `json:"show_read_posts" url:"show_read_posts,omitempty"` - ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` - EmailVerified Optional[bool] `json:"email_verified" url:"email_verified,omitempty"` - AcceptedApplication Optional[bool] `json:"accepted_application" url:"accepted_application,omitempty"` - Totp2faSecret Optional[Optional[string]] `json:"totp_2fa_secret" url:"totp_2fa_secret,omitempty"` - Totp2faURL Optional[Optional[string]] `json:"totp_2fa_url" url:"totp_2fa_url,omitempty"` -} diff --git a/types/mod.gen.go b/types/mod.gen.go deleted file mode 100644 index f754535..0000000 --- a/types/mod.gen.go +++ /dev/null @@ -1,4 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/mod.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types diff --git a/types/moderator.gen.go b/types/moderator.gen.go deleted file mode 100644 index 7215aac..0000000 --- a/types/moderator.gen.go +++ /dev/null @@ -1,205 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/moderator.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type ModRemovePost struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModRemovePostForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` -} -type ModLockPost struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Locked bool `json:"locked" url:"locked,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModLockPostForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Locked Optional[bool] `json:"locked" url:"locked,omitempty"` -} -type ModFeaturePost struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Featured bool `json:"featured" url:"featured,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` - IsFeaturedCommunity bool `json:"is_featured_community" url:"is_featured_community,omitempty"` -} -type ModFeaturePostForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Featured bool `json:"featured" url:"featured,omitempty"` - IsFeaturedCommunity bool `json:"is_featured_community" url:"is_featured_community,omitempty"` -} -type ModRemoveComment struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModRemoveCommentForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` -} -type ModRemoveCommunity struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - Expires LemmyTime `json:"expires" url:"expires,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModRemoveCommunityForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` - Expires LemmyTime `json:"expires" url:"expires,omitempty"` -} -type ModBanFromCommunity struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Banned bool `json:"banned" url:"banned,omitempty"` - Expires LemmyTime `json:"expires" url:"expires,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModBanFromCommunityForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Banned Optional[bool] `json:"banned" url:"banned,omitempty"` - Expires LemmyTime `json:"expires" url:"expires,omitempty"` -} -type ModBan struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Banned bool `json:"banned" url:"banned,omitempty"` - Expires LemmyTime `json:"expires" url:"expires,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModHideCommunityForm struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - Hidden Optional[bool] `json:"hidden" url:"hidden,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` -} -type ModHideCommunity struct { - ID int32 `json:"id" url:"id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Hidden bool `json:"hidden" url:"hidden,omitempty"` -} -type ModBanForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Banned Optional[bool] `json:"banned" url:"banned,omitempty"` - Expires LemmyTime `json:"expires" url:"expires,omitempty"` -} -type ModAddCommunity struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModAddCommunityForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` -} -type ModTransferCommunity struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModTransferCommunityForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` -} -type ModAdd struct { - ID int32 `json:"id" url:"id,omitempty"` - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type ModAddForm struct { - ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` -} -type AdminPurgePerson struct { - ID int32 `json:"id" url:"id,omitempty"` - AdminPersonID int `json:"admin_person_id" url:"admin_person_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type AdminPurgePersonForm struct { - AdminPersonID int `json:"admin_person_id" url:"admin_person_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` -} -type AdminPurgeCommunity struct { - ID int32 `json:"id" url:"id,omitempty"` - AdminPersonID int `json:"admin_person_id" url:"admin_person_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type AdminPurgeCommunityForm struct { - AdminPersonID int `json:"admin_person_id" url:"admin_person_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` -} -type AdminPurgePost struct { - ID int32 `json:"id" url:"id,omitempty"` - AdminPersonID int `json:"admin_person_id" url:"admin_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type AdminPurgePostForm struct { - AdminPersonID int `json:"admin_person_id" url:"admin_person_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` -} -type AdminPurgeComment struct { - ID int32 `json:"id" url:"id,omitempty"` - AdminPersonID int `json:"admin_person_id" url:"admin_person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - When LemmyTime `json:"when_" url:"when_,omitempty"` -} -type AdminPurgeCommentForm struct { - AdminPersonID int `json:"admin_person_id" url:"admin_person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` -} diff --git a/types/password_reset_request.gen.go b/types/password_reset_request.gen.go deleted file mode 100644 index d0610e0..0000000 --- a/types/password_reset_request.gen.go +++ /dev/null @@ -1,15 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/password_reset_request.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type PasswordResetRequest struct { - ID int32 `json:"id" url:"id,omitempty"` - TokenEncrypted string `json:"token_encrypted" url:"token_encrypted,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - LocalUserID int `json:"local_user_id" url:"local_user_id,omitempty"` -} -type PasswordResetRequestForm struct { - LocalUserID int `json:"local_user_id" url:"local_user_id,omitempty"` - TokenEncrypted string `json:"token_encrypted" url:"token_encrypted,omitempty"` -} diff --git a/types/person.1.gen.go b/types/person.1.gen.go deleted file mode 100644 index a008a31..0000000 --- a/types/person.1.gen.go +++ /dev/null @@ -1,84 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/person.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Person struct { - ID int `json:"id" url:"id,omitempty"` - Name string `json:"name" url:"name,omitempty"` - DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"` - Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"` - Banned bool `json:"banned" url:"banned,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - ActorID string `json:"actor_id" url:"actor_id,omitempty"` - Bio Optional[string] `json:"bio" url:"bio,omitempty"` - Local bool `json:"local" url:"local,omitempty"` - PrivateKey Optional[string] `json:"private_key" url:"private_key,omitempty"` - PublicKey string `json:"public_key" url:"public_key,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"` - SharedInboxURL Optional[string] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"` - MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,omitempty"` - Admin bool `json:"admin" url:"admin,omitempty"` - BotAccount bool `json:"bot_account" url:"bot_account,omitempty"` - BanExpires LemmyTime `json:"ban_expires" url:"ban_expires,omitempty"` - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` -} -type PersonInsertForm struct { - Name string `json:"name" url:"name,omitempty"` - PublicKey string `json:"public_key" url:"public_key,omitempty"` - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` - DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"` - Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"` - Banned Optional[bool] `json:"banned" url:"banned,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - ActorID Optional[string] `json:"actor_id" url:"actor_id,omitempty"` - Bio Optional[string] `json:"bio" url:"bio,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - PrivateKey Optional[string] `json:"private_key" url:"private_key,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - InboxURL Optional[string] `json:"inbox_url" url:"inbox_url,omitempty"` - SharedInboxURL Optional[string] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"` - MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,omitempty"` - Admin Optional[bool] `json:"admin" url:"admin,omitempty"` - BotAccount Optional[bool] `json:"bot_account" url:"bot_account,omitempty"` - BanExpires LemmyTime `json:"ban_expires" url:"ban_expires,omitempty"` -} -type PersonUpdateForm struct { - DisplayName Optional[Optional[string]] `json:"display_name" url:"display_name,omitempty"` - Avatar Optional[Optional[string]] `json:"avatar" url:"avatar,omitempty"` - Banned Optional[bool] `json:"banned" url:"banned,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - ActorID Optional[string] `json:"actor_id" url:"actor_id,omitempty"` - Bio Optional[Optional[string]] `json:"bio" url:"bio,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - PublicKey Optional[string] `json:"public_key" url:"public_key,omitempty"` - PrivateKey Optional[Optional[string]] `json:"private_key" url:"private_key,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - Banner Optional[Optional[string]] `json:"banner" url:"banner,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - InboxURL Optional[string] `json:"inbox_url" url:"inbox_url,omitempty"` - SharedInboxURL Optional[Optional[string]] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"` - MatrixUserID Optional[Optional[string]] `json:"matrix_user_id" url:"matrix_user_id,omitempty"` - Admin Optional[bool] `json:"admin" url:"admin,omitempty"` - BotAccount Optional[bool] `json:"bot_account" url:"bot_account,omitempty"` - BanExpires LemmyTime `json:"ban_expires" url:"ban_expires,omitempty"` -} -type PersonFollower struct { - ID int32 `json:"id" url:"id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - FollowerID int `json:"follower_id" url:"follower_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Pending bool `json:"pending" url:"pending,omitempty"` -} -type PersonFollowerForm struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - FollowerID int `json:"follower_id" url:"follower_id,omitempty"` - Pending bool `json:"pending" url:"pending,omitempty"` -} diff --git a/types/person.gen.go b/types/person.gen.go deleted file mode 100644 index 0ebd475..0000000 --- a/types/person.gen.go +++ /dev/null @@ -1,212 +0,0 @@ -// Source: lemmy/crates/api_common/src/person.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Login struct { - UsernameOrEmail string `json:"username_or_email" url:"username_or_email,omitempty"` - Password string `json:"password" url:"password,omitempty"` - Totp2faToken Optional[string] `json:"totp_2fa_token" url:"totp_2fa_token,omitempty"` -} -type Register struct { - Username string `json:"username" url:"username,omitempty"` - Password string `json:"password" url:"password,omitempty"` - PasswordVerify string `json:"password_verify" url:"password_verify,omitempty"` - ShowNSFW bool `json:"show_nsfw" url:"show_nsfw,omitempty"` - Email Optional[string] `json:"email" url:"email,omitempty"` - CaptchaUuid Optional[string] `json:"captcha_uuid" url:"captcha_uuid,omitempty"` - CaptchaAnswer Optional[string] `json:"captcha_answer" url:"captcha_answer,omitempty"` - Honeypot Optional[string] `json:"honeypot" url:"honeypot,omitempty"` - Answer Optional[string] `json:"answer" url:"answer,omitempty"` -} -type GetCaptcha struct { - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type GetCaptchaResponse struct { - Ok Optional[CaptchaResponse] `json:"ok" url:"ok,omitempty"` - LemmyResponse -} -type CaptchaResponse struct { - Png string `json:"png" url:"png,omitempty"` - Wav string `json:"wav" url:"wav,omitempty"` - Uuid string `json:"uuid" url:"uuid,omitempty"` - LemmyResponse -} -type SaveUserSettings struct { - ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"` - ShowScores Optional[bool] `json:"show_scores" url:"show_scores,omitempty"` - Theme Optional[string] `json:"theme" url:"theme,omitempty"` - DefaultSortType Optional[SortType] `json:"default_sort_type" url:"default_sort_type,omitempty"` - DefaultListingType Optional[ListingType] `json:"default_listing_type" url:"default_listing_type,omitempty"` - InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"` - Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"` - Email Optional[string] `json:"email" url:"email,omitempty"` - Bio Optional[string] `json:"bio" url:"bio,omitempty"` - MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,omitempty"` - ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"` - SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` - BotAccount Optional[bool] `json:"bot_account" url:"bot_account,omitempty"` - ShowBotAccounts Optional[bool] `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` - ShowReadPosts Optional[bool] `json:"show_read_posts" url:"show_read_posts,omitempty"` - ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` - DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"` - GenerateTotp2fa Optional[bool] `json:"generate_totp_2fa" url:"generate_totp_2fa,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ChangePassword struct { - NewPassword string `json:"new_password" url:"new_password,omitempty"` - NewPasswordVerify string `json:"new_password_verify" url:"new_password_verify,omitempty"` - OldPassword string `json:"old_password" url:"old_password,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type LoginResponse struct { - JWT Optional[string] `json:"jwt" url:"jwt,omitempty"` - RegistrationCreated bool `json:"registration_created" url:"registration_created,omitempty"` - VerifyEmailSent bool `json:"verify_email_sent" url:"verify_email_sent,omitempty"` - LemmyResponse -} -type GetPersonDetails struct { - PersonID Optional[int] `json:"person_id" url:"person_id,omitempty"` - Username Optional[string] `json:"username" url:"username,omitempty"` - Sort Optional[SortType] `json:"sort" url:"sort,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - SavedOnly Optional[bool] `json:"saved_only" url:"saved_only,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type GetPersonDetailsResponse struct { - PersonView PersonView `json:"person_view" url:"person_view,omitempty"` - Comments []CommentView `json:"comments" url:"comments,omitempty"` - Posts []PostView `json:"posts" url:"posts,omitempty"` - Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"` - LemmyResponse -} -type MarkAllAsRead struct { - Auth string `json:"auth" url:"auth,omitempty"` -} -type AddAdmin struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - Added bool `json:"added" url:"added,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type AddAdminResponse struct { - Admins []PersonView `json:"admins" url:"admins,omitempty"` - LemmyResponse -} -type BanPerson struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - Ban bool `json:"ban" url:"ban,omitempty"` - RemoveData Optional[bool] `json:"remove_data" url:"remove_data,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Expires Optional[int64] `json:"expires" url:"expires,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetBannedPersons struct { - Auth string `json:"auth" url:"auth,omitempty"` -} -type BannedPersonsResponse struct { - Banned []PersonView `json:"banned" url:"banned,omitempty"` - LemmyResponse -} -type BanPersonResponse struct { - PersonView PersonView `json:"person_view" url:"person_view,omitempty"` - Banned bool `json:"banned" url:"banned,omitempty"` - LemmyResponse -} -type BlockPerson struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - Block bool `json:"block" url:"block,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type BlockPersonResponse struct { - PersonView PersonView `json:"person_view" url:"person_view,omitempty"` - Blocked bool `json:"blocked" url:"blocked,omitempty"` - LemmyResponse -} -type GetReplies struct { - Sort Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetRepliesResponse struct { - Replies []CommentReplyView `json:"replies" url:"replies,omitempty"` - LemmyResponse -} -type GetPersonMentions struct { - Sort Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetPersonMentionsResponse struct { - Mentions []PersonMentionView `json:"mentions" url:"mentions,omitempty"` - LemmyResponse -} -type MarkPersonMentionAsRead struct { - PersonMentionID int `json:"person_mention_id" url:"person_mention_id,omitempty"` - Read bool `json:"read" url:"read,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PersonMentionResponse struct { - PersonMentionView PersonMentionView `json:"person_mention_view" url:"person_mention_view,omitempty"` - LemmyResponse -} -type MarkCommentReplyAsRead struct { - CommentReplyID int `json:"comment_reply_id" url:"comment_reply_id,omitempty"` - Read bool `json:"read" url:"read,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type CommentReplyResponse struct { - CommentReplyView CommentReplyView `json:"comment_reply_view" url:"comment_reply_view,omitempty"` - LemmyResponse -} -type DeleteAccount struct { - Password string `json:"password" url:"password,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type DeleteAccountResponse struct { - LemmyResponse -} -type PasswordReset struct { - Email string `json:"email" url:"email,omitempty"` -} -type PasswordResetResponse struct { - LemmyResponse -} -type PasswordChangeAfterReset struct { - Token string `json:"token" url:"token,omitempty"` - Password string `json:"password" url:"password,omitempty"` - PasswordVerify string `json:"password_verify" url:"password_verify,omitempty"` -} -type GetReportCount struct { - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetReportCountResponse struct { - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - CommentReports int64 `json:"comment_reports" url:"comment_reports,omitempty"` - PostReports int64 `json:"post_reports" url:"post_reports,omitempty"` - PrivateMessageReports Optional[int64] `json:"private_message_reports" url:"private_message_reports,omitempty"` - LemmyResponse -} -type GetUnreadCount struct { - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetUnreadCountResponse struct { - Replies int64 `json:"replies" url:"replies,omitempty"` - Mentions int64 `json:"mentions" url:"mentions,omitempty"` - PrivateMessages int64 `json:"private_messages" url:"private_messages,omitempty"` - LemmyResponse -} -type VerifyEmail struct { - Token string `json:"token" url:"token,omitempty"` -} -type VerifyEmailResponse struct { - LemmyResponse -} diff --git a/types/person_block.gen.go b/types/person_block.gen.go deleted file mode 100644 index 81a5d1e..0000000 --- a/types/person_block.gen.go +++ /dev/null @@ -1,15 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/person_block.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type PersonBlock struct { - ID int `json:"id" url:"id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - TargetID int `json:"target_id" url:"target_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type PersonBlockForm struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - TargetID int `json:"target_id" url:"target_id,omitempty"` -} diff --git a/types/person_mention.gen.go b/types/person_mention.gen.go deleted file mode 100644 index f073953..0000000 --- a/types/person_mention.gen.go +++ /dev/null @@ -1,20 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/person_mention.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type PersonMention struct { - ID int `json:"id" url:"id,omitempty"` - RecipientID int `json:"recipient_id" url:"recipient_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Read bool `json:"read" url:"read,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type PersonMentionInsertForm struct { - RecipientID int `json:"recipient_id" url:"recipient_id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Read Optional[bool] `json:"read" url:"read,omitempty"` -} -type PersonMentionUpdateForm struct { - Read Optional[bool] `json:"read" url:"read,omitempty"` -} diff --git a/types/post.1.gen.go b/types/post.1.gen.go deleted file mode 100644 index 5b44699..0000000 --- a/types/post.1.gen.go +++ /dev/null @@ -1,102 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/post.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Post struct { - ID int `json:"id" url:"id,omitempty"` - Name string `json:"name" url:"name,omitempty"` - URL Optional[string] `json:"url" url:"url,omitempty"` - Body Optional[string] `json:"body" url:"body,omitempty"` - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - Locked bool `json:"locked" url:"locked,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - NSFW bool `json:"nsfw" url:"nsfw,omitempty"` - EmbedTitle Optional[string] `json:"embed_title" url:"embed_title,omitempty"` - EmbedDescription Optional[string] `json:"embed_description" url:"embed_description,omitempty"` - ThumbnailURL Optional[string] `json:"thumbnail_url" url:"thumbnail_url,omitempty"` - ApID string `json:"ap_id" url:"ap_id,omitempty"` - Local bool `json:"local" url:"local,omitempty"` - EmbedVideoURL Optional[string] `json:"embed_video_url" url:"embed_video_url,omitempty"` - LanguageID int `json:"language_id" url:"language_id,omitempty"` - FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"` - FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"` -} -type PostInsertForm struct { - Name string `json:"name" url:"name,omitempty"` - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` - URL Optional[string] `json:"url" url:"url,omitempty"` - Body Optional[string] `json:"body" url:"body,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` - Locked Optional[bool] `json:"locked" url:"locked,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - EmbedTitle Optional[string] `json:"embed_title" url:"embed_title,omitempty"` - EmbedDescription Optional[string] `json:"embed_description" url:"embed_description,omitempty"` - EmbedVideoURL Optional[string] `json:"embed_video_url" url:"embed_video_url,omitempty"` - ThumbnailURL Optional[string] `json:"thumbnail_url" url:"thumbnail_url,omitempty"` - ApID Optional[string] `json:"ap_id" url:"ap_id,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` - FeaturedCommunity Optional[bool] `json:"featured_community" url:"featured_community,omitempty"` - FeaturedLocal Optional[bool] `json:"featured_local" url:"featured_local,omitempty"` -} -type PostUpdateForm struct { - Name Optional[string] `json:"name" url:"name,omitempty"` - NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` - URL Optional[Optional[string]] `json:"url" url:"url,omitempty"` - Body Optional[Optional[string]] `json:"body" url:"body,omitempty"` - Removed Optional[bool] `json:"removed" url:"removed,omitempty"` - Locked Optional[bool] `json:"locked" url:"locked,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - EmbedTitle Optional[Optional[string]] `json:"embed_title" url:"embed_title,omitempty"` - EmbedDescription Optional[Optional[string]] `json:"embed_description" url:"embed_description,omitempty"` - EmbedVideoURL Optional[Optional[string]] `json:"embed_video_url" url:"embed_video_url,omitempty"` - ThumbnailURL Optional[Optional[string]] `json:"thumbnail_url" url:"thumbnail_url,omitempty"` - ApID Optional[string] `json:"ap_id" url:"ap_id,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` - LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` - FeaturedCommunity Optional[bool] `json:"featured_community" url:"featured_community,omitempty"` - FeaturedLocal Optional[bool] `json:"featured_local" url:"featured_local,omitempty"` -} -type PostLike struct { - ID int32 `json:"id" url:"id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Score int16 `json:"score" url:"score,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type PostLikeForm struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Score int16 `json:"score" url:"score,omitempty"` -} -type PostSaved struct { - ID int32 `json:"id" url:"id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type PostSavedForm struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` -} -type PostRead struct { - ID int32 `json:"id" url:"id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type PostReadForm struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` -} diff --git a/types/post.gen.go b/types/post.gen.go deleted file mode 100644 index 1099ede..0000000 --- a/types/post.gen.go +++ /dev/null @@ -1,129 +0,0 @@ -// Source: lemmy/crates/api_common/src/post.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CreatePost struct { - Name string `json:"name" url:"name,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - URL Optional[string] `json:"url" url:"url,omitempty"` - Body Optional[string] `json:"body" url:"body,omitempty"` - Honeypot Optional[string] `json:"honeypot" url:"honeypot,omitempty"` - NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` - LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PostResponse struct { - PostView PostView `json:"post_view" url:"post_view,omitempty"` - LemmyResponse -} -type GetPost struct { - ID Optional[int] `json:"id" url:"id,omitempty"` - CommentID Optional[int] `json:"comment_id" url:"comment_id,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type GetPostResponse struct { - PostView PostView `json:"post_view" url:"post_view,omitempty"` - CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` - Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` - CrossPosts []PostView `json:"cross_posts" url:"cross_posts,omitempty"` - LemmyResponse -} -type GetPosts struct { - Type Optional[ListingType] `json:"type_" url:"type_,omitempty"` - Sort Optional[SortType] `json:"sort" url:"sort,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - CommunityName Optional[string] `json:"community_name" url:"community_name,omitempty"` - SavedOnly Optional[bool] `json:"saved_only" url:"saved_only,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type GetPostsResponse struct { - Posts []PostView `json:"posts" url:"posts,omitempty"` - LemmyResponse -} -type CreatePostLike struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Score int16 `json:"score" url:"score,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type EditPost struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Name Optional[string] `json:"name" url:"name,omitempty"` - URL Optional[string] `json:"url" url:"url,omitempty"` - Body Optional[string] `json:"body" url:"body,omitempty"` - NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` - LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type DeletePost struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type RemovePost struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Removed bool `json:"removed" url:"removed,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type MarkPostAsRead struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Read bool `json:"read" url:"read,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type LockPost struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Locked bool `json:"locked" url:"locked,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type FeaturePost struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Featured bool `json:"featured" url:"featured,omitempty"` - FeatureType PostFeatureType `json:"feature_type" url:"feature_type,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type SavePost struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Save bool `json:"save" url:"save,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type CreatePostReport struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PostReportResponse struct { - PostReportView PostReportView `json:"post_report_view" url:"post_report_view,omitempty"` - LemmyResponse -} -type ResolvePostReport struct { - ReportID int `json:"report_id" url:"report_id,omitempty"` - Resolved bool `json:"resolved" url:"resolved,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ListPostReports struct { - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - UnresolvedOnly Optional[bool] `json:"unresolved_only" url:"unresolved_only,omitempty"` - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ListPostReportsResponse struct { - PostReports []PostReportView `json:"post_reports" url:"post_reports,omitempty"` - LemmyResponse -} -type GetSiteMetadata struct { - URL string `json:"url" url:"url,omitempty"` -} -type GetSiteMetadataResponse struct { - Metadata SiteMetadata `json:"metadata" url:"metadata,omitempty"` - LemmyResponse -} -type SiteMetadata struct { - Title Optional[string] `json:"title" url:"title,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - Image Optional[string] `json:"image" url:"image,omitempty"` - EmbedVideoURL Optional[string] `json:"embed_video_url" url:"embed_video_url,omitempty"` -} diff --git a/types/post_report.gen.go b/types/post_report.gen.go deleted file mode 100644 index ac3d1cb..0000000 --- a/types/post_report.gen.go +++ /dev/null @@ -1,26 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/post_report.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type PostReport struct { - ID int `json:"id" url:"id,omitempty"` - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - OriginalPostName string `json:"original_post_name" url:"original_post_name,omitempty"` - OriginalPostURL Optional[string] `json:"original_post_url" url:"original_post_url,omitempty"` - OriginalPostBody Optional[string] `json:"original_post_body" url:"original_post_body,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` - Resolved bool `json:"resolved" url:"resolved,omitempty"` - ResolverID Optional[int] `json:"resolver_id" url:"resolver_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} -type PostReportForm struct { - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - OriginalPostName string `json:"original_post_name" url:"original_post_name,omitempty"` - OriginalPostURL Optional[string] `json:"original_post_url" url:"original_post_url,omitempty"` - OriginalPostBody Optional[string] `json:"original_post_body" url:"original_post_body,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` -} diff --git a/types/private_message.1.gen.go b/types/private_message.1.gen.go deleted file mode 100644 index c2d5c64..0000000 --- a/types/private_message.1.gen.go +++ /dev/null @@ -1,37 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/private_message.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type PrivateMessage struct { - ID int `json:"id" url:"id,omitempty"` - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - RecipientID int `json:"recipient_id" url:"recipient_id,omitempty"` - Content string `json:"content" url:"content,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - Read bool `json:"read" url:"read,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - ApID string `json:"ap_id" url:"ap_id,omitempty"` - Local bool `json:"local" url:"local,omitempty"` -} -type PrivateMessageInsertForm struct { - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - RecipientID int `json:"recipient_id" url:"recipient_id,omitempty"` - Content string `json:"content" url:"content,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - Read Optional[bool] `json:"read" url:"read,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - ApID Optional[string] `json:"ap_id" url:"ap_id,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` -} -type PrivateMessageUpdateForm struct { - Content Optional[string] `json:"content" url:"content,omitempty"` - Deleted Optional[bool] `json:"deleted" url:"deleted,omitempty"` - Read Optional[bool] `json:"read" url:"read,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - ApID Optional[string] `json:"ap_id" url:"ap_id,omitempty"` - Local Optional[bool] `json:"local" url:"local,omitempty"` -} diff --git a/types/private_message.gen.go b/types/private_message.gen.go deleted file mode 100644 index 88b8ad6..0000000 --- a/types/private_message.gen.go +++ /dev/null @@ -1,63 +0,0 @@ -// Source: lemmy/crates/api_common/src/private_message.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CreatePrivateMessage struct { - Content string `json:"content" url:"content,omitempty"` - RecipientID int `json:"recipient_id" url:"recipient_id,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type EditPrivateMessage struct { - PrivateMessageID int `json:"private_message_id" url:"private_message_id,omitempty"` - Content string `json:"content" url:"content,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type DeletePrivateMessage struct { - PrivateMessageID int `json:"private_message_id" url:"private_message_id,omitempty"` - Deleted bool `json:"deleted" url:"deleted,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type MarkPrivateMessageAsRead struct { - PrivateMessageID int `json:"private_message_id" url:"private_message_id,omitempty"` - Read bool `json:"read" url:"read,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetPrivateMessages struct { - UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PrivateMessagesResponse struct { - PrivateMessages []PrivateMessageView `json:"private_messages" url:"private_messages,omitempty"` - LemmyResponse -} -type PrivateMessageResponse struct { - PrivateMessageView PrivateMessageView `json:"private_message_view" url:"private_message_view,omitempty"` - LemmyResponse -} -type CreatePrivateMessageReport struct { - PrivateMessageID int `json:"private_message_id" url:"private_message_id,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PrivateMessageReportResponse struct { - PrivateMessageReportView PrivateMessageReportView `json:"private_message_report_view" url:"private_message_report_view,omitempty"` - LemmyResponse -} -type ResolvePrivateMessageReport struct { - ReportID int `json:"report_id" url:"report_id,omitempty"` - Resolved bool `json:"resolved" url:"resolved,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ListPrivateMessageReports struct { - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - UnresolvedOnly Optional[bool] `json:"unresolved_only" url:"unresolved_only,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ListPrivateMessageReportsResponse struct { - PrivateMessageReports []PrivateMessageReportView `json:"private_message_reports" url:"private_message_reports,omitempty"` - LemmyResponse -} diff --git a/types/private_message_report.gen.go b/types/private_message_report.gen.go deleted file mode 100644 index 12a30bb..0000000 --- a/types/private_message_report.gen.go +++ /dev/null @@ -1,22 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/private_message_report.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type PrivateMessageReport struct { - ID int `json:"id" url:"id,omitempty"` - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - PrivateMessageID int `json:"private_message_id" url:"private_message_id,omitempty"` - OriginalPmText string `json:"original_pm_text" url:"original_pm_text,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` - Resolved bool `json:"resolved" url:"resolved,omitempty"` - ResolverID Optional[int] `json:"resolver_id" url:"resolver_id,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} -type PrivateMessageReportForm struct { - CreatorID int `json:"creator_id" url:"creator_id,omitempty"` - PrivateMessageID int `json:"private_message_id" url:"private_message_id,omitempty"` - OriginalPmText string `json:"original_pm_text" url:"original_pm_text,omitempty"` - Reason string `json:"reason" url:"reason,omitempty"` -} diff --git a/types/registration_application.gen.go b/types/registration_application.gen.go deleted file mode 100644 index c9529b9..0000000 --- a/types/registration_application.gen.go +++ /dev/null @@ -1,21 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/registration_application.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type RegistrationApplication struct { - ID int32 `json:"id" url:"id,omitempty"` - LocalUserID int `json:"local_user_id" url:"local_user_id,omitempty"` - Answer string `json:"answer" url:"answer,omitempty"` - AdminID Optional[int] `json:"admin_id" url:"admin_id,omitempty"` - DenyReason Optional[string] `json:"deny_reason" url:"deny_reason,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type RegistrationApplicationInsertForm struct { - LocalUserID int `json:"local_user_id" url:"local_user_id,omitempty"` - Answer string `json:"answer" url:"answer,omitempty"` -} -type RegistrationApplicationUpdateForm struct { - AdminID Optional[Optional[int]] `json:"admin_id" url:"admin_id,omitempty"` - DenyReason Optional[Optional[string]] `json:"deny_reason" url:"deny_reason,omitempty"` -} diff --git a/types/request.gen.go b/types/request.gen.go deleted file mode 100644 index 0f2f18c..0000000 --- a/types/request.gen.go +++ /dev/null @@ -1,4 +0,0 @@ -// Source: lemmy/crates/api_common/src/request.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types diff --git a/types/secret.gen.go b/types/secret.gen.go deleted file mode 100644 index c797b0a..0000000 --- a/types/secret.gen.go +++ /dev/null @@ -1,9 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/secret.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Secret struct { - ID int32 `json:"id" url:"id,omitempty"` - JWTSecret string `json:"jwt_secret" url:"jwt_secret,omitempty"` -} diff --git a/types/sensitive.gen.go b/types/sensitive.gen.go deleted file mode 100644 index 0d7dd26..0000000 --- a/types/sensitive.gen.go +++ /dev/null @@ -1,4 +0,0 @@ -// Source: lemmy/crates/api_common/src/sensitive.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types diff --git a/types/site.1.gen.go b/types/site.1.gen.go deleted file mode 100644 index 15c79c0..0000000 --- a/types/site.1.gen.go +++ /dev/null @@ -1,48 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/site.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Site struct { - ID int `json:"id" url:"id,omitempty"` - Name string `json:"name" url:"name,omitempty"` - Sidebar Optional[string] `json:"sidebar" url:"sidebar,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Icon Optional[string] `json:"icon" url:"icon,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - ActorID string `json:"actor_id" url:"actor_id,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"` - PrivateKey Optional[string] `json:"private_key" url:"private_key,omitempty"` - PublicKey string `json:"public_key" url:"public_key,omitempty"` - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` -} -type SiteInsertForm struct { - Name string `json:"name" url:"name,omitempty"` - Sidebar Optional[string] `json:"sidebar" url:"sidebar,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Icon Optional[string] `json:"icon" url:"icon,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - ActorID Optional[string] `json:"actor_id" url:"actor_id,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - InboxURL Optional[string] `json:"inbox_url" url:"inbox_url,omitempty"` - PrivateKey Optional[string] `json:"private_key" url:"private_key,omitempty"` - PublicKey Optional[string] `json:"public_key" url:"public_key,omitempty"` - InstanceID int `json:"instance_id" url:"instance_id,omitempty"` -} -type SiteUpdateForm struct { - Name Optional[string] `json:"name" url:"name,omitempty"` - Sidebar Optional[Optional[string]] `json:"sidebar" url:"sidebar,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` - Icon Optional[Optional[string]] `json:"icon" url:"icon,omitempty"` - Banner Optional[Optional[string]] `json:"banner" url:"banner,omitempty"` - Description Optional[Optional[string]] `json:"description" url:"description,omitempty"` - ActorID Optional[string] `json:"actor_id" url:"actor_id,omitempty"` - LastRefreshedAt LemmyTime `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` - InboxURL Optional[string] `json:"inbox_url" url:"inbox_url,omitempty"` - PrivateKey Optional[Optional[string]] `json:"private_key" url:"private_key,omitempty"` - PublicKey Optional[string] `json:"public_key" url:"public_key,omitempty"` -} diff --git a/types/site.gen.go b/types/site.gen.go deleted file mode 100644 index 1435f5b..0000000 --- a/types/site.gen.go +++ /dev/null @@ -1,243 +0,0 @@ -// Source: lemmy/crates/api_common/src/site.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Search struct { - Q string `json:"q" url:"q,omitempty"` - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - CommunityName Optional[string] `json:"community_name" url:"community_name,omitempty"` - CreatorID Optional[int] `json:"creator_id" url:"creator_id,omitempty"` - Type Optional[SearchType] `json:"type_" url:"type_,omitempty"` - Sort Optional[SortType] `json:"sort" url:"sort,omitempty"` - ListingType Optional[ListingType] `json:"listing_type" url:"listing_type,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type SearchResponse struct { - Type SearchType `json:"type_" url:"type_,omitempty"` - Comments []CommentView `json:"comments" url:"comments,omitempty"` - Posts []PostView `json:"posts" url:"posts,omitempty"` - Communities []CommunityView `json:"communities" url:"communities,omitempty"` - Users []PersonView `json:"users" url:"users,omitempty"` - LemmyResponse -} -type ResolveObject struct { - Q string `json:"q" url:"q,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ResolveObjectResponse struct { - Comment Optional[CommentView] `json:"comment" url:"comment,omitempty"` - Post Optional[PostView] `json:"post" url:"post,omitempty"` - Community Optional[CommunityView] `json:"community" url:"community,omitempty"` - Person Optional[PersonView] `json:"person" url:"person,omitempty"` - LemmyResponse -} -type GetModlog struct { - ModPersonID Optional[int] `json:"mod_person_id" url:"mod_person_id,omitempty"` - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - Type Optional[ModlogActionType] `json:"type_" url:"type_,omitempty"` - OtherPersonID Optional[int] `json:"other_person_id" url:"other_person_id,omitempty"` - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type GetModlogResponse struct { - RemovedPosts []ModRemovePostView `json:"removed_posts" url:"removed_posts,omitempty"` - LockedPosts []ModLockPostView `json:"locked_posts" url:"locked_posts,omitempty"` - FeaturedPosts []ModFeaturePostView `json:"featured_posts" url:"featured_posts,omitempty"` - RemovedComments []ModRemoveCommentView `json:"removed_comments" url:"removed_comments,omitempty"` - RemovedCommunities []ModRemoveCommunityView `json:"removed_communities" url:"removed_communities,omitempty"` - BannedFromCommunity []ModBanFromCommunityView `json:"banned_from_community" url:"banned_from_community,omitempty"` - Banned []ModBanView `json:"banned" url:"banned,omitempty"` - AddedToCommunity []ModAddCommunityView `json:"added_to_community" url:"added_to_community,omitempty"` - TransferredToCommunity []ModTransferCommunityView `json:"transferred_to_community" url:"transferred_to_community,omitempty"` - Added []ModAddView `json:"added" url:"added,omitempty"` - AdminPurgedPersons []AdminPurgePersonView `json:"admin_purged_persons" url:"admin_purged_persons,omitempty"` - AdminPurgedCommunities []AdminPurgeCommunityView `json:"admin_purged_communities" url:"admin_purged_communities,omitempty"` - AdminPurgedPosts []AdminPurgePostView `json:"admin_purged_posts" url:"admin_purged_posts,omitempty"` - AdminPurgedComments []AdminPurgeCommentView `json:"admin_purged_comments" url:"admin_purged_comments,omitempty"` - HiddenCommunities []ModHideCommunityView `json:"hidden_communities" url:"hidden_communities,omitempty"` - LemmyResponse -} -type CreateSite struct { - Name string `json:"name" url:"name,omitempty"` - Sidebar Optional[string] `json:"sidebar" url:"sidebar,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - Icon Optional[string] `json:"icon" url:"icon,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - EnableDownvotes Optional[bool] `json:"enable_downvotes" url:"enable_downvotes,omitempty"` - EnableNSFW Optional[bool] `json:"enable_nsfw" url:"enable_nsfw,omitempty"` - CommunityCreationAdminOnly Optional[bool] `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` - RequireEmailVerification Optional[bool] `json:"require_email_verification" url:"require_email_verification,omitempty"` - ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` - PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` - DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` - DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` - LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` - ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` - HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` - DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"` - SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` - ActorNameMaxLength Optional[int32] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` - RateLimitMessage Optional[int32] `json:"rate_limit_message" url:"rate_limit_message,omitempty"` - RateLimitMessagePerSecond Optional[int32] `json:"rate_limit_message_per_second" url:"rate_limit_message_per_second,omitempty"` - RateLimitPost Optional[int32] `json:"rate_limit_post" url:"rate_limit_post,omitempty"` - RateLimitPostPerSecond Optional[int32] `json:"rate_limit_post_per_second" url:"rate_limit_post_per_second,omitempty"` - RateLimitRegister Optional[int32] `json:"rate_limit_register" url:"rate_limit_register,omitempty"` - RateLimitRegisterPerSecond Optional[int32] `json:"rate_limit_register_per_second" url:"rate_limit_register_per_second,omitempty"` - RateLimitImage Optional[int32] `json:"rate_limit_image" url:"rate_limit_image,omitempty"` - RateLimitImagePerSecond Optional[int32] `json:"rate_limit_image_per_second" url:"rate_limit_image_per_second,omitempty"` - RateLimitComment Optional[int32] `json:"rate_limit_comment" url:"rate_limit_comment,omitempty"` - RateLimitCommentPerSecond Optional[int32] `json:"rate_limit_comment_per_second" url:"rate_limit_comment_per_second,omitempty"` - RateLimitSearch Optional[int32] `json:"rate_limit_search" url:"rate_limit_search,omitempty"` - RateLimitSearchPerSecond Optional[int32] `json:"rate_limit_search_per_second" url:"rate_limit_search_per_second,omitempty"` - FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"` - FederationDebug Optional[bool] `json:"federation_debug" url:"federation_debug,omitempty"` - FederationWorkerCount Optional[int32] `json:"federation_worker_count" url:"federation_worker_count,omitempty"` - CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"` - CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` - AllowedInstances Optional[[]string] `json:"allowed_instances" url:"allowed_instances,omitempty"` - BlockedInstances Optional[[]string] `json:"blocked_instances" url:"blocked_instances,omitempty"` - Taglines Optional[[]string] `json:"taglines" url:"taglines,omitempty"` - RegistrationMode Optional[RegistrationMode] `json:"registration_mode" url:"registration_mode,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type EditSite struct { - Name Optional[string] `json:"name" url:"name,omitempty"` - Sidebar Optional[string] `json:"sidebar" url:"sidebar,omitempty"` - Description Optional[string] `json:"description" url:"description,omitempty"` - Icon Optional[string] `json:"icon" url:"icon,omitempty"` - Banner Optional[string] `json:"banner" url:"banner,omitempty"` - EnableDownvotes Optional[bool] `json:"enable_downvotes" url:"enable_downvotes,omitempty"` - EnableNSFW Optional[bool] `json:"enable_nsfw" url:"enable_nsfw,omitempty"` - CommunityCreationAdminOnly Optional[bool] `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` - RequireEmailVerification Optional[bool] `json:"require_email_verification" url:"require_email_verification,omitempty"` - ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` - PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` - DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` - DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` - LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` - ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` - HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` - DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"` - SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` - ActorNameMaxLength Optional[int32] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` - RateLimitMessage Optional[int32] `json:"rate_limit_message" url:"rate_limit_message,omitempty"` - RateLimitMessagePerSecond Optional[int32] `json:"rate_limit_message_per_second" url:"rate_limit_message_per_second,omitempty"` - RateLimitPost Optional[int32] `json:"rate_limit_post" url:"rate_limit_post,omitempty"` - RateLimitPostPerSecond Optional[int32] `json:"rate_limit_post_per_second" url:"rate_limit_post_per_second,omitempty"` - RateLimitRegister Optional[int32] `json:"rate_limit_register" url:"rate_limit_register,omitempty"` - RateLimitRegisterPerSecond Optional[int32] `json:"rate_limit_register_per_second" url:"rate_limit_register_per_second,omitempty"` - RateLimitImage Optional[int32] `json:"rate_limit_image" url:"rate_limit_image,omitempty"` - RateLimitImagePerSecond Optional[int32] `json:"rate_limit_image_per_second" url:"rate_limit_image_per_second,omitempty"` - RateLimitComment Optional[int32] `json:"rate_limit_comment" url:"rate_limit_comment,omitempty"` - RateLimitCommentPerSecond Optional[int32] `json:"rate_limit_comment_per_second" url:"rate_limit_comment_per_second,omitempty"` - RateLimitSearch Optional[int32] `json:"rate_limit_search" url:"rate_limit_search,omitempty"` - RateLimitSearchPerSecond Optional[int32] `json:"rate_limit_search_per_second" url:"rate_limit_search_per_second,omitempty"` - FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"` - FederationDebug Optional[bool] `json:"federation_debug" url:"federation_debug,omitempty"` - FederationWorkerCount Optional[int32] `json:"federation_worker_count" url:"federation_worker_count,omitempty"` - CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"` - CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` - AllowedInstances Optional[[]string] `json:"allowed_instances" url:"allowed_instances,omitempty"` - BlockedInstances Optional[[]string] `json:"blocked_instances" url:"blocked_instances,omitempty"` - Taglines Optional[[]string] `json:"taglines" url:"taglines,omitempty"` - RegistrationMode Optional[RegistrationMode] `json:"registration_mode" url:"registration_mode,omitempty"` - ReportsEmailAdmins Optional[bool] `json:"reports_email_admins" url:"reports_email_admins,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetSite struct { - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type SiteResponse struct { - SiteView SiteView `json:"site_view" url:"site_view,omitempty"` - Taglines []Tagline `json:"taglines" url:"taglines,omitempty"` - LemmyResponse -} -type GetSiteResponse struct { - SiteView SiteView `json:"site_view" url:"site_view,omitempty"` - Admins []PersonView `json:"admins" url:"admins,omitempty"` - Version string `json:"version" url:"version,omitempty"` - MyUser Optional[MyUserInfo] `json:"my_user" url:"my_user,omitempty"` - AllLanguages []Language `json:"all_languages" url:"all_languages,omitempty"` - DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"` - Taglines []Tagline `json:"taglines" url:"taglines,omitempty"` - CustomEmojis []CustomEmojiView `json:"custom_emojis" url:"custom_emojis,omitempty"` - LemmyResponse -} -type GetFederatedInstances struct { - Auth Optional[string] `json:"auth" url:"auth,omitempty"` -} -type GetFederatedInstancesResponse struct { - FederatedInstances Optional[FederatedInstances] `json:"federated_instances" url:"federated_instances,omitempty"` - LemmyResponse -} -type MyUserInfo struct { - LocalUserView LocalUserView `json:"local_user_view" url:"local_user_view,omitempty"` - Follows []CommunityFollowerView `json:"follows" url:"follows,omitempty"` - Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"` - CommunityBlocks []CommunityBlockView `json:"community_blocks" url:"community_blocks,omitempty"` - PersonBlocks []PersonBlockView `json:"person_blocks" url:"person_blocks,omitempty"` - DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"` -} -type LeaveAdmin struct { - Auth string `json:"auth" url:"auth,omitempty"` -} -type FederatedInstances struct { - Linked []Instance `json:"linked" url:"linked,omitempty"` - Allowed []Instance `json:"allowed" url:"allowed,omitempty"` - Blocked []Instance `json:"blocked" url:"blocked,omitempty"` -} -type PurgePerson struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PurgeCommunity struct { - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PurgePost struct { - PostID int `json:"post_id" url:"post_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PurgeComment struct { - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Reason Optional[string] `json:"reason" url:"reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type PurgeItemResponse struct { - Success bool `json:"success" url:"success,omitempty"` - LemmyResponse -} -type ListRegistrationApplications struct { - UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type ListRegistrationApplicationsResponse struct { - RegistrationApplications []RegistrationApplicationView `json:"registration_applications" url:"registration_applications,omitempty"` - LemmyResponse -} -type ApproveRegistrationApplication struct { - ID int32 `json:"id" url:"id,omitempty"` - Approve bool `json:"approve" url:"approve,omitempty"` - DenyReason Optional[string] `json:"deny_reason" url:"deny_reason,omitempty"` - Auth string `json:"auth" url:"auth,omitempty"` -} -type RegistrationApplicationResponse struct { - RegistrationApplication RegistrationApplicationView `json:"registration_application" url:"registration_application,omitempty"` - LemmyResponse -} -type GetUnreadRegistrationApplicationCount struct { - Auth string `json:"auth" url:"auth,omitempty"` -} -type GetUnreadRegistrationApplicationCountResponse struct { - RegistrationApplications int64 `json:"registration_applications" url:"registration_applications,omitempty"` - LemmyResponse -} diff --git a/types/structs.1.gen.go b/types/structs.1.gen.go deleted file mode 100644 index 2603197..0000000 --- a/types/structs.1.gen.go +++ /dev/null @@ -1,86 +0,0 @@ -// Source: lemmy/crates/db_views/src/structs.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CommentReportView struct { - CommentReport CommentReport `json:"comment_report" url:"comment_report,omitempty"` - Comment Comment `json:"comment" url:"comment,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - CommentCreator Person `json:"comment_creator" url:"comment_creator,omitempty"` - Counts CommentAggregates `json:"counts" url:"counts,omitempty"` - CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` - MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"` - Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"` -} -type CommentView struct { - Comment Comment `json:"comment" url:"comment,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - Counts CommentAggregates `json:"counts" url:"counts,omitempty"` - CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` - Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` - Saved bool `json:"saved" url:"saved,omitempty"` - CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` - MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"` -} -type LocalUserView struct { - LocalUser LocalUser `json:"local_user" url:"local_user,omitempty"` - Person Person `json:"person" url:"person,omitempty"` - Counts PersonAggregates `json:"counts" url:"counts,omitempty"` -} -type PostReportView struct { - PostReport PostReport `json:"post_report" url:"post_report,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - PostCreator Person `json:"post_creator" url:"post_creator,omitempty"` - CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` - MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"` - Counts PostAggregates `json:"counts" url:"counts,omitempty"` - Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"` -} -type PostView struct { - Post Post `json:"post" url:"post,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` - Counts PostAggregates `json:"counts" url:"counts,omitempty"` - Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` - Saved bool `json:"saved" url:"saved,omitempty"` - Read bool `json:"read" url:"read,omitempty"` - CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` - MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"` - UnreadComments int64 `json:"unread_comments" url:"unread_comments,omitempty"` -} -type PrivateMessageView struct { - PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - Recipient Person `json:"recipient" url:"recipient,omitempty"` -} -type PrivateMessageReportView struct { - PrivateMessageReport PrivateMessageReport `json:"private_message_report" url:"private_message_report,omitempty"` - PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"` - PrivateMessageCreator Person `json:"private_message_creator" url:"private_message_creator,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"` -} -type RegistrationApplicationView struct { - RegistrationApplication RegistrationApplication `json:"registration_application" url:"registration_application,omitempty"` - CreatorLocalUser LocalUser `json:"creator_local_user" url:"creator_local_user,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - Admin Optional[Person] `json:"admin" url:"admin,omitempty"` -} -type SiteView struct { - Site Site `json:"site" url:"site,omitempty"` - LocalSite LocalSite `json:"local_site" url:"local_site,omitempty"` - LocalSiteRateLimit LocalSiteRateLimit `json:"local_site_rate_limit" url:"local_site_rate_limit,omitempty"` - Counts SiteAggregates `json:"counts" url:"counts,omitempty"` -} -type CustomEmojiView struct { - CustomEmoji CustomEmoji `json:"custom_emoji" url:"custom_emoji,omitempty"` - Keywords []CustomEmojiKeyword `json:"keywords" url:"keywords,omitempty"` -} diff --git a/types/structs.2.gen.go b/types/structs.2.gen.go deleted file mode 100644 index 9a5667d..0000000 --- a/types/structs.2.gen.go +++ /dev/null @@ -1,95 +0,0 @@ -// Source: lemmy/crates/db_views_moderator/src/structs.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type ModAddCommunityView struct { - ModAddCommunity ModAddCommunity `json:"mod_add_community" url:"mod_add_community,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"` -} -type ModAddView struct { - ModAdd ModAdd `json:"mod_add" url:"mod_add,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"` -} -type ModBanFromCommunityView struct { - ModBanFromCommunity ModBanFromCommunity `json:"mod_ban_from_community" url:"mod_ban_from_community,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - BannedPerson Person `json:"banned_person" url:"banned_person,omitempty"` -} -type ModBanView struct { - ModBan ModBan `json:"mod_ban" url:"mod_ban,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - BannedPerson Person `json:"banned_person" url:"banned_person,omitempty"` -} -type ModHideCommunityView struct { - ModHideCommunity ModHideCommunity `json:"mod_hide_community" url:"mod_hide_community,omitempty"` - Admin Optional[Person] `json:"admin" url:"admin,omitempty"` - Community Community `json:"community" url:"community,omitempty"` -} -type ModLockPostView struct { - ModLockPost ModLockPost `json:"mod_lock_post" url:"mod_lock_post,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` -} -type ModRemoveCommentView struct { - ModRemoveComment ModRemoveComment `json:"mod_remove_comment" url:"mod_remove_comment,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - Comment Comment `json:"comment" url:"comment,omitempty"` - Commenter Person `json:"commenter" url:"commenter,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` -} -type ModRemoveCommunityView struct { - ModRemoveCommunity ModRemoveCommunity `json:"mod_remove_community" url:"mod_remove_community,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - Community Community `json:"community" url:"community,omitempty"` -} -type ModRemovePostView struct { - ModRemovePost ModRemovePost `json:"mod_remove_post" url:"mod_remove_post,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` -} -type ModFeaturePostView struct { - ModFeaturePost ModFeaturePost `json:"mod_feature_post" url:"mod_feature_post,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` -} -type ModTransferCommunityView struct { - ModTransferCommunity ModTransferCommunity `json:"mod_transfer_community" url:"mod_transfer_community,omitempty"` - Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"` -} -type AdminPurgeCommentView struct { - AdminPurgeComment AdminPurgeComment `json:"admin_purge_comment" url:"admin_purge_comment,omitempty"` - Admin Optional[Person] `json:"admin" url:"admin,omitempty"` - Post Post `json:"post" url:"post,omitempty"` -} -type AdminPurgeCommunityView struct { - AdminPurgeCommunity AdminPurgeCommunity `json:"admin_purge_community" url:"admin_purge_community,omitempty"` - Admin Optional[Person] `json:"admin" url:"admin,omitempty"` -} -type AdminPurgePersonView struct { - AdminPurgePerson AdminPurgePerson `json:"admin_purge_person" url:"admin_purge_person,omitempty"` - Admin Optional[Person] `json:"admin" url:"admin,omitempty"` -} -type AdminPurgePostView struct { - AdminPurgePost AdminPurgePost `json:"admin_purge_post" url:"admin_purge_post,omitempty"` - Admin Optional[Person] `json:"admin" url:"admin,omitempty"` - Community Community `json:"community" url:"community,omitempty"` -} -type ModlogListParams struct { - CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` - ModPersonID Optional[int] `json:"mod_person_id" url:"mod_person_id,omitempty"` - OtherPersonID Optional[int] `json:"other_person_id" url:"other_person_id,omitempty"` - Page Optional[int64] `json:"page" url:"page,omitempty"` - Limit Optional[int64] `json:"limit" url:"limit,omitempty"` - HideModlogNames bool `json:"hide_modlog_names" url:"hide_modlog_names,omitempty"` -} diff --git a/types/structs.3.gen.go b/types/structs.3.gen.go deleted file mode 100644 index cfe9985..0000000 --- a/types/structs.3.gen.go +++ /dev/null @@ -1,76 +0,0 @@ -// Source: lemmy/crates/db_schema/src/aggregates/structs.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CommentAggregates struct { - ID int32 `json:"id" url:"id,omitempty"` - CommentID int `json:"comment_id" url:"comment_id,omitempty"` - Score int64 `json:"score" url:"score,omitempty"` - Upvotes int64 `json:"upvotes" url:"upvotes,omitempty"` - Downvotes int64 `json:"downvotes" url:"downvotes,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - ChildCount int32 `json:"child_count" url:"child_count,omitempty"` - HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"` -} -type CommunityAggregates struct { - ID int32 `json:"id" url:"id,omitempty"` - CommunityID int `json:"community_id" url:"community_id,omitempty"` - Subscribers int64 `json:"subscribers" url:"subscribers,omitempty"` - Posts int64 `json:"posts" url:"posts,omitempty"` - Comments int64 `json:"comments" url:"comments,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - UsersActiveDay int64 `json:"users_active_day" url:"users_active_day,omitempty"` - UsersActiveWeek int64 `json:"users_active_week" url:"users_active_week,omitempty"` - UsersActiveMonth int64 `json:"users_active_month" url:"users_active_month,omitempty"` - UsersActiveHalfYear int64 `json:"users_active_half_year" url:"users_active_half_year,omitempty"` - HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"` -} -type PersonAggregates struct { - ID int32 `json:"id" url:"id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - PostCount int64 `json:"post_count" url:"post_count,omitempty"` - PostScore int64 `json:"post_score" url:"post_score,omitempty"` - CommentCount int64 `json:"comment_count" url:"comment_count,omitempty"` - CommentScore int64 `json:"comment_score" url:"comment_score,omitempty"` -} -type PostAggregates struct { - ID int32 `json:"id" url:"id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - Comments int64 `json:"comments" url:"comments,omitempty"` - Score int64 `json:"score" url:"score,omitempty"` - Upvotes int64 `json:"upvotes" url:"upvotes,omitempty"` - Downvotes int64 `json:"downvotes" url:"downvotes,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - NewestCommentTimeNecro LemmyTime `json:"newest_comment_time_necro" url:"newest_comment_time_necro,omitempty"` - NewestCommentTime LemmyTime `json:"newest_comment_time" url:"newest_comment_time,omitempty"` - FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"` - FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"` - HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"` - HotRankActive int32 `json:"hot_rank_active" url:"hot_rank_active,omitempty"` -} -type PersonPostAggregates struct { - ID int32 `json:"id" url:"id,omitempty"` - PersonID int `json:"person_id" url:"person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - ReadComments int64 `json:"read_comments" url:"read_comments,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type PersonPostAggregatesForm struct { - PersonID int `json:"person_id" url:"person_id,omitempty"` - PostID int `json:"post_id" url:"post_id,omitempty"` - ReadComments int64 `json:"read_comments" url:"read_comments,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` -} -type SiteAggregates struct { - ID int32 `json:"id" url:"id,omitempty"` - SiteID int `json:"site_id" url:"site_id,omitempty"` - Users int64 `json:"users" url:"users,omitempty"` - Posts int64 `json:"posts" url:"posts,omitempty"` - Comments int64 `json:"comments" url:"comments,omitempty"` - Communities int64 `json:"communities" url:"communities,omitempty"` - UsersActiveDay int64 `json:"users_active_day" url:"users_active_day,omitempty"` - UsersActiveWeek int64 `json:"users_active_week" url:"users_active_week,omitempty"` - UsersActiveMonth int64 `json:"users_active_month" url:"users_active_month,omitempty"` - UsersActiveHalfYear int64 `json:"users_active_half_year" url:"users_active_half_year,omitempty"` -} diff --git a/types/structs.gen.go b/types/structs.gen.go deleted file mode 100644 index 3a37978..0000000 --- a/types/structs.gen.go +++ /dev/null @@ -1,63 +0,0 @@ -// Source: lemmy/crates/db_views_actor/src/structs.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type CommunityBlockView struct { - Person Person `json:"person" url:"person,omitempty"` - Community Community `json:"community" url:"community,omitempty"` -} -type CommunityFollowerView struct { - Community Community `json:"community" url:"community,omitempty"` - Follower Person `json:"follower" url:"follower,omitempty"` -} -type CommunityModeratorView struct { - Community Community `json:"community" url:"community,omitempty"` - Moderator Person `json:"moderator" url:"moderator,omitempty"` -} -type CommunityPersonBanView struct { - Community Community `json:"community" url:"community,omitempty"` - Person Person `json:"person" url:"person,omitempty"` -} -type CommunityView struct { - Community Community `json:"community" url:"community,omitempty"` - Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` - Blocked bool `json:"blocked" url:"blocked,omitempty"` - Counts CommunityAggregates `json:"counts" url:"counts,omitempty"` -} -type PersonBlockView struct { - Person Person `json:"person" url:"person,omitempty"` - Target Person `json:"target" url:"target,omitempty"` -} -type PersonMentionView struct { - PersonMention PersonMention `json:"person_mention" url:"person_mention,omitempty"` - Comment Comment `json:"comment" url:"comment,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - Recipient Person `json:"recipient" url:"recipient,omitempty"` - Counts CommentAggregates `json:"counts" url:"counts,omitempty"` - CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` - Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` - Saved bool `json:"saved" url:"saved,omitempty"` - CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` - MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"` -} -type CommentReplyView struct { - CommentReply CommentReply `json:"comment_reply" url:"comment_reply,omitempty"` - Comment Comment `json:"comment" url:"comment,omitempty"` - Creator Person `json:"creator" url:"creator,omitempty"` - Post Post `json:"post" url:"post,omitempty"` - Community Community `json:"community" url:"community,omitempty"` - Recipient Person `json:"recipient" url:"recipient,omitempty"` - Counts CommentAggregates `json:"counts" url:"counts,omitempty"` - CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` - Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` - Saved bool `json:"saved" url:"saved,omitempty"` - CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` - MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"` -} -type PersonView struct { - Person Person `json:"person" url:"person,omitempty"` - Counts PersonAggregates `json:"counts" url:"counts,omitempty"` -} diff --git a/types/tagline.gen.go b/types/tagline.gen.go deleted file mode 100644 index 69d8bb6..0000000 --- a/types/tagline.gen.go +++ /dev/null @@ -1,17 +0,0 @@ -// Source: lemmy/crates/db_schema/src/source/tagline.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type Tagline struct { - ID int32 `json:"id" url:"id,omitempty"` - LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"` - Content string `json:"content" url:"content,omitempty"` - Published LemmyTime `json:"published" url:"published,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} -type TaglineForm struct { - LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"` - Content string `json:"content" url:"content,omitempty"` - Updated LemmyTime `json:"updated" url:"updated,omitempty"` -} diff --git a/types/types.gen.go b/types/types.gen.go new file mode 100644 index 0000000..9a3996a --- /dev/null +++ b/types/types.gen.go @@ -0,0 +1,1596 @@ +// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. + +package types + +type ModHideCommunityView struct { + Admin Optional[Person] `json:"admin" url:"admin,omitempty"` + Community Community `json:"community" url:"community,omitempty"` + ModHideCommunity ModHideCommunity `json:"mod_hide_community" url:"mod_hide_community,omitempty"` +} +type EditSite struct { + ActorNameMaxLength Optional[float64] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` + AllowedInstances Optional[[]string] `json:"allowed_instances" url:"allowed_instances,omitempty"` + ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` + ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` + Auth string `json:"auth" url:"auth,omitempty"` + Banner Optional[string] `json:"banner" url:"banner,omitempty"` + BlockedInstances Optional[[]string] `json:"blocked_instances" url:"blocked_instances,omitempty"` + CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` + CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"` + CommunityCreationAdminOnly Optional[bool] `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` + DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` + DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` + Description Optional[string] `json:"description" url:"description,omitempty"` + DiscussionLanguages Optional[[]float64] `json:"discussion_languages" url:"discussion_languages,omitempty"` + EnableDownvotes Optional[bool] `json:"enable_downvotes" url:"enable_downvotes,omitempty"` + EnableNSFW Optional[bool] `json:"enable_nsfw" url:"enable_nsfw,omitempty"` + FederationDebug Optional[bool] `json:"federation_debug" url:"federation_debug,omitempty"` + FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"` + HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` + Icon Optional[string] `json:"icon" url:"icon,omitempty"` + LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` + Name Optional[string] `json:"name" url:"name,omitempty"` + PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` + RateLimitComment Optional[float64] `json:"rate_limit_comment" url:"rate_limit_comment,omitempty"` + RateLimitCommentPerSecond Optional[float64] `json:"rate_limit_comment_per_second" url:"rate_limit_comment_per_second,omitempty"` + RateLimitImage Optional[float64] `json:"rate_limit_image" url:"rate_limit_image,omitempty"` + RateLimitImagePerSecond Optional[float64] `json:"rate_limit_image_per_second" url:"rate_limit_image_per_second,omitempty"` + RateLimitMessage Optional[float64] `json:"rate_limit_message" url:"rate_limit_message,omitempty"` + RateLimitMessagePerSecond Optional[float64] `json:"rate_limit_message_per_second" url:"rate_limit_message_per_second,omitempty"` + RateLimitPost Optional[float64] `json:"rate_limit_post" url:"rate_limit_post,omitempty"` + RateLimitPostPerSecond Optional[float64] `json:"rate_limit_post_per_second" url:"rate_limit_post_per_second,omitempty"` + RateLimitRegister Optional[float64] `json:"rate_limit_register" url:"rate_limit_register,omitempty"` + RateLimitRegisterPerSecond Optional[float64] `json:"rate_limit_register_per_second" url:"rate_limit_register_per_second,omitempty"` + RateLimitSearch Optional[float64] `json:"rate_limit_search" url:"rate_limit_search,omitempty"` + RateLimitSearchPerSecond Optional[float64] `json:"rate_limit_search_per_second" url:"rate_limit_search_per_second,omitempty"` + RegistrationMode Optional[RegistrationMode] `json:"registration_mode" url:"registration_mode,omitempty"` + ReportsEmailAdmins Optional[bool] `json:"reports_email_admins" url:"reports_email_admins,omitempty"` + RequireEmailVerification Optional[bool] `json:"require_email_verification" url:"require_email_verification,omitempty"` + Sidebar Optional[string] `json:"sidebar" url:"sidebar,omitempty"` + SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` + Taglines Optional[[]string] `json:"taglines" url:"taglines,omitempty"` +} +type CommentView struct { + Comment Comment `json:"comment" url:"comment,omitempty"` + Community Community `json:"community" url:"community,omitempty"` + Counts CommentAggregates `json:"counts" url:"counts,omitempty"` + Creator Person `json:"creator" url:"creator,omitempty"` + CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` + CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` + MyVote Optional[float64] `json:"my_vote" url:"my_vote,omitempty"` + Post Post `json:"post" url:"post,omitempty"` + Saved bool `json:"saved" url:"saved,omitempty"` + Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` +} +type LocalSiteRateLimit struct { + Comment float64 `json:"comment" url:"comment,omitempty"` + CommentPerSecond float64 `json:"comment_per_second" url:"comment_per_second,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Image float64 `json:"image" url:"image,omitempty"` + ImagePerSecond float64 `json:"image_per_second" url:"image_per_second,omitempty"` + LocalSiteID float64 `json:"local_site_id" url:"local_site_id,omitempty"` + Message float64 `json:"message" url:"message,omitempty"` + MessagePerSecond float64 `json:"message_per_second" url:"message_per_second,omitempty"` + Post float64 `json:"post" url:"post,omitempty"` + PostPerSecond float64 `json:"post_per_second" url:"post_per_second,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Register float64 `json:"register" url:"register,omitempty"` + RegisterPerSecond float64 `json:"register_per_second" url:"register_per_second,omitempty"` + Search float64 `json:"search" url:"search,omitempty"` + SearchPerSecond float64 `json:"search_per_second" url:"search_per_second,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type CreatePrivateMessage struct { + Auth string `json:"auth" url:"auth,omitempty"` + Content string `json:"content" url:"content,omitempty"` + RecipientID float64 `json:"recipient_id" url:"recipient_id,omitempty"` +} +type CreateSite struct { + ActorNameMaxLength Optional[float64] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` + AllowedInstances Optional[[]string] `json:"allowed_instances" url:"allowed_instances,omitempty"` + ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` + ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` + Auth string `json:"auth" url:"auth,omitempty"` + Banner Optional[string] `json:"banner" url:"banner,omitempty"` + BlockedInstances Optional[[]string] `json:"blocked_instances" url:"blocked_instances,omitempty"` + CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` + CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"` + CommunityCreationAdminOnly Optional[bool] `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` + DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` + DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` + Description Optional[string] `json:"description" url:"description,omitempty"` + DiscussionLanguages Optional[[]float64] `json:"discussion_languages" url:"discussion_languages,omitempty"` + EnableDownvotes Optional[bool] `json:"enable_downvotes" url:"enable_downvotes,omitempty"` + EnableNSFW Optional[bool] `json:"enable_nsfw" url:"enable_nsfw,omitempty"` + FederationDebug Optional[bool] `json:"federation_debug" url:"federation_debug,omitempty"` + FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"` + HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` + Icon Optional[string] `json:"icon" url:"icon,omitempty"` + LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` + Name string `json:"name" url:"name,omitempty"` + PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` + RateLimitComment Optional[float64] `json:"rate_limit_comment" url:"rate_limit_comment,omitempty"` + RateLimitCommentPerSecond Optional[float64] `json:"rate_limit_comment_per_second" url:"rate_limit_comment_per_second,omitempty"` + RateLimitImage Optional[float64] `json:"rate_limit_image" url:"rate_limit_image,omitempty"` + RateLimitImagePerSecond Optional[float64] `json:"rate_limit_image_per_second" url:"rate_limit_image_per_second,omitempty"` + RateLimitMessage Optional[float64] `json:"rate_limit_message" url:"rate_limit_message,omitempty"` + RateLimitMessagePerSecond Optional[float64] `json:"rate_limit_message_per_second" url:"rate_limit_message_per_second,omitempty"` + RateLimitPost Optional[float64] `json:"rate_limit_post" url:"rate_limit_post,omitempty"` + RateLimitPostPerSecond Optional[float64] `json:"rate_limit_post_per_second" url:"rate_limit_post_per_second,omitempty"` + RateLimitRegister Optional[float64] `json:"rate_limit_register" url:"rate_limit_register,omitempty"` + RateLimitRegisterPerSecond Optional[float64] `json:"rate_limit_register_per_second" url:"rate_limit_register_per_second,omitempty"` + RateLimitSearch Optional[float64] `json:"rate_limit_search" url:"rate_limit_search,omitempty"` + RateLimitSearchPerSecond Optional[float64] `json:"rate_limit_search_per_second" url:"rate_limit_search_per_second,omitempty"` + RegistrationMode Optional[RegistrationMode] `json:"registration_mode" url:"registration_mode,omitempty"` + RequireEmailVerification Optional[bool] `json:"require_email_verification" url:"require_email_verification,omitempty"` + Sidebar Optional[string] `json:"sidebar" url:"sidebar,omitempty"` + SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` + Taglines Optional[[]string] `json:"taglines" url:"taglines,omitempty"` +} +type SiteResponse struct { + SiteView SiteView `json:"site_view" url:"site_view,omitempty"` + Taglines []Tagline `json:"taglines" url:"taglines,omitempty"` + LemmyResponse +} +type GetBannedPersons struct { + Auth string `json:"auth" url:"auth,omitempty"` +} +type BanPerson struct { + Auth string `json:"auth" url:"auth,omitempty"` + Ban bool `json:"ban" url:"ban,omitempty"` + Expires Optional[float64] `json:"expires" url:"expires,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + RemoveData Optional[bool] `json:"remove_data" url:"remove_data,omitempty"` +} +type Comment struct { + ApID string `json:"ap_id" url:"ap_id,omitempty"` + Content string `json:"content" url:"content,omitempty"` + CreatorID float64 `json:"creator_id" url:"creator_id,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` + Distinguished bool `json:"distinguished" url:"distinguished,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + LanguageID float64 `json:"language_id" url:"language_id,omitempty"` + Local bool `json:"local" url:"local,omitempty"` + Path string `json:"path" url:"path,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type PrivateMessage struct { + ApID string `json:"ap_id" url:"ap_id,omitempty"` + Content string `json:"content" url:"content,omitempty"` + CreatorID float64 `json:"creator_id" url:"creator_id,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Local bool `json:"local" url:"local,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Read bool `json:"read" url:"read,omitempty"` + RecipientID float64 `json:"recipient_id" url:"recipient_id,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type GetComment struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` +} +type ListPostReports struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + UnresolvedOnly Optional[bool] `json:"unresolved_only" url:"unresolved_only,omitempty"` +} +type RegistrationApplication struct { + AdminID Optional[float64] `json:"admin_id" url:"admin_id,omitempty"` + Answer string `json:"answer" url:"answer,omitempty"` + DenyReason Optional[string] `json:"deny_reason" url:"deny_reason,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + LocalUserID float64 `json:"local_user_id" url:"local_user_id,omitempty"` + Published string `json:"published" url:"published,omitempty"` +} +type CreateComment struct { + Auth string `json:"auth" url:"auth,omitempty"` + Content string `json:"content" url:"content,omitempty"` + FormID Optional[string] `json:"form_id" url:"form_id,omitempty"` + LanguageID Optional[float64] `json:"language_id" url:"language_id,omitempty"` + ParentID Optional[float64] `json:"parent_id" url:"parent_id,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` +} +type Search struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` + CommunityName Optional[string] `json:"community_name" url:"community_name,omitempty"` + CreatorID Optional[float64] `json:"creator_id" url:"creator_id,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + ListingType Optional[ListingType] `json:"listing_type" url:"listing_type,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + Q string `json:"q" url:"q,omitempty"` + Sort Optional[SortType] `json:"sort" url:"sort,omitempty"` + Type Optional[SearchType] `json:"type_" url:"type_,omitempty"` +} +type RemoveCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Expires Optional[float64] `json:"expires" url:"expires,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` +} +type SaveComment struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Save bool `json:"save" url:"save,omitempty"` +} +type SavePost struct { + Auth string `json:"auth" url:"auth,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Save bool `json:"save" url:"save,omitempty"` +} +type CommentReportView struct { + Comment Comment `json:"comment" url:"comment,omitempty"` + CommentCreator Person `json:"comment_creator" url:"comment_creator,omitempty"` + CommentReport CommentReport `json:"comment_report" url:"comment_report,omitempty"` + Community Community `json:"community" url:"community,omitempty"` + Counts CommentAggregates `json:"counts" url:"counts,omitempty"` + Creator Person `json:"creator" url:"creator,omitempty"` + CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` + MyVote Optional[float64] `json:"my_vote" url:"my_vote,omitempty"` + Post Post `json:"post" url:"post,omitempty"` + Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"` +} +type PostView struct { + Community Community `json:"community" url:"community,omitempty"` + Counts PostAggregates `json:"counts" url:"counts,omitempty"` + Creator Person `json:"creator" url:"creator,omitempty"` + CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` + CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` + MyVote Optional[float64] `json:"my_vote" url:"my_vote,omitempty"` + Post Post `json:"post" url:"post,omitempty"` + Read bool `json:"read" url:"read,omitempty"` + Saved bool `json:"saved" url:"saved,omitempty"` + Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` + UnreadComments float64 `json:"unread_comments" url:"unread_comments,omitempty"` +} +type BannedPersonsResponse struct { + Banned []PersonView `json:"banned" url:"banned,omitempty"` + LemmyResponse +} +type GetComments struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` + CommunityName Optional[string] `json:"community_name" url:"community_name,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + MaxDepth Optional[float64] `json:"max_depth" url:"max_depth,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + ParentID Optional[float64] `json:"parent_id" url:"parent_id,omitempty"` + PostID Optional[float64] `json:"post_id" url:"post_id,omitempty"` + SavedOnly Optional[bool] `json:"saved_only" url:"saved_only,omitempty"` + Sort Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` + Type Optional[ListingType] `json:"type_" url:"type_,omitempty"` +} +type ListPrivateMessageReportsResponse struct { + PrivateMessageReports []PrivateMessageReportView `json:"private_message_reports" url:"private_message_reports,omitempty"` + LemmyResponse +} +type RemovePost struct { + Auth string `json:"auth" url:"auth,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` +} +type CaptchaResponse struct { + Png string `json:"png" url:"png,omitempty"` + Uuid string `json:"uuid" url:"uuid,omitempty"` + Wav string `json:"wav" url:"wav,omitempty"` + LemmyResponse +} +type GetRepliesResponse struct { + Replies []CommentReplyView `json:"replies" url:"replies,omitempty"` + LemmyResponse +} +type SiteMetadata struct { + Description Optional[string] `json:"description" url:"description,omitempty"` + EmbedVideoURL Optional[string] `json:"embed_video_url" url:"embed_video_url,omitempty"` + Image Optional[string] `json:"image" url:"image,omitempty"` + Title Optional[string] `json:"title" url:"title,omitempty"` +} +type GetModlog struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + ModPersonID Optional[float64] `json:"mod_person_id" url:"mod_person_id,omitempty"` + OtherPersonID Optional[float64] `json:"other_person_id" url:"other_person_id,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + Type Optional[ModlogActionType] `json:"type_" url:"type_,omitempty"` +} +type ModTransferCommunity struct { + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + OtherPersonID float64 `json:"other_person_id" url:"other_person_id,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type CustomEmojiResponse struct { + CustomEmoji CustomEmojiView `json:"custom_emoji" url:"custom_emoji,omitempty"` + LemmyResponse +} +type CustomEmoji struct { + AltText string `json:"alt_text" url:"alt_text,omitempty"` + Category string `json:"category" url:"category,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ImageURL string `json:"image_url" url:"image_url,omitempty"` + LocalSiteID float64 `json:"local_site_id" url:"local_site_id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Shortcode string `json:"shortcode" url:"shortcode,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type PrivateMessageReportResponse struct { + PrivateMessageReportView PrivateMessageReportView `json:"private_message_report_view" url:"private_message_report_view,omitempty"` + LemmyResponse +} +type AdminPurgePersonView struct { + Admin Optional[Person] `json:"admin" url:"admin,omitempty"` + AdminPurgePerson AdminPurgePerson `json:"admin_purge_person" url:"admin_purge_person,omitempty"` +} +type ResolveCommentReport struct { + Auth string `json:"auth" url:"auth,omitempty"` + ReportID float64 `json:"report_id" url:"report_id,omitempty"` + Resolved bool `json:"resolved" url:"resolved,omitempty"` +} +type AddAdminResponse struct { + Admins []PersonView `json:"admins" url:"admins,omitempty"` + LemmyResponse +} +type BlockPerson struct { + Auth string `json:"auth" url:"auth,omitempty"` + Block bool `json:"block" url:"block,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` +} +type GetSiteResponse struct { + Admins []PersonView `json:"admins" url:"admins,omitempty"` + AllLanguages []Language `json:"all_languages" url:"all_languages,omitempty"` + CustomEmojis []CustomEmojiView `json:"custom_emojis" url:"custom_emojis,omitempty"` + DiscussionLanguages []float64 `json:"discussion_languages" url:"discussion_languages,omitempty"` + MyUser Optional[MyUserInfo] `json:"my_user" url:"my_user,omitempty"` + SiteView SiteView `json:"site_view" url:"site_view,omitempty"` + Taglines []Tagline `json:"taglines" url:"taglines,omitempty"` + Version string `json:"version" url:"version,omitempty"` + LemmyResponse +} +type SiteView struct { + Counts SiteAggregates `json:"counts" url:"counts,omitempty"` + LocalSite LocalSite `json:"local_site" url:"local_site,omitempty"` + LocalSiteRateLimit LocalSiteRateLimit `json:"local_site_rate_limit" url:"local_site_rate_limit,omitempty"` + Site Site `json:"site" url:"site,omitempty"` +} +type ModFeaturePostView struct { + Community Community `json:"community" url:"community,omitempty"` + ModFeaturePost ModFeaturePost `json:"mod_feature_post" url:"mod_feature_post,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` + Post Post `json:"post" url:"post,omitempty"` +} +type GetReportCountResponse struct { + CommentReports float64 `json:"comment_reports" url:"comment_reports,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` + PostReports float64 `json:"post_reports" url:"post_reports,omitempty"` + PrivateMessageReports Optional[float64] `json:"private_message_reports" url:"private_message_reports,omitempty"` + LemmyResponse +} +type RemoveComment struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` +} +type GetUnreadCountResponse struct { + Mentions float64 `json:"mentions" url:"mentions,omitempty"` + PrivateMessages float64 `json:"private_messages" url:"private_messages,omitempty"` + Replies float64 `json:"replies" url:"replies,omitempty"` + LemmyResponse +} +type ModBanFromCommunity struct { + Banned bool `json:"banned" url:"banned,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Expires Optional[string] `json:"expires" url:"expires,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + OtherPersonID float64 `json:"other_person_id" url:"other_person_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type ModHideCommunity struct { + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Hidden bool `json:"hidden" url:"hidden,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type PostAggregates struct { + Comments float64 `json:"comments" url:"comments,omitempty"` + Downvotes float64 `json:"downvotes" url:"downvotes,omitempty"` + FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"` + FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"` + HotRank float64 `json:"hot_rank" url:"hot_rank,omitempty"` + HotRankActive float64 `json:"hot_rank_active" url:"hot_rank_active,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + NewestCommentTime string `json:"newest_comment_time" url:"newest_comment_time,omitempty"` + NewestCommentTimeNecro string `json:"newest_comment_time_necro" url:"newest_comment_time_necro,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Score float64 `json:"score" url:"score,omitempty"` + Upvotes float64 `json:"upvotes" url:"upvotes,omitempty"` +} +type ModRemoveCommentView struct { + Comment Comment `json:"comment" url:"comment,omitempty"` + Commenter Person `json:"commenter" url:"commenter,omitempty"` + Community Community `json:"community" url:"community,omitempty"` + ModRemoveComment ModRemoveComment `json:"mod_remove_comment" url:"mod_remove_comment,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` + Post Post `json:"post" url:"post,omitempty"` +} +type ListRegistrationApplicationsResponse struct { + RegistrationApplications []RegistrationApplicationView `json:"registration_applications" url:"registration_applications,omitempty"` + LemmyResponse +} +type BlockCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + Block bool `json:"block" url:"block,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` +} +type GetPostsResponse struct { + Posts []PostView `json:"posts" url:"posts,omitempty"` + LemmyResponse +} +type GetSite struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` +} +type MarkCommentReplyAsRead struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentReplyID float64 `json:"comment_reply_id" url:"comment_reply_id,omitempty"` + Read bool `json:"read" url:"read,omitempty"` +} +type AdminPurgeCommunityView struct { + Admin Optional[Person] `json:"admin" url:"admin,omitempty"` + AdminPurgeCommunity AdminPurgeCommunity `json:"admin_purge_community" url:"admin_purge_community,omitempty"` +} +type PersonMention struct { + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Read bool `json:"read" url:"read,omitempty"` + RecipientID float64 `json:"recipient_id" url:"recipient_id,omitempty"` +} +type ListPrivateMessageReports struct { + Auth string `json:"auth" url:"auth,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + UnresolvedOnly Optional[bool] `json:"unresolved_only" url:"unresolved_only,omitempty"` +} +type ResolvePostReport struct { + Auth string `json:"auth" url:"auth,omitempty"` + ReportID float64 `json:"report_id" url:"report_id,omitempty"` + Resolved bool `json:"resolved" url:"resolved,omitempty"` +} +type EditCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + Banner Optional[string] `json:"banner" url:"banner,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Description Optional[string] `json:"description" url:"description,omitempty"` + DiscussionLanguages Optional[[]float64] `json:"discussion_languages" url:"discussion_languages,omitempty"` + Icon Optional[string] `json:"icon" url:"icon,omitempty"` + NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` + PostingRestrictedToMods Optional[bool] `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` + Title Optional[string] `json:"title" url:"title,omitempty"` +} +type ModRemoveComment struct { + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type DeletePost struct { + Auth string `json:"auth" url:"auth,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` +} +type ListPostReportsResponse struct { + PostReports []PostReportView `json:"post_reports" url:"post_reports,omitempty"` + LemmyResponse +} +type SiteAggregates struct { + Comments float64 `json:"comments" url:"comments,omitempty"` + Communities float64 `json:"communities" url:"communities,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Posts float64 `json:"posts" url:"posts,omitempty"` + SiteID float64 `json:"site_id" url:"site_id,omitempty"` + Users float64 `json:"users" url:"users,omitempty"` + UsersActiveDay float64 `json:"users_active_day" url:"users_active_day,omitempty"` + UsersActiveHalfYear float64 `json:"users_active_half_year" url:"users_active_half_year,omitempty"` + UsersActiveMonth float64 `json:"users_active_month" url:"users_active_month,omitempty"` + UsersActiveWeek float64 `json:"users_active_week" url:"users_active_week,omitempty"` +} +type DeleteCustomEmoji struct { + Auth string `json:"auth" url:"auth,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` +} +type GetSiteMetadata struct { + URL string `json:"url" url:"url,omitempty"` +} +type GetSiteMetadataResponse struct { + Metadata SiteMetadata `json:"metadata" url:"metadata,omitempty"` + LemmyResponse +} +type TransferCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` +} +type GetPosts struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` + CommunityName Optional[string] `json:"community_name" url:"community_name,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + SavedOnly Optional[bool] `json:"saved_only" url:"saved_only,omitempty"` + Sort Optional[SortType] `json:"sort" url:"sort,omitempty"` + Type Optional[ListingType] `json:"type_" url:"type_,omitempty"` +} +type SaveUserSettings struct { + Auth string `json:"auth" url:"auth,omitempty"` + Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"` + Banner Optional[string] `json:"banner" url:"banner,omitempty"` + Bio Optional[string] `json:"bio" url:"bio,omitempty"` + BotAccount Optional[bool] `json:"bot_account" url:"bot_account,omitempty"` + DefaultListingType Optional[ListingType] `json:"default_listing_type" url:"default_listing_type,omitempty"` + DefaultSortType Optional[SortType] `json:"default_sort_type" url:"default_sort_type,omitempty"` + DiscussionLanguages Optional[[]float64] `json:"discussion_languages" url:"discussion_languages,omitempty"` + DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"` + Email Optional[string] `json:"email" url:"email,omitempty"` + GenerateTotp2fa Optional[bool] `json:"generate_totp_2fa" url:"generate_totp_2fa,omitempty"` + InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"` + MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,omitempty"` + OpenLinksInNewTab Optional[bool] `json:"open_links_in_new_tab" url:"open_links_in_new_tab,omitempty"` + SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` + ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"` + ShowBotAccounts Optional[bool] `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` + ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` + ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"` + ShowReadPosts Optional[bool] `json:"show_read_posts" url:"show_read_posts,omitempty"` + ShowScores Optional[bool] `json:"show_scores" url:"show_scores,omitempty"` + Theme Optional[string] `json:"theme" url:"theme,omitempty"` +} +type PurgeCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` +} +type SearchResponse struct { + Comments []CommentView `json:"comments" url:"comments,omitempty"` + Communities []CommunityView `json:"communities" url:"communities,omitempty"` + Posts []PostView `json:"posts" url:"posts,omitempty"` + Type SearchType `json:"type_" url:"type_,omitempty"` + Users []PersonView `json:"users" url:"users,omitempty"` + LemmyResponse +} +type AddModToCommunityResponse struct { + Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` + LemmyResponse +} +type MyUserInfo struct { + CommunityBlocks []CommunityBlockView `json:"community_blocks" url:"community_blocks,omitempty"` + DiscussionLanguages []float64 `json:"discussion_languages" url:"discussion_languages,omitempty"` + Follows []CommunityFollowerView `json:"follows" url:"follows,omitempty"` + LocalUserView LocalUserView `json:"local_user_view" url:"local_user_view,omitempty"` + Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"` + PersonBlocks []PersonBlockView `json:"person_blocks" url:"person_blocks,omitempty"` +} +type GetCaptchaResponse struct { + Ok Optional[CaptchaResponse] `json:"ok" url:"ok,omitempty"` + LemmyResponse +} +type ModLockPost struct { + ID float64 `json:"id" url:"id,omitempty"` + Locked bool `json:"locked" url:"locked,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type CommunityModeratorView struct { + Community Community `json:"community" url:"community,omitempty"` + Moderator Person `json:"moderator" url:"moderator,omitempty"` +} +type PostFeatureType string + +const ( + PostFeatureTypeLocal PostFeatureType = "Local" + PostFeatureTypeCommunity PostFeatureType = "Community" +) + +type ModBanFromCommunityView struct { + BannedPerson Person `json:"banned_person" url:"banned_person,omitempty"` + Community Community `json:"community" url:"community,omitempty"` + ModBanFromCommunity ModBanFromCommunity `json:"mod_ban_from_community" url:"mod_ban_from_community,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` +} +type ModRemovePost struct { + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type MarkAllAsRead struct { + Auth string `json:"auth" url:"auth,omitempty"` +} +type AddAdmin struct { + Added bool `json:"added" url:"added,omitempty"` + Auth string `json:"auth" url:"auth,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` +} +type CommentReport struct { + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + CreatorID float64 `json:"creator_id" url:"creator_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + OriginalCommentText string `json:"original_comment_text" url:"original_comment_text,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Reason string `json:"reason" url:"reason,omitempty"` + Resolved bool `json:"resolved" url:"resolved,omitempty"` + ResolverID Optional[float64] `json:"resolver_id" url:"resolver_id,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type GetModlogResponse struct { + Added []ModAddView `json:"added" url:"added,omitempty"` + AddedToCommunity []ModAddCommunityView `json:"added_to_community" url:"added_to_community,omitempty"` + AdminPurgedComments []AdminPurgeCommentView `json:"admin_purged_comments" url:"admin_purged_comments,omitempty"` + AdminPurgedCommunities []AdminPurgeCommunityView `json:"admin_purged_communities" url:"admin_purged_communities,omitempty"` + AdminPurgedPersons []AdminPurgePersonView `json:"admin_purged_persons" url:"admin_purged_persons,omitempty"` + AdminPurgedPosts []AdminPurgePostView `json:"admin_purged_posts" url:"admin_purged_posts,omitempty"` + Banned []ModBanView `json:"banned" url:"banned,omitempty"` + BannedFromCommunity []ModBanFromCommunityView `json:"banned_from_community" url:"banned_from_community,omitempty"` + FeaturedPosts []ModFeaturePostView `json:"featured_posts" url:"featured_posts,omitempty"` + HiddenCommunities []ModHideCommunityView `json:"hidden_communities" url:"hidden_communities,omitempty"` + LockedPosts []ModLockPostView `json:"locked_posts" url:"locked_posts,omitempty"` + RemovedComments []ModRemoveCommentView `json:"removed_comments" url:"removed_comments,omitempty"` + RemovedCommunities []ModRemoveCommunityView `json:"removed_communities" url:"removed_communities,omitempty"` + RemovedPosts []ModRemovePostView `json:"removed_posts" url:"removed_posts,omitempty"` + TransferredToCommunity []ModTransferCommunityView `json:"transferred_to_community" url:"transferred_to_community,omitempty"` + LemmyResponse +} +type ResolveObject struct { + Auth string `json:"auth" url:"auth,omitempty"` + Q string `json:"q" url:"q,omitempty"` +} +type CustomEmojiView struct { + CustomEmoji CustomEmoji `json:"custom_emoji" url:"custom_emoji,omitempty"` + Keywords []CustomEmojiKeyword `json:"keywords" url:"keywords,omitempty"` +} +type ModlogActionType string + +const ( + ModlogActionTypeAll ModlogActionType = "All" + ModlogActionTypeModRemovePost ModlogActionType = "ModRemovePost" + ModlogActionTypeModLockPost ModlogActionType = "ModLockPost" + ModlogActionTypeModFeaturePost ModlogActionType = "ModFeaturePost" + ModlogActionTypeModRemoveComment ModlogActionType = "ModRemoveComment" + ModlogActionTypeModRemoveCommunity ModlogActionType = "ModRemoveCommunity" + ModlogActionTypeModBanFromCommunity ModlogActionType = "ModBanFromCommunity" + ModlogActionTypeModAddCommunity ModlogActionType = "ModAddCommunity" + ModlogActionTypeModTransferCommunity ModlogActionType = "ModTransferCommunity" + ModlogActionTypeModAdd ModlogActionType = "ModAdd" + ModlogActionTypeModBan ModlogActionType = "ModBan" + ModlogActionTypeModHideCommunity ModlogActionType = "ModHideCommunity" + ModlogActionTypeAdminPurgePerson ModlogActionType = "AdminPurgePerson" + ModlogActionTypeAdminPurgeCommunity ModlogActionType = "AdminPurgeCommunity" + ModlogActionTypeAdminPurgePost ModlogActionType = "AdminPurgePost" + ModlogActionTypeAdminPurgeComment ModlogActionType = "AdminPurgeComment" +) + +type PostReportView struct { + Community Community `json:"community" url:"community,omitempty"` + Counts PostAggregates `json:"counts" url:"counts,omitempty"` + Creator Person `json:"creator" url:"creator,omitempty"` + CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` + MyVote Optional[float64] `json:"my_vote" url:"my_vote,omitempty"` + Post Post `json:"post" url:"post,omitempty"` + PostCreator Person `json:"post_creator" url:"post_creator,omitempty"` + PostReport PostReport `json:"post_report" url:"post_report,omitempty"` + Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"` +} +type FeaturePost struct { + Auth string `json:"auth" url:"auth,omitempty"` + FeatureType PostFeatureType `json:"feature_type" url:"feature_type,omitempty"` + Featured bool `json:"featured" url:"featured,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` +} +type GetCaptcha struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` +} +type ModBan struct { + Banned bool `json:"banned" url:"banned,omitempty"` + Expires Optional[string] `json:"expires" url:"expires,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + OtherPersonID float64 `json:"other_person_id" url:"other_person_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type ModFeaturePost struct { + Featured bool `json:"featured" url:"featured,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + IsFeaturedCommunity bool `json:"is_featured_community" url:"is_featured_community,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type PurgeItemResponse struct { + Success bool `json:"success" url:"success,omitempty"` + LemmyResponse +} +type ChangePassword struct { + Auth string `json:"auth" url:"auth,omitempty"` + NewPassword string `json:"new_password" url:"new_password,omitempty"` + NewPasswordVerify string `json:"new_password_verify" url:"new_password_verify,omitempty"` + OldPassword string `json:"old_password" url:"old_password,omitempty"` +} +type CreateCommentReport struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Reason string `json:"reason" url:"reason,omitempty"` +} +type PasswordReset struct { + Email string `json:"email" url:"email,omitempty"` +} +type GetCommentsResponse struct { + Comments []CommentView `json:"comments" url:"comments,omitempty"` + LemmyResponse +} +type ListCommunitiesResponse struct { + Communities []CommunityView `json:"communities" url:"communities,omitempty"` + LemmyResponse +} +type ModAdd struct { + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + OtherPersonID float64 `json:"other_person_id" url:"other_person_id,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type GetPersonDetails struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + PersonID Optional[float64] `json:"person_id" url:"person_id,omitempty"` + SavedOnly Optional[bool] `json:"saved_only" url:"saved_only,omitempty"` + Sort Optional[SortType] `json:"sort" url:"sort,omitempty"` + Username Optional[string] `json:"username" url:"username,omitempty"` +} +type BanFromCommunityResponse struct { + Banned bool `json:"banned" url:"banned,omitempty"` + PersonView PersonView `json:"person_view" url:"person_view,omitempty"` + LemmyResponse +} +type CommunityView struct { + Blocked bool `json:"blocked" url:"blocked,omitempty"` + Community Community `json:"community" url:"community,omitempty"` + Counts CommunityAggregates `json:"counts" url:"counts,omitempty"` + Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` +} +type CreatePostReport struct { + Auth string `json:"auth" url:"auth,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Reason string `json:"reason" url:"reason,omitempty"` +} +type SearchType string + +const ( + SearchTypeAll SearchType = "All" + SearchTypeComments SearchType = "Comments" + SearchTypePosts SearchType = "Posts" + SearchTypeCommunities SearchType = "Communities" + SearchTypeUsers SearchType = "Users" + SearchTypeUrl SearchType = "Url" +) + +type BlockPersonResponse struct { + Blocked bool `json:"blocked" url:"blocked,omitempty"` + PersonView PersonView `json:"person_view" url:"person_view,omitempty"` + LemmyResponse +} +type PostResponse struct { + PostView PostView `json:"post_view" url:"post_view,omitempty"` + LemmyResponse +} +type BanPersonResponse struct { + Banned bool `json:"banned" url:"banned,omitempty"` + PersonView PersonView `json:"person_view" url:"person_view,omitempty"` + LemmyResponse +} +type GetUnreadRegistrationApplicationCount struct { + Auth string `json:"auth" url:"auth,omitempty"` +} +type RegistrationApplicationResponse struct { + RegistrationApplication RegistrationApplicationView `json:"registration_application" url:"registration_application,omitempty"` + LemmyResponse +} +type Login struct { + Password string `json:"password" url:"password,omitempty"` + Totp2faToken Optional[string] `json:"totp_2fa_token" url:"totp_2fa_token,omitempty"` + UsernameOrEmail string `json:"username_or_email" url:"username_or_email,omitempty"` +} +type PersonMentionView struct { + Comment Comment `json:"comment" url:"comment,omitempty"` + Community Community `json:"community" url:"community,omitempty"` + Counts CommentAggregates `json:"counts" url:"counts,omitempty"` + Creator Person `json:"creator" url:"creator,omitempty"` + CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` + CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` + MyVote Optional[float64] `json:"my_vote" url:"my_vote,omitempty"` + PersonMention PersonMention `json:"person_mention" url:"person_mention,omitempty"` + Post Post `json:"post" url:"post,omitempty"` + Recipient Person `json:"recipient" url:"recipient,omitempty"` + Saved bool `json:"saved" url:"saved,omitempty"` + Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` +} +type PersonBlockView struct { + Person Person `json:"person" url:"person,omitempty"` + Target Person `json:"target" url:"target,omitempty"` +} +type PostReportResponse struct { + PostReportView PostReportView `json:"post_report_view" url:"post_report_view,omitempty"` + LemmyResponse +} +type EditPost struct { + Auth string `json:"auth" url:"auth,omitempty"` + Body Optional[string] `json:"body" url:"body,omitempty"` + LanguageID Optional[float64] `json:"language_id" url:"language_id,omitempty"` + Name Optional[string] `json:"name" url:"name,omitempty"` + NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + URL Optional[string] `json:"url" url:"url,omitempty"` +} +type CommentReply struct { + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Read bool `json:"read" url:"read,omitempty"` + RecipientID float64 `json:"recipient_id" url:"recipient_id,omitempty"` +} +type PersonView struct { + Counts PersonAggregates `json:"counts" url:"counts,omitempty"` + Person Person `json:"person" url:"person,omitempty"` +} +type Community struct { + ActorID string `json:"actor_id" url:"actor_id,omitempty"` + Banner Optional[string] `json:"banner" url:"banner,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` + Description Optional[string] `json:"description" url:"description,omitempty"` + FollowersURL string `json:"followers_url" url:"followers_url,omitempty"` + Hidden bool `json:"hidden" url:"hidden,omitempty"` + Icon Optional[string] `json:"icon" url:"icon,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"` + InstanceID float64 `json:"instance_id" url:"instance_id,omitempty"` + Local bool `json:"local" url:"local,omitempty"` + Name string `json:"name" url:"name,omitempty"` + NSFW bool `json:"nsfw" url:"nsfw,omitempty"` + PostingRestrictedToMods bool `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` + Title string `json:"title" url:"title,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type Tagline struct { + Content string `json:"content" url:"content,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + LocalSiteID float64 `json:"local_site_id" url:"local_site_id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type DistinguishComment struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Distinguished bool `json:"distinguished" url:"distinguished,omitempty"` +} +type LeaveAdmin struct { + Auth string `json:"auth" url:"auth,omitempty"` +} +type ResolveObjectResponse struct { + Comment Optional[CommentView] `json:"comment" url:"comment,omitempty"` + Community Optional[CommunityView] `json:"community" url:"community,omitempty"` + Person Optional[PersonView] `json:"person" url:"person,omitempty"` + Post Optional[PostView] `json:"post" url:"post,omitempty"` + LemmyResponse +} +type ResolvePrivateMessageReport struct { + Auth string `json:"auth" url:"auth,omitempty"` + ReportID float64 `json:"report_id" url:"report_id,omitempty"` + Resolved bool `json:"resolved" url:"resolved,omitempty"` +} +type PersonAggregates struct { + CommentCount float64 `json:"comment_count" url:"comment_count,omitempty"` + CommentScore float64 `json:"comment_score" url:"comment_score,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` + PostCount float64 `json:"post_count" url:"post_count,omitempty"` + PostScore float64 `json:"post_score" url:"post_score,omitempty"` +} +type CommentReportResponse struct { + CommentReportView CommentReportView `json:"comment_report_view" url:"comment_report_view,omitempty"` + LemmyResponse +} +type EditCustomEmoji struct { + AltText string `json:"alt_text" url:"alt_text,omitempty"` + Auth string `json:"auth" url:"auth,omitempty"` + Category string `json:"category" url:"category,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ImageURL string `json:"image_url" url:"image_url,omitempty"` + Keywords []string `json:"keywords" url:"keywords,omitempty"` +} +type AddModToCommunity struct { + Added bool `json:"added" url:"added,omitempty"` + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` +} +type ListingType string + +const ( + ListingTypeAll ListingType = "All" + ListingTypeLocal ListingType = "Local" + ListingTypeSubscribed ListingType = "Subscribed" +) + +type LocalSite struct { + ActorNameMaxLength float64 `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` + ApplicationEmailAdmins bool `json:"application_email_admins" url:"application_email_admins,omitempty"` + ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` + CaptchaDifficulty string `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` + CaptchaEnabled bool `json:"captcha_enabled" url:"captcha_enabled,omitempty"` + CommunityCreationAdminOnly bool `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` + DefaultPostListingType ListingType `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` + DefaultTheme string `json:"default_theme" url:"default_theme,omitempty"` + EnableDownvotes bool `json:"enable_downvotes" url:"enable_downvotes,omitempty"` + EnableNSFW bool `json:"enable_nsfw" url:"enable_nsfw,omitempty"` + FederationEnabled bool `json:"federation_enabled" url:"federation_enabled,omitempty"` + HideModlogModNames bool `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` + PrivateInstance bool `json:"private_instance" url:"private_instance,omitempty"` + Published string `json:"published" url:"published,omitempty"` + RegistrationMode RegistrationMode `json:"registration_mode" url:"registration_mode,omitempty"` + ReportsEmailAdmins bool `json:"reports_email_admins" url:"reports_email_admins,omitempty"` + RequireEmailVerification bool `json:"require_email_verification" url:"require_email_verification,omitempty"` + SiteID float64 `json:"site_id" url:"site_id,omitempty"` + SiteSetup bool `json:"site_setup" url:"site_setup,omitempty"` + SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type FederatedInstances struct { + Allowed []Instance `json:"allowed" url:"allowed,omitempty"` + Blocked []Instance `json:"blocked" url:"blocked,omitempty"` + Linked []Instance `json:"linked" url:"linked,omitempty"` +} +type PurgeComment struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` +} +type BlockCommunityResponse struct { + Blocked bool `json:"blocked" url:"blocked,omitempty"` + CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` + LemmyResponse +} +type ModTransferCommunityView struct { + Community Community `json:"community" url:"community,omitempty"` + ModTransferCommunity ModTransferCommunity `json:"mod_transfer_community" url:"mod_transfer_community,omitempty"` + ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` +} +type GetFederatedInstancesResponse struct { + FederatedInstances Optional[FederatedInstances] `json:"federated_instances" url:"federated_instances,omitempty"` + LemmyResponse +} +type GetPrivateMessages struct { + Auth string `json:"auth" url:"auth,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` +} +type RegistrationApplicationView struct { + Admin Optional[Person] `json:"admin" url:"admin,omitempty"` + Creator Person `json:"creator" url:"creator,omitempty"` + CreatorLocalUser LocalUser `json:"creator_local_user" url:"creator_local_user,omitempty"` + RegistrationApplication RegistrationApplication `json:"registration_application" url:"registration_application,omitempty"` +} +type LocalUser struct { + AcceptedApplication bool `json:"accepted_application" url:"accepted_application,omitempty"` + DefaultListingType ListingType `json:"default_listing_type" url:"default_listing_type,omitempty"` + DefaultSortType SortType `json:"default_sort_type" url:"default_sort_type,omitempty"` + Email Optional[string] `json:"email" url:"email,omitempty"` + EmailVerified bool `json:"email_verified" url:"email_verified,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + InterfaceLanguage string `json:"interface_language" url:"interface_language,omitempty"` + OpenLinksInNewTab bool `json:"open_links_in_new_tab" url:"open_links_in_new_tab,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` + SendNotificationsToEmail bool `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` + ShowAvatars bool `json:"show_avatars" url:"show_avatars,omitempty"` + ShowBotAccounts bool `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` + ShowNewPostNotifs bool `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` + ShowNSFW bool `json:"show_nsfw" url:"show_nsfw,omitempty"` + ShowReadPosts bool `json:"show_read_posts" url:"show_read_posts,omitempty"` + ShowScores bool `json:"show_scores" url:"show_scores,omitempty"` + Theme string `json:"theme" url:"theme,omitempty"` + Totp2faURL Optional[string] `json:"totp_2fa_url" url:"totp_2fa_url,omitempty"` + ValidatorTime string `json:"validator_time" url:"validator_time,omitempty"` +} +type Instance struct { + Domain string `json:"domain" url:"domain,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Software Optional[string] `json:"software" url:"software,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` + Version Optional[string] `json:"version" url:"version,omitempty"` +} +type CommunityAggregates struct { + Comments float64 `json:"comments" url:"comments,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + HotRank float64 `json:"hot_rank" url:"hot_rank,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Posts float64 `json:"posts" url:"posts,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Subscribers float64 `json:"subscribers" url:"subscribers,omitempty"` + UsersActiveDay float64 `json:"users_active_day" url:"users_active_day,omitempty"` + UsersActiveHalfYear float64 `json:"users_active_half_year" url:"users_active_half_year,omitempty"` + UsersActiveMonth float64 `json:"users_active_month" url:"users_active_month,omitempty"` + UsersActiveWeek float64 `json:"users_active_week" url:"users_active_week,omitempty"` +} +type GetFederatedInstances struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` +} +type AdminPurgeCommunity struct { + AdminPersonID float64 `json:"admin_person_id" url:"admin_person_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type GetPostResponse struct { + CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` + CrossPosts []PostView `json:"cross_posts" url:"cross_posts,omitempty"` + Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` + PostView PostView `json:"post_view" url:"post_view,omitempty"` + LemmyResponse +} +type ModRemovePostView struct { + Community Community `json:"community" url:"community,omitempty"` + ModRemovePost ModRemovePost `json:"mod_remove_post" url:"mod_remove_post,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` + Post Post `json:"post" url:"post,omitempty"` +} +type GetPersonMentions struct { + Auth string `json:"auth" url:"auth,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + Sort Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` + UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` +} +type MarkPersonMentionAsRead struct { + Auth string `json:"auth" url:"auth,omitempty"` + PersonMentionID float64 `json:"person_mention_id" url:"person_mention_id,omitempty"` + Read bool `json:"read" url:"read,omitempty"` +} +type GetCommunity struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + ID Optional[float64] `json:"id" url:"id,omitempty"` + Name Optional[string] `json:"name" url:"name,omitempty"` +} +type GetCommunityResponse struct { + CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` + DiscussionLanguages []float64 `json:"discussion_languages" url:"discussion_languages,omitempty"` + Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` + Site Optional[Site] `json:"site" url:"site,omitempty"` + LemmyResponse +} +type CommentSortType string + +const ( + CommentSortTypeHot CommentSortType = "Hot" + CommentSortTypeTop CommentSortType = "Top" + CommentSortTypeNew CommentSortType = "New" + CommentSortTypeOld CommentSortType = "Old" +) + +type CommentAggregates struct { + ChildCount float64 `json:"child_count" url:"child_count,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Downvotes float64 `json:"downvotes" url:"downvotes,omitempty"` + HotRank float64 `json:"hot_rank" url:"hot_rank,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Score float64 `json:"score" url:"score,omitempty"` + Upvotes float64 `json:"upvotes" url:"upvotes,omitempty"` +} +type PostReport struct { + CreatorID float64 `json:"creator_id" url:"creator_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + OriginalPostBody Optional[string] `json:"original_post_body" url:"original_post_body,omitempty"` + OriginalPostName string `json:"original_post_name" url:"original_post_name,omitempty"` + OriginalPostURL Optional[string] `json:"original_post_url" url:"original_post_url,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Reason string `json:"reason" url:"reason,omitempty"` + Resolved bool `json:"resolved" url:"resolved,omitempty"` + ResolverID Optional[float64] `json:"resolver_id" url:"resolver_id,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type ModAddCommunity struct { + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + OtherPersonID float64 `json:"other_person_id" url:"other_person_id,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type GetReportCount struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` +} +type ListCommunities struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"` + Sort Optional[SortType] `json:"sort" url:"sort,omitempty"` + Type Optional[ListingType] `json:"type_" url:"type_,omitempty"` +} +type MarkPostAsRead struct { + Auth string `json:"auth" url:"auth,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Read bool `json:"read" url:"read,omitempty"` +} +type PrivateMessageReportView struct { + Creator Person `json:"creator" url:"creator,omitempty"` + PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"` + PrivateMessageCreator Person `json:"private_message_creator" url:"private_message_creator,omitempty"` + PrivateMessageReport PrivateMessageReport `json:"private_message_report" url:"private_message_report,omitempty"` + Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"` +} +type ModRemoveCommunityView struct { + Community Community `json:"community" url:"community,omitempty"` + ModRemoveCommunity ModRemoveCommunity `json:"mod_remove_community" url:"mod_remove_community,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` +} +type ModAddCommunityView struct { + Community Community `json:"community" url:"community,omitempty"` + ModAddCommunity ModAddCommunity `json:"mod_add_community" url:"mod_add_community,omitempty"` + ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` +} +type CommunityFollowerView struct { + Community Community `json:"community" url:"community,omitempty"` + Follower Person `json:"follower" url:"follower,omitempty"` +} +type PurgePerson struct { + Auth string `json:"auth" url:"auth,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` +} +type LoginResponse struct { + JWT Optional[string] `json:"jwt" url:"jwt,omitempty"` + RegistrationCreated bool `json:"registration_created" url:"registration_created,omitempty"` + VerifyEmailSent bool `json:"verify_email_sent" url:"verify_email_sent,omitempty"` + LemmyResponse +} +type PrivateMessageResponse struct { + PrivateMessageView PrivateMessageView `json:"private_message_view" url:"private_message_view,omitempty"` + LemmyResponse +} +type PrivateMessageView struct { + Creator Person `json:"creator" url:"creator,omitempty"` + PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"` + Recipient Person `json:"recipient" url:"recipient,omitempty"` +} +type AdminPurgeCommentView struct { + Admin Optional[Person] `json:"admin" url:"admin,omitempty"` + AdminPurgeComment AdminPurgeComment `json:"admin_purge_comment" url:"admin_purge_comment,omitempty"` + Post Post `json:"post" url:"post,omitempty"` +} +type GetPersonDetailsResponse struct { + Comments []CommentView `json:"comments" url:"comments,omitempty"` + Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"` + PersonView PersonView `json:"person_view" url:"person_view,omitempty"` + Posts []PostView `json:"posts" url:"posts,omitempty"` + LemmyResponse +} +type GetUnreadCount struct { + Auth string `json:"auth" url:"auth,omitempty"` +} +type GetUnreadRegistrationApplicationCountResponse struct { + RegistrationApplications float64 `json:"registration_applications" url:"registration_applications,omitempty"` + LemmyResponse +} +type SortType string + +const ( + SortTypeActive SortType = "Active" + SortTypeHot SortType = "Hot" + SortTypeNew SortType = "New" + SortTypeOld SortType = "Old" + SortTypeTopDay SortType = "TopDay" + SortTypeTopWeek SortType = "TopWeek" + SortTypeTopMonth SortType = "TopMonth" + SortTypeTopYear SortType = "TopYear" + SortTypeTopAll SortType = "TopAll" + SortTypeMostComments SortType = "MostComments" + SortTypeNewComments SortType = "NewComments" + SortTypeTopHour SortType = "TopHour" + SortTypeTopSixHour SortType = "TopSixHour" + SortTypeTopTwelveHour SortType = "TopTwelveHour" + SortTypeTopThreeMonths SortType = "TopThreeMonths" + SortTypeTopSixMonths SortType = "TopSixMonths" + SortTypeTopNineMonths SortType = "TopNineMonths" +) + +type CreateCustomEmoji struct { + AltText string `json:"alt_text" url:"alt_text,omitempty"` + Auth string `json:"auth" url:"auth,omitempty"` + Category string `json:"category" url:"category,omitempty"` + ImageURL string `json:"image_url" url:"image_url,omitempty"` + Keywords []string `json:"keywords" url:"keywords,omitempty"` + Shortcode string `json:"shortcode" url:"shortcode,omitempty"` +} +type AdminPurgePost struct { + AdminPersonID float64 `json:"admin_person_id" url:"admin_person_id,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type ListCommentReportsResponse struct { + CommentReports []CommentReportView `json:"comment_reports" url:"comment_reports,omitempty"` + LemmyResponse +} +type CreateCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + Banner Optional[string] `json:"banner" url:"banner,omitempty"` + Description Optional[string] `json:"description" url:"description,omitempty"` + DiscussionLanguages Optional[[]float64] `json:"discussion_languages" url:"discussion_languages,omitempty"` + Icon Optional[string] `json:"icon" url:"icon,omitempty"` + Name string `json:"name" url:"name,omitempty"` + NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` + PostingRestrictedToMods Optional[bool] `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` + Title string `json:"title" url:"title,omitempty"` +} +type DeleteCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` +} +type Person struct { + ActorID string `json:"actor_id" url:"actor_id,omitempty"` + Admin bool `json:"admin" url:"admin,omitempty"` + Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"` + BanExpires Optional[string] `json:"ban_expires" url:"ban_expires,omitempty"` + Banned bool `json:"banned" url:"banned,omitempty"` + Banner Optional[string] `json:"banner" url:"banner,omitempty"` + Bio Optional[string] `json:"bio" url:"bio,omitempty"` + BotAccount bool `json:"bot_account" url:"bot_account,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` + DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"` + InstanceID float64 `json:"instance_id" url:"instance_id,omitempty"` + Local bool `json:"local" url:"local,omitempty"` + MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,omitempty"` + Name string `json:"name" url:"name,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type PrivateMessageReport struct { + CreatorID float64 `json:"creator_id" url:"creator_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + OriginalPmText string `json:"original_pm_text" url:"original_pm_text,omitempty"` + PrivateMessageID float64 `json:"private_message_id" url:"private_message_id,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Reason string `json:"reason" url:"reason,omitempty"` + Resolved bool `json:"resolved" url:"resolved,omitempty"` + ResolverID Optional[float64] `json:"resolver_id" url:"resolver_id,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type AdminPurgePostView struct { + Admin Optional[Person] `json:"admin" url:"admin,omitempty"` + AdminPurgePost AdminPurgePost `json:"admin_purge_post" url:"admin_purge_post,omitempty"` + Community Community `json:"community" url:"community,omitempty"` +} +type VerifyEmail struct { + Token string `json:"token" url:"token,omitempty"` +} +type Post struct { + ApID string `json:"ap_id" url:"ap_id,omitempty"` + Body Optional[string] `json:"body" url:"body,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + CreatorID float64 `json:"creator_id" url:"creator_id,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` + EmbedDescription Optional[string] `json:"embed_description" url:"embed_description,omitempty"` + EmbedTitle Optional[string] `json:"embed_title" url:"embed_title,omitempty"` + EmbedVideoURL Optional[string] `json:"embed_video_url" url:"embed_video_url,omitempty"` + FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"` + FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + LanguageID float64 `json:"language_id" url:"language_id,omitempty"` + Local bool `json:"local" url:"local,omitempty"` + Locked bool `json:"locked" url:"locked,omitempty"` + Name string `json:"name" url:"name,omitempty"` + NSFW bool `json:"nsfw" url:"nsfw,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` + ThumbnailURL Optional[string] `json:"thumbnail_url" url:"thumbnail_url,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` + URL Optional[string] `json:"url" url:"url,omitempty"` +} +type EditComment struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Content Optional[string] `json:"content" url:"content,omitempty"` + FormID Optional[string] `json:"form_id" url:"form_id,omitempty"` + LanguageID Optional[float64] `json:"language_id" url:"language_id,omitempty"` +} +type GetPost struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` + CommentID Optional[float64] `json:"comment_id" url:"comment_id,omitempty"` + ID Optional[float64] `json:"id" url:"id,omitempty"` +} +type ListRegistrationApplications struct { + Auth string `json:"auth" url:"auth,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` +} +type AdminPurgeComment struct { + AdminPersonID float64 `json:"admin_person_id" url:"admin_person_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type LockPost struct { + Auth string `json:"auth" url:"auth,omitempty"` + Locked bool `json:"locked" url:"locked,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` +} +type AdminPurgePerson struct { + AdminPersonID float64 `json:"admin_person_id" url:"admin_person_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type PersonMentionResponse struct { + PersonMentionView PersonMentionView `json:"person_mention_view" url:"person_mention_view,omitempty"` + LemmyResponse +} +type MarkPrivateMessageAsRead struct { + Auth string `json:"auth" url:"auth,omitempty"` + PrivateMessageID float64 `json:"private_message_id" url:"private_message_id,omitempty"` + Read bool `json:"read" url:"read,omitempty"` +} +type Register struct { + Answer Optional[string] `json:"answer" url:"answer,omitempty"` + CaptchaAnswer Optional[string] `json:"captcha_answer" url:"captcha_answer,omitempty"` + CaptchaUuid Optional[string] `json:"captcha_uuid" url:"captcha_uuid,omitempty"` + Email Optional[string] `json:"email" url:"email,omitempty"` + Honeypot Optional[string] `json:"honeypot" url:"honeypot,omitempty"` + Password string `json:"password" url:"password,omitempty"` + PasswordVerify string `json:"password_verify" url:"password_verify,omitempty"` + ShowNSFW bool `json:"show_nsfw" url:"show_nsfw,omitempty"` + Username string `json:"username" url:"username,omitempty"` +} +type CommentResponse struct { + CommentView CommentView `json:"comment_view" url:"comment_view,omitempty"` + FormID Optional[string] `json:"form_id" url:"form_id,omitempty"` + RecipientIDs []float64 `json:"recipient_ids" url:"recipient_ids,omitempty"` + LemmyResponse +} +type DeletePrivateMessage struct { + Auth string `json:"auth" url:"auth,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` + PrivateMessageID float64 `json:"private_message_id" url:"private_message_id,omitempty"` +} +type GetPersonMentionsResponse struct { + Mentions []PersonMentionView `json:"mentions" url:"mentions,omitempty"` + LemmyResponse +} +type CommentReplyView struct { + Comment Comment `json:"comment" url:"comment,omitempty"` + CommentReply CommentReply `json:"comment_reply" url:"comment_reply,omitempty"` + Community Community `json:"community" url:"community,omitempty"` + Counts CommentAggregates `json:"counts" url:"counts,omitempty"` + Creator Person `json:"creator" url:"creator,omitempty"` + CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` + CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` + MyVote Optional[float64] `json:"my_vote" url:"my_vote,omitempty"` + Post Post `json:"post" url:"post,omitempty"` + Recipient Person `json:"recipient" url:"recipient,omitempty"` + Saved bool `json:"saved" url:"saved,omitempty"` + Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` +} +type RegistrationMode string + +const ( + RegistrationModeClosed RegistrationMode = "Closed" + RegistrationModeRequireApplication RegistrationMode = "RequireApplication" + RegistrationModeOpen RegistrationMode = "Open" +) + +type FollowCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Follow bool `json:"follow" url:"follow,omitempty"` +} +type DeleteComment struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Deleted bool `json:"deleted" url:"deleted,omitempty"` +} +type PrivateMessagesResponse struct { + PrivateMessages []PrivateMessageView `json:"private_messages" url:"private_messages,omitempty"` + LemmyResponse +} +type ListCommentReports struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommunityID Optional[float64] `json:"community_id" url:"community_id,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + UnresolvedOnly Optional[bool] `json:"unresolved_only" url:"unresolved_only,omitempty"` +} +type Site struct { + ActorID string `json:"actor_id" url:"actor_id,omitempty"` + Banner Optional[string] `json:"banner" url:"banner,omitempty"` + Description Optional[string] `json:"description" url:"description,omitempty"` + Icon Optional[string] `json:"icon" url:"icon,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"` + InstanceID float64 `json:"instance_id" url:"instance_id,omitempty"` + LastRefreshedAt string `json:"last_refreshed_at" url:"last_refreshed_at,omitempty"` + Name string `json:"name" url:"name,omitempty"` + PrivateKey Optional[string] `json:"private_key" url:"private_key,omitempty"` + PublicKey string `json:"public_key" url:"public_key,omitempty"` + Published string `json:"published" url:"published,omitempty"` + Sidebar Optional[string] `json:"sidebar" url:"sidebar,omitempty"` + Updated Optional[string] `json:"updated" url:"updated,omitempty"` +} +type DeleteAccount struct { + Auth string `json:"auth" url:"auth,omitempty"` + Password string `json:"password" url:"password,omitempty"` +} +type ModLockPostView struct { + Community Community `json:"community" url:"community,omitempty"` + ModLockPost ModLockPost `json:"mod_lock_post" url:"mod_lock_post,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` + Post Post `json:"post" url:"post,omitempty"` +} +type LocalUserView struct { + Counts PersonAggregates `json:"counts" url:"counts,omitempty"` + LocalUser LocalUser `json:"local_user" url:"local_user,omitempty"` + Person Person `json:"person" url:"person,omitempty"` +} +type CommentReplyResponse struct { + CommentReplyView CommentReplyView `json:"comment_reply_view" url:"comment_reply_view,omitempty"` + LemmyResponse +} +type ApproveRegistrationApplication struct { + Approve bool `json:"approve" url:"approve,omitempty"` + Auth string `json:"auth" url:"auth,omitempty"` + DenyReason Optional[string] `json:"deny_reason" url:"deny_reason,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` +} +type CustomEmojiKeyword struct { + CustomEmojiID float64 `json:"custom_emoji_id" url:"custom_emoji_id,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Keyword string `json:"keyword" url:"keyword,omitempty"` +} +type CreatePrivateMessageReport struct { + Auth string `json:"auth" url:"auth,omitempty"` + PrivateMessageID float64 `json:"private_message_id" url:"private_message_id,omitempty"` + Reason string `json:"reason" url:"reason,omitempty"` +} +type CreatePostLike struct { + Auth string `json:"auth" url:"auth,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Score float64 `json:"score" url:"score,omitempty"` +} +type PasswordChangeAfterReset struct { + Password string `json:"password" url:"password,omitempty"` + PasswordVerify string `json:"password_verify" url:"password_verify,omitempty"` + Token string `json:"token" url:"token,omitempty"` +} +type PurgePost struct { + Auth string `json:"auth" url:"auth,omitempty"` + PostID float64 `json:"post_id" url:"post_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` +} +type ModBanView struct { + BannedPerson Person `json:"banned_person" url:"banned_person,omitempty"` + ModBan ModBan `json:"mod_ban" url:"mod_ban,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` +} +type Language struct { + Code string `json:"code" url:"code,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + Name string `json:"name" url:"name,omitempty"` +} +type ModRemoveCommunity struct { + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Expires Optional[string] `json:"expires" url:"expires,omitempty"` + ID float64 `json:"id" url:"id,omitempty"` + ModPersonID float64 `json:"mod_person_id" url:"mod_person_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + Removed bool `json:"removed" url:"removed,omitempty"` + When string `json:"when_" url:"when_,omitempty"` +} +type GetReplies struct { + Auth string `json:"auth" url:"auth,omitempty"` + Limit Optional[float64] `json:"limit" url:"limit,omitempty"` + Page Optional[float64] `json:"page" url:"page,omitempty"` + Sort Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` + UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` +} +type SubscribedType string + +const ( + SubscribedTypeSubscribed SubscribedType = "Subscribed" + SubscribedTypeNotSubscribed SubscribedType = "NotSubscribed" + SubscribedTypePending SubscribedType = "Pending" +) + +type ModAddView struct { + ModAdd ModAdd `json:"mod_add" url:"mod_add,omitempty"` + ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"` + Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"` +} +type BanFromCommunity struct { + Auth string `json:"auth" url:"auth,omitempty"` + Ban bool `json:"ban" url:"ban,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Expires Optional[float64] `json:"expires" url:"expires,omitempty"` + PersonID float64 `json:"person_id" url:"person_id,omitempty"` + Reason Optional[string] `json:"reason" url:"reason,omitempty"` + RemoveData Optional[bool] `json:"remove_data" url:"remove_data,omitempty"` +} +type DeleteCustomEmojiResponse struct { + ID float64 `json:"id" url:"id,omitempty"` + Success bool `json:"success" url:"success,omitempty"` + LemmyResponse +} +type EditPrivateMessage struct { + Auth string `json:"auth" url:"auth,omitempty"` + Content string `json:"content" url:"content,omitempty"` + PrivateMessageID float64 `json:"private_message_id" url:"private_message_id,omitempty"` +} +type CommunityBlockView struct { + Community Community `json:"community" url:"community,omitempty"` + Person Person `json:"person" url:"person,omitempty"` +} +type CreateCommentLike struct { + Auth string `json:"auth" url:"auth,omitempty"` + CommentID float64 `json:"comment_id" url:"comment_id,omitempty"` + Score float64 `json:"score" url:"score,omitempty"` +} +type CommunityResponse struct { + CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` + DiscussionLanguages []float64 `json:"discussion_languages" url:"discussion_languages,omitempty"` + LemmyResponse +} +type CreatePost struct { + Auth string `json:"auth" url:"auth,omitempty"` + Body Optional[string] `json:"body" url:"body,omitempty"` + CommunityID float64 `json:"community_id" url:"community_id,omitempty"` + Honeypot Optional[string] `json:"honeypot" url:"honeypot,omitempty"` + LanguageID Optional[float64] `json:"language_id" url:"language_id,omitempty"` + Name string `json:"name" url:"name,omitempty"` + NSFW Optional[bool] `json:"nsfw" url:"nsfw,omitempty"` + URL Optional[string] `json:"url" url:"url,omitempty"` +} diff --git a/types/types.go b/types/types.go index ca20bb8..5a19c74 100644 --- a/types/types.go +++ b/types/types.go @@ -7,6 +7,10 @@ import ( "time" ) +type EmptyResponse struct { + LemmyResponse +} + type LemmyResponse struct { Error Optional[string] `json:"error" url:"error,omitempty"` } diff --git a/types/utils.gen.go b/types/utils.gen.go deleted file mode 100644 index 7b9279d..0000000 --- a/types/utils.gen.go +++ /dev/null @@ -1,14 +0,0 @@ -// Source: lemmy/crates/api_common/src/utils.rs -// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. - -package types - -type EndpointType string - -const ( - EndpointTypeCommunity EndpointType = "Community" - EndpointTypePerson EndpointType = "Person" - EndpointTypePost EndpointType = "Post" - EndpointTypeComment EndpointType = "Comment" - EndpointTypePrivateMessage EndpointType = "PrivateMessage" -)