file_uploader

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QONTAK_FILE_UPLOADER_URI = "/file_uploader"
	DEFAULT_CONTENT_TYPE     = "application/octet-stream"
	CONTENT_TYPE_PDF         = "application/pdf"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	// UploadFromUrl Upload a file to Qontak server, if there is any document you want to send via qontak whatsapp
	//if there are no content type, the default content type will be application/octet-stream
	UploadFromUrl(ctx context.Context, filename string, url string) (response *UploadResponse, err error)
	//UploadFromUrlWithContentType Upload a file with mime type application/octet-stream to Qontak server
	UploadFromUrlWithContentType(ctx context.Context, filename string, url string, contentType string) (response *UploadResponse, err error)
}

func NewService

func NewService(client pkg.Client, token string, baseUrl string) Service

type UploadResponse

type UploadResponse struct {
	Status string                `json:"status,omitempty"`
	Data   UploadResponseSuccess `json:"data"`
}

type UploadResponseSuccess

type UploadResponseSuccess struct {
	FileName string `json:"filename"`
	Url      string `json:"url"`
}

Jump to

Keyboard shortcuts

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