# Packages
No description provided by the author
# 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.