posts

package
v0.0.0-...-7b45942 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePost

func CreatePost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Create Post @Description Create a new post. @Router /v1/auth/writer/post [post] @Security BearerAuth @Accept application/json @Accept application/msgpack @Produce application/json @Produce application/msgpack @Param form body object{slug=string,title=string,description=string,featuringImagePath=string,categories=[]string,tags=[]string,content=string,publishNow=boolean} true "Create post form" @Success 200 {object} object{data=object{uid=string,slug=string,title=string,featuringImagePath=string,description=string,categories=[]object{uid=string,slug=string,name=string},tags=[]string,author=object{uid=string,username=string,email=string,firstName=string,lastName=string},commentCount=int,publishedAt=time,updatedAt=time,createdAt=time,deletedAt=time}} @Failure 401 {object} object{message=string} @Failure 422 {object} object{message=string} @Failure 500 {object} object{message=string}

func DeleteMyPost

func DeleteMyPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Delete My Post (Permanent) @Description Delete my post (permanent). @Router /v1/auth/writer/post/{uid}/permanent [delete] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 204 @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 500 {object} object{message=string}

func DeletePost

func DeletePost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Delete Post (Permanent) @Description Delete a post (permanent). @Router /v1/auth/editor/post/{uid}/permanent [delete] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 204 @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 422 {object} object{message=string} @Failure 500 {object} object{message=string}

func DepublishMyPost

func DepublishMyPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Unpublish My Post @Description Remove publish status from my post if post already published. @Router /v1/auth/writer/post/{uid}/depublish [put] @Router /v1/auth/writer/post/{uid}/depublish [patch] @Security BearerAuth @Produce application/json @Produce application/msgpack @Success 204 @Failure 401 {object} object{message=string} @Failure 500 {object} object{message=string}

func DepublishPost

func DepublishPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Editor) @Summary Unpublish Post @Description Remove a post from publish status if post already published. @Router /v1/auth/editor/post/{uid}/depublish [get] @Security BearerAuth @Produce application/json @Produce application/msgpack @Success 204 @Failure 401 {object} object{message=string} @Failure 500 {object} object{message=string}

func DetrashMyPost

func DetrashMyPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Restore My Post (Soft) @Description Restore my deleted post (soft-deleted). @Router /v1/auth/writer/post/{uid}/detrash [put] @Router /v1/auth/writer/post/{uid}/detrash [patch] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 204 @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 500 {object} object{message=string}

func DetrashPost

func DetrashPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Editor) @Summary Restore Post (Soft) @Description Restore a deleted post (soft-deleted). @Router /v1/auth/editor/post/{uid}/detrash [put] @Router /v1/auth/editor/post/{uid}/detrash [patch] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 204 @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 422 {object} object{message=string} @Failure 500 {object} object{message=string}

func GetMyPost

func GetMyPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Get My Post @Description Get my post. @Router /v1/auth/writer/post/{uid} [get] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 200 {object} object{data=object{uid=string,slug=string,title=string,featuringImagePath=string,description=string,categories=[]object{uid=string,slug=string,name=string},tags=[]string,author=object{uid=string,username=string,email=string,firstName=string,lastName=string},commentCount=int,publishedAt=time,updatedAt=time,createdAt=time,deletedAt=time}} @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 500 {object} object{message=string}

func GetMyPosts

func GetMyPosts(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Get My Posts @Description Get my posts. @Router /v1/auth/writer/posts [get] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param show query int false "Number of data to be shown." @Param page query int false "Selected page of data." @Param order query string false "Selected field to order data with." @Param asc query string false "Ascending or descending, e.g.: ?asc=false." @Param type query string false "Filter data by type, e.g.: ?type=trash, ?type=published, ?type=draft." @Success 200 {object} object{data=[]object{uid=string,slug=string,title=string,featuringImagePath=string,description=string,categories=[]object{uid=string,slug=string,name=string},tags=[]string,author=object{uid=string,username=string,email=string,firstName=string,lastName=string},commentCount=int,publishedAt=time,updatedAt=time,createdAt=time,deletedAt=time}} @Failure 204 @Failure 401 {object} object{message=string} @Failure 500 {object} object{message=string}

func GetMyPostsStats

func GetMyPostsStats(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Get My Posts Stats @Description Get my posts's stats. @Router /v1/auth/writer/posts/stats [get] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param show query int false "Number of data to be shown." @Param page query int false "Selected page of data." @Param order query string false "Selected field to order data with." @Param asc query string false "Ascending or descending, e.g.: ?asc=false." @Param type query string false "Filter data by type, e.g.: ?type=trash, ?type=published, ?type=draft." @Success 200 {object} object{data=object{currentPage=int,totalPages=int,itemsPerPage=int,totalItems=int}} @Failure 401 {object} object{message=string} @Failure 500 {object} object{message=string}

func GetPost

func GetPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Editor) @Summary Get Post @Description Get a post. @Router /v1/auth/editor/post/{uid} [get] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 200 {object} object{data=object{uid=string,slug=string,title=string,featuringImagePath=string,description=string,categories=[]object{uid=string,slug=string,name=string},tags=[]string,author=object{uid=string,username=string,email=string,firstName=string,lastName=string},commentCount=int,publishedAt=time,updatedAt=time,createdAt=time,deletedAt=time}} @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 500 {object} object{message=string}

func GetPosts

func GetPosts(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Editor) @Summary Get Posts @Description Get posts. @Router /v1/auth/editor/posts [get] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param show query int false "Number of data to be shown." @Param page query int false "Selected page of data." @Param order query string false "Selected field to order data with." @Param asc query string false "Ascending or descending, e.g.: ?asc=false." @Param type query string false "Filter data by type, e.g.: ?type=trash, ?type=published, ?type=draft." @Success 200 {object} object{data=[]object{uid=string,slug=string,title=string,featuringImagePath=string,description=string,categories=[]object{uid=string,slug=string,name=string},tags=[]string,author=object{uid=string,username=string,email=string,firstName=string,lastName=string},commentCount=int,publishedAt=time,updatedAt=time,createdAt=time,deletedAt=time}} @Success 204 @Failure 401 {object} object{message=string} @Failure 500 {object} object{message=string}

func GetPostsStats

func GetPostsStats(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Editor) @Summary Get Posts Stats @Description Get posts's stats. @Router /v1/auth/editor/posts/stats [get] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param show query int false "Number of data to be shown." @Param page query int false "Selected page of data." @Param order query string false "Selected field to order data with." @Param asc query string false "Ascending or descending, e.g.: ?asc=false." @Param type query string false "Filter data by type, e.g.: ?type=trash, ?type=published, ?type=draft." @Success 200 {object} object{data=object{currentPage=int,totalPages=int,itemsPerPage=int,totalItems=int}} @Failure 401 {object} object{message=string} @Failure 500 {object} object{message=string}

func GetPublicPost

func GetPublicPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Public) @Summary Get Public Post @Description Get a post that available publicly. @Router /v1/post/{uid} [get] @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 200 {object} object{data=object{uid=string,slug=string,title=string,featuringImagePath=string,description=string,categories=[]object{uid=string,slug=string,name=string},tags=[]string,content=string,author=object{uid=string,username=string,email=string,firstName=string,lastName=string},commentCount=int,publishedAt=time}} @Failure 404 {object} object{message=string} @Failure 500 {object} object{message=string}

func GetPublicPosts

func GetPublicPosts(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Public) @Summary Get Public Posts @Description Get posts that available publicly. @Router /v1/posts [get] @Produce application/json @Produce application/msgpack @Param show query int false "Number of data to be shown." @Param page query int false "Selected page of data." @Param order query string false "Selected field to order data with." @Param asc query string false "Ascending or descending, e.g.: ?asc=false." @Success 200 {object} object{data=[]object{uid=string,slug=string,title=string,featuringImagePath=string,description=string,categories=[]object{uid=string,slug=string,name=string},tags=[]string,content=string,author=object{uid=string,username=string,email=string,firstName=string,lastName=string},commentCount=int,publishedAt=time}} @Success 204 @Failure 404 {object} object{message=string} @Failure 500 {object} object{message=string}

func PublishMyPost

func PublishMyPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Publish My Post @Description Publish my post if not published yet. @Router /v1/auth/writer/post/{uid}/publish [put] @Router /v1/auth/writer/post/{uid}/publish [patch] @Security BearerAuth @Produce application/json @Produce application/msgpack @Success 204 @Failure 401 {object} object{message=string} @Failure 500 {object} object{message=string}

func PublishPost

func PublishPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Editor) @Summary Publish Post @Description Publish a post if not published yet. @Router /v1/auth/editor/post/{uid}/publish [get] @Security BearerAuth @Produce application/json @Produce application/msgpack @Success 204 @Failure 401 {object} object{message=string} @Failure 500 {object} object{message=string}

func SearchPublicPosts

func SearchPublicPosts(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Public) @Summary Search Public Posts @Description Search posts that available publicly. @Router /v1/post/search [get] @Produce application/json @Produce application/msgpack @Param q query string false "The search query." @Param show query int false "Number of data to be shown." @Param page query int false "Selected page of data." @Param order query string false "Selected field to order data with." @Param asc query string false "Ascending or descending, e.g.: ?asc=false." @Success 200 {object} object{data=[]object{uid=string,slug=string,title=string,featuringImagePath=string,description=string,categories=[]object{uid=string,slug=string,name=string},tags=[]string,content=string,author=object{uid=string,username=string,email=string,firstName=string,lastName=string},commentCount=int,publishedAt=time}} @Success 204 @Failure 404 {object} object{message=string} @Failure 500 {object} object{message=string}

func TrashMyPost

func TrashMyPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Delete My Post (Soft) @Description Delete my post (soft-deleted). @Router /v1/auth/writer/post/{uid} [delete] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 204 @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 500 {object} object{message=string}

func TrashPost

func TrashPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Editor) @Summary Delete Post (Soft) @Description Delete a post (soft-deleted). @Router /v1/auth/editor/post/{uid} [delete] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Success 204 @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 422 {object} object{message=string} @Failure 500 {object} object{message=string}

func UpdateMyPost

func UpdateMyPost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Writer) @Summary Update My Post @Description Update my post. @Router /v1/auth/writer/post/{uid} [put] @Router /v1/auth/writer/post/{uid} [patch] @Security BearerAuth @Accept application/json @Accept application/msgpack @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Param form body object{slug=string,title=string,description=string,featuringImagePath=string,categories=[]string,tags=[]string,content=string,publishNow=boolean} true "Update post form" @Success 204 @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 422 {object} object{message=string} @Failure 500 {object} object{message=string}

func UpdatePost

func UpdatePost(
	maxCtxDuration time.Duration,
	svc *service.Service,
) (handler gin.HandlerFunc)

@Tags Post (Editor) @Summary Update Post @Description Update a post. @Router /v1/auth/editor/post/{uid} [put] @Router /v1/auth/editor/post/{uid} [patch] @Security BearerAuth @Produce application/json @Produce application/msgpack @Param uid path string true "Post's UID or slug" @Param form body object{slug=string,title=string,description=string,featuringImagePath=string,categories=[]string,tags=[]string,content=string,publishNow=boolean} true "Update post form" @Success 204 @Failure 401 {object} object{message=string} @Failure 404 {object} object{message=string} @Failure 422 {object} object{message=string} @Failure 500 {object} object{message=string}

Types

This section is empty.

Jump to

Keyboard shortcuts

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