postgrp

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const BasePath = "/posts"
View Source
const GetAllPath = v1.Version + BasePath + "/all"
View Source
const GetByIdPath = v1.Version + BasePath + "/id/{id}"
View Source
const GetPostsByUserAddressAndIndexPath = v1.Version + BasePath + "/{address}/{index}"
View Source
const GetPostsByUserAddressPath = v1.Version + BasePath + "/{address}"
View Source
const GetUserPostsPath = v1.Version + BasePath
View Source
const PostPath = v1.Version + BasePath

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(postCore *post.Core, auth *auth.Auth, userCore *user.Core, mediaCore *media.Core) *Handler

func (*Handler) GetAll

func (h *Handler) GetAll(ctx context.Context, w http.ResponseWriter, r *http.Request) error

@Summary Get all posts @Description Get all posts with pagination @Tags posts @Produce json @Param page query int false "Page number" default(0) @Param pageSize query int false "Page size" default(100) @Success 200 {array} post.Post @Failure 400 {object} v1.ErrorResponse @Failure 404 {object} v1.ErrorResponse @Router /v1/posts/all [get]

func (*Handler) GetById

func (h *Handler) GetById(ctx context.Context, w http.ResponseWriter, r *http.Request) error

@Summary Get a post by ID @Description Get a specific post by its ID @Tags posts @Produce json @Param id path int true "Post ID" @Success 200 {object} post.Post @Failure 400 {object} v1.ErrorResponse @Failure 404 {object} v1.ErrorResponse @Router /v1/posts/id/{id} [get]

func (*Handler) GetPostsByUserAddress

func (h *Handler) GetPostsByUserAddress(ctx context.Context, w http.ResponseWriter, r *http.Request) error

@Summary Get posts by user address @Description Get all posts by a specific user address @Tags posts @Produce json @Param address path string true "User Address" @Param page query int false "Page number" default(0) @Param pageSize query int false "Page size" default(100) @Success 200 {array} post.Post @Failure 400 {object} v1.ErrorResponse @Router /v1/posts/{address} [get]

func (*Handler) GetPostsByUserAddressAndIndex

func (h *Handler) GetPostsByUserAddressAndIndex(ctx context.Context, w http.ResponseWriter, r *http.Request) error

@Summary Get a post by user address and index @Description Get a specific post by user address and index @Tags posts @Produce json @Param address path string true "User Address" @Param index path int true "Post Index" @Success 200 {object} post.Post @Failure 400 {object} v1.ErrorResponse @Failure 404 {object} v1.ErrorResponse @Router /v1/posts/{address}/{index} [get]

func (*Handler) GetUserPosts

func (h *Handler) GetUserPosts(ctx context.Context, w http.ResponseWriter, r *http.Request) error

@Summary Get posts of user who made the request @Description Get all posts by a specific user address @Tags posts @Produce json @Param page query int false "Page number" default(0) @Param pageSize query int false "Page size" default(100) @Success 200 {array} post.Post @Failure 400 {object} v1.ErrorResponse @Router /v1/posts [get]

func (*Handler) Post

@Summary Create a new post @Description Create a new post with title and content @Tags posts @Accept json @Produce json @Param newPost body post.NewPost true "New Post" @Success 201 {object} post.Post @Failure 400 {object} v1.ErrorResponse @Router /v1/posts post

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL