Merge types package into root lemmy package
This commit is contained in:
parent
2511d0dcc7
commit
c40ad29ae1
@ -28,11 +28,11 @@ func (r *RoutesGenerator) Generate(routes []extractor.Route) error {
|
|||||||
).Id(transformName(r.Name)).ParamsFunc(func(g *jen.Group) {
|
).Id(transformName(r.Name)).ParamsFunc(func(g *jen.Group) {
|
||||||
g.Id("ctx").Qual("context", "Context")
|
g.Id("ctx").Qual("context", "Context")
|
||||||
if r.ParamsName != "" {
|
if r.ParamsName != "" {
|
||||||
g.Id("data").Qual("go.elara.ws/go-lemmy/types", r.ParamsName)
|
g.Id("data").Id(r.ParamsName)
|
||||||
}
|
}
|
||||||
}).ParamsFunc(func(g *jen.Group) {
|
}).ParamsFunc(func(g *jen.Group) {
|
||||||
if r.ReturnName != "" {
|
if r.ReturnName != "" {
|
||||||
g.Op("*").Qual("go.elara.ws/go-lemmy/types", r.ReturnName)
|
g.Op("*").Id(r.ReturnName)
|
||||||
}
|
}
|
||||||
g.Error()
|
g.Error()
|
||||||
}).BlockFunc(func(g *jen.Group) {
|
}).BlockFunc(func(g *jen.Group) {
|
||||||
@ -47,7 +47,7 @@ func (r *RoutesGenerator) Generate(routes []extractor.Route) error {
|
|||||||
returnName = "EmptyResponse"
|
returnName = "EmptyResponse"
|
||||||
}
|
}
|
||||||
|
|
||||||
g.Id("resData").Op(":=").Op("&").Qual("go.elara.ws/go-lemmy/types", returnName).Block()
|
g.Id("resData").Op(":=").Op("&").Id(returnName).Block()
|
||||||
|
|
||||||
funcName := "req"
|
funcName := "req"
|
||||||
if r.Method == "GET" {
|
if r.Method == "GET" {
|
||||||
|
@ -27,18 +27,13 @@ func main() {
|
|||||||
|
|
||||||
routes, structs := e.Extract()
|
routes, structs := e.Extract()
|
||||||
|
|
||||||
err = os.MkdirAll(filepath.Join(*outDir, "types"), 0o755)
|
otf, err := os.Create(filepath.Join(*outDir, "types.gen.go"))
|
||||||
if err != nil {
|
|
||||||
log.Fatal("Error creating types directory").Err(err).Send()
|
|
||||||
}
|
|
||||||
|
|
||||||
otf, err := os.Create(filepath.Join(*outDir, "types/types.gen.go"))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error creating types output file").Err(err).Send()
|
log.Fatal("Error creating types output file").Err(err).Send()
|
||||||
}
|
}
|
||||||
defer otf.Close()
|
defer otf.Close()
|
||||||
|
|
||||||
err = generator.NewStruct(otf, "types").Generate(structs)
|
err = generator.NewStruct(otf, "lemmy").Generate(structs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error generating output routes file").Err(err).Send()
|
log.Fatal("Error generating output routes file").Err(err).Send()
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package types
|
package lemmy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"go.elara.ws/go-lemmy"
|
"go.elara.ws/go-lemmy"
|
||||||
"go.elara.ws/go-lemmy/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -15,7 +14,7 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.ClientLogin(ctx, types.Login{
|
err = c.ClientLogin(ctx, lemmy.Login{
|
||||||
UsernameOrEmail: "user@example.com",
|
UsernameOrEmail: "user@example.com",
|
||||||
Password: `TestPwd`,
|
Password: `TestPwd`,
|
||||||
})
|
})
|
||||||
@ -23,8 +22,8 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = c.SaveUserSettings(ctx, types.SaveUserSettings{
|
_, err = c.SaveUserSettings(ctx, lemmy.SaveUserSettings{
|
||||||
BotAccount: types.NewOptional(true),
|
BotAccount: lemmy.NewOptional(true),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
9
lemmy.go
9
lemmy.go
@ -9,7 +9,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"go.elara.ws/go-lemmy/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client is a client for Lemmy's HTTP API
|
// Client is a client for Lemmy's HTTP API
|
||||||
@ -36,7 +35,7 @@ func NewWithClient(baseURL string, client *http.Client) (*Client, error) {
|
|||||||
|
|
||||||
// ClientLogin logs in to Lemmy by calling the Lemmy endpoint,
|
// ClientLogin logs in to Lemmy by calling the Lemmy endpoint,
|
||||||
// and stores the returned token for use in future requests.
|
// and stores the returned token for use in future requests.
|
||||||
func (c *Client) ClientLogin(ctx context.Context, l types.Login) error {
|
func (c *Client) ClientLogin(ctx context.Context, l Login) error {
|
||||||
lr, err := c.Login(ctx, l)
|
lr, err := c.Login(ctx, l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -132,14 +131,14 @@ func (c *Client) getReq(ctx context.Context, method string, path string, data, r
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resError returns an error if the the response contains an error
|
// resError returns an error if the the response contains an error
|
||||||
func resError(res *http.Response, lr types.LemmyResponse) error {
|
func resError(res *http.Response, lr LemmyResponse) error {
|
||||||
if lr.Error.IsValid() {
|
if lr.Error.IsValid() {
|
||||||
return types.LemmyError{
|
return LemmyError{
|
||||||
Code: res.StatusCode,
|
Code: res.StatusCode,
|
||||||
ErrStr: lr.Error.MustValue(),
|
ErrStr: lr.Error.MustValue(),
|
||||||
}
|
}
|
||||||
} else if res.StatusCode != http.StatusOK {
|
} else if res.StatusCode != http.StatusOK {
|
||||||
return types.HTTPError{
|
return HTTPError{
|
||||||
Code: res.StatusCode,
|
Code: res.StatusCode,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package types
|
package lemmy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@ -20,11 +20,6 @@ func NewOptional[T any](v T) Optional[T] {
|
|||||||
return Optional[T]{value: &v}
|
return Optional[T]{value: &v}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOptionalPtr creates an optional with the value pointed to by v
|
|
||||||
func NewOptionalPtr[T any](v *T) Optional[T] {
|
|
||||||
return Optional[T]{value: v}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewOptionalNil creates a new nil optional value
|
// NewOptionalNil creates a new nil optional value
|
||||||
func NewOptionalNil[T any]() Optional[T] {
|
func NewOptionalNil[T any]() Optional[T] {
|
||||||
return Optional[T]{}
|
return Optional[T]{}
|
||||||
@ -36,12 +31,6 @@ func (o Optional[T]) Set(v T) Optional[T] {
|
|||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPtr sets the value of the optional to the value bointed to by v
|
|
||||||
func (o Optional[T]) SetPtr(v *T) Optional[T] {
|
|
||||||
o.value = v
|
|
||||||
return o
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNil sets the optional value to nil
|
// SetNil sets the optional value to nil
|
||||||
func (o Optional[T]) SetNil() Optional[T] {
|
func (o Optional[T]) SetNil() Optional[T] {
|
||||||
o.value = nil
|
o.value = nil
|
||||||
@ -77,8 +66,8 @@ func (o Optional[T]) ValueOr(fallback T) T {
|
|||||||
return fallback
|
return fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValueOrEmpty returns the value inside the optional if it exists, or else it returns the zero value of T
|
// ValueOrZero returns the value inside the optional if it exists, or else it returns the zero value of T
|
||||||
func (o Optional[T]) ValueOrEmpty() T {
|
func (o Optional[T]) ValueOrZero() T {
|
||||||
if o.value != nil {
|
if o.value != nil {
|
||||||
return *o.value
|
return *o.value
|
||||||
}
|
}
|
353
routes.gen.go
353
routes.gen.go
@ -2,14 +2,11 @@
|
|||||||
|
|
||||||
package lemmy
|
package lemmy
|
||||||
|
|
||||||
import (
|
import "context"
|
||||||
"context"
|
|
||||||
types "go.elara.ws/go-lemmy/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Add an admin to your site.
|
// Add an admin to your site.
|
||||||
func (c *Client) AddAdmin(ctx context.Context, data types.AddAdmin) (*types.AddAdminResponse, error) {
|
func (c *Client) AddAdmin(ctx context.Context, data AddAdmin) (*AddAdminResponse, error) {
|
||||||
resData := &types.AddAdminResponse{}
|
resData := &AddAdminResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/admin/add", data, &resData)
|
res, err := c.req(ctx, "POST", "/admin/add", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -22,8 +19,8 @@ func (c *Client) AddAdmin(ctx context.Context, data types.AddAdmin) (*types.AddA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a moderator to your community.
|
// Add a moderator to your community.
|
||||||
func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommunity) (*types.AddModToCommunityResponse, error) {
|
func (c *Client) AddModToCommunity(ctx context.Context, data AddModToCommunity) (*AddModToCommunityResponse, error) {
|
||||||
resData := &types.AddModToCommunityResponse{}
|
resData := &AddModToCommunityResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/community/mod", data, &resData)
|
res, err := c.req(ctx, "POST", "/community/mod", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -36,8 +33,8 @@ func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Approve a registration application
|
// Approve a registration application
|
||||||
func (c *Client) ApproveRegistrationApplication(ctx context.Context, data types.ApproveRegistrationApplication) (*types.RegistrationApplicationResponse, error) {
|
func (c *Client) ApproveRegistrationApplication(ctx context.Context, data ApproveRegistrationApplication) (*RegistrationApplicationResponse, error) {
|
||||||
resData := &types.RegistrationApplicationResponse{}
|
resData := &RegistrationApplicationResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/admin/registration_application/approve", data, &resData)
|
res, err := c.req(ctx, "PUT", "/admin/registration_application/approve", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -50,8 +47,8 @@ func (c *Client) ApproveRegistrationApplication(ctx context.Context, data types.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ban a user from a community.
|
// Ban a user from a community.
|
||||||
func (c *Client) BanFromCommunity(ctx context.Context, data types.BanFromCommunity) (*types.BanFromCommunityResponse, error) {
|
func (c *Client) BanFromCommunity(ctx context.Context, data BanFromCommunity) (*BanFromCommunityResponse, error) {
|
||||||
resData := &types.BanFromCommunityResponse{}
|
resData := &BanFromCommunityResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/community/ban_user", data, &resData)
|
res, err := c.req(ctx, "POST", "/community/ban_user", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -64,8 +61,8 @@ func (c *Client) BanFromCommunity(ctx context.Context, data types.BanFromCommuni
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ban a person from your site.
|
// Ban a person from your site.
|
||||||
func (c *Client) BanPerson(ctx context.Context, data types.BanPerson) (*types.BanPersonResponse, error) {
|
func (c *Client) BanPerson(ctx context.Context, data BanPerson) (*BanPersonResponse, error) {
|
||||||
resData := &types.BanPersonResponse{}
|
resData := &BanPersonResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/ban", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/ban", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -78,8 +75,8 @@ func (c *Client) BanPerson(ctx context.Context, data types.BanPerson) (*types.Ba
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Block a community.
|
// Block a community.
|
||||||
func (c *Client) BlockCommunity(ctx context.Context, data types.BlockCommunity) (*types.BlockCommunityResponse, error) {
|
func (c *Client) BlockCommunity(ctx context.Context, data BlockCommunity) (*BlockCommunityResponse, error) {
|
||||||
resData := &types.BlockCommunityResponse{}
|
resData := &BlockCommunityResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/community/block", data, &resData)
|
res, err := c.req(ctx, "POST", "/community/block", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -92,8 +89,8 @@ func (c *Client) BlockCommunity(ctx context.Context, data types.BlockCommunity)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Block an instance.
|
// Block an instance.
|
||||||
func (c *Client) BlockInstance(ctx context.Context, data types.BlockInstance) (*types.BlockInstanceResponse, error) {
|
func (c *Client) BlockInstance(ctx context.Context, data BlockInstance) (*BlockInstanceResponse, error) {
|
||||||
resData := &types.BlockInstanceResponse{}
|
resData := &BlockInstanceResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/site/block", data, &resData)
|
res, err := c.req(ctx, "POST", "/site/block", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -106,8 +103,8 @@ func (c *Client) BlockInstance(ctx context.Context, data types.BlockInstance) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Block a person.
|
// Block a person.
|
||||||
func (c *Client) BlockPerson(ctx context.Context, data types.BlockPerson) (*types.BlockPersonResponse, error) {
|
func (c *Client) BlockPerson(ctx context.Context, data BlockPerson) (*BlockPersonResponse, error) {
|
||||||
resData := &types.BlockPersonResponse{}
|
resData := &BlockPersonResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/block", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/block", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -120,8 +117,8 @@ func (c *Client) BlockPerson(ctx context.Context, data types.BlockPerson) (*type
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Change your user password.
|
// Change your user password.
|
||||||
func (c *Client) ChangePassword(ctx context.Context, data types.ChangePassword) (*types.LoginResponse, error) {
|
func (c *Client) ChangePassword(ctx context.Context, data ChangePassword) (*LoginResponse, error) {
|
||||||
resData := &types.LoginResponse{}
|
resData := &LoginResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/user/change_password", data, &resData)
|
res, err := c.req(ctx, "PUT", "/user/change_password", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -134,8 +131,8 @@ func (c *Client) ChangePassword(ctx context.Context, data types.ChangePassword)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a comment.
|
// Create a comment.
|
||||||
func (c *Client) CreateComment(ctx context.Context, data types.CreateComment) (*types.CommentResponse, error) {
|
func (c *Client) CreateComment(ctx context.Context, data CreateComment) (*CommentResponse, error) {
|
||||||
resData := &types.CommentResponse{}
|
resData := &CommentResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/comment", data, &resData)
|
res, err := c.req(ctx, "POST", "/comment", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -148,8 +145,8 @@ func (c *Client) CreateComment(ctx context.Context, data types.CreateComment) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Report a comment.
|
// Report a comment.
|
||||||
func (c *Client) CreateCommentReport(ctx context.Context, data types.CreateCommentReport) (*types.CommentReportResponse, error) {
|
func (c *Client) CreateCommentReport(ctx context.Context, data CreateCommentReport) (*CommentReportResponse, error) {
|
||||||
resData := &types.CommentReportResponse{}
|
resData := &CommentReportResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/comment/report", data, &resData)
|
res, err := c.req(ctx, "POST", "/comment/report", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -162,8 +159,8 @@ func (c *Client) CreateCommentReport(ctx context.Context, data types.CreateComme
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a new community.
|
// Create a new community.
|
||||||
func (c *Client) CreateCommunity(ctx context.Context, data types.CreateCommunity) (*types.CommunityResponse, error) {
|
func (c *Client) CreateCommunity(ctx context.Context, data CreateCommunity) (*CommunityResponse, error) {
|
||||||
resData := &types.CommunityResponse{}
|
resData := &CommunityResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/community", data, &resData)
|
res, err := c.req(ctx, "POST", "/community", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -176,8 +173,8 @@ func (c *Client) CreateCommunity(ctx context.Context, data types.CreateCommunity
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a new custom emoji
|
// Create a new custom emoji
|
||||||
func (c *Client) CreateCustomEmoji(ctx context.Context, data types.CreateCustomEmoji) (*types.CustomEmojiResponse, error) {
|
func (c *Client) CreateCustomEmoji(ctx context.Context, data CreateCustomEmoji) (*CustomEmojiResponse, error) {
|
||||||
resData := &types.CustomEmojiResponse{}
|
resData := &CustomEmojiResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/custom_emoji", data, &resData)
|
res, err := c.req(ctx, "POST", "/custom_emoji", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -190,8 +187,8 @@ func (c *Client) CreateCustomEmoji(ctx context.Context, data types.CreateCustomE
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a post.
|
// Create a post.
|
||||||
func (c *Client) CreatePost(ctx context.Context, data types.CreatePost) (*types.PostResponse, error) {
|
func (c *Client) CreatePost(ctx context.Context, data CreatePost) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/post", data, &resData)
|
res, err := c.req(ctx, "POST", "/post", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -204,8 +201,8 @@ func (c *Client) CreatePost(ctx context.Context, data types.CreatePost) (*types.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Report a post.
|
// Report a post.
|
||||||
func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostReport) (*types.PostReportResponse, error) {
|
func (c *Client) CreatePostReport(ctx context.Context, data CreatePostReport) (*PostReportResponse, error) {
|
||||||
resData := &types.PostReportResponse{}
|
resData := &PostReportResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/post/report", data, &resData)
|
res, err := c.req(ctx, "POST", "/post/report", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -218,8 +215,8 @@ func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostRepo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a private message.
|
// Create a private message.
|
||||||
func (c *Client) CreatePrivateMessage(ctx context.Context, data types.CreatePrivateMessage) (*types.PrivateMessageResponse, error) {
|
func (c *Client) CreatePrivateMessage(ctx context.Context, data CreatePrivateMessage) (*PrivateMessageResponse, error) {
|
||||||
resData := &types.PrivateMessageResponse{}
|
resData := &PrivateMessageResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/private_message", data, &resData)
|
res, err := c.req(ctx, "POST", "/private_message", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -232,8 +229,8 @@ func (c *Client) CreatePrivateMessage(ctx context.Context, data types.CreatePriv
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a report for a private message.
|
// Create a report for a private message.
|
||||||
func (c *Client) CreatePrivateMessageReport(ctx context.Context, data types.CreatePrivateMessageReport) (*types.PrivateMessageReportResponse, error) {
|
func (c *Client) CreatePrivateMessageReport(ctx context.Context, data CreatePrivateMessageReport) (*PrivateMessageReportResponse, error) {
|
||||||
resData := &types.PrivateMessageReportResponse{}
|
resData := &PrivateMessageReportResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/private_message/report", data, &resData)
|
res, err := c.req(ctx, "POST", "/private_message/report", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -246,8 +243,8 @@ func (c *Client) CreatePrivateMessageReport(ctx context.Context, data types.Crea
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create your site.
|
// Create your site.
|
||||||
func (c *Client) CreateSite(ctx context.Context, data types.CreateSite) (*types.SiteResponse, error) {
|
func (c *Client) CreateSite(ctx context.Context, data CreateSite) (*SiteResponse, error) {
|
||||||
resData := &types.SiteResponse{}
|
resData := &SiteResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/site", data, &resData)
|
res, err := c.req(ctx, "POST", "/site", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -260,8 +257,8 @@ func (c *Client) CreateSite(ctx context.Context, data types.CreateSite) (*types.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete your account.
|
// Delete your account.
|
||||||
func (c *Client) DeleteAccount(ctx context.Context, data types.DeleteAccount) error {
|
func (c *Client) DeleteAccount(ctx context.Context, data DeleteAccount) error {
|
||||||
resData := &types.EmptyResponse{}
|
resData := &EmptyResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/delete_account", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/delete_account", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -274,8 +271,8 @@ func (c *Client) DeleteAccount(ctx context.Context, data types.DeleteAccount) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a comment.
|
// Delete a comment.
|
||||||
func (c *Client) DeleteComment(ctx context.Context, data types.DeleteComment) (*types.CommentResponse, error) {
|
func (c *Client) DeleteComment(ctx context.Context, data DeleteComment) (*CommentResponse, error) {
|
||||||
resData := &types.CommentResponse{}
|
resData := &CommentResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/comment/delete", data, &resData)
|
res, err := c.req(ctx, "POST", "/comment/delete", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -288,8 +285,8 @@ func (c *Client) DeleteComment(ctx context.Context, data types.DeleteComment) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a community.
|
// Delete a community.
|
||||||
func (c *Client) DeleteCommunity(ctx context.Context, data types.DeleteCommunity) (*types.CommunityResponse, error) {
|
func (c *Client) DeleteCommunity(ctx context.Context, data DeleteCommunity) (*CommunityResponse, error) {
|
||||||
resData := &types.CommunityResponse{}
|
resData := &CommunityResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/community/delete", data, &resData)
|
res, err := c.req(ctx, "POST", "/community/delete", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -302,8 +299,8 @@ func (c *Client) DeleteCommunity(ctx context.Context, data types.DeleteCommunity
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a custom emoji
|
// Delete a custom emoji
|
||||||
func (c *Client) DeleteCustomEmoji(ctx context.Context, data types.DeleteCustomEmoji) (*types.DeleteCustomEmojiResponse, error) {
|
func (c *Client) DeleteCustomEmoji(ctx context.Context, data DeleteCustomEmoji) (*DeleteCustomEmojiResponse, error) {
|
||||||
resData := &types.DeleteCustomEmojiResponse{}
|
resData := &DeleteCustomEmojiResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/custom_emoji/delete", data, &resData)
|
res, err := c.req(ctx, "POST", "/custom_emoji/delete", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -316,8 +313,8 @@ func (c *Client) DeleteCustomEmoji(ctx context.Context, data types.DeleteCustomE
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a post.
|
// Delete a post.
|
||||||
func (c *Client) DeletePost(ctx context.Context, data types.DeletePost) (*types.PostResponse, error) {
|
func (c *Client) DeletePost(ctx context.Context, data DeletePost) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/post/delete", data, &resData)
|
res, err := c.req(ctx, "POST", "/post/delete", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -330,8 +327,8 @@ func (c *Client) DeletePost(ctx context.Context, data types.DeletePost) (*types.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a private message.
|
// Delete a private message.
|
||||||
func (c *Client) DeletePrivateMessage(ctx context.Context, data types.DeletePrivateMessage) (*types.PrivateMessageResponse, error) {
|
func (c *Client) DeletePrivateMessage(ctx context.Context, data DeletePrivateMessage) (*PrivateMessageResponse, error) {
|
||||||
resData := &types.PrivateMessageResponse{}
|
resData := &PrivateMessageResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/private_message/delete", data, &resData)
|
res, err := c.req(ctx, "POST", "/private_message/delete", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -344,8 +341,8 @@ func (c *Client) DeletePrivateMessage(ctx context.Context, data types.DeletePriv
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Distinguishes a comment (speak as moderator)
|
// Distinguishes a comment (speak as moderator)
|
||||||
func (c *Client) DistinguishComment(ctx context.Context, data types.DistinguishComment) (*types.CommentResponse, error) {
|
func (c *Client) DistinguishComment(ctx context.Context, data DistinguishComment) (*CommentResponse, error) {
|
||||||
resData := &types.CommentResponse{}
|
resData := &CommentResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/comment/distinguish", data, &resData)
|
res, err := c.req(ctx, "POST", "/comment/distinguish", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -358,8 +355,8 @@ func (c *Client) DistinguishComment(ctx context.Context, data types.DistinguishC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edit a comment.
|
// Edit a comment.
|
||||||
func (c *Client) EditComment(ctx context.Context, data types.EditComment) (*types.CommentResponse, error) {
|
func (c *Client) EditComment(ctx context.Context, data EditComment) (*CommentResponse, error) {
|
||||||
resData := &types.CommentResponse{}
|
resData := &CommentResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/comment", data, &resData)
|
res, err := c.req(ctx, "PUT", "/comment", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -372,8 +369,8 @@ func (c *Client) EditComment(ctx context.Context, data types.EditComment) (*type
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edit a community.
|
// Edit a community.
|
||||||
func (c *Client) EditCommunity(ctx context.Context, data types.EditCommunity) (*types.CommunityResponse, error) {
|
func (c *Client) EditCommunity(ctx context.Context, data EditCommunity) (*CommunityResponse, error) {
|
||||||
resData := &types.CommunityResponse{}
|
resData := &CommunityResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/community", data, &resData)
|
res, err := c.req(ctx, "PUT", "/community", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -386,8 +383,8 @@ func (c *Client) EditCommunity(ctx context.Context, data types.EditCommunity) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edit an existing custom emoji
|
// Edit an existing custom emoji
|
||||||
func (c *Client) EditCustomEmoji(ctx context.Context, data types.EditCustomEmoji) (*types.CustomEmojiResponse, error) {
|
func (c *Client) EditCustomEmoji(ctx context.Context, data EditCustomEmoji) (*CustomEmojiResponse, error) {
|
||||||
resData := &types.CustomEmojiResponse{}
|
resData := &CustomEmojiResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/custom_emoji", data, &resData)
|
res, err := c.req(ctx, "PUT", "/custom_emoji", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -400,8 +397,8 @@ func (c *Client) EditCustomEmoji(ctx context.Context, data types.EditCustomEmoji
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edit a post.
|
// Edit a post.
|
||||||
func (c *Client) EditPost(ctx context.Context, data types.EditPost) (*types.PostResponse, error) {
|
func (c *Client) EditPost(ctx context.Context, data EditPost) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/post", data, &resData)
|
res, err := c.req(ctx, "PUT", "/post", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -414,8 +411,8 @@ func (c *Client) EditPost(ctx context.Context, data types.EditPost) (*types.Post
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edit a private message.
|
// Edit a private message.
|
||||||
func (c *Client) EditPrivateMessage(ctx context.Context, data types.EditPrivateMessage) (*types.PrivateMessageResponse, error) {
|
func (c *Client) EditPrivateMessage(ctx context.Context, data EditPrivateMessage) (*PrivateMessageResponse, error) {
|
||||||
resData := &types.PrivateMessageResponse{}
|
resData := &PrivateMessageResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/private_message", data, &resData)
|
res, err := c.req(ctx, "PUT", "/private_message", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -428,8 +425,8 @@ func (c *Client) EditPrivateMessage(ctx context.Context, data types.EditPrivateM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Edit your site.
|
// Edit your site.
|
||||||
func (c *Client) EditSite(ctx context.Context, data types.EditSite) (*types.SiteResponse, error) {
|
func (c *Client) EditSite(ctx context.Context, data EditSite) (*SiteResponse, error) {
|
||||||
resData := &types.SiteResponse{}
|
resData := &SiteResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/site", data, &resData)
|
res, err := c.req(ctx, "PUT", "/site", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -442,8 +439,8 @@ func (c *Client) EditSite(ctx context.Context, data types.EditSite) (*types.Site
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A moderator can feature a community post ( IE stick it to the top of a community ).
|
// A moderator can feature a community post ( IE stick it to the top of a community ).
|
||||||
func (c *Client) FeaturePost(ctx context.Context, data types.FeaturePost) (*types.PostResponse, error) {
|
func (c *Client) FeaturePost(ctx context.Context, data FeaturePost) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/post/feature", data, &resData)
|
res, err := c.req(ctx, "POST", "/post/feature", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -456,8 +453,8 @@ func (c *Client) FeaturePost(ctx context.Context, data types.FeaturePost) (*type
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Follow / subscribe to a community.
|
// Follow / subscribe to a community.
|
||||||
func (c *Client) FollowCommunity(ctx context.Context, data types.FollowCommunity) (*types.CommunityResponse, error) {
|
func (c *Client) FollowCommunity(ctx context.Context, data FollowCommunity) (*CommunityResponse, error) {
|
||||||
resData := &types.CommunityResponse{}
|
resData := &CommunityResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/community/follow", data, &resData)
|
res, err := c.req(ctx, "POST", "/community/follow", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -470,8 +467,8 @@ func (c *Client) FollowCommunity(ctx context.Context, data types.FollowCommunity
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of banned users
|
// Get a list of banned users
|
||||||
func (c *Client) BannedPersons(ctx context.Context) (*types.BannedPersonsResponse, error) {
|
func (c *Client) BannedPersons(ctx context.Context) (*BannedPersonsResponse, error) {
|
||||||
resData := &types.BannedPersonsResponse{}
|
resData := &BannedPersonsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/user/banned", nil, &resData)
|
res, err := c.getReq(ctx, "GET", "/user/banned", nil, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -484,8 +481,8 @@ func (c *Client) BannedPersons(ctx context.Context) (*types.BannedPersonsRespons
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch a Captcha.
|
// Fetch a Captcha.
|
||||||
func (c *Client) Captcha(ctx context.Context) (*types.GetCaptchaResponse, error) {
|
func (c *Client) Captcha(ctx context.Context) (*GetCaptchaResponse, error) {
|
||||||
resData := &types.GetCaptchaResponse{}
|
resData := &GetCaptchaResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/user/get_captcha", nil, &resData)
|
res, err := c.getReq(ctx, "GET", "/user/get_captcha", nil, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -498,8 +495,8 @@ func (c *Client) Captcha(ctx context.Context) (*types.GetCaptchaResponse, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get / fetch comment.
|
// Get / fetch comment.
|
||||||
func (c *Client) Comment(ctx context.Context, data types.GetComment) (*types.CommentResponse, error) {
|
func (c *Client) Comment(ctx context.Context, data GetComment) (*CommentResponse, error) {
|
||||||
resData := &types.CommentResponse{}
|
resData := &CommentResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/comment", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/comment", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -512,8 +509,8 @@ func (c *Client) Comment(ctx context.Context, data types.GetComment) (*types.Com
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get / fetch comments.
|
// Get / fetch comments.
|
||||||
func (c *Client) Comments(ctx context.Context, data types.GetComments) (*types.GetCommentsResponse, error) {
|
func (c *Client) Comments(ctx context.Context, data GetComments) (*GetCommentsResponse, error) {
|
||||||
resData := &types.GetCommentsResponse{}
|
resData := &GetCommentsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/comment/list", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/comment/list", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -526,8 +523,8 @@ func (c *Client) Comments(ctx context.Context, data types.GetComments) (*types.G
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get / fetch a community.
|
// Get / fetch a community.
|
||||||
func (c *Client) Community(ctx context.Context, data types.GetCommunity) (*types.GetCommunityResponse, error) {
|
func (c *Client) Community(ctx context.Context, data GetCommunity) (*GetCommunityResponse, error) {
|
||||||
resData := &types.GetCommunityResponse{}
|
resData := &GetCommunityResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/community", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/community", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -540,8 +537,8 @@ func (c *Client) Community(ctx context.Context, data types.GetCommunity) (*types
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch federated instances.
|
// Fetch federated instances.
|
||||||
func (c *Client) FederatedInstances(ctx context.Context) (*types.GetFederatedInstancesResponse, error) {
|
func (c *Client) FederatedInstances(ctx context.Context) (*GetFederatedInstancesResponse, error) {
|
||||||
resData := &types.GetFederatedInstancesResponse{}
|
resData := &GetFederatedInstancesResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/federated_instances", nil, &resData)
|
res, err := c.getReq(ctx, "GET", "/federated_instances", nil, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -554,8 +551,8 @@ func (c *Client) FederatedInstances(ctx context.Context) (*types.GetFederatedIns
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the modlog.
|
// Get the modlog.
|
||||||
func (c *Client) Modlog(ctx context.Context, data types.GetModlog) (*types.GetModlogResponse, error) {
|
func (c *Client) Modlog(ctx context.Context, data GetModlog) (*GetModlogResponse, error) {
|
||||||
resData := &types.GetModlogResponse{}
|
resData := &GetModlogResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/modlog", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/modlog", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -568,8 +565,8 @@ func (c *Client) Modlog(ctx context.Context, data types.GetModlog) (*types.GetMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the details for a person.
|
// Get the details for a person.
|
||||||
func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails) (*types.GetPersonDetailsResponse, error) {
|
func (c *Client) PersonDetails(ctx context.Context, data GetPersonDetails) (*GetPersonDetailsResponse, error) {
|
||||||
resData := &types.GetPersonDetailsResponse{}
|
resData := &GetPersonDetailsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/user", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/user", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -582,8 +579,8 @@ func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get mentions for your user.
|
// Get mentions for your user.
|
||||||
func (c *Client) PersonMentions(ctx context.Context, data types.GetPersonMentions) (*types.GetPersonMentionsResponse, error) {
|
func (c *Client) PersonMentions(ctx context.Context, data GetPersonMentions) (*GetPersonMentionsResponse, error) {
|
||||||
resData := &types.GetPersonMentionsResponse{}
|
resData := &GetPersonMentionsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/user/mention", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/user/mention", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -596,8 +593,8 @@ func (c *Client) PersonMentions(ctx context.Context, data types.GetPersonMention
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get / fetch a post.
|
// Get / fetch a post.
|
||||||
func (c *Client) Post(ctx context.Context, data types.GetPost) (*types.GetPostResponse, error) {
|
func (c *Client) Post(ctx context.Context, data GetPost) (*GetPostResponse, error) {
|
||||||
resData := &types.GetPostResponse{}
|
resData := &GetPostResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/post", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/post", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -610,8 +607,8 @@ func (c *Client) Post(ctx context.Context, data types.GetPost) (*types.GetPostRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get / fetch posts, with various filters.
|
// Get / fetch posts, with various filters.
|
||||||
func (c *Client) Posts(ctx context.Context, data types.GetPosts) (*types.GetPostsResponse, error) {
|
func (c *Client) Posts(ctx context.Context, data GetPosts) (*GetPostsResponse, error) {
|
||||||
resData := &types.GetPostsResponse{}
|
resData := &GetPostsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/post/list", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/post/list", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -624,8 +621,8 @@ func (c *Client) Posts(ctx context.Context, data types.GetPosts) (*types.GetPost
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get / fetch private messages.
|
// Get / fetch private messages.
|
||||||
func (c *Client) PrivateMessages(ctx context.Context, data types.GetPrivateMessages) (*types.PrivateMessagesResponse, error) {
|
func (c *Client) PrivateMessages(ctx context.Context, data GetPrivateMessages) (*PrivateMessagesResponse, error) {
|
||||||
resData := &types.PrivateMessagesResponse{}
|
resData := &PrivateMessagesResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/private_message/list", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/private_message/list", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -638,8 +635,8 @@ func (c *Client) PrivateMessages(ctx context.Context, data types.GetPrivateMessa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get comment replies.
|
// Get comment replies.
|
||||||
func (c *Client) Replies(ctx context.Context, data types.GetReplies) (*types.GetRepliesResponse, error) {
|
func (c *Client) Replies(ctx context.Context, data GetReplies) (*GetRepliesResponse, error) {
|
||||||
resData := &types.GetRepliesResponse{}
|
resData := &GetRepliesResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/user/replies", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/user/replies", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -652,8 +649,8 @@ func (c *Client) Replies(ctx context.Context, data types.GetReplies) (*types.Get
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get counts for your reports
|
// Get counts for your reports
|
||||||
func (c *Client) ReportCount(ctx context.Context, data types.GetReportCount) (*types.GetReportCountResponse, error) {
|
func (c *Client) ReportCount(ctx context.Context, data GetReportCount) (*GetReportCountResponse, error) {
|
||||||
resData := &types.GetReportCountResponse{}
|
resData := &GetReportCountResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/user/report_count", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/user/report_count", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -666,8 +663,8 @@ func (c *Client) ReportCount(ctx context.Context, data types.GetReportCount) (*t
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gets the site, and your user data.
|
// Gets the site, and your user data.
|
||||||
func (c *Client) Site(ctx context.Context) (*types.GetSiteResponse, error) {
|
func (c *Client) Site(ctx context.Context) (*GetSiteResponse, error) {
|
||||||
resData := &types.GetSiteResponse{}
|
resData := &GetSiteResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/site", nil, &resData)
|
res, err := c.getReq(ctx, "GET", "/site", nil, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -680,8 +677,8 @@ func (c *Client) Site(ctx context.Context) (*types.GetSiteResponse, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch metadata for any given site.
|
// Fetch metadata for any given site.
|
||||||
func (c *Client) SiteMetadata(ctx context.Context, data types.GetSiteMetadata) (*types.GetSiteMetadataResponse, error) {
|
func (c *Client) SiteMetadata(ctx context.Context, data GetSiteMetadata) (*GetSiteMetadataResponse, error) {
|
||||||
resData := &types.GetSiteMetadataResponse{}
|
resData := &GetSiteMetadataResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/post/site_metadata", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/post/site_metadata", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -694,8 +691,8 @@ func (c *Client) SiteMetadata(ctx context.Context, data types.GetSiteMetadata) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get your unread counts
|
// Get your unread counts
|
||||||
func (c *Client) UnreadCount(ctx context.Context) (*types.GetUnreadCountResponse, error) {
|
func (c *Client) UnreadCount(ctx context.Context) (*GetUnreadCountResponse, error) {
|
||||||
resData := &types.GetUnreadCountResponse{}
|
resData := &GetUnreadCountResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/user/unread_count", nil, &resData)
|
res, err := c.getReq(ctx, "GET", "/user/unread_count", nil, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -708,8 +705,8 @@ func (c *Client) UnreadCount(ctx context.Context) (*types.GetUnreadCountResponse
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the unread registration applications count.
|
// Get the unread registration applications count.
|
||||||
func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context) (*types.GetUnreadRegistrationApplicationCountResponse, error) {
|
func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context) (*GetUnreadRegistrationApplicationCountResponse, error) {
|
||||||
resData := &types.GetUnreadRegistrationApplicationCountResponse{}
|
resData := &GetUnreadRegistrationApplicationCountResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/admin/registration_application/count", nil, &resData)
|
res, err := c.getReq(ctx, "GET", "/admin/registration_application/count", nil, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -722,8 +719,8 @@ func (c *Client) UnreadRegistrationApplicationCount(ctx context.Context) (*types
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hide a community from public view.
|
// Hide a community from public view.
|
||||||
func (c *Client) HideCommunity(ctx context.Context, data types.HideCommunity) (*types.CommunityResponse, error) {
|
func (c *Client) HideCommunity(ctx context.Context, data HideCommunity) (*CommunityResponse, error) {
|
||||||
resData := &types.CommunityResponse{}
|
resData := &CommunityResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/community/hide", data, &resData)
|
res, err := c.req(ctx, "PUT", "/community/hide", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -736,8 +733,8 @@ func (c *Client) HideCommunity(ctx context.Context, data types.HideCommunity) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Leave the Site admins.
|
// Leave the Site admins.
|
||||||
func (c *Client) LeaveAdmin(ctx context.Context) (*types.GetSiteResponse, error) {
|
func (c *Client) LeaveAdmin(ctx context.Context) (*GetSiteResponse, error) {
|
||||||
resData := &types.GetSiteResponse{}
|
resData := &GetSiteResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/leave_admin", nil, &resData)
|
res, err := c.req(ctx, "POST", "/user/leave_admin", nil, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -750,8 +747,8 @@ func (c *Client) LeaveAdmin(ctx context.Context) (*types.GetSiteResponse, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Like / vote on a comment.
|
// Like / vote on a comment.
|
||||||
func (c *Client) LikeComment(ctx context.Context, data types.CreateCommentLike) (*types.CommentResponse, error) {
|
func (c *Client) LikeComment(ctx context.Context, data CreateCommentLike) (*CommentResponse, error) {
|
||||||
resData := &types.CommentResponse{}
|
resData := &CommentResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/comment/like", data, &resData)
|
res, err := c.req(ctx, "POST", "/comment/like", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -764,8 +761,8 @@ func (c *Client) LikeComment(ctx context.Context, data types.CreateCommentLike)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Like / vote on a post.
|
// Like / vote on a post.
|
||||||
func (c *Client) LikePost(ctx context.Context, data types.CreatePostLike) (*types.PostResponse, error) {
|
func (c *Client) LikePost(ctx context.Context, data CreatePostLike) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/post/like", data, &resData)
|
res, err := c.req(ctx, "POST", "/post/like", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -778,8 +775,8 @@ func (c *Client) LikePost(ctx context.Context, data types.CreatePostLike) (*type
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List comment reports.
|
// List comment reports.
|
||||||
func (c *Client) CommentReports(ctx context.Context, data types.ListCommentReports) (*types.ListCommentReportsResponse, error) {
|
func (c *Client) CommentReports(ctx context.Context, data ListCommentReports) (*ListCommentReportsResponse, error) {
|
||||||
resData := &types.ListCommentReportsResponse{}
|
resData := &ListCommentReportsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/comment/report/list", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/comment/report/list", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -792,8 +789,8 @@ func (c *Client) CommentReports(ctx context.Context, data types.ListCommentRepor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List communities, with various filters.
|
// List communities, with various filters.
|
||||||
func (c *Client) Communities(ctx context.Context, data types.ListCommunities) (*types.ListCommunitiesResponse, error) {
|
func (c *Client) Communities(ctx context.Context, data ListCommunities) (*ListCommunitiesResponse, error) {
|
||||||
resData := &types.ListCommunitiesResponse{}
|
resData := &ListCommunitiesResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/community/list", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/community/list", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -806,8 +803,8 @@ func (c *Client) Communities(ctx context.Context, data types.ListCommunities) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List post reports.
|
// List post reports.
|
||||||
func (c *Client) PostReports(ctx context.Context, data types.ListPostReports) (*types.ListPostReportsResponse, error) {
|
func (c *Client) PostReports(ctx context.Context, data ListPostReports) (*ListPostReportsResponse, error) {
|
||||||
resData := &types.ListPostReportsResponse{}
|
resData := &ListPostReportsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/post/report/list", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/post/report/list", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -820,8 +817,8 @@ func (c *Client) PostReports(ctx context.Context, data types.ListPostReports) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List private message reports.
|
// List private message reports.
|
||||||
func (c *Client) PrivateMessageReports(ctx context.Context, data types.ListPrivateMessageReports) (*types.ListPrivateMessageReportsResponse, error) {
|
func (c *Client) PrivateMessageReports(ctx context.Context, data ListPrivateMessageReports) (*ListPrivateMessageReportsResponse, error) {
|
||||||
resData := &types.ListPrivateMessageReportsResponse{}
|
resData := &ListPrivateMessageReportsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/private_message/report/list", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/private_message/report/list", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -834,8 +831,8 @@ func (c *Client) PrivateMessageReports(ctx context.Context, data types.ListPriva
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List the registration applications.
|
// List the registration applications.
|
||||||
func (c *Client) RegistrationApplications(ctx context.Context, data types.ListRegistrationApplications) (*types.ListRegistrationApplicationsResponse, error) {
|
func (c *Client) RegistrationApplications(ctx context.Context, data ListRegistrationApplications) (*ListRegistrationApplicationsResponse, error) {
|
||||||
resData := &types.ListRegistrationApplicationsResponse{}
|
resData := &ListRegistrationApplicationsResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/admin/registration_application/list", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/admin/registration_application/list", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -848,8 +845,8 @@ func (c *Client) RegistrationApplications(ctx context.Context, data types.ListRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A moderator can lock a post ( IE disable new comments ).
|
// A moderator can lock a post ( IE disable new comments ).
|
||||||
func (c *Client) LockPost(ctx context.Context, data types.LockPost) (*types.PostResponse, error) {
|
func (c *Client) LockPost(ctx context.Context, data LockPost) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/post/lock", data, &resData)
|
res, err := c.req(ctx, "POST", "/post/lock", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -862,8 +859,8 @@ func (c *Client) LockPost(ctx context.Context, data types.LockPost) (*types.Post
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Log into lemmy.
|
// Log into lemmy.
|
||||||
func (c *Client) Login(ctx context.Context, data types.Login) (*types.LoginResponse, error) {
|
func (c *Client) Login(ctx context.Context, data Login) (*LoginResponse, error) {
|
||||||
resData := &types.LoginResponse{}
|
resData := &LoginResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/login", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/login", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -876,8 +873,8 @@ func (c *Client) Login(ctx context.Context, data types.Login) (*types.LoginRespo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark all replies as read.
|
// Mark all replies as read.
|
||||||
func (c *Client) MarkAllAsRead(ctx context.Context) (*types.GetRepliesResponse, error) {
|
func (c *Client) MarkAllAsRead(ctx context.Context) (*GetRepliesResponse, error) {
|
||||||
resData := &types.GetRepliesResponse{}
|
resData := &GetRepliesResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/mark_all_as_read", nil, &resData)
|
res, err := c.req(ctx, "POST", "/user/mark_all_as_read", nil, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -890,8 +887,8 @@ func (c *Client) MarkAllAsRead(ctx context.Context) (*types.GetRepliesResponse,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark a comment as read.
|
// Mark a comment as read.
|
||||||
func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data types.MarkCommentReplyAsRead) (*types.CommentReplyResponse, error) {
|
func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data MarkCommentReplyAsRead) (*CommentReplyResponse, error) {
|
||||||
resData := &types.CommentReplyResponse{}
|
resData := &CommentReplyResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/comment/mark_as_read", data, &resData)
|
res, err := c.req(ctx, "POST", "/comment/mark_as_read", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -904,8 +901,8 @@ func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data types.MarkComm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark a person mention as read.
|
// Mark a person mention as read.
|
||||||
func (c *Client) MarkPersonMentionAsRead(ctx context.Context, data types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error) {
|
func (c *Client) MarkPersonMentionAsRead(ctx context.Context, data MarkPersonMentionAsRead) (*PersonMentionResponse, error) {
|
||||||
resData := &types.PersonMentionResponse{}
|
resData := &PersonMentionResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/mention/mark_as_read", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/mention/mark_as_read", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -918,8 +915,8 @@ func (c *Client) MarkPersonMentionAsRead(ctx context.Context, data types.MarkPer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark a post as read.
|
// Mark a post as read.
|
||||||
func (c *Client) MarkPostAsRead(ctx context.Context, data types.MarkPostAsRead) (*types.PostResponse, error) {
|
func (c *Client) MarkPostAsRead(ctx context.Context, data MarkPostAsRead) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/post/mark_as_read", data, &resData)
|
res, err := c.req(ctx, "POST", "/post/mark_as_read", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -932,8 +929,8 @@ func (c *Client) MarkPostAsRead(ctx context.Context, data types.MarkPostAsRead)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark a private message as read.
|
// Mark a private message as read.
|
||||||
func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, data types.MarkPrivateMessageAsRead) (*types.PrivateMessageResponse, error) {
|
func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, data MarkPrivateMessageAsRead) (*PrivateMessageResponse, error) {
|
||||||
resData := &types.PrivateMessageResponse{}
|
resData := &PrivateMessageResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/private_message/mark_as_read", data, &resData)
|
res, err := c.req(ctx, "POST", "/private_message/mark_as_read", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -946,8 +943,8 @@ func (c *Client) MarkPrivateMessageAsRead(ctx context.Context, data types.MarkPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Change your password from an email / token based reset.
|
// Change your password from an email / token based reset.
|
||||||
func (c *Client) PasswordChangeAfterReset(ctx context.Context, data types.PasswordChangeAfterReset) (*types.LoginResponse, error) {
|
func (c *Client) PasswordChangeAfterReset(ctx context.Context, data PasswordChangeAfterReset) (*LoginResponse, error) {
|
||||||
resData := &types.LoginResponse{}
|
resData := &LoginResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/password_change", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/password_change", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -960,8 +957,8 @@ func (c *Client) PasswordChangeAfterReset(ctx context.Context, data types.Passwo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset your password.
|
// Reset your password.
|
||||||
func (c *Client) PasswordReset(ctx context.Context, data types.PasswordReset) error {
|
func (c *Client) PasswordReset(ctx context.Context, data PasswordReset) error {
|
||||||
resData := &types.EmptyResponse{}
|
resData := &EmptyResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/password_reset", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/password_reset", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -974,8 +971,8 @@ func (c *Client) PasswordReset(ctx context.Context, data types.PasswordReset) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Purge / Delete a comment from the database.
|
// Purge / Delete a comment from the database.
|
||||||
func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*types.PurgeItemResponse, error) {
|
func (c *Client) PurgeComment(ctx context.Context, data PurgeComment) (*PurgeItemResponse, error) {
|
||||||
resData := &types.PurgeItemResponse{}
|
resData := &PurgeItemResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/admin/purge/comment", data, &resData)
|
res, err := c.req(ctx, "POST", "/admin/purge/comment", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -988,8 +985,8 @@ func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*ty
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Purge / Delete a community from the database.
|
// Purge / Delete a community from the database.
|
||||||
func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) (*types.PurgeItemResponse, error) {
|
func (c *Client) PurgeCommunity(ctx context.Context, data PurgeCommunity) (*PurgeItemResponse, error) {
|
||||||
resData := &types.PurgeItemResponse{}
|
resData := &PurgeItemResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/admin/purge/community", data, &resData)
|
res, err := c.req(ctx, "POST", "/admin/purge/community", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1002,8 +999,8 @@ func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Purge / Delete a person from the database.
|
// Purge / Delete a person from the database.
|
||||||
func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*types.PurgeItemResponse, error) {
|
func (c *Client) PurgePerson(ctx context.Context, data PurgePerson) (*PurgeItemResponse, error) {
|
||||||
resData := &types.PurgeItemResponse{}
|
resData := &PurgeItemResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/admin/purge/person", data, &resData)
|
res, err := c.req(ctx, "POST", "/admin/purge/person", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1016,8 +1013,8 @@ func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*type
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Purge / Delete a post from the database.
|
// Purge / Delete a post from the database.
|
||||||
func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.PurgeItemResponse, error) {
|
func (c *Client) PurgePost(ctx context.Context, data PurgePost) (*PurgeItemResponse, error) {
|
||||||
resData := &types.PurgeItemResponse{}
|
resData := &PurgeItemResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/admin/purge/post", data, &resData)
|
res, err := c.req(ctx, "POST", "/admin/purge/post", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1030,8 +1027,8 @@ func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.Pu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Register a new user.
|
// Register a new user.
|
||||||
func (c *Client) Register(ctx context.Context, data types.Register) (*types.LoginResponse, error) {
|
func (c *Client) Register(ctx context.Context, data Register) (*LoginResponse, error) {
|
||||||
resData := &types.LoginResponse{}
|
resData := &LoginResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/register", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/register", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1044,8 +1041,8 @@ func (c *Client) Register(ctx context.Context, data types.Register) (*types.Logi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A moderator remove for a comment.
|
// A moderator remove for a comment.
|
||||||
func (c *Client) RemoveComment(ctx context.Context, data types.RemoveComment) (*types.CommentResponse, error) {
|
func (c *Client) RemoveComment(ctx context.Context, data RemoveComment) (*CommentResponse, error) {
|
||||||
resData := &types.CommentResponse{}
|
resData := &CommentResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/comment/remove", data, &resData)
|
res, err := c.req(ctx, "POST", "/comment/remove", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1058,8 +1055,8 @@ func (c *Client) RemoveComment(ctx context.Context, data types.RemoveComment) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A moderator remove for a community.
|
// A moderator remove for a community.
|
||||||
func (c *Client) RemoveCommunity(ctx context.Context, data types.RemoveCommunity) (*types.CommunityResponse, error) {
|
func (c *Client) RemoveCommunity(ctx context.Context, data RemoveCommunity) (*CommunityResponse, error) {
|
||||||
resData := &types.CommunityResponse{}
|
resData := &CommunityResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/community/remove", data, &resData)
|
res, err := c.req(ctx, "POST", "/community/remove", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1072,8 +1069,8 @@ func (c *Client) RemoveCommunity(ctx context.Context, data types.RemoveCommunity
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A moderator remove for a post.
|
// A moderator remove for a post.
|
||||||
func (c *Client) RemovePost(ctx context.Context, data types.RemovePost) (*types.PostResponse, error) {
|
func (c *Client) RemovePost(ctx context.Context, data RemovePost) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/post/remove", data, &resData)
|
res, err := c.req(ctx, "POST", "/post/remove", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1086,8 +1083,8 @@ func (c *Client) RemovePost(ctx context.Context, data types.RemovePost) (*types.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve a comment report. Only a mod can do this.
|
// Resolve a comment report. Only a mod can do this.
|
||||||
func (c *Client) ResolveCommentReport(ctx context.Context, data types.ResolveCommentReport) (*types.CommentReportResponse, error) {
|
func (c *Client) ResolveCommentReport(ctx context.Context, data ResolveCommentReport) (*CommentReportResponse, error) {
|
||||||
resData := &types.CommentReportResponse{}
|
resData := &CommentReportResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/comment/report/resolve", data, &resData)
|
res, err := c.req(ctx, "PUT", "/comment/report/resolve", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1100,8 +1097,8 @@ func (c *Client) ResolveCommentReport(ctx context.Context, data types.ResolveCom
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch a non-local / federated object.
|
// Fetch a non-local / federated object.
|
||||||
func (c *Client) ResolveObject(ctx context.Context, data types.ResolveObject) (*types.ResolveObjectResponse, error) {
|
func (c *Client) ResolveObject(ctx context.Context, data ResolveObject) (*ResolveObjectResponse, error) {
|
||||||
resData := &types.ResolveObjectResponse{}
|
resData := &ResolveObjectResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/resolve_object", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/resolve_object", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1114,8 +1111,8 @@ func (c *Client) ResolveObject(ctx context.Context, data types.ResolveObject) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve a post report. Only a mod can do this.
|
// Resolve a post report. Only a mod can do this.
|
||||||
func (c *Client) ResolvePostReport(ctx context.Context, data types.ResolvePostReport) (*types.PostReportResponse, error) {
|
func (c *Client) ResolvePostReport(ctx context.Context, data ResolvePostReport) (*PostReportResponse, error) {
|
||||||
resData := &types.PostReportResponse{}
|
resData := &PostReportResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/post/report/resolve", data, &resData)
|
res, err := c.req(ctx, "PUT", "/post/report/resolve", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1128,8 +1125,8 @@ func (c *Client) ResolvePostReport(ctx context.Context, data types.ResolvePostRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve a report for a private message.
|
// Resolve a report for a private message.
|
||||||
func (c *Client) ResolvePrivateMessageReport(ctx context.Context, data types.ResolvePrivateMessageReport) (*types.PrivateMessageReportResponse, error) {
|
func (c *Client) ResolvePrivateMessageReport(ctx context.Context, data ResolvePrivateMessageReport) (*PrivateMessageReportResponse, error) {
|
||||||
resData := &types.PrivateMessageReportResponse{}
|
resData := &PrivateMessageReportResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/private_message/report/resolve", data, &resData)
|
res, err := c.req(ctx, "PUT", "/private_message/report/resolve", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1142,8 +1139,8 @@ func (c *Client) ResolvePrivateMessageReport(ctx context.Context, data types.Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save a comment.
|
// Save a comment.
|
||||||
func (c *Client) SaveComment(ctx context.Context, data types.SaveComment) (*types.CommentResponse, error) {
|
func (c *Client) SaveComment(ctx context.Context, data SaveComment) (*CommentResponse, error) {
|
||||||
resData := &types.CommentResponse{}
|
resData := &CommentResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/comment/save", data, &resData)
|
res, err := c.req(ctx, "PUT", "/comment/save", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1156,8 +1153,8 @@ func (c *Client) SaveComment(ctx context.Context, data types.SaveComment) (*type
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save a post.
|
// Save a post.
|
||||||
func (c *Client) SavePost(ctx context.Context, data types.SavePost) (*types.PostResponse, error) {
|
func (c *Client) SavePost(ctx context.Context, data SavePost) (*PostResponse, error) {
|
||||||
resData := &types.PostResponse{}
|
resData := &PostResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/post/save", data, &resData)
|
res, err := c.req(ctx, "PUT", "/post/save", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1170,8 +1167,8 @@ func (c *Client) SavePost(ctx context.Context, data types.SavePost) (*types.Post
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save your user settings.
|
// Save your user settings.
|
||||||
func (c *Client) SaveUserSettings(ctx context.Context, data types.SaveUserSettings) (*types.LoginResponse, error) {
|
func (c *Client) SaveUserSettings(ctx context.Context, data SaveUserSettings) (*LoginResponse, error) {
|
||||||
resData := &types.LoginResponse{}
|
resData := &LoginResponse{}
|
||||||
res, err := c.req(ctx, "PUT", "/user/save_user_settings", data, &resData)
|
res, err := c.req(ctx, "PUT", "/user/save_user_settings", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1184,8 +1181,8 @@ func (c *Client) SaveUserSettings(ctx context.Context, data types.SaveUserSettin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search lemmy.
|
// Search lemmy.
|
||||||
func (c *Client) Search(ctx context.Context, data types.Search) (*types.SearchResponse, error) {
|
func (c *Client) Search(ctx context.Context, data Search) (*SearchResponse, error) {
|
||||||
resData := &types.SearchResponse{}
|
resData := &SearchResponse{}
|
||||||
res, err := c.getReq(ctx, "GET", "/search", data, &resData)
|
res, err := c.getReq(ctx, "GET", "/search", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1198,8 +1195,8 @@ func (c *Client) Search(ctx context.Context, data types.Search) (*types.SearchRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transfer your community to an existing moderator.
|
// Transfer your community to an existing moderator.
|
||||||
func (c *Client) TransferCommunity(ctx context.Context, data types.TransferCommunity) (*types.GetCommunityResponse, error) {
|
func (c *Client) TransferCommunity(ctx context.Context, data TransferCommunity) (*GetCommunityResponse, error) {
|
||||||
resData := &types.GetCommunityResponse{}
|
resData := &GetCommunityResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/community/transfer", data, &resData)
|
res, err := c.req(ctx, "POST", "/community/transfer", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1212,8 +1209,8 @@ func (c *Client) TransferCommunity(ctx context.Context, data types.TransferCommu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify your email
|
// Verify your email
|
||||||
func (c *Client) VerifyEmail(ctx context.Context, data types.VerifyEmail) error {
|
func (c *Client) VerifyEmail(ctx context.Context, data VerifyEmail) error {
|
||||||
resData := &types.EmptyResponse{}
|
resData := &EmptyResponse{}
|
||||||
res, err := c.req(ctx, "POST", "/user/verify_email", data, &resData)
|
res, err := c.req(ctx, "POST", "/user/verify_email", data, &resData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
package types
|
package lemmy
|
||||||
|
|
||||||
// EmptyResponse is a response without any fields.
|
// EmptyResponse is a response without any fields.
|
||||||
// It embeds LemmyResponse to capture any errors.
|
// It embeds LemmyResponse to capture any errors.
|
Loading…
Reference in New Issue
Block a user