helper

package
v0.0.0-...-b6fdb97 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// file convertion
	CsvUrltoExcelFile  = "https://api.apyhub.com/convert/csv-url/excel-file"
	CsvUrltoExcelUrl   = "https://api.apyhub.com/convert/csv-url/excel-url"
	CsvFiletoExcelFile = "https://api.apyhub.com/convert/csv-file/excel-file"
	CsvFiletoExcelUrl  = "https://api.apyhub.com/convert/csv-file/excel-url"

	HtmlUrltoPdfFile  = "https://api.apyhub.com/convert/html-url/pdf-file"
	HtmlUrltoPdfUrl   = "https://api.apyhub.com/convert/html-url/pdf-url"
	HtmlFiletoPdfFile = "https://api.apyhub.com/convert/html-file/pdf-file"
	HtmlFiletoPdfUrl  = "https://api.apyhub.com/convert/html-file/pdf-url"

	ImageUrltoPdfFile = "https://api.apyhub.com/convert/image-url/pdf-file"
	ImageUrltoPdfUrl  = "https://api.apyhub.com/convert/image-url/pdf-url"
	ImagFiletoPdfFile = "https://api.apyhub.com/convert/image-file/pdf-file"
	ImageFiletoPdfUrl = "https://api.apyhub.com/convert/image-file/pdf-url"

	MdUrltoHtmlFile  = "https://api.apyhub.com/convert/md-url/html-file"
	MdUrltoHtmlUrl   = "https://api.apyhub.com/convert/md-url/html-url"
	MdFiletoHtmlFile = "https://api.apyhub.com/convert/md-file/html-file"
	MdFiletoHtmlUrl  = "https://api.apyhub.com/convert/md-file/html-url"

	PresentationUrltoPdfFile  = "https://api.apyhub.com/convert/presentation-url/pdf-file"
	PresentationUrltoPdfUrl   = "https://api.apyhub.com/convert/presentation-url/pdf-url"
	PresentationFiletoPdfFile = "https://api.apyhub.com/convert/presentation-file/pdf-file"
	PresentationFiletoPdfUrl  = "https://api.apyhub.com/convert/presentation-file/pdf-url"

	SpreadsheetUrltoPdfFile  = "https://api.apyhub.com/convert/spreadsheet-url/pdf-file"
	SpreadsheetUrltoPdfUrl   = "https://api.apyhub.com/convert/spreadsheet-url/pdf-url"
	SpreadsheetFiletoPdfFile = "https://api.apyhub.com/convert/spreadsheet-file/pdf-file"
	SpreadsheetFiletoPdfUrl  = "https://api.apyhub.com/convert/spreadsheet-file/pdf-url"

	WordUrltoPdfFile  = "https://api.apyhub.com/convert/word-url/pdf-file"
	WordUrltoPdfUrl   = "https://api.apyhub.com/convert/word-url/pdf-url"
	WordFiletoPdfFile = "https://api.apyhub.com/convert/word-file/pdf-file"
	WordFiletoPdfUrl  = "https://api.apyhub.com/convert/word-file/pdf-url"

	// image processing
	CompressImageUrlToFile  = "https://api.apyhub.com/processor/image/compress/url/file"
	CompressImageUrlToUrl   = "https://api.apyhub.com/processor/image/compress/file-urls"
	CompressImageFileToFile = "https://api.apyhub.com/processor/image/compress/file"
	CompressImageFileToUrl  = "https://api.apyhub.com/processor/image/compress/file/url"

	WaterMarkImageUrlToFile  = "https://api.apyhub.com/processor/image/watermark/url/file"
	WaterMarkImageUrlToUrl   = "https://api.apyhub.com/processor/image/watermark/file-urls"
	WaterMarkImageFileToFile = "https://api.apyhub.com/processor/image/watermark/file"
	WaterMarkImageFileToUrl  = "https://api.apyhub.com/processor/image/watermark/file/url"

	CropImageUrlToFile  = "https://api.apyhub.com/processor/image/crop/url/file"
	CropImageUrlToUrl   = "https://api.apyhub.com/processor/image/crop/file-urls"
	CropImageFileToFile = "https://api.apyhub.com/processor/image/crop/file"
	CropImageFileToUrl  = "https://api.apyhub.com/processor/image/crop/file/url"

	ResizeImageUrlToFile  = "https://api.apyhub.com/processor/image/resize/url/file"
	ResizeImageUrlToUrl   = "https://api.apyhub.com/processor/image/resize/file-urls"
	ResizeImageFileToFile = "https://api.apyhub.com/processor/image/resize/file"
	ResizeImageFileToUrl  = "https://api.apyhub.com/processor/image/resize/file/urls"

	ThumnailsImageUrlToFile  = "https://api.apyhub.com/generate/image/thumbnail/url/file"
	ThumnailsImageUrlToUrl   = "https://api.apyhub.com/generate/image/thumbnail/file-urls"
	ThumnailsImageFileToFile = "https://api.apyhub.com/generate/image/thumbnail/file"
	ThumnailsImageFileToUrl  = "https://api.apyhub.com/generate/image/thumbnail/file/url"

	// validation
	VatValidate        = "https://api.apyhub.com/validate/vat"
	INPostcodeValidate = "https://api.apyhub.com/validate/postcodes/in"
	UKPostcodeValidate = "https://api.apyhub.com/validate/postcodes/uk"
	EmailDNS           = "https://api.apyhub.com/validate/email/dns"
	EmailAcadamic      = "https://api.apyhub.com/validate/email/academic"

	// file-extraction
	TextFromWebpage       = "https://api.apyhub.com/extract/text/webpage"
	TextFromWordUrl       = "https://api.apyhub.com/extract/text/word-url"
	TextFromWordFile      = "https://api.apyhub.com/extract/text/word-file"
	TextFromPdfUrl        = "https://api.apyhub.com/extract/text/pdf-url"
	TextFromPdfFile       = "https://api.apyhub.com/extract/text/pdf-file"
	ImageMetadataFromFile = "https://api.apyhub.com/processor/image/metadata/file"
	ImageMetadataFromUrl  = "https://api.apyhub.com/processor/image/metadata/file-urls"
	FuzzySearch           = "https://api.apyhub.com/search/text/fuzzy"

	// data
	CountryInfo    = "https://api.apyhub.com/data/info/country"
	CountryList    = "https://api.apyhub.com/data/dictionary/country"
	CurrenciesList = "https://api.apyhub.com/data/dictionary/currency"
	CurrencyConv   = "https://api.apyhub.com/data/convert/currency"
	Timezones      = "https://api.apyhub.com/data/dictionary/timezone"

	// generate
	BarChartFile = "https://api.apyhub.com/generate/charts/bar/file"
	BarChartUrl  = "https://api.apyhub.com/generate/charts/bar/url"

	PieChartFile = "https://api.apyhub.com/generate/charts/pie/file"
	PieChartUrl  = "https://api.apyhub.com/generate/charts/pie/url"

	StackedBarChartFile = "https://api.apyhub.com/generate/charts/stacked/file"
	StackedBarChartUrl  = "https://api.apyhub.com/generate/charts/stacked/url"

	BarcodeAsFile = "https://api.apyhub.com/generate/barcode/file"
	BarcodeAsURL  = "https://api.apyhub.com/generate/barcode/url"

	QrcodeAsFile = "https://api.apyhub.com/generate/qr-code/file"
	QrcodeAsURL  = "https://api.apyhub.com/generate/qr-code/url"

	HtmlContentToPdfFile = "https://api.apyhub.com/generate/html-content/pdf-file"
	HtmlContentToPdfURL  = "https://api.apyhub.com/generate/html-content/pdf-url"

	WebpageToPdfFile = "https://api.apyhub.com/generate/webpage/pdf-file"
	WebpageToPdfURL  = "https://api.apyhub.com/generate/webpage/pdf-url"

	ScreenshotWebpageAsFile = "https://api.apyhub.com/generate/screenshot/webpage/image-file"
	ScreenshotWebpageAsURL  = "https://api.apyhub.com/generate/screenshot/webpage/image-url"

	IcalAsFile = "https://api.apyhub.com/generate/ical/file"
	IcalAsURL  = "https://api.apyhub.com/generate/ical/url"

	ArchiveURLToFile  = "https://api.apyhub.com/generate/archive/file-urls/archive-file"
	ArchiveFileToFile = "https://api.apyhub.com/generate/archive/files/archive-file"
	ArchiveFileToURL  = "https://api.apyhub.com/generate/archive/files/archive-url"
	ArchiveURLToURL   = "https://api.apyhub.com/generate/archive/file-urls/archive-url"

	SecureArchiveURLToFile  = "https://api.apyhub.com/generate/secure-archive/file-urls/archive-file"
	SecureArchiveFileToFile = "https://api.apyhub.com/generate/secure-archive/files/archive-file"
	SecureArchiveURLToURL   = "https://api.apyhub.com/generate/secure-archive/file-urls/archive-url"
	SecureArchiveFileToURL  = "https://api.apyhub.com/generate/secure-archive/files/archive-url"

	UnArchiveAsURLToURL      = "https://api.apyhub.com/extract/archive/url/file-urls"
	UnArchiveFileToURL       = "https://api.apyhub.com/extract/archive/file/file-urls"
	SecureUnArchiveURLToURL  = "https://api.apyhub.com/extract/secure-archive/url/file-urls"
	SecureUnArchiveFileToURL = "https://api.apyhub.com/extract/secure-archive/file/file-urls"
)

