Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Latest commit

 

History

History
44 lines (33 loc) · 1.32 KB

File metadata and controls

44 lines (33 loc) · 1.32 KB

Warning

This SDK has been deprecated. We recommend you to generate a Commercelayer Go client yourself based on the API specifications from Commercelayer.

Go Commercelayer SDK

This projects provides an API client to connect with the Commercelayer apis. It is automatically generated from the openapi definition so it should be feature complete.

Documentation

Usage

clientId := <client-id>
clientSecret := <client-secret>
apiEndpoint := <url>/api
authEndpoint := <ur>/oauth/token

ctx := context.Background()

credentials := clientcredentials.Config{
    ClientID:     clientId,
    ClientSecret: clientSecret,
    TokenURL:     authEndpoint,
    Scopes:       []string{},
}

httpClient := credentials.Client(ctx)

commercelayerClient := api.NewAPIClient(&api.Configuration{
    HTTPClient: httpClient,
    Debug:      true,
    Servers: []api.ServerConfiguration{
        {URL: apiEndpoint},
    },
})

data, resp, err := commercelayerClient.AddressesApi.GETAddresses(ctx).Execute()

Development

  • Make sure you have nodejs and npm installed
  • Run make to regenerate the whole SDK. This will also install the dependencies required to generate the SDK through npm.