apyhub

package module
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: 8 Imported by: 0

README

Alt text

ApyHub for Golang

Reference Chat

About

Welcome to the ApyHub SDK for Golang! This library provides easy access to the ApyHub APIs through a set of simple and powerful functions.

Our underlying philosophy is to not bloat applications, which is why we have made sure to keep the package as minimal as possible. With this SDK, you can easily perform tasks such as file conversion, text and metadata extraction, document and image generation, image processing, and access to data lists and currency conversion. As our platform grows and develops new APIs, we will be adding more functions to this library.

To learn more about ApyHub, visit our website at apyhub.com or join our Discord server at discord.com/invite/apyhub.

API Documentation

Our SDK provides access to the following API categories:

Each of these categories contains multiple functions for interacting with the corresponding API. For more examples and detailed API documentation, see the links above.

Installation

Use go get to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies.

go get github.com/apyhub/apyhub.go

To update the SDK use go get -u to retrieve the latest version of the SDK.

go get -u github.com/apyhub/apyhub.go

Usage

To use the library, you will need to initialize it with your ApyHub API token.

Token
import (
   apyhub "github.com/apyhub/apyhub.go"
)

err:=apyhub.InitApyHub("YOUR_APY_TOKEN")
if err!=nil {
   log.Fatal(err)
}
Basic Authorization
import(
   apyhub "github.com/apyhub/apyhub.go"
   h "github.com/apyhub/apyhub.go/helper"
)

BasicAuth := h.BasicAuth{
   Username: "username",
   Password: "password",
}
    
err:=apyhub.InitApyHub(BasicAuth)
if err!=nil {
   log.Fatal(err)
}

Example

Once the library is initialized, you can import and use the various functions and methods provided by the library. For example, to access the data list of countries, you can do the following:

import (
   "github.com/apyhub/apyhub.go/data"
)

 country,err:=data.Country("countrycode")

Contributing

We welcome contributions to this project. If you have an idea for a new feature or improvement, please open an issue to discuss it. If you'd like to contribute code, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Make your changes and commit them.
  4. Push your branch to your fork on GitHub.
  5. Open a pull request from your branch to the main branch of this repository.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchiveAsFile

func ArchiveAsFile(conv ...interface{}) ([]byte, error)

Archiver and secure archiver

func ArchiveAsURL

func ArchiveAsURL(conv ...interface{}) (string, error)

func BarChartAsFile

func BarChartAsFile(charts h.Chart) ([]byte, error)

Generate Charts, bar code,qr code and pdf

func BarChartAsURL

func BarChartAsURL(charts h.Chart) (string, error)

func BarcodeAsFile

func BarcodeAsFile(content string) ([]byte, error)

func BarcodeAsURL

func BarcodeAsURL(content string) (string, error)

func CompressImageAsFile

func CompressImageAsFile(conv interface{}, quality int) ([]byte, error)

image processing

func CompressImageAsURL

func CompressImageAsURL(conv interface{}, quality int) (string, error)

func Country

func Country(countrycode string) (h.Country, error)

Data getting Information

func CountryList

func CountryList() ([]h.Country, error)

func CropImageAsFile

func CropImageAsFile(conv interface{}, width int, height int) ([]byte, error)

func CropImageAsURL

func CropImageAsURL(conv interface{}, width int, height int) (string, error)

func CsvToExcelAsFile

func CsvToExcelAsFile(urlorFile interface{}) ([]byte, error)

##Functions

### csvToExcel

Converts a CSV file or URL to an Excel file.

**`Example 1 : convert csv file to Excel file`**

```go

import (
	apyhub "github.com/apyhub/apyhub.go"
)

File,err :=os.Open("any csv file")
if err!=nil {
	log.Fatal(err)
}

// Input is a file
byt,err :=apyhub.CsvToExcelAsFile(File)

```

**`Example 2 : convert csv file url to Excel file`**

```go

fileUrl :="csv file url"

// Input is a url
byt,err :=apyhub.CsvToExcelAsFile(fileUrl)

```

#### Defined in

[convert/csvToExcel.go:63](https://github.com/apyhub/apyhub.go/blob/main/convert/csvToExcel.go#L63)

func CsvToExcelAsUrl

func CsvToExcelAsUrl(urlorFile interface{}) (string, error)

**`Example 3 : convert csv file to AWS presigned url`**

```go

// Input is a file
File,err :=os.Open("any csv file")
if err!=nil {
	log.Fatal(err)
}

url,err :=apyhub.CsvToExcelAsUrl(File)

```

**`Example 4 : convert csv file url to AWS presigned url`**

```go

fileUrl :="csv file url"

// Input is a url
url,err :=apyhub.CsvToExcelAsUrl(fileUrl)

```

#### Defined in

[convert/csvToExcel.go:38](https://github.com/apyhub/apyhub.go/blob/main/convert/csvToExcel.go#L38)

**`Link`**

https://apyhub.com/utility/converter-csv-excel

#### Parameters

<table> <tr><th>Name</th><th>Type</th><th>Description</th></tr> <tr><td>input</td><td> <code>"string"</code> | <code>Buffer</code></td><td>The html file or URL.</td></tr> <tr><td>output</td><td><code>[]byte</code> | <code>"string"</code> </td><td>The format for the response.</td></tr> </table>

#### Returns

The data for the output file as slice of byte or Url as a string.

func CurrencyConv

func CurrencyConv(currency h.CurrencyConverter) (float64, error)

func CurrencyList

func CurrencyList() ([]h.Currency, error)

func EmailValidation

func EmailValidation(email string, checkType validation.CheckType) (bool, error)

Email DNS and Acadamic

func FuzzySearch

func FuzzySearch(source string, target string, unicodeNormalize bool) ([]string, error)

func HtmlContentToPdfFile

func HtmlContentToPdfFile(content string) ([]byte, error)

func HtmlContentToPdfURL

func HtmlContentToPdfURL(content string) (string, error)

func HtmlToPdfAsFile

func HtmlToPdfAsFile(urlorFile interface{}, landscape bool) ([]byte, error)

func HtmlToPdfAsUrl

func HtmlToPdfAsUrl(urlorFile interface{}, landscape bool) (string, error)

func IcalGeneratorAsFile

func IcalGeneratorAsFile(calendar h.CalenderEvent) ([]byte, error)

func IcalGeneratorAsURL

func IcalGeneratorAsURL(calendar h.CalenderEvent) (string, error)

func ImageMetadata

func ImageMetadata(urlorFile interface{}) (map[string]interface{}, error)

func ImageToPdfAsFile

func ImageToPdfAsFile(urlorFile interface{}, landscape bool) ([]byte, error)

### imageToPdf

Converts a image file or URL to an pdf file.

**`Example 1 : convert image to pdf file`**

```go

import (
apyhub "github.com/apyhub/apyhub.go"
)

// Input is a file
File,err :=os.Open("any image")
if err!=nil {
	log.Fatal(err)
}

byt,err :=apyhub.ImageToPdfAsFile(File)

```

**`Example 2 : convert image url to pdf file`**

```go

// Input is a url
fileUrl :="image url"

byt,err :=apyhub.ImageToPdfAsFile(fileUrl)

```

#### Defined in

[convert/imageToPdf.go:12](https://github.com/apyhub/apyhub.go/blob/main/convert/imageToPdf.go#L12)

func ImageToPdfAsUrl

func ImageToPdfAsUrl(urlorFile interface{}, landscape bool) (string, error)

func InitApyHub

func InitApyHub(auth interface{}) error

Set the token

func MarkdownToHtmlAsFile

func MarkdownToHtmlAsFile(urlorFile interface{}) ([]byte, error)

func MarkdownToHtmlAsUrl

func MarkdownToHtmlAsUrl(urlorFile interface{}) (string, error)

func PieChartAsFile

func PieChartAsFile(charts h.Chart) ([]byte, error)

func PieChartAsURL

func PieChartAsURL(charts h.Chart) (string, error)

func PostCodeValidation

func PostCodeValidation(postcode string, checkType validation.CheckType) (bool, error)

IN and UK postcode

func PresentationToPdfAsFile

func PresentationToPdfAsFile(urlorFile interface{}, landscape bool) ([]byte, error)

func PresentationToPdfAsUrl

func PresentationToPdfAsUrl(urlorFile interface{}, landscape bool) (string, error)

func QrcodeAsFile

func QrcodeAsFile(content string) ([]byte, error)

func QrcodeAsURL

func QrcodeAsURL(content string) (string, error)

func ResizeImageAsFile

func ResizeImageAsFile(conv interface{}, width int, height int) ([]byte, error)

func ResizeImageAsURL

func ResizeImageAsURL(conv interface{}, width int, height int) (string, error)

func ScreenshotWebpageAsFile

func ScreenshotWebpageAsFile(url string, quality int, delay int) ([]byte, error)

func ScreenshotWebpageAsURL

func ScreenshotWebpageAsURL(url string, quality int, delay int) (string, error)

func SecureArchiveAsURL

func SecureArchiveAsURL(password string, conv ...interface{}) (string, error)

func SecureArchiveFile

func SecureArchiveFile(password string, conv ...interface{}) ([]byte, error)

func SecureUnArchiveAsURL

func SecureUnArchiveAsURL(password string, conv interface{}) ([]string, error)

func SpreadsheetToPdfAsFile

func SpreadsheetToPdfAsFile(urlorFile interface{}, landscape bool) ([]byte, error)

func SpreadsheetToPdfAsUrl

func SpreadsheetToPdfAsUrl(urlorFile interface{}, landscape bool) (string, error)

func StackedBarChartAsFile

func StackedBarChartAsFile(charts h.StackedBarChart) ([]byte, error)

func StackedBarChartAsURL

func StackedBarChartAsURL(charts h.StackedBarChart) (string, error)

func TextFromPdf

func TextFromPdf(urlorFile interface{}) (string, error)

func TextFromWebpage

func TextFromWebpage(url string) (string, error)

Extraction

func TextFromWord

func TextFromWord(urlorFile interface{}) (string, error)

func ThumnailsImageAsFile

func ThumnailsImageAsFile(conv interface{}, width int, height int) ([]byte, error)

func ThumnailsImageAsURL

func ThumnailsImageAsURL(conv interface{}, width int, height int) (string, error)

func Timezones

func Timezones() ([]h.Timezone, error)

func UnArchiveAsURL

func UnArchiveAsURL(conv interface{}) ([]string, error)

unarchiver

func VatValidation

func VatValidation(vat string) (bool, error)

Validation

func WatermarkImageAsFile

func WatermarkImageAsFile(conv h.Watermark, width int, height int) ([]byte, error)

func WatermarkImageAsURL

func WatermarkImageAsURL(conv h.Watermark, width int, height int) (string, error)

func WebpageToPdfFile

func WebpageToPdfFile(url string, margin float64) ([]byte, error)

func WebpageToPdfURL

func WebpageToPdfURL(url string, margin float64) (string, error)

func WordToPdfAsFile

func WordToPdfAsFile(urlorFile interface{}, landscape bool) ([]byte, error)

func WordToPdfAsUrl

func WordToPdfAsUrl(urlorFile interface{}, landscape bool) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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