Variables

View Source
var (
	ErrTypeNotMatch        = errors.New("type not matched")
	ErrInvalidFormat       = errors.New("format of file submitted is invalid")
	ErrNotSameType         = errors.New("image and watermark is not same type")
	ErrUnableToGetCurrency = errors.New("unable to get currency")
	ErrTokenNotSet         = errors.New("authentication required")
	ErrNoArgs              = errors.New("url or file required")
	ErrMixedType           = errors.New("mixed type can't be allowed")
)
View Source
var ContentType = func(contentType string) (string, string) { return "Content-Type", contentType }
View Source
var Token string

Functions

func CallApyhub

func CallApyhub(method string, url string, body io.Reader, s ...string) ([]byte, error)

func CallApyhubFromFile

func CallApyhubFromFile(key string, url string, input io.Reader, filename string) ([]byte, error)

Create Form File

func CallApyhubFromJson

func CallApyhubFromJson(url string, byt []byte) ([]byte, error)

Call Apyhub

func CheckDocumentExt

func CheckDocumentExt(jsnbyt []byte) bool

func CheckImageExt

func CheckImageExt(jsnbyt []byte) bool

func GetFileExt

func GetFileExt(byt []byte) string

func PrepareBody

func PrepareBody(key string, input io.Reader, filename string) (*bytes.Buffer, *multipart.Writer, error)

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}
var Auth BasicAuth

