paste

package
v0.0.0-...-3ea1b23 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(context *gin.Context)

Create 创建一贴 @Summary 创建永久存储或者是自我销毁的一贴 @Description 只有在登陆的状态下才能创建永久的一贴 @Tags Paste @Accept json @Produce json @Param Authorization header string false "登陆的 Token" @Param data body CreateRequest true "请求数据" @Success 201 {object} CreateResponse @Failure default {object} common.ErrorResponse @Router /paste/ [post]

func Get

func Get(context *gin.Context)

Get godoc @Summary 读取一贴 @Description 如果不指定 Accept: application/json 的话,默认会返回 text/plain 格式的 content @Tags Paste @Accept json @Produce json @Param Accept header string false "响应格式" default("text/plain") @Param key path string true "索引" @Success 201 {object} GetResponse @Failure default {object} common.ErrorResponse @Router /paste/{key} [get]

Types

type CreateRequest

type CreateRequest struct {
	*model.AbstractPaste
	SelfDestruct bool   `json:"self_destruct" example:"true"` // 是否自我销毁
	ExpireSecond uint64 `json:"expire_second" example:"300"`  // 创建若干秒后自我销毁
	ExpireCount  uint64 `json:"expire_count" example:"1"`     // 访问若干次后自我销毁
}

type CreateResponse

type CreateResponse struct {
	*common.Response
	Key string `json:"key" example:"a1b2c3d4"`
}

type GetResponse

type GetResponse struct {
	*common.Response
	Lang    string `json:"lang" example:"plain"`
	Content string `json:"content" example:"Hello World!"`
}

Jump to

Keyboard shortcuts

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