Compare commits
4 Commits
e5092d3898
...
2e4f4281de
Author | SHA1 | Date | |
---|---|---|---|
2e4f4281de | |||
b32e07b887 | |||
862bcd5164 | |||
8e0208dec2 |
@ -19,6 +19,8 @@ func NewRoutes(w io.Writer, pkgName string) *RoutesGenerator {
|
||||
|
||||
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]
|
||||
|
||||
|
@ -19,6 +19,8 @@ func NewStruct(w io.Writer, pkgName string) *StructGenerator {
|
||||
|
||||
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
|
||||
|
@ -242,6 +242,10 @@ func TransformNameGo(s string) string {
|
||||
out += "URL"
|
||||
case "nsfw":
|
||||
out += "NSFW"
|
||||
case "jwt":
|
||||
out += "JWT"
|
||||
case "crud":
|
||||
out += "CRUD"
|
||||
default:
|
||||
if len(segment) == 0 {
|
||||
continue
|
||||
|
2
lemmy.go
2
lemmy.go
@ -45,7 +45,7 @@ func (c *Client) ClientLogin(ctx context.Context, l types.Login) error {
|
||||
return err
|
||||
}
|
||||
|
||||
c.Token = lr.Jwt.MustValue()
|
||||
c.Token = lr.JWT.MustValue()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (routes generator). DO NOT EDIT.
|
||||
|
||||
package lemmy
|
||||
|
||||
import (
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type Activity struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type Comment struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type CreateComment struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type CommentReport struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type Community struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type GetCommunity struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type CommunityBlock struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type EmailVerification struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type SortType string
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type UserOperation string
|
||||
|
@ -1 +1,3 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type LocalUser struct {
|
||||
|
@ -1 +1,3 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type ModRemovePost struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type PasswordResetRequest struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type Person struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type Login struct {
|
||||
@ -54,7 +56,7 @@ type ChangePassword struct {
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type LoginResponse struct {
|
||||
Jwt Optional[string] `json:"jwt" url:"jwt,omitempty"`
|
||||
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
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type PersonBlock struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type PersonMention struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type Post struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type CreatePost struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type PostReport struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type PrivateMessage struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type RegistrationApplication struct {
|
||||
|
@ -1 +1,3 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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"`
|
||||
JWTSecret string `json:"jwt_secret" url:"jwt_secret,omitempty"`
|
||||
}
|
||||
|
@ -1 +1,3 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type Site struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type Search struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type CommentReportView struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type ModAddCommunityView struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type CommentAggregates struct {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type CommunityBlockView struct {
|
||||
|
@ -1 +1,3 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Code generated by go.arsenm.dev/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type UserJoin struct {
|
||||
|
Loading…
Reference in New Issue
Block a user