Skip to content

codedius/imagekit-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imagekit-go

A Go client library for accessing the ImageKit.io API.

Installation

Use the following command to download this module:

go get github.com/codedius/imagekit-go

Usage

import "github.com/codedius/imagekit-go"

Construct a new API client, then use to access the ImageKit.io API. For example:

opts := imagekit.Options{
    PublicKey:  "Your API Private Key",
    PrivateKey: "Your API Public Key",
}

ik, err := imagekit.NewClient(&opts)
if err != nil {
    // error handling
}

Upload image to your ImageKit.io Media Library:

ur := imagekit.UploadRequest{
    File:              file, // []byte OR *url.URL OR url.URL OR base64 string
    FileName:          "file name",
    UseUniqueFileName: false,
    Tags:              []string{},
    Folder:            "/",
    IsPrivateFile:     false,
    CustomCoordinates: "",
    ResponseFields:    nil,
}

ctx := context.Background()

upr, err := ik.Upload.ServerUpload(ctx, &ur)
if err != nil {
    // error handling
}

Other methods are pretty straightforward and doesn't need extra explanations. For more info please read library's documentation from go.dev and ImageKit.io API documentation.

About

A Go client library for accessing the ImageKit.io API.

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages