Categorygithub.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go

# README

GroupDocs.Conversion Cloud Go SDK

Go package for communicating with the GroupDocs.Conversion Cloud API

Installation

The package is available at github.com. You can install it with:

go get github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go

To add dependency to your app copy following into your go.mod and run go mod tidy:

require (
 github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go v1.0.0
)

Getting Started

Please follow the installation procedure and then run the following code:

package main

import (
 "context"
 "fmt"

 "github.com/antihax/optional"
 conversion "github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-go"
 "golang.org/x/oauth2/clientcredentials"
)

func main() {

 // Create an OAuth2 config using client_credentials grant type
 conf := &clientcredentials.Config{
  ClientID:     "XXXX-XXXX-XXXX-XXXX",      // Your client_id
  ClientSecret: "XXXXXXXXXXXXXXXX",         // Your client_secret
  TokenURL:     "https://api.groupdocs.cloud/connect/token", // The token URL
  Scopes:       []string{},                                  // Optional: specify any required scopes
 }

 // Request the token
 token, err := conf.Token(context.Background())
 if err != nil {
  fmt.Printf("Unable to retrieve token: %v", err)
 }

 // Output the access token
 fmt.Printf("Access Token: %s\n", token.AccessToken)

 cfg := conversion.NewConfiguration()
 client := conversion.NewAPIClient(cfg)
 auth := context.WithValue(context.Background(), conversion.ContextAccessToken, token.AccessToken)
 opts := &conversion.InfoApiGetSupportedConversionTypesOpts{
  Format: optional.NewString("pdf"),
 }

 formats, _, _ := client.InfoApi.GetSupportedConversionTypes(auth, opts)

 for _, format := range formats {
  fmt.Printf("Source Format: %s\n", format.SourceFormat)
  fmt.Printf("Target Formats: %v\n", format.TargetFormats)
  fmt.Println()
 }
}

Licensing

GroupDocs.Conversion Cloud Go SDK licensed under MIT License.

Resources

Contact Us

Your feedback is very important to us. Please feel free to contact us using our Support Forums.

# Packages

No description provided by the author

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.

# Structs

APIClient manages communication with the GroupDocs.Conversion Cloud API Reference API v24.11 In most cases there should be only one, shared, APIClient.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
No description provided by the author
No description provided by the author
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GenericSwaggerError Provides access to the body, error and model on returned errors.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author