Documentation ¶
Index ¶
- Variables
- func AssertDirExists(t *testing.T, p string)
- func AssertFileExists(t *testing.T, p string)
- func CleanupOldTempFiles()
- func GetUserFromJWT(c *gin.Context) (string, error)
- func HandleLayersGet(c *gin.Context)
- func HandleObjectArchiveGet(c *gin.Context)
- func HandleObjectArchiveUploadMultipart(c *gin.Context)
- func HandleObjectBatchUploadBegin(c *gin.Context)
- func HandleObjectBatchUploadEnd(c *gin.Context)
- func HandleObjectBatchUploadMultipart(c *gin.Context)
- func HandleObjectIndexGet(c *gin.Context)
- func HandleObjectIndexPost(c *gin.Context)
- func HandleObjectSearch(c *gin.Context)
- func HandleTransactionEnqueue(c *gin.Context)
- func HandleTransactionQueueCallback(c *gin.Context)
- func HandleTransactionQueueGet(c *gin.Context)
- func PerformRequest(r http.Handler, method, relativePath, body string) *httptest.ResponseRecorder
- func PerformRequestFull(r http.Handler, method, fullpath, body string) *httptest.ResponseRecorder
- func SetupAuth(r *gin.Engine) *jwt.GinJWTMiddleware
- func SetupRouter() *gin.Engine
- func UploadFile(r http.Handler, method, p string, localPath string, remotePath string) (*httptest.ResponseRecorder, error)
- func ValJWT(c *gin.Context) string
- type ArcAndPin
- type UserJWT
Constants ¶
This section is empty.
Variables ¶
var AuthMiddleware *jwt.GinJWTMiddleware
AuthMiddleware is JWT authorizer
var IdentityKey = "jwtid"
Functions ¶
func AssertDirExists ¶
func AssertFileExists ¶
func CleanupOldTempFiles ¶
func CleanupOldTempFiles()
CleanupOldTempFiles cleans up old temp files in temp upload folder
func GetUserFromJWT ¶
GetUserFromJWT validates the JWT and returns user model
func HandleLayersGet ¶
HandleLayersGet godoc @Summary Gets list of all layers @Security JWT @Produce json @Success 200 {string} success "" @Failure 500 {string} error "Internal error" @Router /layers [get]
func HandleObjectArchiveGet ¶
HandleObjectArchiveGet godoc @Summary HandleObjectArchiveGet gets an Object tar archive @Produce json @Param cid path string true "content identifier" @Success 200 {string} success "" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 500 {string} error "Internal error" @Router /object/archive/{cid} [get]
func HandleObjectArchiveUploadMultipart ¶
HandleObjectArchiveUploadMultipart godoc @Summary HandleObjectArchiveUploadMultipart uploads a tar archive. It saves to IPFS, creates thumbs, then saves to S3 @Accept mpfd @Produce json @Param App-Key header string true "Application key header" @Success 200 object respObject success "CID of object" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 451 {string} error "Cannot expand tar" @Failure 500 {string} error "Internal error" @Router /object/archive/multipart [post]
func HandleObjectBatchUploadBegin ¶
HandleObjectBatchUploadBegin godoc @Summary HandleObjectBatchUploadBegin starts a batch upload for an object @Accept json @Produce json @Success 200 object respBatchUploadBegin success "Batch upload session ID" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 500 {string} error "Internal error" @Router /object/batchUpload [post]
func HandleObjectBatchUploadEnd ¶
HandleObjectBatchUploadEnd godoc @Summary HandleObjectBatchUploadEnd ends a batch upload and loads files to IPFS and S3 @Accept mpfd @Produce json @Success 200 object respObject success "CID of uploaded Object" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 451 {string} error "Cannot file session ID" @Failure 500 {string} error "Internal error" @Router /object/batchUpload/end/{sessionId} [put]
func HandleObjectBatchUploadMultipart ¶
HandleObjectBatchUploadMultipart @Summary HandleObjectBatchUploadMultipart Uploads multipart files to an Object. Optional path<n> form field specifies the full path for stored full path. @Accept json @Produce json @Success 200 {string} success "" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 451 {string} error "Cannot find sessionId" @Failure 500 {string} error "Internal error" @Router /object/batchUpload/multipart/{sessionId} [post]
func HandleObjectIndexGet ¶
HandleObjectIndexGet godoc @Summary HandleObjectIndexGet gets an index at Object cid @Accept json @Produce json @Param cid path string true "object address" @Success 200 object respObject success "Object body" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 451 {string} error "Cannot find object" @Failure 500 {string} error "Internal error" @Router /object/{cid}/index [get]
func HandleObjectIndexPost ¶
HandleObjectIndexPost godoc @Summary HandleObjectIndexPost adds an object index to IPFS and S3 @Accept json @Produce json @Param App-Key header string true "Application key header" @Param json body reqObject required "index only object to create as JSON" @Success 200 object respObject success "CID of object" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 451 {string} error "Cannot match arc selector with an arc" @Failure 452 {string} error "Cannot match pin selector with a pin" @Failure 500 {string} error "Internal error" @Router /object/index [post]
func HandleObjectSearch ¶
HandleObjectSearch godoc @Summary HandleObjectSearch searches for Objects @Accept json @Produce json @Param json body reqObjectSearch required "search criteria JSON" @Success 200 object respObjectSearch success "Array of Objects matching search criteria" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 500 {string} error "Internal error" @Router /object/search [get]
func HandleTransactionEnqueue ¶
HandleTransactionEnqueue godoc @Summary HandleTransactionEnqueue enqueues a transaction for the transactor @Accept mpfd @Produce json @Param App-Key header string true "Application key header" @Param json body reqTransactionEnqueue required "transaction details" @Success 200 {string} success "" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 500 {string} error "Internal Server Error" @Router /transaction/enqueue [post]
func HandleTransactionQueueCallback ¶
HandleTransactionQueueCallback godoc @Summary HandleTransactionQueueCallback handles queued callbacks from the transactor @Accept mpfd @Produce json @Param App-Key header string true "Application key header" @Success 200 object respObject success "CID of object" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 451 {string} error "Cannot find transaction matching UID" @Failure 500 {string} error "Internal Server Error" @Router /transaction/callback [post]
func HandleTransactionQueueGet ¶
HandleTransactionQueueGet godoc @Summary HandleTransactionQueueGet gets an item from the transaction queue from the transactor @Accept mpfd @Produce json @Param App-Key header string true "Application key header" @Success 200 object respTransaction success "transaction details" @Success 201 {string} success "no transactions" @Failure 400 {string} error "Request params wrong" @Failure 401 {string} error "Unauthorized" @Failure 500 {string} error "Internal Server Error" @Router /transaction/queue [get]
func PerformRequest ¶
func PerformRequest(r http.Handler, method, relativePath, body string) *httptest.ResponseRecorder
func PerformRequestFull ¶
func PerformRequestFull(r http.Handler, method, fullpath, body string) *httptest.ResponseRecorder
func SetupAuth ¶
func SetupAuth(r *gin.Engine) *jwt.GinJWTMiddleware
SetupAuth Authenticates the user (logs in), sets up the JWT auth token, and returns username and rememberMeToken, requires the App-Key header to be present. There are two ways of logging in, supplying username/password or supplying RememberMeToken header. In both cases the user needs to activate the account first by clicking confirm email.