bluestonepim_go_sdk

package module
v0.0.0-...-51df98d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 0 Imported by: 0

README

bluestonepim-go-sdk

Build Status codecov Go Report Card GoDoc

The Bluestone PIM Go SDK is automatically generated based on the official API specifications of Bluestone PIM. It should therefore be nearly feature complete.

The SDK was initially created for enabling the creation of the Terraform Provider for Bluestone PIM That provider enables you to use infrastructure-as-code principles with Bluestone PIM.

Note that since this SDK is automatically generated we cannot guarantee backwards compatibility between releases. Please pin the dependency correctly and be aware of potential changes when updating

Using the SDK

package main

import (
   "context"
   "errors"
   "fmt"
   "github.com/labd/bluestonepim-go-sdk/pim"
   "log"
   "math/rand"
   "time"

   "golang.org/x/oauth2/clientcredentials"
)

func main() {

   // Create the new client. When an empty value is passed it will use the CTP_*
   // environment variables to get the value. The HTTPClient arg is optional,
   // and when empty will automatically be created using the env values.
   oauth2Config := &clientcredentials.Config{
      ClientID:     "<your-client-id>",
      ClientSecret: "<your-client-secret",
      TokenURL:     "https://idp.bluestonepim.com/op/token",
   }
   
   ctx := context.Background()

   httpClient := oauth2Config.Client(ctx)

   client, err := pim.NewClientWithResponses(
      fmt.Sprintf("%s/pim", "https://api.bluestonepim.com"),
      pim.WithHTTPClient(httpClient),
   )
   if err != nil {
      log.Fatal(err)
   }
   
   // Create a new category
   response, err := client.CreateCategoryWithResponse(ctx,
      &pim.CreateCategoryParams{
         Validation: "NAME",
      },
      pim.CreateCategoryJSONRequestBody{
         Name:     "my category name",
         Number:   "my-category-key",
      },
   )
    if err != nil {
        log.Fatal(err)
    }
}

Generating code

To re-generate the API take the following steps:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package global_settings provides primitives to interact with the openapi HTTP API.
Package global_settings provides primitives to interact with the openapi HTTP API.
Package notification_external provides primitives to interact with the openapi HTTP API.
Package notification_external provides primitives to interact with the openapi HTTP API.
Package pim provides primitives to interact with the openapi HTTP API.
Package pim provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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