Compare commits
	
		
			19 Commits
		
	
	
		
			a4a015a4cc
			...
			v0.16.7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d4c5776790 | |||
| 6465ee25bc | |||
| 9788468c0a | |||
| 6f5a84c24b | |||
| 2e4f4281de | |||
| b32e07b887 | |||
| 862bcd5164 | |||
| 8e0208dec2 | |||
| e5092d3898 | |||
| 754cfa602c | |||
| 0942490238 | |||
| 4ecce09b73 | |||
| cf871efc23 | |||
| cdd67e35a3 | |||
| 7459b363f6 | |||
| e097e6c8b5 | |||
| 92b96981e2 | |||
| b38c6b0a54 | |||
| ce8f58ed2d | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1 +1,2 @@ | |||||||
| /test | /test | ||||||
|  | /gen | ||||||
							
								
								
									
										46
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								README.md
									
									
									
									
									
								
							| @@ -2,30 +2,58 @@ | |||||||
|  |  | ||||||
| [](https://pkg.go.dev/go.arsenm.dev/go-lemmy) | [](https://pkg.go.dev/go.arsenm.dev/go-lemmy) | ||||||
|  |  | ||||||
| Go bindings to the [Lemmy](https://join-lemmy.org) API | 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). | ||||||
|  |  | ||||||
| Example: | Example: | ||||||
|  |  | ||||||
| ```go | ```go | ||||||
| ctx := context.Background() | ctx := context.Background() | ||||||
|  |  | ||||||
| c, err := lemmy.New("https://lemmy.ml") | c, err := lemmy.New("https://lemmygrad.ml") | ||||||
| if err != nil { | if err != nil { | ||||||
|     panic(err) | 	panic(err) | ||||||
| } | } | ||||||
|  |  | ||||||
| err = c.Login(ctx, types.Login{ | err = c.ClientLogin(ctx, types.Login{ | ||||||
|     UsernameOrEmail: "email@example.com", | 	UsernameOrEmail: "user@example.com", | ||||||
|     Password:        `TestPwd`, | 	Password:        `TestPwd`, | ||||||
| }) | }) | ||||||
| if err != nil { | if err != nil { | ||||||
|     panic(err) | 	panic(err) | ||||||
| } | } | ||||||
|  |  | ||||||
| _, err = c.SaveUserSettings(ctx, types.SaveUserSettings{ | _, err = c.SaveUserSettings(ctx, types.SaveUserSettings{ | ||||||
|     BotAccount: types.NewOptional(true), | 	BotAccount: types.NewOptional(true), | ||||||
| }) | }) | ||||||
| if err != nil { | if err != nil { | ||||||
|     panic(err) | 	panic(err) | ||||||
| } | } | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | ### How to generate | ||||||
|  |  | ||||||
|  | First, 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 | ||||||
|  | rm **/*.gen.go | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Execute the generator: | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | ./gen -out-dir . | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | And that's it! Your generated code should be ready for use. | ||||||
							
								
								
									
										128
									
								
								admin.go
									
									
									
									
									
								
							
							
						
						
									
										128
									
								
								admin.go
									
									
									
									
									
								
							| @@ -1,128 +0,0 @@ | |||||||
| package lemmy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"net/http" |  | ||||||
|  |  | ||||||
| 	"go.arsenm.dev/go-lemmy/types" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func (c *Client) AddAdmin(ctx context.Context, d types.AddAdmin) (*types.AddAdminResponse, error) { |  | ||||||
| 	ar := &types.AddAdminResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/admin/add", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) ApproveRegistrationApplication(ctx context.Context, d types.ApproveRegistrationApplication) (*types.RegistrationApplicationResponse, error) { |  | ||||||
| 	ar := &types.RegistrationApplicationResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/admin/registration_application/approve", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context, d types.GetUnreadRegistrationApplicationCount) (*types.GetUnreadRegistrationApplicationCountResponse, error) { |  | ||||||
| 	ar := &types.GetUnreadRegistrationApplicationCountResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/admin/registration_application/count", nil, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) RegistrationApplications(ctx context.Context, d types.ListRegistrationApplications) (*types.ListRegistrationApplicationsResponse, error) { |  | ||||||
| 	ar := &types.ListRegistrationApplicationsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/admin/registration_application/list", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PurgeComment(ctx context.Context, d types.PurgeComment) (*types.PurgeItemResponse, error) { |  | ||||||
| 	ar := &types.PurgeItemResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/admin/purge/comment", nil, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PurgeCommunity(ctx context.Context, d types.PurgeCommunity) (*types.PurgeItemResponse, error) { |  | ||||||
| 	ar := &types.PurgeItemResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/admin/purge/community", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PurgePerson(ctx context.Context, d types.PurgePerson) (*types.PurgeItemResponse, error) { |  | ||||||
| 	ar := &types.PurgeItemResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/admin/purge/person", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PurgePost(ctx context.Context, d types.PurgePost) (*types.PurgeItemResponse, error) { |  | ||||||
| 	ar := &types.PurgeItemResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/admin/purge/post", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
							
								
								
									
										63
									
								
								cmd/gen/generator/routes.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								cmd/gen/generator/routes.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | |||||||
|  | package generator | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"io" | ||||||
|  | 	"strings" | ||||||
|  |  | ||||||
|  | 	"github.com/dave/jennifer/jen" | ||||||
|  | 	"go.arsenm.dev/go-lemmy/cmd/gen/parser" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | type RoutesGenerator struct { | ||||||
|  | 	w       io.Writer | ||||||
|  | 	PkgName string | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func NewRoutes(w io.Writer, pkgName string) *RoutesGenerator { | ||||||
|  | 	return &RoutesGenerator{w, pkgName} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (r *RoutesGenerator) Generate(routes []parser.Route, impls map[string]string) error { | ||||||
|  | 	f := jen.NewFile(r.PkgName) | ||||||
|  | 	f.HeaderComment("Code generated by go.arsenm.dev/go-lemmy/cmd/gen (routes generator). DO NOT EDIT.") | ||||||
|  |  | ||||||
|  | 	for _, r := range routes { | ||||||
|  | 		resStruct := impls[r.Struct] | ||||||
|  |  | ||||||
|  | 		f.Func().Params( | ||||||
|  | 			jen.Id("c").Id("*Client"), | ||||||
|  | 		).Id(strings.TrimPrefix(r.Struct, "Get")).Params( | ||||||
|  | 			jen.Id("ctx").Qual("context", "Context"), | ||||||
|  | 			jen.Id("data").Qual("go.arsenm.dev/go-lemmy/types", r.Struct), | ||||||
|  | 		).Params( | ||||||
|  | 			jen.Op("*").Qual("go.arsenm.dev/go-lemmy/types", resStruct), | ||||||
|  | 			jen.Error(), | ||||||
|  | 		).BlockFunc(func(g *jen.Group) { | ||||||
|  | 			g.Id("resData").Op(":=").Op("&").Qual("go.arsenm.dev/go-lemmy/types", resStruct).Block() | ||||||
|  |  | ||||||
|  | 			var funcName string | ||||||
|  | 			switch r.Method { | ||||||
|  | 			case "GET": | ||||||
|  | 				funcName = "getReq" | ||||||
|  | 			default: | ||||||
|  | 				funcName = "req" | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			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.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.Return(jen.Id("resData"), jen.Nil()) | ||||||
|  | 		}) | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return f.Render(r.w) | ||||||
|  | } | ||||||
							
								
								
									
										52
									
								
								cmd/gen/generator/struct.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								cmd/gen/generator/struct.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | |||||||
|  | package generator | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"io" | ||||||
|  | 	"strings" | ||||||
|  |  | ||||||
|  | 	"github.com/dave/jennifer/jen" | ||||||
|  | 	"go.arsenm.dev/go-lemmy/cmd/gen/parser" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | type StructGenerator struct { | ||||||
|  | 	w       io.Writer | ||||||
|  | 	PkgName string | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func NewStruct(w io.Writer, pkgName string) *StructGenerator { | ||||||
|  | 	return &StructGenerator{w, pkgName} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (s *StructGenerator) Generate(items []parser.Item) error { | ||||||
|  | 	f := jen.NewFile(s.PkgName) | ||||||
|  | 	f.HeaderComment("Code generated by go.arsenm.dev/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 strings.HasSuffix(st.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) | ||||||
|  | } | ||||||
							
								
								
									
										177
									
								
								cmd/gen/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										177
									
								
								cmd/gen/main.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,177 @@ | |||||||
|  | package main | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"flag" | ||||||
|  | 	"io/fs" | ||||||
|  | 	"os" | ||||||
|  | 	"path/filepath" | ||||||
|  | 	"strconv" | ||||||
|  | 	"strings" | ||||||
|  |  | ||||||
|  | 	"go.arsenm.dev/go-lemmy/cmd/gen/generator" | ||||||
|  | 	"go.arsenm.dev/go-lemmy/cmd/gen/parser" | ||||||
|  | 	"go.arsenm.dev/logger" | ||||||
|  | 	"go.arsenm.dev/logger/log" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | 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.rs" | ||||||
|  |  | ||||||
|  | func main() { | ||||||
|  | 	lemmyDir := flag.String("lemmy-dir", "lemmy", "Path to Lemmy repository") | ||||||
|  | 	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"} | ||||||
|  | 	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) | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal("Error opening routes file").Err(err).Send() | ||||||
|  | 	} | ||||||
|  | 	defer rf.Close() | ||||||
|  |  | ||||||
|  | 	rp := parser.NewRoutes(rf) | ||||||
|  | 	routes, err := rp.Parse() | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal("Error parsing routes file").Err(err).Send() | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	orf, err := os.Create(filepath.Join(*outDir, "routes.gen.go")) | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal("Error creating routes output file").Err(err).Send() | ||||||
|  | 	} | ||||||
|  | 	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) | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Fatal("Error generating output routes file").Err(err).Send() | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										62
									
								
								cmd/gen/parser/impl.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								cmd/gen/parser/impl.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | |||||||
|  | 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) | ||||||
|  | } | ||||||
							
								
								
									
										121
									
								
								cmd/gen/parser/routes.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								cmd/gen/parser/routes.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,121 @@ | |||||||
|  | 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) | ||||||
|  | } | ||||||
							
								
								
									
										267
									
								
								cmd/gen/parser/struct.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										267
									
								
								cmd/gen/parser/struct.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,267 @@ | |||||||
|  | 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) { | ||||||
|  | 	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 | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		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<Vec<i64>>") // 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) | ||||||
|  | } | ||||||
							
								
								
									
										49
									
								
								cmd/gen/parser/struct_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								cmd/gen/parser/struct_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | 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<Vec<i64>>", "Optional[[]int64]"}, | ||||||
|  | 		{"Url", "string"}, | ||||||
|  | 		{"Sensitive<String>", "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) | ||||||
|  | 			} | ||||||
|  | 		}) | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										158
									
								
								comment.go
									
									
									
									
									
								
							
							
						
						
									
										158
									
								
								comment.go
									
									
									
									
									
								
							| @@ -1,158 +0,0 @@ | |||||||
| package lemmy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"net/http" |  | ||||||
|  |  | ||||||
| 	"go.arsenm.dev/go-lemmy/types" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func (c *Client) Comments(ctx context.Context, d types.GetComments) (*types.GetCommentsResponse, error) { |  | ||||||
| 	ar := &types.GetCommentsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/comment/list", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) CreateComment(ctx context.Context, d types.CreateComment) (*types.CommentResponse, error) { |  | ||||||
| 	ar := &types.CommentResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/comment", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) CreateCommentReport(ctx context.Context, d types.CreateCommentReport) (*types.CommentReportResponse, error) { |  | ||||||
| 	ar := &types.CommentReportResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/comment/report", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) DeleteComment(ctx context.Context, d types.DeleteComment) (*types.CommentResponse, error) { |  | ||||||
| 	ar := &types.CommentResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/comment/delete", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) RemoveComment(ctx context.Context, d types.RemoveComment) (*types.CommentResponse, error) { |  | ||||||
| 	ar := &types.CommentResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/comment/remove", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) EditComment(ctx context.Context, d types.EditComment) (*types.CommentResponse, error) { |  | ||||||
| 	ar := &types.CommentResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/comment", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) LikeComment(ctx context.Context, d types.CreateCommentLike) (*types.CommentResponse, error) { |  | ||||||
| 	ar := &types.CommentResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/comment/like", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) CommentReports(ctx context.Context, d types.ListCommentReports) (*types.ListCommentReportsResponse, error) { |  | ||||||
| 	ar := &types.ListCommentReportsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/comments/report/list", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) MarkCommentReplyAsRead(ctx context.Context, d types.MarkCommentReplyAsRead) (*types.CommentResponse, error) { |  | ||||||
| 	ar := &types.CommentResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/comment/mark_as_read", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) SaveComment(ctx context.Context, d types.SaveComment) (*types.CommentResponse, error) { |  | ||||||
| 	ar := &types.CommentResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/comment/save", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
							
								
								
									
										173
									
								
								community.go
									
									
									
									
									
								
							
							
						
						
									
										173
									
								
								community.go
									
									
									
									
									
								
							| @@ -1,173 +0,0 @@ | |||||||
| package lemmy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"net/http" |  | ||||||
|  |  | ||||||
| 	"go.arsenm.dev/go-lemmy/types" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func (c *Client) AddModToCommunity(ctx context.Context, d types.AddModToCommunity) (*types.AddModToCommunityResponse, error) { |  | ||||||
| 	ar := &types.AddModToCommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/community/mod", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) BanFromCommunity(ctx context.Context, d types.BanFromCommunity) (*types.BanFromCommunityResponse, error) { |  | ||||||
| 	ar := &types.BanFromCommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/community/ban_user", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) BlockCommunity(ctx context.Context, d types.BlockCommunity) (*types.BlockCommunityResponse, error) { |  | ||||||
| 	ar := &types.BlockCommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/community/block", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) CreateCommunity(ctx context.Context, d types.CreateCommunity) (*types.CommunityResponse, error) { |  | ||||||
| 	ar := &types.CommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/community", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) EditCommunity(ctx context.Context, d types.EditCommunity) (*types.CommunityResponse, error) { |  | ||||||
| 	ar := &types.CommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/community", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) FollowCommunity(ctx context.Context, d types.FollowCommunity) (*types.CommunityResponse, error) { |  | ||||||
| 	ar := &types.CommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/community/follow", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) DeleteCommunity(ctx context.Context, d types.DeleteCommunity) (*types.CommunityResponse, error) { |  | ||||||
| 	ar := &types.CommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/community/delete", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) RemoveCommunity(ctx context.Context, d types.RemoveCommunity) (*types.CommunityResponse, error) { |  | ||||||
| 	ar := &types.CommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/community/remove", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) Community(ctx context.Context, d types.GetCommunity) (*types.GetCommunityResponse, error) { |  | ||||||
| 	ar := &types.GetCommunityResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/community", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) Communities(ctx context.Context, d types.ListCommunities) (*types.ListCommunitiesResponse, error) { |  | ||||||
| 	ar := &types.ListCommunitiesResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/community/list", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) TransferCommunity(ctx context.Context, d types.TransferCommunity) (*types.GetCommunityResponse, error) { |  | ||||||
| 	ar := &types.GetCommunityResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/community/transfer", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
							
								
								
									
										14
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								go.mod
									
									
									
									
									
								
							| @@ -2,13 +2,19 @@ module go.arsenm.dev/go-lemmy | |||||||
|  |  | ||||||
| go 1.19 | go 1.19 | ||||||
|  |  | ||||||
|  | retract v0.0.0-20230105203020-27ef17a00e22 | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
|  | 	github.com/dave/jennifer v1.6.0 | ||||||
| 	github.com/google/go-querystring v1.1.0 | 	github.com/google/go-querystring v1.1.0 | ||||||
| 	github.com/mitchellh/mapstructure v1.5.0 | 	github.com/gorilla/websocket v1.4.2 | ||||||
| 	github.com/recws-org/recws v1.4.0 | 	go.arsenm.dev/logger v0.0.0-20230104225304-d706171ea6df | ||||||
|  | 	golang.org/x/exp v0.0.0-20230105000112-eab7a2c85304 | ||||||
| ) | ) | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/gorilla/websocket v1.4.2 // indirect | 	github.com/gookit/color v1.5.1 // indirect | ||||||
| 	github.com/jpillora/backoff v1.0.0 // indirect | 	github.com/mattn/go-isatty v0.0.14 // indirect | ||||||
|  | 	github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect | ||||||
|  | 	golang.org/x/sys v0.1.0 // indirect | ||||||
| ) | ) | ||||||
|   | |||||||
							
								
								
									
										34
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								go.sum
									
									
									
									
									
								
							| @@ -1,13 +1,33 @@ | |||||||
| github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= | 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= | ||||||
|  | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
| github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||||||
|  | github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= | ||||||
| github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= | github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= | ||||||
| github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= | 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 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= | ||||||
| github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | ||||||
| github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= | github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= | ||||||
| github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= | ||||||
| github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||||||
| github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||||||
| github.com/recws-org/recws v1.4.0 h1:y9LLddtAicjejikNZXiaY9DQjIwcAQ82acd1XU6n0lU= | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||||
| github.com/recws-org/recws v1.4.0/go.mod h1:7+NQkTmBdU98VSzkzq9/P7+X0xExioUVBx9OeRKQIkk= | github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= | ||||||
|  | github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= | ||||||
|  | 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.arsenm.dev/logger v0.0.0-20230104225304-d706171ea6df h1:8mBHvEe7BJmpOeKSMA5YLqrGo9dCpePocTeR0C1+/2w= | ||||||
|  | go.arsenm.dev/logger v0.0.0-20230104225304-d706171ea6df/go.mod h1:RV2qydKDdoyaRkhAq8JEGvojR8eJ6bjq5WnSIlH7gYw= | ||||||
|  | golang.org/x/exp v0.0.0-20230105000112-eab7a2c85304 h1:YUqj+XKtfrn3kXjFIiZ8jwKROD7ioAOOHUuo3ZZ2opc= | ||||||
|  | golang.org/x/exp v0.0.0-20230105000112-eab7a2c85304/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= | ||||||
|  | golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= | ||||||
|  | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
| golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||||||
|  | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
|  | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||||||
|  | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||||
|   | |||||||
							
								
								
									
										43
									
								
								lemmy.go
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								lemmy.go
									
									
									
									
									
								
							| @@ -13,16 +13,19 @@ import ( | |||||||
| 	"go.arsenm.dev/go-lemmy/types" | 	"go.arsenm.dev/go-lemmy/types" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | // Client is a client for Lemmy's HTTP API | ||||||
| type Client struct { | type Client struct { | ||||||
| 	client  *http.Client | 	client  *http.Client | ||||||
| 	baseURL *url.URL | 	baseURL *url.URL | ||||||
| 	token   string | 	Token   string | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // New creates a new Lemmy client with the default HTTP client. | ||||||
| func New(baseURL string) (*Client, error) { | func New(baseURL string) (*Client, error) { | ||||||
| 	return NewWithClient(baseURL, http.DefaultClient) | 	return NewWithClient(baseURL, http.DefaultClient) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // NewWithClient creates a new Lemmy client with the given HTTP client | ||||||
| func NewWithClient(baseURL string, client *http.Client) (*Client, error) { | func NewWithClient(baseURL string, client *http.Client) (*Client, error) { | ||||||
| 	u, err := url.Parse(baseURL) | 	u, err := url.Parse(baseURL) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @@ -33,31 +36,20 @@ func NewWithClient(baseURL string, client *http.Client) (*Client, error) { | |||||||
| 	return &Client{baseURL: u, client: client}, nil | 	return &Client{baseURL: u, client: client}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func (c *Client) Login(ctx context.Context, l types.Login) error { | // ClientLogin logs in to Lemmy by sending an HTTP request to the | ||||||
| 	var lr types.LoginResponse | // login endpoint. It stores the returned token in the client | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/login", l, &lr) | // for future use. | ||||||
|  | func (c *Client) ClientLogin(ctx context.Context, l types.Login) error { | ||||||
|  | 	lr, err := c.Login(ctx, l) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	err = resError(res, lr.LemmyResponse) | 	c.Token = lr.JWT.MustValue() | ||||||
| 	if err != nil { |  | ||||||
| 		return err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	c.token = lr.JWT.MustValue() |  | ||||||
|  |  | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func (c *Client) Token() string { | // req makes a request to the server | ||||||
| 	return c.token |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) SetToken(t string) { |  | ||||||
| 	c.token = t |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) req(ctx context.Context, method string, path string, data, resp any) (*http.Response, error) { | func (c *Client) req(ctx context.Context, method string, path string, data, resp any) (*http.Response, error) { | ||||||
| 	data = c.setAuth(data) | 	data = c.setAuth(data) | ||||||
|  |  | ||||||
| @@ -98,6 +90,9 @@ func (c *Client) req(ctx context.Context, method string, path string, data, resp | |||||||
| 	return res, nil | 	return res, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // getReq makes a get request to the Lemmy server. | ||||||
|  | // It is separate from req() because it uses query | ||||||
|  | // parameters rather than a JSON request body. | ||||||
| func (c *Client) getReq(ctx context.Context, method string, path string, data, resp any) (*http.Response, error) { | func (c *Client) getReq(ctx context.Context, method string, path string, data, resp any) (*http.Response, error) { | ||||||
| 	data = c.setAuth(data) | 	data = c.setAuth(data) | ||||||
|  |  | ||||||
| @@ -134,6 +129,7 @@ func (c *Client) getReq(ctx context.Context, method string, path string, data, r | |||||||
| 	return res, nil | 	return res, nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // resError returns an error if the given response is an error | ||||||
| func resError(res *http.Response, lr types.LemmyResponse) error { | func resError(res *http.Response, lr types.LemmyResponse) error { | ||||||
| 	if lr.Error.IsValid() { | 	if lr.Error.IsValid() { | ||||||
| 		return types.LemmyError{ | 		return types.LemmyError{ | ||||||
| @@ -149,6 +145,11 @@ func resError(res *http.Response, lr types.LemmyResponse) error { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // setAuth uses reflection to automatically | ||||||
|  | // set struct fields called Auth of type | ||||||
|  | // string or types.Optional[string] to the | ||||||
|  | // authentication token, then returns the | ||||||
|  | // updated struct | ||||||
| func (c *Client) setAuth(data any) any { | func (c *Client) setAuth(data any) any { | ||||||
| 	if data == nil { | 	if data == nil { | ||||||
| 		return data | 		return data | ||||||
| @@ -164,10 +165,10 @@ func (c *Client) setAuth(data any) any { | |||||||
|  |  | ||||||
| 	switch authField.Type().String() { | 	switch authField.Type().String() { | ||||||
| 	case "string": | 	case "string": | ||||||
| 		authField.SetString(c.token) | 		authField.SetString(c.Token) | ||||||
| 	case "types.Optional[string]": | 	case "types.Optional[string]": | ||||||
| 		setMtd := authField.MethodByName("Set") | 		setMtd := authField.MethodByName("Set") | ||||||
| 		out := setMtd.Call([]reflect.Value{reflect.ValueOf(c.token)}) | 		out := setMtd.Call([]reflect.Value{reflect.ValueOf(c.Token)}) | ||||||
| 		authField.Set(out[0]) | 		authField.Set(out[0]) | ||||||
| 	default: | 	default: | ||||||
| 		return data | 		return data | ||||||
|   | |||||||
							
								
								
									
										301
									
								
								person.go
									
									
									
									
									
								
							
							
						
						
									
										301
									
								
								person.go
									
									
									
									
									
								
							| @@ -1,301 +0,0 @@ | |||||||
| package lemmy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"net/http" |  | ||||||
|  |  | ||||||
| 	"go.arsenm.dev/go-lemmy/types" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func (c *Client) BanPerson(ctx context.Context, d types.BanPerson) (*types.BanPersonResponse, error) { |  | ||||||
| 	ar := &types.BanPersonResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/ban", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) BlockPerson(ctx context.Context, d types.BlockPerson) (*types.BlockPersonResponse, error) { |  | ||||||
| 	ar := &types.BlockPersonResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/block", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) ChangePassword(ctx context.Context, d types.ChangePassword) (*types.LoginResponse, error) { |  | ||||||
| 	ar := &types.LoginResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/user/change_password", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	c.token = ar.JWT.MustValue() |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) DeleteAccount(ctx context.Context, d types.DeleteAccount) (*types.DeleteAccountResponse, error) { |  | ||||||
| 	ar := &types.DeleteAccountResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/delete_account", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) BannedPersons(ctx context.Context, d types.GetBannedPersons) (*types.BannedPersonsResponse, error) { |  | ||||||
| 	ar := &types.BannedPersonsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/user/banned", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) Captcha(ctx context.Context, d types.GetCaptcha) (*types.CaptchaResponse, error) { |  | ||||||
| 	ar := &types.CaptchaResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/user/get_captcha", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PersonDetails(ctx context.Context, d types.GetPersonDetails) (*types.GetPersonDetailsResponse, error) { |  | ||||||
| 	ar := &types.GetPersonDetailsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/user", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PersonMentions(ctx context.Context, d types.GetPersonMentions) (*types.GetPersonMentionsResponse, error) { |  | ||||||
| 	ar := &types.GetPersonMentionsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/user/mention", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) Replies(ctx context.Context, d types.GetReplies) (*types.GetRepliesResponse, error) { |  | ||||||
| 	ar := &types.GetRepliesResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/user/replies", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) ReportCount(ctx context.Context, d types.GetReportCount) (*types.GetReportCountResponse, error) { |  | ||||||
| 	ar := &types.GetReportCountResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/user/report_count", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) UnreadCount(ctx context.Context, d types.GetUnreadCount) (*types.GetUnreadCountResponse, error) { |  | ||||||
| 	ar := &types.GetUnreadCountResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/user/unread_count", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) LeaveAdmin(ctx context.Context, d types.LeaveAdmin) (*types.GetSiteResponse, error) { |  | ||||||
| 	ar := &types.GetSiteResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/leave_admin", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) MarkAllAsRead(ctx context.Context, d types.MarkAllAsRead) (*types.GetRepliesResponse, error) { |  | ||||||
| 	ar := &types.GetRepliesResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/mark_all_as_read", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) MarkPersonMentionAsRead(ctx context.Context, d types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error) { |  | ||||||
| 	ar := &types.PersonMentionResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/mention/mark_as_read", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PasswordChange(ctx context.Context, d types.PasswordChange) (*types.LoginResponse, error) { |  | ||||||
| 	ar := &types.LoginResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/password_change", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	c.token = ar.JWT.MustValue() |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PasswordReset(ctx context.Context, d types.PasswordReset) (*types.PasswordResetResponse, error) { |  | ||||||
| 	ar := &types.PasswordResetResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/password_reset", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) Register(ctx context.Context, d types.Register) (*types.LoginResponse, error) { |  | ||||||
| 	ar := &types.LoginResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/user/register", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	c.token = ar.JWT.MustValue() |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) SaveUserSettings(ctx context.Context, d types.SaveUserSettings) (*types.LoginResponse, error) { |  | ||||||
| 	ar := &types.LoginResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/user/save_user_settings", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	c.token = ar.JWT.MustValue() |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) VerifyEmail(ctx context.Context, d types.VerifyEmail) (*types.VerifyEmailResponse, error) { |  | ||||||
| 	ar := &types.VerifyEmailResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/user/verify_email", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
							
								
								
									
										233
									
								
								post.go
									
									
									
									
									
								
							
							
						
						
									
										233
									
								
								post.go
									
									
									
									
									
								
							| @@ -1,233 +0,0 @@ | |||||||
| package lemmy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"net/http" |  | ||||||
|  |  | ||||||
| 	"go.arsenm.dev/go-lemmy/types" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func (c *Client) CreatePost(ctx context.Context, d types.CreatePost) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/post", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) EditPost(ctx context.Context, d types.EditPost) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/post", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) Post(ctx context.Context, d types.GetPost) (*types.GetPostResponse, error) { |  | ||||||
| 	ar := &types.GetPostResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/post", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) CreatePostReport(ctx context.Context, d types.CreatePostReport) (*types.PostReportResponse, error) { |  | ||||||
| 	ar := &types.PostReportResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/post/report", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) DeletePost(ctx context.Context, d types.DeletePost) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/post/delete", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) RemovePost(ctx context.Context, d types.RemovePost) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/post/remove", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) Posts(ctx context.Context, d types.GetPosts) (*types.GetPostsResponse, error) { |  | ||||||
| 	ar := &types.GetPostsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/post/list", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) SiteMetadata(ctx context.Context, d types.GetSiteMetadata) (*types.GetSiteMetadataResponse, error) { |  | ||||||
| 	ar := &types.GetSiteMetadataResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/post/site_metadata", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) LikePost(ctx context.Context, d types.CreatePostLike) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/post/like", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PostReports(ctx context.Context, d types.ListPostReports) (*types.ListPostReportsResponse, error) { |  | ||||||
| 	ar := &types.ListPostReportsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/post/report/list", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) LockPost(ctx context.Context, d types.LockPost) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/post/lock", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) MarkPostAsRead(ctx context.Context, d types.MarkPostAsRead) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/post/mark_as_read", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) ResolvePostReport(ctx context.Context, d types.ResolvePostReport) (*types.PostReportResponse, error) { |  | ||||||
| 	ar := &types.PostReportResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/post/report/resolve", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) SavePost(ctx context.Context, d types.SavePost) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/post/save", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) StickyPost(ctx context.Context, d types.StickyPost) (*types.PostResponse, error) { |  | ||||||
| 	ar := &types.PostResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/post/sticky", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
| @@ -1,128 +0,0 @@ | |||||||
| package lemmy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"net/http" |  | ||||||
|  |  | ||||||
| 	"go.arsenm.dev/go-lemmy/types" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func (c *Client) CreatePrivateMessage(ctx context.Context, d types.CreatePrivateMessage) (*types.PrivateMessageResponse, error) { |  | ||||||
| 	ar := &types.PrivateMessageResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/private_message", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) CreatePrivateMessageReport(ctx context.Context, d types.CreatePrivateMessageReport) (*types.PrivateMessageReportResponse, error) { |  | ||||||
| 	ar := &types.PrivateMessageReportResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/private_message/report", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) DeletePrivateMessage(ctx context.Context, d types.DeletePrivateMessage) (*types.PrivateMessageResponse, error) { |  | ||||||
| 	ar := &types.PrivateMessageResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/private_message/delete", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) EditPrivateMessage(ctx context.Context, d types.EditPrivateMessage) (*types.PrivateMessageResponse, error) { |  | ||||||
| 	ar := &types.PrivateMessageResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/private_message", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PrivateMessages(ctx context.Context, d types.GetPrivateMessages) (*types.PrivateMessagesResponse, error) { |  | ||||||
| 	ar := &types.PrivateMessagesResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/private_message/list", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) PrivateMessageReports(ctx context.Context, d types.ListPrivateMessageReports) (*types.ListPrivateMessageReportsResponse, error) { |  | ||||||
| 	ar := &types.ListPrivateMessageReportsResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/private_message/report/list", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, d types.MarkPrivateMessageAsRead) (*types.PrivateMessageResponse, error) { |  | ||||||
| 	ar := &types.PrivateMessageResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/private_message/mark_as_read", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) ResolvePrivateMessageReport(ctx context.Context, d types.ResolvePrivateMessageReport) (*types.PrivateMessageReportResponse, error) { |  | ||||||
| 	ar := &types.PrivateMessageReportResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/private_message/report/resolve", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
							
								
								
									
										970
									
								
								routes.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										970
									
								
								routes.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,970 @@ | |||||||
|  | //  Source: lemmy/src/api_routes.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (routes generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package lemmy | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"context" | ||||||
|  | 	types "go.arsenm.dev/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) SiteConfig(ctx context.Context, data types.GetSiteConfig) (*types.GetSiteConfigResponse, error) { | ||||||
|  | 	resData := &types.GetSiteConfigResponse{} | ||||||
|  | 	res, err := c.getReq(ctx, "GET", "/site/config", 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) SaveSiteConfig(ctx context.Context, data types.SaveSiteConfig) (*types.GetSiteConfigResponse, error) { | ||||||
|  | 	resData := &types.GetSiteConfigResponse{} | ||||||
|  | 	res, err := c.req(ctx, "PUT", "/site/config", 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) ListCommunities(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) CommunityJoin(ctx context.Context, data types.CommunityJoin) (*types.CommunityJoinResponse, error) { | ||||||
|  | 	resData := &types.CommunityJoinResponse{} | ||||||
|  | 	res, err := c.req(ctx, "POST", "/community/join", 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) ModJoin(ctx context.Context, data types.ModJoin) (*types.ModJoinResponse, error) { | ||||||
|  | 	resData := &types.ModJoinResponse{} | ||||||
|  | 	res, err := c.req(ctx, "POST", "/community/mod/join", 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) StickyPost(ctx context.Context, data types.StickyPost) (*types.PostResponse, error) { | ||||||
|  | 	resData := &types.PostResponse{} | ||||||
|  | 	res, err := c.req(ctx, "POST", "/post/sticky", 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) PostJoin(ctx context.Context, data types.PostJoin) (*types.PostJoinResponse, error) { | ||||||
|  | 	resData := &types.PostJoinResponse{} | ||||||
|  | 	res, err := c.req(ctx, "POST", "/post/join", 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) ListPostReports(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) MarkCommentAsRead(ctx context.Context, data types.MarkCommentAsRead) (*types.CommentResponse, error) { | ||||||
|  | 	resData := &types.CommentResponse{} | ||||||
|  | 	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) 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) ListCommentReports(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) 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) 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 | ||||||
|  | } | ||||||
|  | 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) UserJoin(ctx context.Context, data types.UserJoin) (*types.UserJoinResponse, error) { | ||||||
|  | 	resData := &types.UserJoinResponse{} | ||||||
|  | 	res, err := c.req(ctx, "POST", "/user/join", 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 | ||||||
|  | } | ||||||
|  | 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) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	err = resError(res, resData.LemmyResponse) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	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) ListRegistrationApplications(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 | ||||||
|  | } | ||||||
|  | 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) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	err = resError(res, resData.LemmyResponse) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  | 	return resData, nil | ||||||
|  | } | ||||||
							
								
								
									
										23
									
								
								search.go
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								search.go
									
									
									
									
									
								
							| @@ -1,23 +0,0 @@ | |||||||
| package lemmy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"net/http" |  | ||||||
|  |  | ||||||
| 	"go.arsenm.dev/go-lemmy/types" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func (c *Client) Search(ctx context.Context, d types.Search) (*types.SearchResponse, error) { |  | ||||||
| 	ar := &types.SearchResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/search", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
							
								
								
									
										53
									
								
								site.go
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								site.go
									
									
									
									
									
								
							| @@ -1,53 +0,0 @@ | |||||||
| package lemmy |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"context" |  | ||||||
| 	"net/http" |  | ||||||
|  |  | ||||||
| 	"go.arsenm.dev/go-lemmy/types" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func (c *Client) CreateSite(ctx context.Context, d types.CreateSite) (*types.SiteResponse, error) { |  | ||||||
| 	ar := &types.SiteResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPost, "/site", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) EditSite(ctx context.Context, d types.EditSite) (*types.SiteResponse, error) { |  | ||||||
| 	ar := &types.SiteResponse{} |  | ||||||
| 	res, err := c.req(ctx, http.MethodPut, "/site", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (c *Client) Site(ctx context.Context, d types.GetSite) (*types.GetSiteResponse, error) { |  | ||||||
| 	ar := &types.GetSiteResponse{} |  | ||||||
| 	res, err := c.getReq(ctx, http.MethodGet, "/site", d, &ar) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	err = resError(res, ar.LemmyResponse) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return ar, nil |  | ||||||
| } |  | ||||||
							
								
								
									
										21
									
								
								types/activity.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								types/activity.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/activity.rs | ||||||
|  | // Code generated by go.arsenm.dev/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 Optional[bool] `json:"sensitive" url:"sensitive,omitempty"` | ||||||
|  | } | ||||||
|  | type ActivityForm 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 bool           `json:"sensitive" url:"sensitive,omitempty"` | ||||||
|  | } | ||||||
| @@ -1,55 +0,0 @@ | |||||||
| package types |  | ||||||
|  |  | ||||||
| type PersonAggregates struct { |  | ||||||
| 	ID           int `json:"id" url:"id,omitempty"` |  | ||||||
| 	PersonID     int `json:"person_id" url:"person_id,omitempty"` |  | ||||||
| 	PostCount    int `json:"post_count" url:"post_count,omitempty"` |  | ||||||
| 	PostScore    int `json:"post_score" url:"post_score,omitempty"` |  | ||||||
| 	CommentCount int `json:"comment_count" url:"comment_count,omitempty"` |  | ||||||
| 	CommentScore int `json:"comment_score" url:"comment_score,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type SiteAggregates struct { |  | ||||||
| 	ID                  int `json:"id" url:"id,omitempty"` |  | ||||||
| 	SiteID              int `json:"site_id" url:"site_id,omitempty"` |  | ||||||
| 	Users               int `json:"users" url:"users,omitempty"` |  | ||||||
| 	Posts               int `json:"posts" url:"posts,omitempty"` |  | ||||||
| 	Comments            int `json:"comments" url:"comments,omitempty"` |  | ||||||
| 	Communities         int `json:"communities" url:"communities,omitempty"` |  | ||||||
| 	UsersActiveDay      int `json:"users_active_day" url:"users_active_day,omitempty"` |  | ||||||
| 	UsersActiveWeek     int `json:"users_active_week" url:"users_active_week,omitempty"` |  | ||||||
| 	UsersActiveMonth    int `json:"users_active_month" url:"users_active_month,omitempty"` |  | ||||||
| 	UsersActiveHalfYear int `json:"users_active_half_year" url:"users_active_half_year,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PostAggregates struct { |  | ||||||
| 	ID                     int    `json:"id" url:"id,omitempty"` |  | ||||||
| 	PostID                 int    `json:"post_id" url:"post_id,omitempty"` |  | ||||||
| 	Comments               int    `json:"comments" url:"comments,omitempty"` |  | ||||||
| 	Score                  int    `json:"score" url:"score,omitempty"` |  | ||||||
| 	Upvotes                int    `json:"upvotes" url:"upvotes,omitempty"` |  | ||||||
| 	Downvotes              int    `json:"downvotes" url:"downvotes,omitempty"` |  | ||||||
| 	NewestCommentTimeNecro string `json:"newest_comment_time_necro" url:"newest_comment_time_necro,omitempty"` |  | ||||||
| 	NewestCommentTime      string `json:"newest_comment_time" url:"newest_comment_time,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunityAggregates struct { |  | ||||||
| 	ID                  int `json:"id" url:"id,omitempty"` |  | ||||||
| 	CommunityID         int `json:"community_id" url:"community_id,omitempty"` |  | ||||||
| 	Subscribers         int `json:"subscribers" url:"subscribers,omitempty"` |  | ||||||
| 	Posts               int `json:"posts" url:"posts,omitempty"` |  | ||||||
| 	Comments            int `json:"comments" url:"comments,omitempty"` |  | ||||||
| 	UsersActiveDay      int `json:"users_active_day" url:"users_active_day,omitempty"` |  | ||||||
| 	UsersActiveWeek     int `json:"users_active_week" url:"users_active_week,omitempty"` |  | ||||||
| 	UsersActiveMonth    int `json:"users_active_month" url:"users_active_month,omitempty"` |  | ||||||
| 	UsersActiveHalfYear int `json:"users_active_half_year" url:"users_active_half_year,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommentAggregates struct { |  | ||||||
| 	ID         int `json:"id" url:"id,omitempty"` |  | ||||||
| 	CommentID  int `json:"comment_id" url:"comment_id,omitempty"` |  | ||||||
| 	Score      int `json:"score" url:"score,omitempty"` |  | ||||||
| 	Upvotes    int `json:"upvotes" url:"upvotes,omitempty"` |  | ||||||
| 	Downvotes  int `json:"downvotes" url:"downvotes,omitempty"` |  | ||||||
| 	ChildCount int `json:"child_count" url:"child_count,omitempty"` |  | ||||||
| } |  | ||||||
							
								
								
									
										70
									
								
								types/comment.1.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								types/comment.1.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/comment.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | 	ParentID  Optional[int] `json:"parent_id" url:"parent_id,omitempty"` | ||||||
|  | 	Content   string        `json:"content" url:"content,omitempty"` | ||||||
|  | 	Removed   bool          `json:"removed" url:"removed,omitempty"` | ||||||
|  | 	Read      bool          `json:"read" url:"read,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"` | ||||||
|  | } | ||||||
|  | type CommentAlias1 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"` | ||||||
|  | 	ParentID  Optional[int] `json:"parent_id" url:"parent_id,omitempty"` | ||||||
|  | 	Content   string        `json:"content" url:"content,omitempty"` | ||||||
|  | 	Removed   bool          `json:"removed" url:"removed,omitempty"` | ||||||
|  | 	Read      bool          `json:"read" url:"read,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"` | ||||||
|  | } | ||||||
|  | type CommentForm 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"` | ||||||
|  | 	ParentID  Optional[int]    `json:"parent_id" url:"parent_id,omitempty"` | ||||||
|  | 	Removed   Optional[bool]   `json:"removed" url:"removed,omitempty"` | ||||||
|  | 	Read      Optional[bool]   `json:"read" url:"read,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"` | ||||||
|  | } | ||||||
|  | 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"` | ||||||
|  | } | ||||||
| @@ -1,104 +1,92 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/comment.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  | 
 | ||||||
| package types | package types | ||||||
| 
 | 
 | ||||||
| type CreateComment struct { | type CreateComment struct { | ||||||
| 	Content    string           `json:"content" url:"content,omitempty"` | 	Content  string           `json:"content" url:"content,omitempty"` | ||||||
| 	PostID     int              `json:"post_id" url:"post_id,omitempty"` | 	PostID   int              `json:"post_id" url:"post_id,omitempty"` | ||||||
| 	ParentID   Optional[int]    `json:"parent_id" url:"parent_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"` | ||||||
| 	FormID     Optional[string] `json:"form_id" url:"form_id,omitempty"` | 	Auth     string           `json:"auth" url:"auth,omitempty"` | ||||||
| 	Auth       string           `json:"auth" url:"auth,omitempty"` |  | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetComment struct { | type GetComment struct { | ||||||
| 	ID   int              `json:"id" url:"id,omitempty"` | 	ID   int              `json:"id" url:"id,omitempty"` | ||||||
| 	Auth Optional[string] `json:"auth" url:"auth,omitempty"` | 	Auth Optional[string] `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type EditComment struct { | type EditComment struct { | ||||||
| 	CommentID     int              `json:"comment_id" url:"comment_id,omitempty"` | 	Content   string           `json:"content" url:"content,omitempty"` | ||||||
| 	Content       Optional[string] `json:"content" url:"content,omitempty"` | 	CommentID int              `json:"comment_id" url:"comment_id,omitempty"` | ||||||
| 	Distinguished Optional[bool]   `json:"distinguished" url:"distinguished,omitempty"` | 	FormID    Optional[string] `json:"form_id" url:"form_id,omitempty"` | ||||||
| 	LanguageID    Optional[int]    `json:"language_id" url:"language_id,omitempty"` | 	Auth      string           `json:"auth" url:"auth,omitempty"` | ||||||
| 	FormID        Optional[string] `json:"form_id" url:"form_id,omitempty"` |  | ||||||
| 	Auth          string           `json:"auth" url:"auth,omitempty"` |  | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type DeleteComment struct { | type DeleteComment struct { | ||||||
| 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | ||||||
| 	Deleted   bool   `json:"deleted" url:"deleted,omitempty"` | 	Deleted   bool   `json:"deleted" url:"deleted,omitempty"` | ||||||
| 	Auth      string `json:"auth" url:"auth,omitempty"` | 	Auth      string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type RemoveComment struct { | type RemoveComment struct { | ||||||
| 	CommentID int              `json:"comment_id" url:"comment_id,omitempty"` | 	CommentID int              `json:"comment_id" url:"comment_id,omitempty"` | ||||||
| 	Removed   bool             `json:"removed" url:"removed,omitempty"` | 	Removed   bool             `json:"removed" url:"removed,omitempty"` | ||||||
| 	Reason    Optional[string] `json:"reason" url:"reason,omitempty"` | 	Reason    Optional[string] `json:"reason" url:"reason,omitempty"` | ||||||
| 	Auth      string           `json:"auth" url:"auth,omitempty"` | 	Auth      string           `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 | type MarkCommentAsRead struct { | ||||||
|  | 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | ||||||
|  | 	Read      bool   `json:"read" url:"read,omitempty"` | ||||||
|  | 	Auth      string `json:"auth" url:"auth,omitempty"` | ||||||
|  | } | ||||||
| type SaveComment struct { | type SaveComment struct { | ||||||
| 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | ||||||
| 	Save      bool   `json:"save" url:"save,omitempty"` | 	Save      bool   `json:"save" url:"save,omitempty"` | ||||||
| 	Auth      string `json:"auth" url:"auth,omitempty"` | 	Auth      string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type CommentResponse struct { | type CommentResponse struct { | ||||||
| 	CommentView  CommentView      `json:"comment_view" url:"comment_view,omitempty"` | 	CommentView  CommentView      `json:"comment_view" url:"comment_view,omitempty"` | ||||||
| 	RecipientIDs []int            `json:"recipient_i_ds" url:"recipient_i_ds,omitempty"` | 	RecipientIds []int            `json:"recipient_ids" url:"recipient_ids,omitempty"` | ||||||
| 	FormID       Optional[string] `json:"form_id" url:"form_id,omitempty"` | 	FormID       Optional[string] `json:"form_id" url:"form_id,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type CreateCommentLike struct { | type CreateCommentLike struct { | ||||||
| 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | ||||||
| 	Score     int16  `json:"score" url:"score,omitempty"` | 	Score     int16  `json:"score" url:"score,omitempty"` | ||||||
| 	Auth      string `json:"auth" url:"auth,omitempty"` | 	Auth      string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetComments struct { | type GetComments struct { | ||||||
| 	Type          Optional[ListingType]     `json:"type" url:"type,omitempty"` | 	Type          Optional[ListingType] `json:"type_" url:"type_,omitempty"` | ||||||
| 	Sort          Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` | 	Sort          Optional[SortType]    `json:"sort" url:"sort,omitempty"` | ||||||
| 	MaxDepth      Optional[int]             `json:"max_depth" url:"max_depth,omitempty"` | 	Page          Optional[int64]       `json:"page" url:"page,omitempty"` | ||||||
| 	Page          Optional[int]             `json:"page" url:"page,omitempty"` | 	Limit         Optional[int64]       `json:"limit" url:"limit,omitempty"` | ||||||
| 	Limit         Optional[int]             `json:"limit" url:"limit,omitempty"` | 	CommunityID   Optional[int]         `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	CommunityID   Optional[int]             `json:"community_id" url:"community_id,omitempty"` | 	CommunityName Optional[string]      `json:"community_name" url:"community_name,omitempty"` | ||||||
| 	CommunityName Optional[string]          `json:"community_name" url:"community_name,omitempty"` | 	SavedOnly     Optional[bool]        `json:"saved_only" url:"saved_only,omitempty"` | ||||||
| 	PostID        Optional[int]             `json:"post_id" url:"post_id,omitempty"` | 	Auth          Optional[string]      `json:"auth" url:"auth,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 { | type GetCommentsResponse struct { | ||||||
| 	Comments []CommentView `json:"comments" url:"comments,omitempty"` | 	Comments []CommentView `json:"comments" url:"comments,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type CreateCommentReport struct { | type CreateCommentReport struct { | ||||||
| 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | 	CommentID int    `json:"comment_id" url:"comment_id,omitempty"` | ||||||
| 	Reason    string `json:"reason" url:"reason,omitempty"` | 	Reason    string `json:"reason" url:"reason,omitempty"` | ||||||
| 	Auth      string `json:"auth" url:"auth,omitempty"` | 	Auth      string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type CommentReportResponse struct { | type CommentReportResponse struct { | ||||||
| 	CommentReportView CommentReportView `json:"comment_report_view" url:"comment_report_view,omitempty"` | 	CommentReportView CommentReportView `json:"comment_report_view" url:"comment_report_view,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type ResolveCommentReport struct { | type ResolveCommentReport struct { | ||||||
| 	ReportID int    `json:"report_id" url:"report_id,omitempty"` | 	ReportID int    `json:"report_id" url:"report_id,omitempty"` | ||||||
| 	Resolved bool   `json:"resolved" url:"resolved,omitempty"` | 	Resolved bool   `json:"resolved" url:"resolved,omitempty"` | ||||||
| 	Auth     string `json:"auth" url:"auth,omitempty"` | 	Auth     string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type ListCommentReports struct { | type ListCommentReports struct { | ||||||
| 	Page           Optional[int]  `json:"page" url:"page,omitempty"` | 	Page           Optional[int64] `json:"page" url:"page,omitempty"` | ||||||
| 	Limit          Optional[int]  `json:"limit" url:"limit,omitempty"` | 	Limit          Optional[int64] `json:"limit" url:"limit,omitempty"` | ||||||
| 	UnresolvedOnly Optional[bool] `json:"unresolved_only" url:"unresolved_only,omitempty"` | 	UnresolvedOnly Optional[bool]  `json:"unresolved_only" url:"unresolved_only,omitempty"` | ||||||
| 	CommunityID    Optional[int]  `json:"community_id" url:"community_id,omitempty"` | 	CommunityID    Optional[int]   `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	Auth           string         `json:"auth" url:"auth,omitempty"` | 	Auth           string          `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type ListCommentReportsResponse struct { | type ListCommentReportsResponse struct { | ||||||
| 	CommentReports []CommentReportView `json:"comment_reports" url:"comment_reports,omitempty"` | 	CommentReports []CommentReportView `json:"comment_reports" url:"comment_reports,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
							
								
								
									
										22
									
								
								types/comment_report.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								types/comment_report.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/comment_report.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
							
								
								
									
										101
									
								
								types/community.1.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								types/community.1.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,101 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/community.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
|  | type CommunitySafe 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"` | ||||||
|  | 	Icon                    Optional[string] `json:"icon" url:"icon,omitempty"` | ||||||
|  | 	Banner                  Optional[string] `json:"banner" url:"banner,omitempty"` | ||||||
|  | 	Hidden                  bool             `json:"hidden" url:"hidden,omitempty"` | ||||||
|  | 	PostingRestrictedToMods bool             `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` | ||||||
|  | } | ||||||
|  | type CommunityForm 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[Optional[string]] `json:"private_key" url:"private_key,omitempty"` | ||||||
|  | 	PublicKey               Optional[string]           `json:"public_key" url:"public_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"` | ||||||
|  | 	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     Optional[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"` | ||||||
|  | } | ||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/community.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  | 
 | ||||||
| package types | package types | ||||||
| 
 | 
 | ||||||
| type GetCommunity struct { | type GetCommunity struct { | ||||||
| @@ -5,17 +8,13 @@ type GetCommunity struct { | |||||||
| 	Name Optional[string] `json:"name" url:"name,omitempty"` | 	Name Optional[string] `json:"name" url:"name,omitempty"` | ||||||
| 	Auth Optional[string] `json:"auth" url:"auth,omitempty"` | 	Auth Optional[string] `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetCommunityResponse struct { | type GetCommunityResponse struct { | ||||||
| 	CommunityView       CommunityView            `json:"community_view" url:"community_view,omitempty"` | 	CommunityView CommunityView            `json:"community_view" url:"community_view,omitempty"` | ||||||
| 	Site                Optional[Site]           `json:"site" url:"site,omitempty"` | 	Site          Optional[Site]           `json:"site" url:"site,omitempty"` | ||||||
| 	Moderators          []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` | 	Moderators    []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` | ||||||
| 	Online              uint                     `json:"online" url:"online,omitempty"` | 	Online        uint                     `json:"online" url:"online,omitempty"` | ||||||
| 	DiscussionLanguages []int                    `json:"discussion_languages" url:"discussion_languages,omitempty"` |  | ||||||
| 	DefaultPostLanguage Optional[int]            `json:"default_post_language" url:"default_post_language,omitempty"` |  | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type CreateCommunity struct { | type CreateCommunity struct { | ||||||
| 	Name                    string           `json:"name" url:"name,omitempty"` | 	Name                    string           `json:"name" url:"name,omitempty"` | ||||||
| 	Title                   string           `json:"title" url:"title,omitempty"` | 	Title                   string           `json:"title" url:"title,omitempty"` | ||||||
| @@ -26,25 +25,21 @@ type CreateCommunity struct { | |||||||
| 	PostingRestrictedToMods Optional[bool]   `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` | 	PostingRestrictedToMods Optional[bool]   `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"` | ||||||
| 	Auth                    string           `json:"auth" url:"auth,omitempty"` | 	Auth                    string           `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type CommunityResponse struct { | type CommunityResponse struct { | ||||||
| 	CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` | 	CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type ListCommunities struct { | type ListCommunities struct { | ||||||
| 	Type  Optional[ListingType] `json:"type" url:"type,omitempty"` | 	Type  Optional[ListingType] `json:"type_" url:"type_,omitempty"` | ||||||
| 	Sort  Optional[SortType]    `json:"sort" url:"sort,omitempty"` | 	Sort  Optional[SortType]    `json:"sort" url:"sort,omitempty"` | ||||||
| 	Page  Optional[int64]       `json:"page" url:"page,omitempty"` | 	Page  Optional[int64]       `json:"page" url:"page,omitempty"` | ||||||
| 	Limit Optional[int64]       `json:"limit" url:"limit,omitempty"` | 	Limit Optional[int64]       `json:"limit" url:"limit,omitempty"` | ||||||
| 	Auth  Optional[string]      `json:"auth" url:"auth,omitempty"` | 	Auth  Optional[string]      `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type ListCommunitiesResponse struct { | type ListCommunitiesResponse struct { | ||||||
| 	Communities []CommunityView `json:"communities" url:"communities,omitempty"` | 	Communities []CommunityView `json:"communities" url:"communities,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type BanFromCommunity struct { | type BanFromCommunity struct { | ||||||
| 	CommunityID int              `json:"community_id" url:"community_id,omitempty"` | 	CommunityID int              `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	PersonID    int              `json:"person_id" url:"person_id,omitempty"` | 	PersonID    int              `json:"person_id" url:"person_id,omitempty"` | ||||||
| @@ -54,25 +49,21 @@ type BanFromCommunity struct { | |||||||
| 	Expires     Optional[int64]  `json:"expires" url:"expires,omitempty"` | 	Expires     Optional[int64]  `json:"expires" url:"expires,omitempty"` | ||||||
| 	Auth        string           `json:"auth" url:"auth,omitempty"` | 	Auth        string           `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type BanFromCommunityResponse struct { | type BanFromCommunityResponse struct { | ||||||
| 	PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` | 	PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` | ||||||
| 	Banned     bool           `json:"banned" url:"banned,omitempty"` | 	Banned     bool           `json:"banned" url:"banned,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type AddModToCommunity struct { | type AddModToCommunity struct { | ||||||
| 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	PersonID    int    `json:"person_id" url:"person_id,omitempty"` | 	PersonID    int    `json:"person_id" url:"person_id,omitempty"` | ||||||
| 	Added       bool   `json:"added" url:"added,omitempty"` | 	Added       bool   `json:"added" url:"added,omitempty"` | ||||||
| 	Auth        string `json:"auth" url:"auth,omitempty"` | 	Auth        string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type AddModToCommunityResponse struct { | type AddModToCommunityResponse struct { | ||||||
| 	Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` | 	Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type EditCommunity struct { | type EditCommunity struct { | ||||||
| 	CommunityID             int              `json:"community_id" url:"community_id,omitempty"` | 	CommunityID             int              `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	Title                   Optional[string] `json:"title" url:"title,omitempty"` | 	Title                   Optional[string] `json:"title" url:"title,omitempty"` | ||||||
| @@ -81,23 +72,19 @@ type EditCommunity struct { | |||||||
| 	Banner                  Optional[string] `json:"banner" url:"banner,omitempty"` | 	Banner                  Optional[string] `json:"banner" url:"banner,omitempty"` | ||||||
| 	NSFW                    Optional[bool]   `json:"nsfw" url:"nsfw,omitempty"` | 	NSFW                    Optional[bool]   `json:"nsfw" url:"nsfw,omitempty"` | ||||||
| 	PostingRestrictedToMods Optional[bool]   `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,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"` | 	Auth                    string           `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type HideCommunity struct { | type HideCommunity struct { | ||||||
| 	CommunityID int              `json:"community_id" url:"community_id,omitempty"` | 	CommunityID int              `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	Hidden      bool             `json:"hidden" url:"hidden,omitempty"` | 	Hidden      bool             `json:"hidden" url:"hidden,omitempty"` | ||||||
| 	Reason      Optional[string] `json:"reason" url:"reason,omitempty"` | 	Reason      Optional[string] `json:"reason" url:"reason,omitempty"` | ||||||
| 	Auth        string           `json:"auth" url:"auth,omitempty"` | 	Auth        string           `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type DeleteCommunity struct { | type DeleteCommunity struct { | ||||||
| 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	Deleted     bool   `json:"deleted" url:"deleted,omitempty"` | 	Deleted     bool   `json:"deleted" url:"deleted,omitempty"` | ||||||
| 	Auth        string `json:"auth" url:"auth,omitempty"` | 	Auth        string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type RemoveCommunity struct { | type RemoveCommunity struct { | ||||||
| 	CommunityID int              `json:"community_id" url:"community_id,omitempty"` | 	CommunityID int              `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	Removed     bool             `json:"removed" url:"removed,omitempty"` | 	Removed     bool             `json:"removed" url:"removed,omitempty"` | ||||||
| @@ -105,25 +92,21 @@ type RemoveCommunity struct { | |||||||
| 	Expires     Optional[int64]  `json:"expires" url:"expires,omitempty"` | 	Expires     Optional[int64]  `json:"expires" url:"expires,omitempty"` | ||||||
| 	Auth        string           `json:"auth" url:"auth,omitempty"` | 	Auth        string           `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type FollowCommunity struct { | type FollowCommunity struct { | ||||||
| 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	Follow      bool   `json:"follow" url:"follow,omitempty"` | 	Follow      bool   `json:"follow" url:"follow,omitempty"` | ||||||
| 	Auth        string `json:"auth" url:"auth,omitempty"` | 	Auth        string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type BlockCommunity struct { | type BlockCommunity struct { | ||||||
| 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	Block       bool   `json:"block" url:"block,omitempty"` | 	Block       bool   `json:"block" url:"block,omitempty"` | ||||||
| 	Auth        string `json:"auth" url:"auth,omitempty"` | 	Auth        string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type BlockCommunityResponse struct { | type BlockCommunityResponse struct { | ||||||
| 	CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` | 	CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` | ||||||
| 	Blocked       bool          `json:"blocked" url:"blocked,omitempty"` | 	Blocked       bool          `json:"blocked" url:"blocked,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type TransferCommunity struct { | type TransferCommunity struct { | ||||||
| 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | 	CommunityID int    `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	PersonID    int    `json:"person_id" url:"person_id,omitempty"` | 	PersonID    int    `json:"person_id" url:"person_id,omitempty"` | ||||||
							
								
								
									
										15
									
								
								types/community_block.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								types/community_block.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/community_block.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								types/email_verification.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								types/email_verification.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/email_verification.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
							
								
								
									
										39
									
								
								types/lib.1.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								types/lib.1.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/lib.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
|  |  | ||||||
|  | type SortType string | ||||||
|  |  | ||||||
|  | const ( | ||||||
|  | 	SortTypeActive       SortType = "Active" | ||||||
|  | 	SortTypeHot          SortType = "Hot" | ||||||
|  | 	SortTypeNew          SortType = "New" | ||||||
|  | 	SortTypeTopDay       SortType = "TopDay" | ||||||
|  | 	SortTypeTopWeek      SortType = "TopWeek" | ||||||
|  | 	SortTypeTopMonth     SortType = "TopMonth" | ||||||
|  | 	SortTypeTopYear      SortType = "TopYear" | ||||||
|  | 	SortTypeTopAll       SortType = "TopAll" | ||||||
|  | 	SortTypeMostComments SortType = "MostComments" | ||||||
|  | 	SortTypeNewComments  SortType = "NewComments" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | type ListingType string | ||||||
|  |  | ||||||
|  | const ( | ||||||
|  | 	ListingTypeAll        ListingType = "All" | ||||||
|  | 	ListingTypeLocal      ListingType = "Local" | ||||||
|  | 	ListingTypeSubscribed ListingType = "Subscribed" | ||||||
|  | 	ListingTypeCommunity  ListingType = "Community" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | type SearchType string | ||||||
|  |  | ||||||
|  | const ( | ||||||
|  | 	SearchTypeAll         SearchType = "All" | ||||||
|  | 	SearchTypeComments    SearchType = "Comments" | ||||||
|  | 	SearchTypePosts       SearchType = "Posts" | ||||||
|  | 	SearchTypeCommunities SearchType = "Communities" | ||||||
|  | 	SearchTypeUsers       SearchType = "Users" | ||||||
|  | 	SearchTypeUrl         SearchType = "Url" | ||||||
|  | ) | ||||||
							
								
								
									
										93
									
								
								types/lib.2.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								types/lib.2.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,93 @@ | |||||||
|  | //  Source: lemmy/crates/websocket/src/lib.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
|  |  | ||||||
|  | type UserOperation string | ||||||
|  |  | ||||||
|  | const ( | ||||||
|  | 	UserOperationLogin                                 UserOperation = "Login" | ||||||
|  | 	UserOperationGetCaptcha                            UserOperation = "GetCaptcha" | ||||||
|  | 	UserOperationMarkCommentAsRead                     UserOperation = "MarkCommentAsRead" | ||||||
|  | 	UserOperationSaveComment                           UserOperation = "SaveComment" | ||||||
|  | 	UserOperationCreateCommentLike                     UserOperation = "CreateCommentLike" | ||||||
|  | 	UserOperationCreateCommentReport                   UserOperation = "CreateCommentReport" | ||||||
|  | 	UserOperationResolveCommentReport                  UserOperation = "ResolveCommentReport" | ||||||
|  | 	UserOperationListCommentReports                    UserOperation = "ListCommentReports" | ||||||
|  | 	UserOperationCreatePostLike                        UserOperation = "CreatePostLike" | ||||||
|  | 	UserOperationLockPost                              UserOperation = "LockPost" | ||||||
|  | 	UserOperationStickyPost                            UserOperation = "StickyPost" | ||||||
|  | 	UserOperationMarkPostAsRead                        UserOperation = "MarkPostAsRead" | ||||||
|  | 	UserOperationSavePost                              UserOperation = "SavePost" | ||||||
|  | 	UserOperationCreatePostReport                      UserOperation = "CreatePostReport" | ||||||
|  | 	UserOperationResolvePostReport                     UserOperation = "ResolvePostReport" | ||||||
|  | 	UserOperationListPostReports                       UserOperation = "ListPostReports" | ||||||
|  | 	UserOperationGetReportCount                        UserOperation = "GetReportCount" | ||||||
|  | 	UserOperationGetUnreadCount                        UserOperation = "GetUnreadCount" | ||||||
|  | 	UserOperationVerifyEmail                           UserOperation = "VerifyEmail" | ||||||
|  | 	UserOperationFollowCommunity                       UserOperation = "FollowCommunity" | ||||||
|  | 	UserOperationGetReplies                            UserOperation = "GetReplies" | ||||||
|  | 	UserOperationGetPersonMentions                     UserOperation = "GetPersonMentions" | ||||||
|  | 	UserOperationMarkPersonMentionAsRead               UserOperation = "MarkPersonMentionAsRead" | ||||||
|  | 	UserOperationGetModlog                             UserOperation = "GetModlog" | ||||||
|  | 	UserOperationBanFromCommunity                      UserOperation = "BanFromCommunity" | ||||||
|  | 	UserOperationAddModToCommunity                     UserOperation = "AddModToCommunity" | ||||||
|  | 	UserOperationAddAdmin                              UserOperation = "AddAdmin" | ||||||
|  | 	UserOperationGetUnreadRegistrationApplicationCount UserOperation = "GetUnreadRegistrationApplicationCount" | ||||||
|  | 	UserOperationListRegistrationApplications          UserOperation = "ListRegistrationApplications" | ||||||
|  | 	UserOperationApproveRegistrationApplication        UserOperation = "ApproveRegistrationApplication" | ||||||
|  | 	UserOperationBanPerson                             UserOperation = "BanPerson" | ||||||
|  | 	UserOperationGetBannedPersons                      UserOperation = "GetBannedPersons" | ||||||
|  | 	UserOperationSearch                                UserOperation = "Search" | ||||||
|  | 	UserOperationResolveObject                         UserOperation = "ResolveObject" | ||||||
|  | 	UserOperationMarkAllAsRead                         UserOperation = "MarkAllAsRead" | ||||||
|  | 	UserOperationSaveUserSettings                      UserOperation = "SaveUserSettings" | ||||||
|  | 	UserOperationTransferCommunity                     UserOperation = "TransferCommunity" | ||||||
|  | 	UserOperationLeaveAdmin                            UserOperation = "LeaveAdmin" | ||||||
|  | 	UserOperationPasswordReset                         UserOperation = "PasswordReset" | ||||||
|  | 	UserOperationPasswordChange                        UserOperation = "PasswordChange" | ||||||
|  | 	UserOperationMarkPrivateMessageAsRead              UserOperation = "MarkPrivateMessageAsRead" | ||||||
|  | 	UserOperationUserJoin                              UserOperation = "UserJoin" | ||||||
|  | 	UserOperationGetSiteConfig                         UserOperation = "GetSiteConfig" | ||||||
|  | 	UserOperationSaveSiteConfig                        UserOperation = "SaveSiteConfig" | ||||||
|  | 	UserOperationPostJoin                              UserOperation = "PostJoin" | ||||||
|  | 	UserOperationCommunityJoin                         UserOperation = "CommunityJoin" | ||||||
|  | 	UserOperationModJoin                               UserOperation = "ModJoin" | ||||||
|  | 	UserOperationChangePassword                        UserOperation = "ChangePassword" | ||||||
|  | 	UserOperationGetSiteMetadata                       UserOperation = "GetSiteMetadata" | ||||||
|  | 	UserOperationBlockCommunity                        UserOperation = "BlockCommunity" | ||||||
|  | 	UserOperationBlockPerson                           UserOperation = "BlockPerson" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | type UserOperationCRUD string | ||||||
|  |  | ||||||
|  | const ( | ||||||
|  | 	UserOperationCRUDCreateSite           UserOperationCRUD = "CreateSite" | ||||||
|  | 	UserOperationCRUDGetSite              UserOperationCRUD = "GetSite" | ||||||
|  | 	UserOperationCRUDEditSite             UserOperationCRUD = "EditSite" | ||||||
|  | 	UserOperationCRUDCreateCommunity      UserOperationCRUD = "CreateCommunity" | ||||||
|  | 	UserOperationCRUDListCommunities      UserOperationCRUD = "ListCommunities" | ||||||
|  | 	UserOperationCRUDGetCommunity         UserOperationCRUD = "GetCommunity" | ||||||
|  | 	UserOperationCRUDEditCommunity        UserOperationCRUD = "EditCommunity" | ||||||
|  | 	UserOperationCRUDDeleteCommunity      UserOperationCRUD = "DeleteCommunity" | ||||||
|  | 	UserOperationCRUDRemoveCommunity      UserOperationCRUD = "RemoveCommunity" | ||||||
|  | 	UserOperationCRUDCreatePost           UserOperationCRUD = "CreatePost" | ||||||
|  | 	UserOperationCRUDGetPost              UserOperationCRUD = "GetPost" | ||||||
|  | 	UserOperationCRUDGetPosts             UserOperationCRUD = "GetPosts" | ||||||
|  | 	UserOperationCRUDEditPost             UserOperationCRUD = "EditPost" | ||||||
|  | 	UserOperationCRUDDeletePost           UserOperationCRUD = "DeletePost" | ||||||
|  | 	UserOperationCRUDRemovePost           UserOperationCRUD = "RemovePost" | ||||||
|  | 	UserOperationCRUDCreateComment        UserOperationCRUD = "CreateComment" | ||||||
|  | 	UserOperationCRUDGetComment           UserOperationCRUD = "GetComment" | ||||||
|  | 	UserOperationCRUDGetComments          UserOperationCRUD = "GetComments" | ||||||
|  | 	UserOperationCRUDEditComment          UserOperationCRUD = "EditComment" | ||||||
|  | 	UserOperationCRUDDeleteComment        UserOperationCRUD = "DeleteComment" | ||||||
|  | 	UserOperationCRUDRemoveComment        UserOperationCRUD = "RemoveComment" | ||||||
|  | 	UserOperationCRUDRegister             UserOperationCRUD = "Register" | ||||||
|  | 	UserOperationCRUDGetPersonDetails     UserOperationCRUD = "GetPersonDetails" | ||||||
|  | 	UserOperationCRUDDeleteAccount        UserOperationCRUD = "DeleteAccount" | ||||||
|  | 	UserOperationCRUDCreatePrivateMessage UserOperationCRUD = "CreatePrivateMessage" | ||||||
|  | 	UserOperationCRUDGetPrivateMessages   UserOperationCRUD = "GetPrivateMessages" | ||||||
|  | 	UserOperationCRUDEditPrivateMessage   UserOperationCRUD = "EditPrivateMessage" | ||||||
|  | 	UserOperationCRUDDeletePrivateMessage UserOperationCRUD = "DeletePrivateMessage" | ||||||
|  | ) | ||||||
							
								
								
									
										4
									
								
								types/lib.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								types/lib.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/lib.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
							
								
								
									
										62
									
								
								types/local_user.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								types/local_user.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/local_user.rs | ||||||
|  | // Code generated by go.arsenm.dev/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          int16            `json:"default_sort_type" url:"default_sort_type,omitempty"` | ||||||
|  | 	DefaultListingType       int16            `json:"default_listing_type" url:"default_listing_type,omitempty"` | ||||||
|  | 	Lang                     string           `json:"lang" url:"lang,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"` | ||||||
|  | 	ShowBotAccounts          bool             `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` | ||||||
|  | 	ShowScores               bool             `json:"show_scores" url:"show_scores,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"` | ||||||
|  | } | ||||||
|  | type LocalUserForm struct { | ||||||
|  | 	PersonID                 Optional[int]              `json:"person_id" url:"person_id,omitempty"` | ||||||
|  | 	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[int16]            `json:"default_sort_type" url:"default_sort_type,omitempty"` | ||||||
|  | 	DefaultListingType       Optional[int16]            `json:"default_listing_type" url:"default_listing_type,omitempty"` | ||||||
|  | 	Lang                     Optional[string]           `json:"lang" url:"lang,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"` | ||||||
|  | } | ||||||
|  | type LocalUserSettings struct { | ||||||
|  | 	ID                       int              `json:"id" url:"id,omitempty"` | ||||||
|  | 	PersonID                 int              `json:"person_id" url:"person_id,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          int16            `json:"default_sort_type" url:"default_sort_type,omitempty"` | ||||||
|  | 	DefaultListingType       int16            `json:"default_listing_type" url:"default_listing_type,omitempty"` | ||||||
|  | 	Lang                     string           `json:"lang" url:"lang,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"` | ||||||
|  | 	ShowBotAccounts          bool             `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` | ||||||
|  | 	ShowScores               bool             `json:"show_scores" url:"show_scores,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"` | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								types/mod.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								types/mod.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/mod.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
							
								
								
									
										161
									
								
								types/moderator.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								types/moderator.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,161 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/moderator.rs | ||||||
|  | // Code generated by go.arsenm.dev/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     Optional[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      Optional[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 ModStickyPost 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"` | ||||||
|  | 	Stickied    Optional[bool] `json:"stickied" url:"stickied,omitempty"` | ||||||
|  | 	When        LemmyTime      `json:"when_" url:"when_,omitempty"` | ||||||
|  | } | ||||||
|  | type ModStickyPostForm struct { | ||||||
|  | 	ModPersonID int            `json:"mod_person_id" url:"mod_person_id,omitempty"` | ||||||
|  | 	PostID      int            `json:"post_id" url:"post_id,omitempty"` | ||||||
|  | 	Stickied    Optional[bool] `json:"stickied" url:"stickied,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     Optional[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     Optional[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        Optional[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        Optional[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"` | ||||||
|  | 	Reason      Optional[string] `json:"reason" url:"reason,omitempty"` | ||||||
|  | 	Hidden      Optional[bool]   `json:"hidden" url:"hidden,omitempty"` | ||||||
|  | 	When        LemmyTime        `json:"when_" url:"when_,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       Optional[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"` | ||||||
|  | 	Removed       Optional[bool] `json:"removed" url:"removed,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"` | ||||||
|  | 	Removed       Optional[bool] `json:"removed" url:"removed,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       Optional[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"` | ||||||
|  | } | ||||||
							
								
								
									
										162
									
								
								types/others.go
									
									
									
									
									
								
							
							
						
						
									
										162
									
								
								types/others.go
									
									
									
									
									
								
							| @@ -1,162 +0,0 @@ | |||||||
| package types |  | ||||||
|  |  | ||||||
| type UserOperation string |  | ||||||
|  |  | ||||||
| const ( |  | ||||||
| 	UserOpLogin                                 UserOperation = "Login" |  | ||||||
| 	UserOpRegister                              UserOperation = "Register" |  | ||||||
| 	UserOpGetCaptcha                            UserOperation = "GetCaptcha" |  | ||||||
| 	UserOpCreateCommunity                       UserOperation = "CreateCommunity" |  | ||||||
| 	UserOpCreatePost                            UserOperation = "CreatePost" |  | ||||||
| 	UserOpListCommunities                       UserOperation = "ListCommunities" |  | ||||||
| 	UserOpGetPost                               UserOperation = "GetPost" |  | ||||||
| 	UserOpGetCommunity                          UserOperation = "GetCommunity" |  | ||||||
| 	UserOpCreateComment                         UserOperation = "CreateComment" |  | ||||||
| 	UserOpEditComment                           UserOperation = "EditComment" |  | ||||||
| 	UserOpDeleteComment                         UserOperation = "DeleteComment" |  | ||||||
| 	UserOpRemoveComment                         UserOperation = "RemoveComment" |  | ||||||
| 	UserOpSaveComment                           UserOperation = "SaveComment" |  | ||||||
| 	UserOpCreateCommentLike                     UserOperation = "CreateCommentLike" |  | ||||||
| 	UserOpGetPosts                              UserOperation = "GetPosts" |  | ||||||
| 	UserOpCreatePostLike                        UserOperation = "CreatePostLike" |  | ||||||
| 	UserOpEditPost                              UserOperation = "EditPost" |  | ||||||
| 	UserOpDeletePost                            UserOperation = "DeletePost" |  | ||||||
| 	UserOpRemovePost                            UserOperation = "RemovePost" |  | ||||||
| 	UserOpLockPost                              UserOperation = "LockPost" |  | ||||||
| 	UserOpFeaturePost                           UserOperation = "FeaturePost" |  | ||||||
| 	UserOpMarkPostAsRead                        UserOperation = "MarkPostAsRead" |  | ||||||
| 	UserOpSavePost                              UserOperation = "SavePost" |  | ||||||
| 	UserOpEditCommunity                         UserOperation = "EditCommunity" |  | ||||||
| 	UserOpDeleteCommunity                       UserOperation = "DeleteCommunity" |  | ||||||
| 	UserOpRemoveCommunity                       UserOperation = "RemoveCommunity" |  | ||||||
| 	UserOpFollowCommunity                       UserOperation = "FollowCommunity" |  | ||||||
| 	UserOpGetPersonDetails                      UserOperation = "GetPersonDetails" |  | ||||||
| 	UserOpGetReplies                            UserOperation = "GetReplies" |  | ||||||
| 	UserOpGetPersonMentions                     UserOperation = "GetPersonMentions" |  | ||||||
| 	UserOpMarkPersonMentionAsRead               UserOperation = "MarkPersonMentionAsRead" |  | ||||||
| 	UserOpMarkCommentReplyAsRead                UserOperation = "MarkCommentReplyAsRead" |  | ||||||
| 	UserOpGetModlog                             UserOperation = "GetModlog" |  | ||||||
| 	UserOpBanFromCommunity                      UserOperation = "BanFromCommunity" |  | ||||||
| 	UserOpAddModToCommunity                     UserOperation = "AddModToCommunity" |  | ||||||
| 	UserOpCreateSite                            UserOperation = "CreateSite" |  | ||||||
| 	UserOpEditSite                              UserOperation = "EditSite" |  | ||||||
| 	UserOpGetSite                               UserOperation = "GetSite" |  | ||||||
| 	UserOpAddAdmin                              UserOperation = "AddAdmin" |  | ||||||
| 	UserOpGetUnreadRegistrationApplicationCount UserOperation = "GetUnreadRegistrationApplicationCount" |  | ||||||
| 	UserOpListRegistrationApplications          UserOperation = "ListRegistrationApplications" |  | ||||||
| 	UserOpApproveRegistrationApplication        UserOperation = "ApproveRegistrationApplication" |  | ||||||
| 	UserOpBanPerson                             UserOperation = "BanPerson" |  | ||||||
| 	UserOpGetBannedPersons                      UserOperation = "GetBannedPersons" |  | ||||||
| 	UserOpSearch                                UserOperation = "Search" |  | ||||||
| 	UserOpResolveObject                         UserOperation = "ResolveObject" |  | ||||||
| 	UserOpMarkAllAsRead                         UserOperation = "MarkAllAsRead" |  | ||||||
| 	UserOpSaveUserSettings                      UserOperation = "SaveUserSettings" |  | ||||||
| 	UserOpTransferCommunity                     UserOperation = "TransferCommunity" |  | ||||||
| 	UserOpLeaveAdmin                            UserOperation = "LeaveAdmin" |  | ||||||
| 	UserOpDeleteAccount                         UserOperation = "DeleteAccount" |  | ||||||
| 	UserOpPasswordReset                         UserOperation = "PasswordReset" |  | ||||||
| 	UserOpPasswordChange                        UserOperation = "PasswordChange" |  | ||||||
| 	UserOpCreatePrivateMessage                  UserOperation = "CreatePrivateMessage" |  | ||||||
| 	UserOpEditPrivateMessage                    UserOperation = "EditPrivateMessage" |  | ||||||
| 	UserOpDeletePrivateMessage                  UserOperation = "DeletePrivateMessage" |  | ||||||
| 	UserOpMarkPrivateMessageAsRead              UserOperation = "MarkPrivateMessageAsRead" |  | ||||||
| 	UserOpCreatePrivateMessageReport            UserOperation = "CreatePrivateMessageReport" |  | ||||||
| 	UserOpResolvePrivateMessageReport           UserOperation = "ResolvePrivateMessageReport" |  | ||||||
| 	UserOpListPrivateMessageReports             UserOperation = "ListPrivateMessageReports" |  | ||||||
| 	UserOpGetPrivateMessages                    UserOperation = "GetPrivateMessages" |  | ||||||
| 	UserOpUserJoin                              UserOperation = "UserJoin" |  | ||||||
| 	UserOpGetComments                           UserOperation = "GetComments" |  | ||||||
| 	UserOpPostJoin                              UserOperation = "PostJoin" |  | ||||||
| 	UserOpCommunityJoin                         UserOperation = "CommunityJoin" |  | ||||||
| 	UserOpChangePassword                        UserOperation = "ChangePassword" |  | ||||||
| 	UserOpGetSiteMetadata                       UserOperation = "GetSiteMetadata" |  | ||||||
| 	UserOpBlockCommunity                        UserOperation = "BlockCommunity" |  | ||||||
| 	UserOpBlockPerson                           UserOperation = "BlockPerson" |  | ||||||
| 	UserOpPurgePerson                           UserOperation = "PurgePerson" |  | ||||||
| 	UserOpPurgeCommunity                        UserOperation = "PurgeCommunity" |  | ||||||
| 	UserOpPurgePost                             UserOperation = "PurgePost" |  | ||||||
| 	UserOpPurgeComment                          UserOperation = "PurgeComment" |  | ||||||
| 	UserOpCreateCommentReport                   UserOperation = "CreateCommentReport" |  | ||||||
| 	UserOpResolveCommentReport                  UserOperation = "ResolveCommentReport" |  | ||||||
| 	UserOpListCommentReports                    UserOperation = "ListCommentReports" |  | ||||||
| 	UserOpCreatePostReport                      UserOperation = "CreatePostReport" |  | ||||||
| 	UserOpResolvePostReport                     UserOperation = "ResolvePostReport" |  | ||||||
| 	UserOpListPostReports                       UserOperation = "ListPostReports" |  | ||||||
| 	UserOpGetReportCount                        UserOperation = "GetReportCount" |  | ||||||
| 	UserOpGetUnreadCount                        UserOperation = "GetUnreadCount" |  | ||||||
| 	UserOpVerifyEmail                           UserOperation = "VerifyEmail" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type SortType string |  | ||||||
|  |  | ||||||
| const ( |  | ||||||
| 	Active       SortType = "Active" |  | ||||||
| 	Hot          SortType = "Hot" |  | ||||||
| 	New          SortType = "New" |  | ||||||
| 	Old          SortType = "Old" |  | ||||||
| 	TopDay       SortType = "TopDay" |  | ||||||
| 	TopWeek      SortType = "TopWeek" |  | ||||||
| 	TopMonth     SortType = "TopMonth" |  | ||||||
| 	TopYear      SortType = "TopYear" |  | ||||||
| 	TopAll       SortType = "TopAll" |  | ||||||
| 	MostComments SortType = "MostComments" |  | ||||||
| 	NewComments  SortType = "NewComments" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type CommentSortType string |  | ||||||
|  |  | ||||||
| const ( |  | ||||||
| 	CommentSortHot CommentSortType = "Hot" |  | ||||||
| 	CommentSortTop CommentSortType = "Top" |  | ||||||
| 	CommentSortNew CommentSortType = "New" |  | ||||||
| 	CommentSortOld CommentSortType = "Old" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type ListingType string |  | ||||||
|  |  | ||||||
| const ( |  | ||||||
| 	ListingAll        ListingType = "All" |  | ||||||
| 	ListingLocal      ListingType = "Local" |  | ||||||
| 	ListingSubscribed ListingType = "Subscribed" |  | ||||||
| 	ListingCommunity  ListingType = "Community" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type SearchType string |  | ||||||
|  |  | ||||||
| const ( |  | ||||||
| 	SearchAll         SearchType = "All" |  | ||||||
| 	SearchComments    SearchType = "Comments" |  | ||||||
| 	SearchPosts       SearchType = "Posts" |  | ||||||
| 	SearchCommunities SearchType = "Communities" |  | ||||||
| 	SearchUsers       SearchType = "Users" |  | ||||||
| 	SearchURL         SearchType = "URL" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type ModlogActionType string |  | ||||||
|  |  | ||||||
| const ( |  | ||||||
| 	ModlogAll                  ModlogActionType = "All" |  | ||||||
| 	ModlogModRemovePost        ModlogActionType = "ModRemovePost" |  | ||||||
| 	ModlogModLockPost          ModlogActionType = "ModLockPost" |  | ||||||
| 	ModlogModStickyPost        ModlogActionType = "ModStickyPost" |  | ||||||
| 	ModlogModRemoveComment     ModlogActionType = "ModRemoveComment" |  | ||||||
| 	ModlogModRemoveCommunity   ModlogActionType = "ModRemoveCommunity" |  | ||||||
| 	ModlogModBanFromCommunity  ModlogActionType = "ModBanFromCommunity" |  | ||||||
| 	ModlogModAddCommunity      ModlogActionType = "ModAddCommunity" |  | ||||||
| 	ModlogModTransferCommunity ModlogActionType = "ModTransferCommunity" |  | ||||||
| 	ModlogModAdd               ModlogActionType = "ModAdd" |  | ||||||
| 	ModlogModBan               ModlogActionType = "ModBan" |  | ||||||
| 	ModlogModHideCommunity     ModlogActionType = "ModHideCommunity" |  | ||||||
| 	ModlogAdminPurgePerson     ModlogActionType = "AdminPurgePerson" |  | ||||||
| 	ModlogAdminPurgeCommunity  ModlogActionType = "AdminPurgeCommunity" |  | ||||||
| 	ModlogAdminPurgePost       ModlogActionType = "AdminPurgePost" |  | ||||||
| 	ModlogAdminPurgeComment    ModlogActionType = "AdminPurgeComment" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| type SubscribedType string |  | ||||||
|  |  | ||||||
| const ( |  | ||||||
| 	Subscribed    SubscribedType = "Subscribed" |  | ||||||
| 	NotSubscribed SubscribedType = "NotSubscribed" |  | ||||||
| 	Pending       SubscribedType = "Pending" |  | ||||||
| ) |  | ||||||
							
								
								
									
										15
									
								
								types/password_reset_request.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								types/password_reset_request.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/password_reset_request.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
							
								
								
									
										156
									
								
								types/person.1.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										156
									
								
								types/person.1.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,156 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/person.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
|  | type PersonSafe 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"` | ||||||
|  | 	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"` | ||||||
|  | } | ||||||
|  | type PersonAlias1 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"` | ||||||
|  | } | ||||||
|  | type PersonSafeAlias1 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"` | ||||||
|  | 	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"` | ||||||
|  | } | ||||||
|  | type PersonAlias2 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"` | ||||||
|  | } | ||||||
|  | type PersonSafeAlias2 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"` | ||||||
|  | 	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"` | ||||||
|  | } | ||||||
|  | type PersonForm struct { | ||||||
|  | 	Name            string                     `json:"name" url:"name,omitempty"` | ||||||
|  | 	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"` | ||||||
|  | 	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[Optional[string]] `json:"bio" url:"bio,omitempty"` | ||||||
|  | 	Local           Optional[bool]             `json:"local" url:"local,omitempty"` | ||||||
|  | 	PrivateKey      Optional[Optional[string]] `json:"private_key" url:"private_key,omitempty"` | ||||||
|  | 	PublicKey       Optional[string]           `json:"public_key" url:"public_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"` | ||||||
|  | } | ||||||
| @@ -1,17 +1,12 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/person.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  | 
 | ||||||
| package types | package types | ||||||
| 
 | 
 | ||||||
| type Login struct { | type Login struct { | ||||||
| 	Password        string `json:"password" url:"password,omitempty"` |  | ||||||
| 	UsernameOrEmail string `json:"username_or_email" url:"username_or_email,omitempty"` | 	UsernameOrEmail string `json:"username_or_email" url:"username_or_email,omitempty"` | ||||||
|  | 	Password        string `json:"password" url:"password,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type LoginResponse struct { |  | ||||||
| 	JWT                 Optional[string] `json:"jwt" url:"jwt,omitempty"` |  | ||||||
| 	RegistrationCreated bool             `json:"registration_created" url:"registration_created,omitempty"` |  | ||||||
| 	VeriftEmailSent     bool             `json:"verify_email_sent" url:"verify_email_sent,omitempty"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| type Register struct { | type Register struct { | ||||||
| 	Username       string           `json:"username" url:"username,omitempty"` | 	Username       string           `json:"username" url:"username,omitempty"` | ||||||
| 	Password       string           `json:"password" url:"password,omitempty"` | 	Password       string           `json:"password" url:"password,omitempty"` | ||||||
| @@ -23,23 +18,24 @@ type Register struct { | |||||||
| 	Honeypot       Optional[string] `json:"honeypot" url:"honeypot,omitempty"` | 	Honeypot       Optional[string] `json:"honeypot" url:"honeypot,omitempty"` | ||||||
| 	Answer         Optional[string] `json:"answer" url:"answer,omitempty"` | 	Answer         Optional[string] `json:"answer" url:"answer,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetCaptcha struct{} | type GetCaptcha struct{} | ||||||
| 
 | type GetCaptchaResponse struct { | ||||||
|  | 	Ok Optional[CaptchaResponse] `json:"ok" url:"ok,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
| type CaptchaResponse struct { | type CaptchaResponse struct { | ||||||
| 	Png  string `json:"png" url:"png,omitempty"` | 	Png  string `json:"png" url:"png,omitempty"` | ||||||
| 	Wav  string `json:"wav" url:"wav,omitempty"` | 	Wav  string `json:"wav" url:"wav,omitempty"` | ||||||
| 	Uuid string `json:"uuid" url:"uuid,omitempty"` | 	Uuid string `json:"uuid" url:"uuid,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type SaveUserSettings struct { | type SaveUserSettings struct { | ||||||
| 	ShowNSFW                 Optional[bool]   `json:"show_nsfw" url:"show_nsfw,omitempty"` | 	ShowNSFW                 Optional[bool]   `json:"show_nsfw" url:"show_nsfw,omitempty"` | ||||||
| 	ShowScores               Optional[bool]   `json:"show_scores" url:"show_scores,omitempty"` | 	ShowScores               Optional[bool]   `json:"show_scores" url:"show_scores,omitempty"` | ||||||
| 	Theme                    Optional[string] `json:"theme" url:"theme,omitempty"` | 	Theme                    Optional[string] `json:"theme" url:"theme,omitempty"` | ||||||
| 	DefaultSortType          Optional[int16]  `json:"default_sort_type" url:"default_sort_type,omitempty"` | 	DefaultSortType          Optional[int16]  `json:"default_sort_type" url:"default_sort_type,omitempty"` | ||||||
| 	DefaultListingType       Optional[int16]  `json:"default_listing_type" url:"default_listing_type,omitempty"` | 	DefaultListingType       Optional[int16]  `json:"default_listing_type" url:"default_listing_type,omitempty"` | ||||||
| 	InterfaceLanguage        Optional[string] `json:"interface_language" url:"interface_language,omitempty"` | 	Lang                     Optional[string] `json:"lang" url:"lang,omitempty"` | ||||||
| 	Avatar                   Optional[string] `json:"avatar" url:"avatar,omitempty"` | 	Avatar                   Optional[string] `json:"avatar" url:"avatar,omitempty"` | ||||||
| 	Banner                   Optional[string] `json:"banner" url:"banner,omitempty"` | 	Banner                   Optional[string] `json:"banner" url:"banner,omitempty"` | ||||||
| 	DisplayName              Optional[string] `json:"display_name" url:"display_name,omitempty"` | 	DisplayName              Optional[string] `json:"display_name" url:"display_name,omitempty"` | ||||||
| @@ -52,17 +48,20 @@ type SaveUserSettings struct { | |||||||
| 	ShowBotAccounts          Optional[bool]   `json:"show_bot_accounts" url:"show_bot_accounts,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"` | 	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"` | 	ShowNewPostNotifs        Optional[bool]   `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` | ||||||
| 	DiscussionLanguages      Optional[[]int]  `json:"discussion_languages" url:"discussion_languages,omitempty"` |  | ||||||
| 	Auth                     string           `json:"auth" url:"auth,omitempty"` | 	Auth                     string           `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type ChangePassword struct { | type ChangePassword struct { | ||||||
| 	NewPassword       string `json:"new_password" url:"new_password,omitempty"` | 	NewPassword       string `json:"new_password" url:"new_password,omitempty"` | ||||||
| 	NewPasswordVerify string `json:"new_password_verify" url:"new_password_verify,omitempty"` | 	NewPasswordVerify string `json:"new_password_verify" url:"new_password_verify,omitempty"` | ||||||
| 	OldPassword       string `json:"old_password" url:"old_password,omitempty"` | 	OldPassword       string `json:"old_password" url:"old_password,omitempty"` | ||||||
| 	Auth              string `json:"auth" url:"auth,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 { | type GetPersonDetails struct { | ||||||
| 	PersonID    Optional[int]      `json:"person_id" url:"person_id,omitempty"` | 	PersonID    Optional[int]      `json:"person_id" url:"person_id,omitempty"` | ||||||
| 	Username    Optional[string]   `json:"username" url:"username,omitempty"` | 	Username    Optional[string]   `json:"username" url:"username,omitempty"` | ||||||
| @@ -73,7 +72,6 @@ type GetPersonDetails struct { | |||||||
| 	SavedOnly   Optional[bool]     `json:"saved_only" url:"saved_only,omitempty"` | 	SavedOnly   Optional[bool]     `json:"saved_only" url:"saved_only,omitempty"` | ||||||
| 	Auth        Optional[string]   `json:"auth" url:"auth,omitempty"` | 	Auth        Optional[string]   `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetPersonDetailsResponse struct { | type GetPersonDetailsResponse struct { | ||||||
| 	PersonView PersonViewSafe           `json:"person_view" url:"person_view,omitempty"` | 	PersonView PersonViewSafe           `json:"person_view" url:"person_view,omitempty"` | ||||||
| 	Comments   []CommentView            `json:"comments" url:"comments,omitempty"` | 	Comments   []CommentView            `json:"comments" url:"comments,omitempty"` | ||||||
| @@ -81,40 +79,26 @@ type GetPersonDetailsResponse struct { | |||||||
| 	Moderates  []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"` | 	Moderates  []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetReplies struct { |  | ||||||
| 	Limit      Optional[int]             `json:"limit" url:"limit,omitempty"` |  | ||||||
| 	Page       Optional[int]             `json:"page" url:"page,omitempty"` |  | ||||||
| 	Sort       Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` |  | ||||||
| 	UnreadOnly Optional[bool]            `json:"unread_only" url:"unread_only,omitempty"` |  | ||||||
| 	Auth       string                    `json:"auth" url:"auth,omitempty"` |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| type GetRepliesResponse struct { | type GetRepliesResponse struct { | ||||||
| 	Replies []CommentReplyView `json:"replies" url:"replies,omitempty"` | 	Replies []CommentView `json:"replies" url:"replies,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetPersonMentionsResponse struct { | type GetPersonMentionsResponse struct { | ||||||
| 	Mentions []PersonMentionView `json:"mentions" url:"mentions,omitempty"` | 	Mentions []PersonMentionView `json:"mentions" url:"mentions,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type MarkAllAsRead struct { | type MarkAllAsRead struct { | ||||||
| 	Auth string `json:"auth" url:"auth,omitempty"` | 	Auth string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type AddAdmin struct { | type AddAdmin struct { | ||||||
| 	PersonID int    `json:"person_id" url:"person_id,omitempty"` | 	PersonID int    `json:"person_id" url:"person_id,omitempty"` | ||||||
| 	Added    bool   `json:"added" url:"added,omitempty"` | 	Added    bool   `json:"added" url:"added,omitempty"` | ||||||
| 	Auth     string `json:"auth" url:"auth,omitempty"` | 	Auth     string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type AddAdminResponse struct { | type AddAdminResponse struct { | ||||||
| 	Admins []PersonViewSafe `json:"admins" url:"admins,omitempty"` | 	Admins []PersonViewSafe `json:"admins" url:"admins,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type BanPerson struct { | type BanPerson struct { | ||||||
| 	PersonID   int              `json:"person_id" url:"person_id,omitempty"` | 	PersonID   int              `json:"person_id" url:"person_id,omitempty"` | ||||||
| 	Ban        bool             `json:"ban" url:"ban,omitempty"` | 	Ban        bool             `json:"ban" url:"ban,omitempty"` | ||||||
| @@ -123,121 +107,125 @@ type BanPerson struct { | |||||||
| 	Expires    Optional[int64]  `json:"expires" url:"expires,omitempty"` | 	Expires    Optional[int64]  `json:"expires" url:"expires,omitempty"` | ||||||
| 	Auth       string           `json:"auth" url:"auth,omitempty"` | 	Auth       string           `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetBannedPersons struct { | type GetBannedPersons struct { | ||||||
| 	Auth string `json:"auth" url:"auth,omitempty"` | 	Auth string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 | type BannedPersonsResponse struct { | ||||||
|  | 	Banned []PersonViewSafe `json:"banned" url:"banned,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
| type BanPersonResponse struct { | type BanPersonResponse struct { | ||||||
| 	PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` | 	PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` | ||||||
| 	Banned     bool           `json:"banned" url:"banned,omitempty"` | 	Banned     bool           `json:"banned" url:"banned,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type BlockPerson struct { | type BlockPerson struct { | ||||||
| 	PersonID int    `json:"person_id" url:"person_id,omitempty"` | 	PersonID int    `json:"person_id" url:"person_id,omitempty"` | ||||||
| 	Block    bool   `json:"block" url:"block,omitempty"` | 	Block    bool   `json:"block" url:"block,omitempty"` | ||||||
| 	Auth     string `json:"auth" url:"auth,omitempty"` | 	Auth     string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 | type BlockPersonResponse struct { | ||||||
| type GetPersonMentions struct { | 	PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` | ||||||
| 	Sort       Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` | 	Blocked    bool           `json:"blocked" url:"blocked,omitempty"` | ||||||
| 	Page       Optional[int64]           `json:"page" url:"page,omitempty"` | 	LemmyResponse | ||||||
| 	Limit      Optional[int64]           `json:"limit" url:"limit,omitempty"` | } | ||||||
| 	UnreadOnly Optional[bool]            `json:"unread_only" url:"unread_only,omitempty"` | type GetReplies struct { | ||||||
| 	Auth       string                    `json:"auth" url:"auth,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"` | ||||||
|  | 	UnreadOnly Optional[bool]     `json:"unread_only" url:"unread_only,omitempty"` | ||||||
|  | 	Auth       string             `json:"auth" url:"auth,omitempty"` | ||||||
|  | } | ||||||
|  | type GetPersonMentions struct { | ||||||
|  | 	Sort       Optional[SortType] `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 MarkPersonMentionAsRead struct { | type MarkPersonMentionAsRead struct { | ||||||
| 	PersonMentionID int    `json:"person_mention_id" url:"person_mention_id,omitempty"` | 	PersonMentionID int    `json:"person_mention_id" url:"person_mention_id,omitempty"` | ||||||
| 	Read            bool   `json:"read" url:"read,omitempty"` | 	Read            bool   `json:"read" url:"read,omitempty"` | ||||||
| 	Auth            string `json:"auth" url:"auth,omitempty"` | 	Auth            string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type PersonMentionResponse struct { | type PersonMentionResponse struct { | ||||||
| 	PersonMentionView PersonMentionView `json:"person_mention_view" url:"person_mention_view,omitempty"` | 	PersonMentionView PersonMentionView `json:"person_mention_view" url:"person_mention_view,omitempty"` | ||||||
| 	LemmyResponse | 	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 { | type DeleteAccount struct { | ||||||
| 	Password string `json:"password" url:"password,omitempty"` | 	Password string `json:"password" url:"password,omitempty"` | ||||||
| 	Auth     string `json:"auth" url:"auth,omitempty"` | 	Auth     string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type DeleteAccountResponse struct { | type DeleteAccountResponse struct { | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type PasswordReset struct { | type PasswordReset struct { | ||||||
| 	Email string `json:"email" url:"email,omitempty"` | 	Email string `json:"email" url:"email,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type PasswordResetResponse struct { | type PasswordResetResponse struct { | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type PasswordChangeAfterReset struct { | type PasswordChangeAfterReset struct { | ||||||
| 	Token          string `json:"token" url:"token,omitempty"` | 	Token          string `json:"token" url:"token,omitempty"` | ||||||
| 	Password       string `json:"password" url:"password,omitempty"` | 	Password       string `json:"password" url:"password,omitempty"` | ||||||
| 	PasswordVerify string `json:"password_verify" url:"password_verify,omitempty"` | 	PasswordVerify string `json:"password_verify" url:"password_verify,omitempty"` | ||||||
| } | } | ||||||
| 
 | 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 GetReportCount struct { | type GetReportCount struct { | ||||||
| 	CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` | 	CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	Auth        string        `json:"auth" url:"auth,omitempty"` | 	Auth        string        `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetReportCountResponse struct { | type GetReportCountResponse struct { | ||||||
| 	CommunityID           Optional[int]   `json:"community_id" url:"community_id,omitempty"` | 	CommunityID    Optional[int] `json:"community_id" url:"community_id,omitempty"` | ||||||
| 	CommentReports        int64           `json:"comment_reports" url:"comment_reports,omitempty"` | 	CommentReports int64         `json:"comment_reports" url:"comment_reports,omitempty"` | ||||||
| 	PostReports           int64           `json:"post_reports" url:"post_reports,omitempty"` | 	PostReports    int64         `json:"post_reports" url:"post_reports,omitempty"` | ||||||
| 	PrivateMessageReports Optional[int64] `json:"private_message_reports" url:"private_message_reports,omitempty"` |  | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetUnreadCount struct { | type GetUnreadCount struct { | ||||||
| 	Auth string `json:"auth" url:"auth,omitempty"` | 	Auth string `json:"auth" url:"auth,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type GetUnreadCountResponse struct { | type GetUnreadCountResponse struct { | ||||||
| 	Replies         int64 `json:"replies" url:"replies,omitempty"` | 	Replies         int64 `json:"replies" url:"replies,omitempty"` | ||||||
| 	Mentions        int64 `json:"mentions" url:"mentions,omitempty"` | 	Mentions        int64 `json:"mentions" url:"mentions,omitempty"` | ||||||
| 	PrivateMessages int64 `json:"private_messages" url:"private_messages,omitempty"` | 	PrivateMessages int64 `json:"private_messages" url:"private_messages,omitempty"` | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type VerifyEmail struct { | type VerifyEmail struct { | ||||||
| 	Token string `json:"token" url:"token,omitempty"` | 	Token string `json:"token" url:"token,omitempty"` | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type VerifyEmailResponse struct { | type VerifyEmailResponse struct { | ||||||
| 	LemmyResponse | 	LemmyResponse | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type BlockPersonResponse struct { |  | ||||||
| 	Blocked    bool           `json:"blocked" url:"blocked,omitempty"` |  | ||||||
| 	PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| type BannedPersonsResponse struct { |  | ||||||
| 	Banned []PersonViewSafe `json:"banned" url:"banned,omitempty"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| type PasswordChange struct { |  | ||||||
| 	Password       string `json:"password" url:"password,omitempty"` |  | ||||||
| 	PasswordVerify string `json:"password_verify" url:"password_verify,omitempty"` |  | ||||||
| 	Token          string `json:"token" url:"token,omitempty"` |  | ||||||
| } |  | ||||||
							
								
								
									
										15
									
								
								types/person_block.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								types/person_block.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/person_block.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								types/person_mention.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								types/person_mention.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/person_mention.rs | ||||||
|  | // Code generated by go.arsenm.dev/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 PersonMentionForm 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"` | ||||||
|  | } | ||||||
							
								
								
									
										78
									
								
								types/post.1.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								types/post.1.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,78 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/post.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | 	Stickied         bool             `json:"stickied" url:"stickied,omitempty"` | ||||||
|  | 	EmbedTitle       Optional[string] `json:"embed_title" url:"embed_title,omitempty"` | ||||||
|  | 	EmbedDescription Optional[string] `json:"embed_description" url:"embed_description,omitempty"` | ||||||
|  | 	EmbedHtml        Optional[string] `json:"embed_html" url:"embed_html,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"` | ||||||
|  | } | ||||||
|  | type PostForm 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"` | ||||||
|  | 	Published        LemmyTime        `json:"published" url:"published,omitempty"` | ||||||
|  | 	Updated          LemmyTime        `json:"updated" url:"updated,omitempty"` | ||||||
|  | 	Deleted          Optional[bool]   `json:"deleted" url:"deleted,omitempty"` | ||||||
|  | 	Stickied         Optional[bool]   `json:"stickied" url:"stickied,omitempty"` | ||||||
|  | 	EmbedTitle       Optional[string] `json:"embed_title" url:"embed_title,omitempty"` | ||||||
|  | 	EmbedDescription Optional[string] `json:"embed_description" url:"embed_description,omitempty"` | ||||||
|  | 	EmbedHtml        Optional[string] `json:"embed_html" url:"embed_html,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"` | ||||||
|  | } | ||||||
|  | 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"` | ||||||
|  | } | ||||||
							
								
								
									
										126
									
								
								types/post.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								types/post.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,126 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/post.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | 	Auth        string           `json:"auth" url:"auth,omitempty"` | ||||||
|  | } | ||||||
|  | type PostResponse struct { | ||||||
|  | 	PostView PostView `json:"post_view" url:"post_view,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
|  | type GetPost struct { | ||||||
|  | 	ID   int              `json:"id" url:"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"` | ||||||
|  | 	Comments      []CommentView            `json:"comments" url:"comments,omitempty"` | ||||||
|  | 	Moderators    []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` | ||||||
|  | 	Online        uint                     `json:"online" url:"online,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"` | ||||||
|  | 	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 StickyPost struct { | ||||||
|  | 	PostID   int    `json:"post_id" url:"post_id,omitempty"` | ||||||
|  | 	Stickied bool   `json:"stickied" url:"stickied,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"` | ||||||
|  | 	Html        Optional[string] `json:"html" url:"html,omitempty"` | ||||||
|  | } | ||||||
							
								
								
									
										146
									
								
								types/post.go
									
									
									
									
									
								
							
							
						
						
									
										146
									
								
								types/post.go
									
									
									
									
									
								
							| @@ -1,146 +0,0 @@ | |||||||
| 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"` |  | ||||||
| 	Online        uint                     `json:"online" url:"online,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   Optional[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       Optional[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    Optional[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    Optional[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   Optional[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   Optional[string] `json:"auth" url:"auth,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type StickyPost struct { |  | ||||||
| 	PostID   int              `json:"post_id" url:"post_id,omitempty"` |  | ||||||
| 	Stickied bool             `json:"stickied" url:"stickied,omitempty"` |  | ||||||
| 	Auth     Optional[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   Optional[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   Optional[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     Optional[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           Optional[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"` |  | ||||||
| } |  | ||||||
							
								
								
									
										26
									
								
								types/post_report.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								types/post_report.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/post_report.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
| @@ -1,71 +0,0 @@ | |||||||
| package types |  | ||||||
|  |  | ||||||
| type CreatePrivateMessage struct { |  | ||||||
| 	Content     string           `json:"content" url:"content,omitempty"` |  | ||||||
| 	RecipientID int              `json:"recipient_id" url:"recipient_id,omitempty"` |  | ||||||
| 	Auth        Optional[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             Optional[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             Optional[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             Optional[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       Optional[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             Optional[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     Optional[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           Optional[string] `json:"auth" url:"auth,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ListPrivateMessageReportsResponse struct { |  | ||||||
| 	PrivateMessageReports []PrivateMessageReportView `json:"private_message_reports" url:"private_message_reports,omitempty"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
							
								
								
									
										28
									
								
								types/private_message.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								types/private_message.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/private_message.rs | ||||||
|  | // Code generated by go.arsenm.dev/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 PrivateMessageForm 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"` | ||||||
|  | } | ||||||
							
								
								
									
										19
									
								
								types/registration_application.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								types/registration_application.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/registration_application.rs | ||||||
|  | // Code generated by go.arsenm.dev/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 RegistrationApplicationForm struct { | ||||||
|  | 	LocalUserID Optional[int]              `json:"local_user_id" url:"local_user_id,omitempty"` | ||||||
|  | 	Answer      Optional[string]           `json:"answer" url:"answer,omitempty"` | ||||||
|  | 	AdminID     Optional[int]              `json:"admin_id" url:"admin_id,omitempty"` | ||||||
|  | 	DenyReason  Optional[Optional[string]] `json:"deny_reason" url:"deny_reason,omitempty"` | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								types/request.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								types/request.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/request.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
							
								
								
									
										9
									
								
								types/secret.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								types/secret.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/secret.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								types/sensitive.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								types/sensitive.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/sensitive.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
							
								
								
									
										55
									
								
								types/site.1.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								types/site.1.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/source/site.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
|  |  | ||||||
|  | type Site struct { | ||||||
|  | 	ID                         int32            `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"` | ||||||
|  | 	EnableDownvotes            bool             `json:"enable_downvotes" url:"enable_downvotes,omitempty"` | ||||||
|  | 	OpenRegistration           bool             `json:"open_registration" url:"open_registration,omitempty"` | ||||||
|  | 	EnableNSFW                 bool             `json:"enable_nsfw" url:"enable_nsfw,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"` | ||||||
|  | 	CommunityCreationAdminOnly bool             `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` | ||||||
|  | 	RequireEmailVerification   bool             `json:"require_email_verification" url:"require_email_verification,omitempty"` | ||||||
|  | 	RequireApplication         bool             `json:"require_application" url:"require_application,omitempty"` | ||||||
|  | 	ApplicationQuestion        Optional[string] `json:"application_question" url:"application_question,omitempty"` | ||||||
|  | 	PrivateInstance            bool             `json:"private_instance" url:"private_instance,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"` | ||||||
|  | 	DefaultTheme               string           `json:"default_theme" url:"default_theme,omitempty"` | ||||||
|  | 	DefaultPostListingType     string           `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` | ||||||
|  | 	LegalInformation           Optional[string] `json:"legal_information" url:"legal_information,omitempty"` | ||||||
|  | } | ||||||
|  | type SiteForm struct { | ||||||
|  | 	Name                       string                     `json:"name" url:"name,omitempty"` | ||||||
|  | 	Sidebar                    Optional[Optional[string]] `json:"sidebar" url:"sidebar,omitempty"` | ||||||
|  | 	Updated                    LemmyTime                  `json:"updated" url:"updated,omitempty"` | ||||||
|  | 	EnableDownvotes            Optional[bool]             `json:"enable_downvotes" url:"enable_downvotes,omitempty"` | ||||||
|  | 	OpenRegistration           Optional[bool]             `json:"open_registration" url:"open_registration,omitempty"` | ||||||
|  | 	EnableNSFW                 Optional[bool]             `json:"enable_nsfw" url:"enable_nsfw,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"` | ||||||
|  | 	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"` | ||||||
|  | 	RequireApplication         Optional[bool]             `json:"require_application" url:"require_application,omitempty"` | ||||||
|  | 	ApplicationQuestion        Optional[Optional[string]] `json:"application_question" url:"application_question,omitempty"` | ||||||
|  | 	PrivateInstance            Optional[bool]             `json:"private_instance" url:"private_instance,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"` | ||||||
|  | 	DefaultTheme               Optional[string]           `json:"default_theme" url:"default_theme,omitempty"` | ||||||
|  | 	DefaultPostListingType     Optional[string]           `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` | ||||||
|  | 	LegalInformation           Optional[string]           `json:"legal_information" url:"legal_information,omitempty"` | ||||||
|  | } | ||||||
							
								
								
									
										163
									
								
								types/site.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								types/site.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,163 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/site.rs | ||||||
|  | // Code generated by go.arsenm.dev/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        string           `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       []PersonViewSafe `json:"users" url:"users,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
|  | type ResolveObject struct { | ||||||
|  | 	Q    string           `json:"q" url:"q,omitempty"` | ||||||
|  | 	Auth Optional[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[PersonViewSafe] `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"` | ||||||
|  | 	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"` | ||||||
|  | 	StickiedPosts          []ModStickyPostView        `json:"stickied_posts" url:"stickied_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"` | ||||||
|  | 	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"` | ||||||
|  | 	OpenRegistration           Optional[bool]   `json:"open_registration" url:"open_registration,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"` | ||||||
|  | 	RequireApplication         Optional[bool]   `json:"require_application" url:"require_application,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[string] `json:"default_post_listing_type" url:"default_post_listing_type,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"` | ||||||
|  | 	OpenRegistration           Optional[bool]   `json:"open_registration" url:"open_registration,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"` | ||||||
|  | 	RequireApplication         Optional[bool]   `json:"require_application" url:"require_application,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[string] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` | ||||||
|  | 	LegalInformation           Optional[string] `json:"legal_information" url:"legal_information,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"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
|  | type GetSiteResponse struct { | ||||||
|  | 	SiteView           Optional[SiteView]           `json:"site_view" url:"site_view,omitempty"` | ||||||
|  | 	Admins             []PersonViewSafe             `json:"admins" url:"admins,omitempty"` | ||||||
|  | 	Online             uint                         `json:"online" url:"online,omitempty"` | ||||||
|  | 	Version            string                       `json:"version" url:"version,omitempty"` | ||||||
|  | 	MyUser             Optional[MyUserInfo]         `json:"my_user" url:"my_user,omitempty"` | ||||||
|  | 	FederatedInstances Optional[FederatedInstances] `json:"federated_instances" url:"federated_instances,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
|  | type MyUserInfo struct { | ||||||
|  | 	LocalUserView   LocalUserSettingsView    `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"` | ||||||
|  | } | ||||||
|  | type LeaveAdmin struct { | ||||||
|  | 	Auth string `json:"auth" url:"auth,omitempty"` | ||||||
|  | } | ||||||
|  | type GetSiteConfig struct { | ||||||
|  | 	Auth string `json:"auth" url:"auth,omitempty"` | ||||||
|  | } | ||||||
|  | type GetSiteConfigResponse struct { | ||||||
|  | 	ConfigHjson string `json:"config_hjson" url:"config_hjson,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
|  | type SaveSiteConfig struct { | ||||||
|  | 	ConfigHjson string `json:"config_hjson" url:"config_hjson,omitempty"` | ||||||
|  | 	Auth        string `json:"auth" url:"auth,omitempty"` | ||||||
|  | } | ||||||
|  | type FederatedInstances struct { | ||||||
|  | 	Linked  []string           `json:"linked" url:"linked,omitempty"` | ||||||
|  | 	Allowed Optional[[]string] `json:"allowed" url:"allowed,omitempty"` | ||||||
|  | 	Blocked Optional[[]string] `json:"blocked" url:"blocked,omitempty"` | ||||||
|  | } | ||||||
|  | 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 | ||||||
|  | } | ||||||
							
								
								
									
										256
									
								
								types/site.go
									
									
									
									
									
								
							
							
						
						
									
										256
									
								
								types/site.go
									
									
									
									
									
								
							| @@ -1,256 +0,0 @@ | |||||||
| package types |  | ||||||
|  |  | ||||||
| type Search struct { |  | ||||||
| 	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"` |  | ||||||
| 	Limit         Optional[int]         `json:"limit" url:"limit,omitempty"` |  | ||||||
| 	ListingType   Optional[ListingType] `json:"listing_type" url:"listing_type,omitempty"` |  | ||||||
| 	Page          Optional[int]         `json:"page" url:"page,omitempty"` |  | ||||||
| 	Query         string                `json:"q" url:"q,omitempty"` |  | ||||||
| 	Sort          Optional[SortType]    `json:"sort" url:"sort,omitempty"` |  | ||||||
| 	Type          Optional[SearchType]  `json:"type_" url:"type_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type SearchResponse struct { |  | ||||||
| 	Type        string           `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       []PersonViewSafe `json:"users" url:"users,omitempty"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ResolveObject struct { |  | ||||||
| 	Query string           `json:"q" url:"q,omitempty"` |  | ||||||
| 	Auth  Optional[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[PersonViewSafe] `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"` |  | ||||||
| 	Auth          Optional[string]           `json:"auth" url:"auth,omitempty"` |  | ||||||
| 	Type          Optional[ModlogActionType] `json:"type" url:"type,omitempty"` |  | ||||||
| 	OtherPersonID Optional[int]              `json:"other_person_id" url:"other_person_id,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type GetModlogResponse struct { |  | ||||||
| 	RemovedPosts           []ModRemovePostView        `json:"removed_posts" url:"removed_posts,omitempty"` |  | ||||||
| 	LockedPosts            []ModLockPostView          `json:"locked_posts" url:"locked_posts,omitempty"` |  | ||||||
| 	StickiedPosts          []ModStickyPostView        `json:"stickied_posts" url:"stickied_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"` |  | ||||||
| 	OpenRegistration           Optional[bool]     `json:"open_registration" url:"open_registration,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"` |  | ||||||
| 	RequireApplication         Optional[bool]     `json:"require_application" url:"require_application,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[string]   `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[int]      `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` |  | ||||||
| 	RateLimitMessage           Optional[int]      `json:"rate_limit_message" url:"rate_limit_message,omitempty"` |  | ||||||
| 	RateLimitMessagePerSecond  Optional[int]      `json:"rate_limit_message_per_second" url:"rate_limit_message_per_second,omitempty"` |  | ||||||
| 	RateLimitPost              Optional[int]      `json:"rate_limit_post" url:"rate_limit_post,omitempty"` |  | ||||||
| 	RateLimitPostPerSecond     Optional[int]      `json:"rate_limit_post_per_second" url:"rate_limit_post_per_second,omitempty"` |  | ||||||
| 	RateLimitRegister          Optional[int]      `json:"rate_limit_register" url:"rate_limit_register,omitempty"` |  | ||||||
| 	RateLimitRegisterPerSecond Optional[int]      `json:"rate_limit_register_per_second" url:"rate_limit_register_per_second,omitempty"` |  | ||||||
| 	RateLimitImage             Optional[int]      `json:"rate_limit_image" url:"rate_limit_image,omitempty"` |  | ||||||
| 	RateLimitImagePerSecond    Optional[int]      `json:"rate_limit_image_per_second" url:"rate_limit_image_per_second,omitempty"` |  | ||||||
| 	RateLimitComment           Optional[int]      `json:"rate_limit_comment" url:"rate_limit_comment,omitempty"` |  | ||||||
| 	RateLimitCommentPerSecond  Optional[int]      `json:"rate_limit_comment_per_second" url:"rate_limit_comment_per_second,omitempty"` |  | ||||||
| 	RateLimitSearch            Optional[int]      `json:"rate_limit_search" url:"rate_limit_search,omitempty"` |  | ||||||
| 	RateLimitSearchPerSecond   Optional[int]      `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[int]      `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"` |  | ||||||
| 	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"` |  | ||||||
| 	OpenRegistration           Optional[bool]     `json:"open_registration" url:"open_registration,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"` |  | ||||||
| 	RequireApplication         Optional[bool]     `json:"require_application" url:"require_application,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[string]   `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[int]      `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` |  | ||||||
| 	RateLimitMessage           Optional[int]      `json:"rate_limit_message" url:"rate_limit_message,omitempty"` |  | ||||||
| 	RateLimitMessagePerSecond  Optional[int]      `json:"rate_limit_message_per_second" url:"rate_limit_message_per_second,omitempty"` |  | ||||||
| 	RateLimitPost              Optional[int]      `json:"rate_limit_post" url:"rate_limit_post,omitempty"` |  | ||||||
| 	RateLimitPostPerSecond     Optional[int]      `json:"rate_limit_post_per_second" url:"rate_limit_post_per_second,omitempty"` |  | ||||||
| 	RateLimitRegister          Optional[int]      `json:"rate_limit_register" url:"rate_limit_register,omitempty"` |  | ||||||
| 	RateLimitRegisterPerSecond Optional[int]      `json:"rate_limit_register_per_second" url:"rate_limit_register_per_second,omitempty"` |  | ||||||
| 	RateLimitImage             Optional[int]      `json:"rate_limit_image" url:"rate_limit_image,omitempty"` |  | ||||||
| 	RateLimitImagePerSecond    Optional[int]      `json:"rate_limit_image_per_second" url:"rate_limit_image_per_second,omitempty"` |  | ||||||
| 	RateLimitComment           Optional[int]      `json:"rate_limit_comment" url:"rate_limit_comment,omitempty"` |  | ||||||
| 	RateLimitCommentPerSecond  Optional[int]      `json:"rate_limit_comment_per_second" url:"rate_limit_comment_per_second,omitempty"` |  | ||||||
| 	RateLimitSearch            Optional[int]      `json:"rate_limit_search" url:"rate_limit_search,omitempty"` |  | ||||||
| 	RateLimitSearchPerSecond   Optional[int]      `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[int]      `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"` |  | ||||||
| 	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"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type GetSiteResponse struct { |  | ||||||
| 	SiteView            SiteView                     `json:"site_view" url:"site_view,omitempty"` |  | ||||||
| 	Admins              []PersonViewSafe             `json:"admins" url:"admins,omitempty"` |  | ||||||
| 	Online              int                          `json:"online" url:"online,omitempty"` |  | ||||||
| 	Version             string                       `json:"version" url:"version,omitempty"` |  | ||||||
| 	MyUser              Optional[MyUserInfo]         `json:"my_user" url:"my_user,omitempty"` |  | ||||||
| 	FederatedInstances  Optional[FederatedInstances] `json:"federated_instances" url:"federated_instances,omitempty"` |  | ||||||
| 	AllLanguages        []Language                   `json:"all_languages" url:"all_languages,omitempty"` |  | ||||||
| 	DiscussionLanguages []int                        `json:"discussion_languages" url:"discussion_languages,omitempty"` |  | ||||||
| 	Taglines            Optional[[]Tagline]          `json:"taglines" url:"taglines,omitempty"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type MyUserInfo struct { |  | ||||||
| 	LocalUserView       LocalUserSettingsView    `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 []Language               `json:"discussion_languages" url:"discussion_languages,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type LeaveAdmin struct { |  | ||||||
| 	Auth string `json:"auth" url:"auth,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type FederatedInstances struct { |  | ||||||
| 	Linked  []string           `json:"linked" url:"linked,omitempty"` |  | ||||||
| 	Allowed Optional[[]string] `json:"allowed" url:"allowed,omitempty"` |  | ||||||
| 	Blocked Optional[[]string] `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[int]  `json:"page" url:"page,omitempty"` |  | ||||||
| 	Limit      Optional[int]  `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         int              `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 int `json:"registration_applications" url:"registration_applications,omitempty"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
							
								
								
									
										402
									
								
								types/source.go
									
									
									
									
									
								
							
							
						
						
									
										402
									
								
								types/source.go
									
									
									
									
									
								
							| @@ -1,402 +0,0 @@ | |||||||
| package types |  | ||||||
|  |  | ||||||
| import "time" |  | ||||||
|  |  | ||||||
| type LocalUserSettings struct { |  | ||||||
| 	ID                  int              `json:"id" url:"id,omitempty"` |  | ||||||
| 	PersonID            int              `json:"person_id" url:"person_id,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     int              `json:"default_sort_type" url:"default_sort_type,omitempty"` |  | ||||||
| 	DefaultListingType  int              `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"` |  | ||||||
| 	SendNotifications   bool             `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` |  | ||||||
| 	ValidatorTime       string           `json:"validator_time" url:"validator_time,omitempty"` |  | ||||||
| 	ShowBotAccounts     bool             `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` |  | ||||||
| 	ShowScores          bool             `json:"show_scores" url:"show_scores,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"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PersonSafe 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      string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated        Optional[string] `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"` |  | ||||||
| 	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     Optional[string] `json:"ban_expires" url:"ban_expires,omitempty"` |  | ||||||
| 	InstanceID     int              `json:"instance_id" url:"instance_id,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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       string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated         Optional[string] `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 string           `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 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"` |  | ||||||
| 	OpenRegistration           bool             `json:"open_registration" url:"open_registration,omitempty"` |  | ||||||
| 	EnableNSFW                 bool             `json:"enable_nsfw" url:"enable_nsfw,omitempty"` |  | ||||||
| 	AdminOnlyCommunityCreation bool             `json:"community_creation_admin_only" url:"community_creation_admin_only,omitempty"` |  | ||||||
| 	RequireEmailVerification   bool             `json:"require_email_verification" url:"require_email_verification,omitempty"` |  | ||||||
| 	RequireApplication         bool             `json:"require_application" url:"require_application,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     string           `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         int              `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` |  | ||||||
| 	FederationEnabled          bool             `json:"federation_enabled" url:"federation_enabled,omitempty"` |  | ||||||
| 	FederationDebug            bool             `json:"federation_debug" url:"federation_debug,omitempty"` |  | ||||||
| 	FederationStrictAllowlist  bool             `json:"federation_strict_allowlist" url:"federation_strict_allowlist,omitempty"` |  | ||||||
| 	FederationRetryLimit       int              `json:"federation_http_fetch_retry_limit" url:"federation_http_fetch_retry_limit,omitempty"` |  | ||||||
| 	FederationWorkerCount      int              `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                  string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated                    Optional[string] `json:"updated" url:"updated,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type LocalSiteRateLimit struct { |  | ||||||
| 	ID                int              `json:"id" url:"id,omitempty"` |  | ||||||
| 	LocalSiteID       int              `json:"local_site_id" url:"local_site_id,omitempty"` |  | ||||||
| 	Message           int              `json:"message" url:"message,omitempty"` |  | ||||||
| 	MessagePerSecond  int              `json:"message_per_second" url:"message_per_second,omitempty"` |  | ||||||
| 	Post              int              `json:"post" url:"post,omitempty"` |  | ||||||
| 	PostPerSecond     int              `json:"post_per_second" url:"post_per_second,omitempty"` |  | ||||||
| 	Register          int              `json:"register" url:"register,omitempty"` |  | ||||||
| 	RegisterPerSecond int              `json:"register_per_second" url:"register_per_second,omitempty"` |  | ||||||
| 	Image             int              `json:"image" url:"image,omitempty"` |  | ||||||
| 	ImagePerSecond    int              `json:"image_per_second" url:"image_per_second,omitempty"` |  | ||||||
| 	Comment           int              `json:"comment" url:"comment,omitempty"` |  | ||||||
| 	CommentPerSecond  int              `json:"comment_per_second" url:"comment_per_second,omitempty"` |  | ||||||
| 	Search            int              `json:"search" url:"search,omitempty"` |  | ||||||
| 	SearchPerSecond   int              `json:"search_per_second" url:"search_per_second,omitempty"` |  | ||||||
| 	Published         string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated           Optional[string] `json:"updated" url:"updated,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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   string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated     Optional[string] `json:"updated" url:"updated,omitempty"` |  | ||||||
| 	ApID        string           `json:"ap_id" url:"ap_id,omitempty"` |  | ||||||
| 	Local       bool             `json:"local" url:"local,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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        string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated          Optional[string] `json:"updated" url:"updated,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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        string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated          Optional[string] `json:"updated" url:"updated,omitempty"` |  | ||||||
| 	Deleted          bool             `json:"deleted" url:"deleted,omitempty"` |  | ||||||
| 	NSFW             bool             `json:"nsfw" url:"nsfw,omitempty"` |  | ||||||
| 	Stickied         bool             `json:"stickied" url:"stickied,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             string           `json:"ap_id" url:"ap_id,omitempty"` |  | ||||||
| 	Local            bool             `json:"local" url:"local,omitempty"` |  | ||||||
| 	LanguageID       int              `json:"language_id" url:"language_id,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PasswordResetRequest struct { |  | ||||||
| 	ID             int    `json:"id" url:"id,omitempty"` |  | ||||||
| 	LocalUserID    int    `json:"local_user_id" url:"local_user_id,omitempty"` |  | ||||||
| 	TokenEncrypted string `json:"token_encrypted" url:"token_encrypted,omitempty"` |  | ||||||
| 	Published      string `json:"published" url:"published,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModRemovePost struct { |  | ||||||
| 	ID          int              `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     Optional[bool]   `json:"removed" url:"removed,omitempty"` |  | ||||||
| 	When        string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModLockPost struct { |  | ||||||
| 	ID          int            `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      Optional[bool] `json:"locked" url:"locked,omitempty"` |  | ||||||
| 	When        string         `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ModStickyPost represents a post stickied by a moderator. |  | ||||||
| type ModStickyPost struct { |  | ||||||
| 	ID          int            `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"` |  | ||||||
| 	Stickied    Optional[bool] `json:"stickied" url:"stickied,omitempty"` |  | ||||||
| 	When        string         `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ModRemoveComment represents a comment removal by a moderator. |  | ||||||
| type ModRemoveComment struct { |  | ||||||
| 	ID          int              `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     Optional[bool]   `json:"removed" url:"removed,omitempty"` |  | ||||||
| 	When        string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ModRemoveCommunity represents a community removal by a moderator. |  | ||||||
| type ModRemoveCommunity struct { |  | ||||||
| 	ID          int              `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     Optional[bool]   `json:"removed" url:"removed,omitempty"` |  | ||||||
| 	Expires     Optional[string] `json:"expires" url:"expires,omitempty"` |  | ||||||
| 	When        string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ModBanFromCommunity represents a user being banned from a community by a moderator. |  | ||||||
| type ModBanFromCommunity struct { |  | ||||||
| 	ID            int              `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        Optional[bool]   `json:"banned" url:"banned,omitempty"` |  | ||||||
| 	Expires       Optional[string] `json:"expires" url:"expires,omitempty"` |  | ||||||
| 	When          string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ModBan represents a user being banned by a moderator. |  | ||||||
| type ModBan struct { |  | ||||||
| 	ID            int              `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        Optional[bool]   `json:"banned" url:"banned,omitempty"` |  | ||||||
| 	Expires       Optional[string] `json:"expires" url:"expires,omitempty"` |  | ||||||
| 	When          string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ModAddCommunity represents a user being added as a moderator of a community. |  | ||||||
| type ModAddCommunity struct { |  | ||||||
| 	ID            int            `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       Optional[bool] `json:"removed" url:"removed,omitempty"` |  | ||||||
| 	When          string         `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ModTransferCommunity represents a community being transferred to another moderator. |  | ||||||
| type ModTransferCommunity struct { |  | ||||||
| 	ID            int            `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       Optional[bool] `json:"removed" url:"removed,omitempty"` |  | ||||||
| 	When          string         `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // ModAdd represents a user being added as a moderator. |  | ||||||
| type ModAdd struct { |  | ||||||
| 	ID            int            `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       Optional[bool] `json:"removed" url:"removed,omitempty"` |  | ||||||
| 	When          string         `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type AdminPurgePerson struct { |  | ||||||
| 	ID            int              `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          string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type AdminPurgeCommunity struct { |  | ||||||
| 	ID            int              `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          string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type AdminPurgePost struct { |  | ||||||
| 	ID            int              `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          string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type AdminPurgeComment struct { |  | ||||||
| 	ID            int              `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          string           `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunitySafe 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               string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated                 Optional[string] `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"` |  | ||||||
| 	Icon                    Optional[string] `json:"icon" url:"icon,omitempty"` |  | ||||||
| 	Banner                  Optional[string] `json:"banner" url:"banner,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"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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           string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated             Optional[string] `json:"updated" url:"updated,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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     string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated       Optional[string] `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 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   string `json:"published" url:"published,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type Language struct { |  | ||||||
| 	ID   int    `json:"id" url:"id,omitempty"` |  | ||||||
| 	Code string `json:"code" url:"code,omitempty"` |  | ||||||
| 	Name string `json:"name" url:"name,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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        string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated          Optional[string] `json:"updated" url:"updated,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type RegistrationApplication struct { |  | ||||||
| 	ID          int              `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   string           `json:"published" url:"published,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModHideCommunityView struct { |  | ||||||
| 	ModHideCommunity ModHideCommunity     `json:"mod_hide_community" url:"mod_hide_community,omitempty"` |  | ||||||
| 	Admin            Optional[PersonSafe] `json:"admin" url:"admin,omitempty"` |  | ||||||
| 	Community        CommunitySafe        `json:"community" url:"community,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModHideCommunity struct { |  | ||||||
| 	ID          int              `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"` |  | ||||||
| 	Reason      Optional[string] `json:"reason" url:"reason,omitempty"` |  | ||||||
| 	Hidden      Optional[bool]   `json:"hidden" url:"hidden,omitempty"` |  | ||||||
| 	When        time.Time        `json:"when_" url:"when_,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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   string `json:"published" url:"published,omitempty"` |  | ||||||
| } |  | ||||||
							
								
								
									
										78
									
								
								types/structs.1.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								types/structs.1.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,78 @@ | |||||||
|  | //  Source: lemmy/crates/db_views/src/structs.rs | ||||||
|  | // Code generated by go.arsenm.dev/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                  CommunitySafe              `json:"community" url:"community,omitempty"` | ||||||
|  | 	Creator                    PersonSafe                 `json:"creator" url:"creator,omitempty"` | ||||||
|  | 	CommentCreator             PersonSafeAlias1           `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[PersonSafeAlias2] `json:"resolver" url:"resolver,omitempty"` | ||||||
|  | } | ||||||
|  | type CommentView struct { | ||||||
|  | 	Comment                    Comment                    `json:"comment" url:"comment,omitempty"` | ||||||
|  | 	Creator                    PersonSafe                 `json:"creator" url:"creator,omitempty"` | ||||||
|  | 	Recipient                  Optional[PersonSafeAlias1] `json:"recipient" url:"recipient,omitempty"` | ||||||
|  | 	Post                       Post                       `json:"post" url:"post,omitempty"` | ||||||
|  | 	Community                  CommunitySafe              `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                 bool                       `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 LocalUserSettingsView struct { | ||||||
|  | 	LocalUser LocalUserSettings `json:"local_user" url:"local_user,omitempty"` | ||||||
|  | 	Person    PersonSafe        `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                  CommunitySafe              `json:"community" url:"community,omitempty"` | ||||||
|  | 	Creator                    PersonSafe                 `json:"creator" url:"creator,omitempty"` | ||||||
|  | 	PostCreator                PersonSafeAlias1           `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[PersonSafeAlias2] `json:"resolver" url:"resolver,omitempty"` | ||||||
|  | } | ||||||
|  | type PostView struct { | ||||||
|  | 	Post                       Post            `json:"post" url:"post,omitempty"` | ||||||
|  | 	Creator                    PersonSafe      `json:"creator" url:"creator,omitempty"` | ||||||
|  | 	Community                  CommunitySafe   `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                 bool            `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"` | ||||||
|  | } | ||||||
|  | type PrivateMessageView struct { | ||||||
|  | 	PrivateMessage PrivateMessage   `json:"private_message" url:"private_message,omitempty"` | ||||||
|  | 	Creator        PersonSafe       `json:"creator" url:"creator,omitempty"` | ||||||
|  | 	Recipient      PersonSafeAlias1 `json:"recipient" url:"recipient,omitempty"` | ||||||
|  | } | ||||||
|  | type RegistrationApplicationView struct { | ||||||
|  | 	RegistrationApplication RegistrationApplication    `json:"registration_application" url:"registration_application,omitempty"` | ||||||
|  | 	CreatorLocalUser        LocalUserSettings          `json:"creator_local_user" url:"creator_local_user,omitempty"` | ||||||
|  | 	Creator                 PersonSafe                 `json:"creator" url:"creator,omitempty"` | ||||||
|  | 	Admin                   Optional[PersonSafeAlias1] `json:"admin" url:"admin,omitempty"` | ||||||
|  | } | ||||||
|  | type SiteView struct { | ||||||
|  | 	Site   Site           `json:"site" url:"site,omitempty"` | ||||||
|  | 	Counts SiteAggregates `json:"counts" url:"counts,omitempty"` | ||||||
|  | } | ||||||
							
								
								
									
										69
									
								
								types/structs.2.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								types/structs.2.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | |||||||
|  | //  Source: lemmy/crates/db_views_moderator/src/structs.rs | ||||||
|  | // Code generated by go.arsenm.dev/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       PersonSafe       `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	Community       CommunitySafe    `json:"community" url:"community,omitempty"` | ||||||
|  | 	ModdedPerson    PersonSafeAlias1 `json:"modded_person" url:"modded_person,omitempty"` | ||||||
|  | } | ||||||
|  | type ModAddView struct { | ||||||
|  | 	ModAdd       ModAdd           `json:"mod_add" url:"mod_add,omitempty"` | ||||||
|  | 	Moderator    PersonSafe       `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	ModdedPerson PersonSafeAlias1 `json:"modded_person" url:"modded_person,omitempty"` | ||||||
|  | } | ||||||
|  | type ModBanFromCommunityView struct { | ||||||
|  | 	ModBanFromCommunity ModBanFromCommunity `json:"mod_ban_from_community" url:"mod_ban_from_community,omitempty"` | ||||||
|  | 	Moderator           PersonSafe          `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	Community           CommunitySafe       `json:"community" url:"community,omitempty"` | ||||||
|  | 	BannedPerson        PersonSafeAlias1    `json:"banned_person" url:"banned_person,omitempty"` | ||||||
|  | } | ||||||
|  | type ModBanView struct { | ||||||
|  | 	ModBan       ModBan           `json:"mod_ban" url:"mod_ban,omitempty"` | ||||||
|  | 	Moderator    PersonSafe       `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	BannedPerson PersonSafeAlias1 `json:"banned_person" url:"banned_person,omitempty"` | ||||||
|  | } | ||||||
|  | type ModHideCommunityView struct { | ||||||
|  | 	ModHideCommunity ModHideCommunity `json:"mod_hide_community" url:"mod_hide_community,omitempty"` | ||||||
|  | 	Admin            PersonSafe       `json:"admin" url:"admin,omitempty"` | ||||||
|  | 	Community        CommunitySafe    `json:"community" url:"community,omitempty"` | ||||||
|  | } | ||||||
|  | type ModLockPostView struct { | ||||||
|  | 	ModLockPost ModLockPost   `json:"mod_lock_post" url:"mod_lock_post,omitempty"` | ||||||
|  | 	Moderator   PersonSafe    `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	Post        Post          `json:"post" url:"post,omitempty"` | ||||||
|  | 	Community   CommunitySafe `json:"community" url:"community,omitempty"` | ||||||
|  | } | ||||||
|  | type ModRemoveCommentView struct { | ||||||
|  | 	ModRemoveComment ModRemoveComment `json:"mod_remove_comment" url:"mod_remove_comment,omitempty"` | ||||||
|  | 	Moderator        PersonSafe       `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	Comment          Comment          `json:"comment" url:"comment,omitempty"` | ||||||
|  | 	Commenter        PersonSafeAlias1 `json:"commenter" url:"commenter,omitempty"` | ||||||
|  | 	Post             Post             `json:"post" url:"post,omitempty"` | ||||||
|  | 	Community        CommunitySafe    `json:"community" url:"community,omitempty"` | ||||||
|  | } | ||||||
|  | type ModRemoveCommunityView struct { | ||||||
|  | 	ModRemoveCommunity ModRemoveCommunity `json:"mod_remove_community" url:"mod_remove_community,omitempty"` | ||||||
|  | 	Moderator          PersonSafe         `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	Community          CommunitySafe      `json:"community" url:"community,omitempty"` | ||||||
|  | } | ||||||
|  | type ModRemovePostView struct { | ||||||
|  | 	ModRemovePost ModRemovePost `json:"mod_remove_post" url:"mod_remove_post,omitempty"` | ||||||
|  | 	Moderator     PersonSafe    `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	Post          Post          `json:"post" url:"post,omitempty"` | ||||||
|  | 	Community     CommunitySafe `json:"community" url:"community,omitempty"` | ||||||
|  | } | ||||||
|  | type ModStickyPostView struct { | ||||||
|  | 	ModStickyPost ModStickyPost `json:"mod_sticky_post" url:"mod_sticky_post,omitempty"` | ||||||
|  | 	Moderator     PersonSafe    `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	Post          Post          `json:"post" url:"post,omitempty"` | ||||||
|  | 	Community     CommunitySafe `json:"community" url:"community,omitempty"` | ||||||
|  | } | ||||||
|  | type ModTransferCommunityView struct { | ||||||
|  | 	ModTransferCommunity ModTransferCommunity `json:"mod_transfer_community" url:"mod_transfer_community,omitempty"` | ||||||
|  | 	Moderator            PersonSafe           `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | 	Community            CommunitySafe        `json:"community" url:"community,omitempty"` | ||||||
|  | 	ModdedPerson         PersonSafeAlias1     `json:"modded_person" url:"modded_person,omitempty"` | ||||||
|  | } | ||||||
							
								
								
									
										57
									
								
								types/structs.3.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								types/structs.3.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | |||||||
|  | //  Source: lemmy/crates/db_schema/src/aggregates/structs.rs | ||||||
|  | // Code generated by go.arsenm.dev/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"` | ||||||
|  | } | ||||||
|  | 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"` | ||||||
|  | } | ||||||
|  | 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"` | ||||||
|  | 	Stickied               bool      `json:"stickied" url:"stickied,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"` | ||||||
|  | } | ||||||
|  | type SiteAggregates struct { | ||||||
|  | 	ID                  int32 `json:"id" url:"id,omitempty"` | ||||||
|  | 	SiteID              int32 `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"` | ||||||
|  | } | ||||||
							
								
								
									
										49
									
								
								types/structs.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								types/structs.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  | //  Source: lemmy/crates/db_views_actor/src/structs.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
|  |  | ||||||
|  | type CommunityBlockView struct { | ||||||
|  | 	Person    PersonSafe    `json:"person" url:"person,omitempty"` | ||||||
|  | 	Community CommunitySafe `json:"community" url:"community,omitempty"` | ||||||
|  | } | ||||||
|  | type CommunityFollowerView struct { | ||||||
|  | 	Community CommunitySafe `json:"community" url:"community,omitempty"` | ||||||
|  | 	Follower  PersonSafe    `json:"follower" url:"follower,omitempty"` | ||||||
|  | } | ||||||
|  | type CommunityModeratorView struct { | ||||||
|  | 	Community CommunitySafe `json:"community" url:"community,omitempty"` | ||||||
|  | 	Moderator PersonSafe    `json:"moderator" url:"moderator,omitempty"` | ||||||
|  | } | ||||||
|  | type CommunityPersonBanView struct { | ||||||
|  | 	Community CommunitySafe `json:"community" url:"community,omitempty"` | ||||||
|  | 	Person    PersonSafe    `json:"person" url:"person,omitempty"` | ||||||
|  | } | ||||||
|  | type CommunityView struct { | ||||||
|  | 	Community  CommunitySafe       `json:"community" url:"community,omitempty"` | ||||||
|  | 	Subscribed bool                `json:"subscribed" url:"subscribed,omitempty"` | ||||||
|  | 	Blocked    bool                `json:"blocked" url:"blocked,omitempty"` | ||||||
|  | 	Counts     CommunityAggregates `json:"counts" url:"counts,omitempty"` | ||||||
|  | } | ||||||
|  | type PersonBlockView struct { | ||||||
|  | 	Person PersonSafe       `json:"person" url:"person,omitempty"` | ||||||
|  | 	Target PersonSafeAlias1 `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                    PersonSafe        `json:"creator" url:"creator,omitempty"` | ||||||
|  | 	Post                       Post              `json:"post" url:"post,omitempty"` | ||||||
|  | 	Community                  CommunitySafe     `json:"community" url:"community,omitempty"` | ||||||
|  | 	Recipient                  PersonSafeAlias1  `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                 bool              `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 PersonViewSafe struct { | ||||||
|  | 	Person PersonSafe       `json:"person" url:"person,omitempty"` | ||||||
|  | 	Counts PersonAggregates `json:"counts" url:"counts,omitempty"` | ||||||
|  | } | ||||||
| @@ -4,6 +4,7 @@ import ( | |||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  | 	"time" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type LemmyResponse struct { | type LemmyResponse struct { | ||||||
| @@ -27,7 +28,54 @@ func (le LemmyError) Error() string { | |||||||
| 	return fmt.Sprintf("%d %s: %s", le.Code, http.StatusText(le.Code), le.ErrStr) | 	return fmt.Sprintf("%d %s: %s", le.Code, http.StatusText(le.Code), le.ErrStr) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | type LemmyTime struct { | ||||||
|  | 	time.Time | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (lt *LemmyTime) UnmarshalJSON(b []byte) error { | ||||||
|  | 	var timeStr string | ||||||
|  | 	err := json.Unmarshal(b, &timeStr) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if timeStr == "" { | ||||||
|  | 		lt.Time = time.Unix(0, 0) | ||||||
|  | 		return nil | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	t, err := time.Parse("2006-01-02T15:04:05", timeStr) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	lt.Time = t | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
| type LemmyWebSocketMsg struct { | type LemmyWebSocketMsg struct { | ||||||
| 	Op   UserOperation   `json:"op"` | 	Op   string          `json:"op"` | ||||||
| 	Data json.RawMessage `json:"data"` | 	Data json.RawMessage `json:"data"` | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // IsOneOf checks if the message is one of the given operations. | ||||||
|  | func (msg LemmyWebSocketMsg) IsOneOf(ops ...Operation) bool { | ||||||
|  | 	for _, op := range ops { | ||||||
|  | 		if op.Operation() == msg.Op { | ||||||
|  | 			return true | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return false | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type Operation interface { | ||||||
|  | 	Operation() string | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (u UserOperation) Operation() string { | ||||||
|  | 	return string(u) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (u UserOperationCRUD) Operation() string { | ||||||
|  | 	return string(u) | ||||||
|  | } | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								types/utils.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								types/utils.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/utils.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
							
								
								
									
										254
									
								
								types/views.go
									
									
									
									
									
								
							
							
						
						
									
										254
									
								
								types/views.go
									
									
									
									
									
								
							| @@ -1,254 +0,0 @@ | |||||||
| package types |  | ||||||
|  |  | ||||||
| type PersonViewSafe struct { |  | ||||||
| 	Person PersonSafe       `json:"person" url:"person,omitempty"` |  | ||||||
| 	Counts PersonAggregates `json:"counts" url:"counts,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PersonMentionView struct { |  | ||||||
| 	PersonMention              PersonMention     `json:"person_mention" url:"person_mention,omitempty"` |  | ||||||
| 	Comment                    Comment           `json:"comment" url:"comment,omitempty"` |  | ||||||
| 	Creator                    PersonSafe        `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	Post                       Post              `json:"post" url:"post,omitempty"` |  | ||||||
| 	CommunitySafe              CommunitySafe     `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	Recipient                  PersonSafe        `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                 bool              `json:"subscribed" url:"subscribed,omitempty"` |  | ||||||
| 	Saved                      bool              `json:"saved" url:"saved,omitempty"` |  | ||||||
| 	CreatorBlocked             bool              `json:"creator_blocked" url:"creator_blocked,omitempty"` |  | ||||||
| 	MyVote                     Optional[int]     `json:"my_vote" url:"my_vote,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type LocalUserSettingsView struct { |  | ||||||
| 	LocalUserSettings LocalUserSettings `json:"local_user_settings" url:"local_user_settings,omitempty"` |  | ||||||
| 	Person            PersonSafe        `json:"person" url:"person,omitempty"` |  | ||||||
| 	Counts            PersonAggregates  `json:"counts" url:"counts,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"` |  | ||||||
| 	Taglines           Optional[[]Tagline] `json:"taglines" url:"taglines,omitempty"` |  | ||||||
| 	Counts             SiteAggregates      `json:"counts" url:"counts,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PrivateMessageView struct { |  | ||||||
| 	PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"` |  | ||||||
| 	Creator        PersonSafe     `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	Recipient      PersonSafe     `json:"recipient" url:"recipient,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PostView struct { |  | ||||||
| 	Post                       Post           `json:"post" url:"post,omitempty"` |  | ||||||
| 	Creator                    PersonSafe     `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	Community                  CommunitySafe  `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                 bool           `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[int]  `json:"my_vote" url:"my_vote,omitempty"` |  | ||||||
| 	UnreadComments             int            `json:"unread_comments" url:"unread_comments,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PostReportView struct { |  | ||||||
| 	PostReport                 PostReport           `json:"post_report" url:"post_report,omitempty"` |  | ||||||
| 	Post                       Post                 `json:"post" url:"post,omitempty"` |  | ||||||
| 	Community                  CommunitySafe        `json:"community" url:"community,omitempty"` |  | ||||||
| 	Creator                    PersonSafe           `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	PostCreator                PersonSafe           `json:"post_creator" url:"post_creator,omitempty"` |  | ||||||
| 	CreatorBannedFromCommunity bool                 `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` |  | ||||||
| 	MyVote                     Optional[int]        `json:"my_vote" url:"my_vote,omitempty"` |  | ||||||
| 	Counts                     PostAggregates       `json:"counts" url:"counts,omitempty"` |  | ||||||
| 	Resolver                   Optional[PersonSafe] `json:"resolver" url:"resolver,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommentView struct { |  | ||||||
| 	Comment                    Comment           `json:"comment" url:"comment,omitempty"` |  | ||||||
| 	Creator                    PersonSafe        `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	Post                       Post              `json:"post" url:"post,omitempty"` |  | ||||||
| 	Community                  CommunitySafe     `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                 bool              `json:"subscribed" url:"subscribed,omitempty"` |  | ||||||
| 	Saved                      bool              `json:"saved" url:"saved,omitempty"` |  | ||||||
| 	CreatorBlocked             bool              `json:"creator_blocked" url:"creator_blocked,omitempty"` |  | ||||||
| 	MyVote                     Optional[int]     `json:"my_vote" url:"my_vote,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| 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"` |  | ||||||
| 	CommunitySafe              CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	Creator                    PersonSafe           `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	CommentCreator             PersonSafe           `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[int]        `json:"my_vote" url:"my_vote,omitempty"` |  | ||||||
| 	Resolver                   Optional[PersonSafe] `json:"resolver" url:"resolver,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModAddCommunityView struct { |  | ||||||
| 	ModAddCommunity ModAddCommunity      `json:"mod_add_community" url:"mod_add_community,omitempty"` |  | ||||||
| 	Moderator       Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	CommunitySafe   CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	ModdedPerson    PersonSafe           `json:"modded_person" url:"modded_person,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModTransferCommunityView struct { |  | ||||||
| 	ModTransferCommunity ModTransferCommunity `json:"mod_transfer_community" url:"mod_transfer_community,omitempty"` |  | ||||||
| 	Moderator            Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	CommunitySafe        CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	ModdedPerson         PersonSafe           `json:"modded_person" url:"modded_person,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModAddView struct { |  | ||||||
| 	ModAdd       ModAdd               `json:"mod_add" url:"mod_add,omitempty"` |  | ||||||
| 	Moderator    Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	ModdedPerson PersonSafe           `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[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	CommunitySafe       CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	BannedPerson        PersonSafe           `json:"banned_person" url:"banned_person,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModBanView struct { |  | ||||||
| 	ModBan       ModBan               `json:"mod_ban" url:"mod_ban,omitempty"` |  | ||||||
| 	Moderator    Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	BannedPerson PersonSafe           `json:"banned_person" url:"banned_person,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModLockPostView struct { |  | ||||||
| 	ModLockPost   ModLockPost          `json:"mod_lock_post" url:"mod_lock_post,omitempty"` |  | ||||||
| 	Moderator     Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	Post          Post                 `json:"post" url:"post,omitempty"` |  | ||||||
| 	CommunitySafe CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModRemoveCommentView struct { |  | ||||||
| 	ModRemoveComment ModRemoveComment     `json:"mod_remove_comment" url:"mod_remove_comment,omitempty"` |  | ||||||
| 	Moderator        Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	Comment          Comment              `json:"comment" url:"comment,omitempty"` |  | ||||||
| 	Commenter        PersonSafe           `json:"commenter" url:"commenter,omitempty"` |  | ||||||
| 	Post             Post                 `json:"post" url:"post,omitempty"` |  | ||||||
| 	CommunitySafe    CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModRemoveCommunityView struct { |  | ||||||
| 	ModRemoveCommunity ModRemoveCommunity   `json:"mod_remove_community" url:"mod_remove_community,omitempty"` |  | ||||||
| 	Moderator          Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	CommunitySafe      CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModRemovePostView struct { |  | ||||||
| 	ModRemovePost ModRemovePost        `json:"mod_remove_post" url:"mod_remove_post,omitempty"` |  | ||||||
| 	Moderator     Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	Post          Post                 `json:"post" url:"post,omitempty"` |  | ||||||
| 	CommunitySafe CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModStickyPostView struct { |  | ||||||
| 	ModStickyPost ModStickyPost        `json:"mod_sticky_post" url:"mod_sticky_post,omitempty"` |  | ||||||
| 	Moderator     Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| 	Post          Post                 `json:"post" url:"post,omitempty"` |  | ||||||
| 	CommunitySafe CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type AdminPurgeCommunityView struct { |  | ||||||
| 	AdminPurgeCommunity AdminPurgeCommunity  `json:"admin_purge_community" url:"admin_purge_community,omitempty"` |  | ||||||
| 	Admin               Optional[PersonSafe] `json:"admin" url:"admin,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type AdminPurgePersonView struct { |  | ||||||
| 	AdminPurgePerson AdminPurgePerson     `json:"admin_purge_person" url:"admin_purge_person,omitempty"` |  | ||||||
| 	Admin            Optional[PersonSafe] `json:"admin" url:"admin,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type AdminPurgePostView struct { |  | ||||||
| 	AdminPurgePost AdminPurgePost       `json:"admin_purge_post" url:"admin_purge_post,omitempty"` |  | ||||||
| 	Admin          Optional[PersonSafe] `json:"admin" url:"admin,omitempty"` |  | ||||||
| 	CommunitySafe  CommunitySafe        `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type AdminPurgeCommentView struct { |  | ||||||
| 	AdminPurgeComment AdminPurgeComment    `json:"admin_purge_comment" url:"admin_purge_comment,omitempty"` |  | ||||||
| 	Admin             Optional[PersonSafe] `json:"admin" url:"admin,omitempty"` |  | ||||||
| 	Post              Post                 `json:"post" url:"post,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunityFollowerView struct { |  | ||||||
| 	CommunitySafe CommunitySafe `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	Follower      PersonSafe    `json:"follower" url:"follower,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunityBlockView struct { |  | ||||||
| 	PersonSafe    PersonSafe    `json:"person_safe" url:"person_safe,omitempty"` |  | ||||||
| 	CommunitySafe CommunitySafe `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunityModeratorView struct { |  | ||||||
| 	CommunitySafe CommunitySafe `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	Moderator     PersonSafe    `json:"moderator" url:"moderator,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunityPersonBanView struct { |  | ||||||
| 	CommunitySafe CommunitySafe `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	Person        PersonSafe    `json:"person" url:"person,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PersonBlockView struct { |  | ||||||
| 	PersonSafe PersonSafe `json:"person_safe" url:"person_safe,omitempty"` |  | ||||||
| 	Target     PersonSafe `json:"target" url:"target,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunityView struct { |  | ||||||
| 	CommunitySafe CommunitySafe       `json:"community_safe" url:"community_safe,omitempty"` |  | ||||||
| 	Subscribed    bool                `json:"subscribed" url:"subscribed,omitempty"` |  | ||||||
| 	Blocked       bool                `json:"blocked" url:"blocked,omitempty"` |  | ||||||
| 	Counts        CommunityAggregates `json:"counts" url:"counts,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type RegistrationApplicationView struct { |  | ||||||
| 	RegistrationApplication RegistrationApplication `json:"registration_application" url:"registration_application,omitempty"` |  | ||||||
| 	CreatorLocalUser        LocalUserSettings       `json:"creator_local_user" url:"creator_local_user,omitempty"` |  | ||||||
| 	Creator                 PersonSafe              `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	Admin                   Optional[PersonSafe]    `json:"admin" url:"admin,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 PersonSafe           `json:"private_message_creator" url:"private_message_creator,omitempty"` |  | ||||||
| 	Creator               PersonSafe           `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	Resolver              Optional[PersonSafe] `json:"resolver" url:"resolver,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type Tagline struct { |  | ||||||
| 	ID          int              `json:"id" url:"id,omitempty"` |  | ||||||
| 	LocalSiteID int              `json:"local_site_id" url:"local_site_id,omitempty"` |  | ||||||
| 	Content     string           `json:"content" url:"content,omitempty"` |  | ||||||
| 	Published   string           `json:"published" url:"published,omitempty"` |  | ||||||
| 	Updated     Optional[string] `json:"updated" url:"updated,omitempty"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommentReplyView struct { |  | ||||||
| 	CommentReply               CommentReply      `json:"comment_reply" url:"comment_reply,omitempty"` |  | ||||||
| 	Comment                    Comment           `json:"comment" url:"comment,omitempty"` |  | ||||||
| 	Creator                    PersonSafe        `json:"creator" url:"creator,omitempty"` |  | ||||||
| 	Post                       Post              `json:"post" url:"post,omitempty"` |  | ||||||
| 	Community                  CommunitySafe     `json:"community" url:"community,omitempty"` |  | ||||||
| 	Recipient                  PersonSafe        `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                 bool              `json:"subscribed" url:"subscribed,omitempty"` |  | ||||||
| 	Saved                      bool              `json:"saved" url:"saved,omitempty"` |  | ||||||
| 	CreatorBlocked             bool              `json:"creator_blocked" url:"creator_blocked,omitempty"` |  | ||||||
| 	MyVote                     Optional[int]     `json:"my_vote" url:"my_vote,omitempty"` |  | ||||||
| } |  | ||||||
							
								
								
									
										33
									
								
								types/websocket.gen.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								types/websocket.gen.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | //  Source: lemmy/crates/api_common/src/websocket.rs | ||||||
|  | // Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. | ||||||
|  |  | ||||||
|  | package types | ||||||
|  |  | ||||||
|  | type UserJoin struct { | ||||||
|  | 	Auth string `json:"auth" url:"auth,omitempty"` | ||||||
|  | } | ||||||
|  | type UserJoinResponse struct { | ||||||
|  | 	Joined bool `json:"joined" url:"joined,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
|  | type CommunityJoin struct { | ||||||
|  | 	CommunityID int `json:"community_id" url:"community_id,omitempty"` | ||||||
|  | } | ||||||
|  | type CommunityJoinResponse struct { | ||||||
|  | 	Joined bool `json:"joined" url:"joined,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
|  | type ModJoin struct { | ||||||
|  | 	CommunityID int `json:"community_id" url:"community_id,omitempty"` | ||||||
|  | } | ||||||
|  | type ModJoinResponse struct { | ||||||
|  | 	Joined bool `json:"joined" url:"joined,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
|  | type PostJoin struct { | ||||||
|  | 	PostID int `json:"post_id" url:"post_id,omitempty"` | ||||||
|  | } | ||||||
|  | type PostJoinResponse struct { | ||||||
|  | 	Joined bool `json:"joined" url:"joined,omitempty"` | ||||||
|  | 	LemmyResponse | ||||||
|  | } | ||||||
| @@ -1,37 +0,0 @@ | |||||||
| package types |  | ||||||
|  |  | ||||||
| type UserJoin struct { |  | ||||||
| 	Auth string `json:"auth"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type UserJoinResponse struct { |  | ||||||
| 	Joined bool `json:"joined"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunityJoin struct { |  | ||||||
| 	CommunityID int `json:"community_id"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type CommunityJoinResponse struct { |  | ||||||
| 	Joined bool `json:"joined"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModJoin struct { |  | ||||||
| 	CommunityID int `json:"community_id"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type ModJoinResponse struct { |  | ||||||
| 	Joined bool `json:"joined"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PostJoin struct { |  | ||||||
| 	PostID int `json:"post_id"` |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type PostJoinResponse struct { |  | ||||||
| 	Joined bool `json:"joined"` |  | ||||||
| 	LemmyResponse |  | ||||||
| } |  | ||||||
							
								
								
									
										53
									
								
								websocket.go
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								websocket.go
									
									
									
									
									
								
							| @@ -6,9 +6,8 @@ import ( | |||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"net/url" | 	"net/url" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"time" |  | ||||||
|  |  | ||||||
| 	"github.com/recws-org/recws" | 	"github.com/gorilla/websocket" | ||||||
| 	"go.arsenm.dev/go-lemmy/types" | 	"go.arsenm.dev/go-lemmy/types" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -16,29 +15,31 @@ type authData struct { | |||||||
| 	Auth string `json:"auth"` | 	Auth string `json:"auth"` | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // WSClient is a client for Lemmy's WebSocket API | ||||||
| type WSClient struct { | type WSClient struct { | ||||||
| 	conn    *recws.RecConn | 	conn    *websocket.Conn | ||||||
| 	baseURL *url.URL | 	baseURL *url.URL | ||||||
| 	respCh  chan types.LemmyWebSocketMsg | 	respCh  chan types.LemmyWebSocketMsg | ||||||
| 	errCh   chan error | 	errCh   chan error | ||||||
| 	token   string | 	Token   string | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // NewWebSocket creates and returns a new WSClient, and | ||||||
|  | // starts a goroutine to read server responses and errors | ||||||
| func NewWebSocket(baseURL string) (*WSClient, error) { | func NewWebSocket(baseURL string) (*WSClient, error) { | ||||||
| 	ws := &recws.RecConn{ |  | ||||||
| 		KeepAliveTimeout: 10 * time.Second, |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	u, err := url.Parse(baseURL) | 	u, err := url.Parse(baseURL) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
| 	u = u.JoinPath("/api/v3") | 	u = u.JoinPath("/api/v3") | ||||||
|  |  | ||||||
| 	ws.Dial(u.JoinPath("ws").String(), nil) | 	conn, _, err := websocket.DefaultDialer.Dial(u.JoinPath("ws").String(), nil) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	out := &WSClient{ | 	out := &WSClient{ | ||||||
| 		conn:    ws, | 		conn:    conn, | ||||||
| 		baseURL: u, | 		baseURL: u, | ||||||
| 		respCh:  make(chan types.LemmyWebSocketMsg, 10), | 		respCh:  make(chan types.LemmyWebSocketMsg, 10), | ||||||
| 		errCh:   make(chan error, 10), | 		errCh:   make(chan error, 10), | ||||||
| @@ -47,7 +48,7 @@ func NewWebSocket(baseURL string) (*WSClient, error) { | |||||||
| 	go func() { | 	go func() { | ||||||
| 		for { | 		for { | ||||||
| 			var msg types.LemmyWebSocketMsg | 			var msg types.LemmyWebSocketMsg | ||||||
| 			err = ws.ReadJSON(&msg) | 			err = conn.ReadJSON(&msg) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				out.errCh <- err | 				out.errCh <- err | ||||||
| 				continue | 				continue | ||||||
| @@ -59,7 +60,10 @@ func NewWebSocket(baseURL string) (*WSClient, error) { | |||||||
| 	return out, nil | 	return out, nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func (c *WSClient) Login(ctx context.Context, l types.Login) error { | // ClientLogin logs in to Lemmy by sending an HTTP request to the | ||||||
|  | // login endpoint. It stores the returned token in the client | ||||||
|  | // for future use. | ||||||
|  | func (c *WSClient) ClientLogin(ctx context.Context, l types.Login) error { | ||||||
| 	u := &url.URL{} | 	u := &url.URL{} | ||||||
| 	*u = *c.baseURL | 	*u = *c.baseURL | ||||||
|  |  | ||||||
| @@ -70,15 +74,19 @@ func (c *WSClient) Login(ctx context.Context, l types.Login) error { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	hc := &Client{baseURL: u, client: http.DefaultClient} | 	hc := &Client{baseURL: u, client: http.DefaultClient} | ||||||
| 	err := hc.Login(ctx, l) | 	err := hc.ClientLogin(ctx, l) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 	c.token = hc.token | 	c.Token = hc.Token | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func (c *WSClient) Request(op types.UserOperation, data any) error { | // Request sends a request to the server. If data is nil, | ||||||
|  | // the authentication token will be sent instead. If data | ||||||
|  | // has an Auth field, it will be set to the authentication | ||||||
|  | // token automatically. | ||||||
|  | func (c *WSClient) Request(op types.Operation, data any) error { | ||||||
| 	if data == nil { | 	if data == nil { | ||||||
| 		data = authData{} | 		data = authData{} | ||||||
| 	} | 	} | ||||||
| @@ -91,19 +99,28 @@ func (c *WSClient) Request(op types.UserOperation, data any) error { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return c.conn.WriteJSON(types.LemmyWebSocketMsg{ | 	return c.conn.WriteJSON(types.LemmyWebSocketMsg{ | ||||||
| 		Op:   op, | 		Op:   op.Operation(), | ||||||
| 		Data: d, | 		Data: d, | ||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Responses returns a channel that receives messages from | ||||||
|  | // Lemmy. | ||||||
| func (c *WSClient) Responses() <-chan types.LemmyWebSocketMsg { | func (c *WSClient) Responses() <-chan types.LemmyWebSocketMsg { | ||||||
| 	return c.respCh | 	return c.respCh | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Errors returns a channel that receives errors | ||||||
|  | // received while attempting to read responses | ||||||
| func (c *WSClient) Errors() <-chan error { | func (c *WSClient) Errors() <-chan error { | ||||||
| 	return c.errCh | 	return c.errCh | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // setAuth uses reflection to automatically | ||||||
|  | // set struct fields called Auth of type | ||||||
|  | // string or types.Optional[string] to the | ||||||
|  | // authentication token, then returns the | ||||||
|  | // updated struct | ||||||
| func (c *WSClient) setAuth(data any) any { | func (c *WSClient) setAuth(data any) any { | ||||||
| 	val := reflect.New(reflect.TypeOf(data)) | 	val := reflect.New(reflect.TypeOf(data)) | ||||||
| 	val.Elem().Set(reflect.ValueOf(data)) | 	val.Elem().Set(reflect.ValueOf(data)) | ||||||
| @@ -115,10 +132,10 @@ func (c *WSClient) setAuth(data any) any { | |||||||
|  |  | ||||||
| 	switch authField.Type().String() { | 	switch authField.Type().String() { | ||||||
| 	case "string": | 	case "string": | ||||||
| 		authField.SetString(c.token) | 		authField.SetString(c.Token) | ||||||
| 	case "types.Optional[string]": | 	case "types.Optional[string]": | ||||||
| 		setMtd := authField.MethodByName("Set") | 		setMtd := authField.MethodByName("Set") | ||||||
| 		out := setMtd.Call([]reflect.Value{reflect.ValueOf(c.token)}) | 		out := setMtd.Call([]reflect.Value{reflect.ValueOf(c.Token)}) | ||||||
| 		authField.Set(out[0]) | 		authField.Set(out[0]) | ||||||
| 	default: | 	default: | ||||||
| 		return data | 		return data | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user