type CalenderEvent

type CalenderEvent struct {
	Summary         string    `json:"summary"`
	Description     string    `json:"description"`
	OrganizerEmail  string    `json:"organizer_email"`
	AttendeesEmails []string  `json:"attendees_emails"`
	Location        string    `json:"location"`
	TimeZone        string    `json:"time_zone"`
	MeetingDate     string    `json:"meeting_date"`
	StartTime       string    `json:"start_time"`
	EndTime         string    `json:"end_time"`
	Reccuring       bool      `json:"recurring"`
	Recurrence      Reccurent `json:"recurrence"`
}

type Chart

type Chart struct {
	Title string   `json:"title"`
	Theme string   `json:"theme"`
	Data  []Values `json:"data"`
}

Charts struct

type ContentRequest

type ContentRequest struct {
	Content string `json:"content"`
}

type Country

type Country struct {
	Value        string   `json:"value"`
	Key          string   `json:"key"`
	Cca3         string   `json:"cca3"`
	Emoji        string   `json:"emoji"`
	Calling_code []int    `json:"calling_code"`
	Subdivision  []subdiv `json:"subdivision"`
}

type CountryListResponse

type CountryListResponse struct {
	Data []Country `json:"data"`
}

type CountryResponse

type CountryResponse struct {
	Data Country `json:"data"`
}

Country Code

type Currency

type Currency struct {
	Emoji string `json:"emoji"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

type CurrencyConverter

type CurrencyConverter struct {
	Source string `json:"source"`
	Target string `json:"target"`
	Date   string `json:"date,omitempty"`
}

currency struct

type CurrencyList

type CurrencyList struct {
	Data []Currency `json:"data"`
}

type CurrencyResponse

type CurrencyResponse struct {
	Data float64 `json:"data"`
}

type EmailRequest

type EmailRequest struct {
	Email string
}

type ErrJsn

type ErrJsn struct {
	Error string `json:"error"`
}

type FuzzyRequest

type FuzzyRequest struct {
	Source string `json:"source"`
	Target string `json:"target"`
}

Fuzzy search

type FuzzyResponse

type FuzzyResponse struct {
	Data []string `json:"data"`
}

type MetaResponse

type MetaResponse struct {
	Data map[string]interface{} `json:"data"`
}

Metadata struct

type PostRequest

type PostRequest struct {
	Postcode string
}

type Reccurent

type Reccurent struct {
	Frequency string `json:"frequency"`
	Interval  int    `json:"interval"`
	Count     int    `json:"count"`
}

type Request

type Request struct {
	Url string `json:"url"`
}

type Response

type Response struct {
	Data string `json:"data"`
}

type SecureUnZip

type SecureUnZip struct {
	Url      string `json:"url"`
	Password string `json:"password"`
}

type StackedBarChart

type StackedBarChart struct {
	Title string         `json:"title"`
	Theme string         `json:"theme"`
	Data  []StackedValue `json:"data"`
}

type StackedValue

type StackedValue struct {
	Name   string   `json:"name"`
	Values []Values `json:"values"`
}

type Timezone

type Timezone struct {
	Key          string   `json:"key"`
	Value        string   `json:"value"`
	Abbreviation []string `json:"abbreviation"`
	UTC_time     string   `json:"utc_time"`
}

type TimezoneResponse

type TimezoneResponse struct {
	Data []Timezone `json:"data"`
}

Timezone struct

type UnZip

type UnZip struct {
	Url string `json:"url"`
}

type UnZipResponse

type UnZipResponse struct {
	Data []string `json:"data"`
}

type Values

type Values struct {
	Label string  `json:"label"`
	Value float64 `json:"value"`
}

type VatRequest

type VatRequest struct {
	Vat string
}

type Watermark

type Watermark struct {
	Image     interface{}
	Watermark interface{}
}

type WatermarkRequest

type WatermarkRequest struct {
	ImageUrl     string
	WatermarkUrl string
}

type WrongJsn

type WrongJsn struct {
	Data  interface{} `json:"data"`
	Error string      `json:"error"`
}

type Zip

type Zip struct {
	Urls []string `json:"urls"`
}

type ZipSecure

type ZipSecure struct {
	Urls     []string `json:"urls"`
	Password string   `json:"password"`
}

Jump to

Keyboard shortcuts

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