Categorygithub.com/Gemini-Commerce/go-client-product-configurator
repositorypackage
0.0.0-20241118165457-17bc09f20fa8
Repository: https://github.com/gemini-commerce/go-client-product-configurator.git
Documentation: pkg.go.dev

# README

Go API client for productconfigurator

Introduction

This comprehensive guide will equip you with the knowledge to integrate and leverage our Product Configurator Service in your applications.

Quick Start

Get up and running in no time! Follow these steps to kickstart your integration:

  1. Authentication: Obtain your integration JWT to authenticate your requests.
  2. Client Libraries: Explore our GitHub repositories to grab client libraries in your preferred programming language.
  3. API Overview: Familiarize yourself with our RESTful API using the OpenAPI specification.

Integration

API Overview

Our RESTful API is the gateway to unlocking the full potential of Product Configurator. Check out the detailed API Reference for a granular understanding of each endpoint and request/response format.

Client Libraries

To expedite your integration process, we provide client libraries for various programming languages. Find the one that suits your stack in our GitHub repositories.

Authentication

Security is paramount. Learn how to authenticate your requests using JWT. This ensures a secure and reliable connection between your application and Product Configurator.

Configuration Management

Configurator Lifecycle

Understand the lifecycle of configurators, from draft to active and deleted. This flexibility allows you to manage configurations at your own pace.

Steps and Options

Configure product steps with ease and define options effortlessly. Explore the power of dependencies to create dynamic and intuitive configurations.

Matrices

Delve into matrices—your secret weapon. Explore price and weight matrices, and learn how configured steps influence properties and pricing.

Price Management

Unleash dynamic pricing with our versatile price matrices. From fixed prices to incremental structures, adapt to diverse pricing models effortlessly.

Security

Your data is in safe hands. Discover how Product Configurator ensures security through JWT authentication, safeguarding your sensitive information.

Backward Compatibility

Stay ahead of the curve. Learn about our versioning strategy, providing backward compatibility while allowing our service to evolve seamlessly.

Developer Support

Have questions? Need assistance? Write to us at [email protected] and we will get back to you.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1
  • Package version: 1.0.0
  • Generator version: 7.9.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import productconfigurator "github.com/Gemini-Commerce/go-client-product-configurator"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value productconfigurator.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), productconfigurator.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value productconfigurator.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), productconfigurator.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using productconfigurator.ContextOperationServerIndices and productconfigurator.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), productconfigurator.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), productconfigurator.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://product-configurator.api.gogemini.io

ClassMethodHTTP requestDescription
ConfigurationAPIProductConfiguratorGetAvailableConfigurationGet /v1/{tenantId}/product/{productId}/configurationGet Available Configuration
ConfigurationAPIProductConfiguratorGetAvailableConfiguration2Post /v1/{tenantId}/product/{productId}/configurationGet Available Configuration
ConfigurationAPIProductConfiguratorGetConfigurationFromSelectionsPost /v1/{tenantId}/product/{productId}/configuration-from-selectionsGet Configuration from Selections
ConfiguratorAPIProductConfiguratorCopyConfiguratorPost /v1/{tenantId}/product/{sourceConfiguratorId}/copyCopy Configurator
ConfiguratorAPIProductConfiguratorCreateConfiguratorPost /v1/{tenantId}/product/{productId}/createCreate Configurator
ConfiguratorAPIProductConfiguratorDeleteConfiguratorDelete /v1/{tenantId}/configurator/{configuratorId}Delete Configurator
ConfiguratorAPIProductConfiguratorGetConfiguratorByProductIdGet /v1/{tenantId}/product/{productId}Get Configurator by Product ID
ConfiguratorAPIProductConfiguratorGetConfiguratorByProductId2Get /v1/{tenantId}/product/{productId}/status/{status}Get Configurator by Product ID
ConfiguratorAPIProductConfiguratorListConfiguratorsPost /v1/{tenantId}/product/{productId}/page-size/{pageSize}/configuratorsList Product Configurators
ConfiguratorAPIProductConfiguratorUpdateConfiguratorPut /v1/{tenantId}/configurator/{configuratorId}Update Configurator
DependencyAPIProductConfiguratorCreateDependencyPost /v1/{tenantId}/step/{stepId}/dependency/createCreate Dependency
DependencyAPIProductConfiguratorDeleteDependencyDelete /v1/{tenantId}/dependency/{dependencyId}Delete Dependency
DependencyAPIProductConfiguratorListDependenciesPost /v1/{tenantId}/page-size/{pageSize}/dependenciesList Dependencies
DependencyAPIProductConfiguratorUpdateDependencyPut /v1/{tenantId}/dependency/{dependencyId}Update Dependency
MatrixAPIProductConfiguratorCreateMatrixPost /v1/{tenantId}/matrix/createCreate Matrix
MatrixAPIProductConfiguratorDeleteMatrixDelete /v1/{tenantId}/matrix/{matrixId}Delete Matrix
MatrixAPIProductConfiguratorGetMatrixGet /v1/{tenantId}/matrix/{matrixId}Get Matrix
MatrixAPIProductConfiguratorListMatricesPost /v1/{tenantId}/configurator/{configuratorId}/page-size/{pageSize}/matricesList Matrices
MatrixAPIProductConfiguratorRemovePricelistFromMatrixDelete /v1/{tenantId}/matrix/{matrixId}/pricelist/{pricelistGrn}Remove Pricelist from Matrix
MatrixAPIProductConfiguratorUpdateMatrixPut /v1/{tenantId}/matrix/{matrixId}Update Matrix
OptionAPIProductConfiguratorBulkCreateOptionsPost /v1/{tenantId}/step/{stepId}/option/create/bulkBulk Create Options
OptionAPIProductConfiguratorBulkDeleteOptionsPost /v1/{tenantId}/option/delete/bulkBulk Delete Options
OptionAPIProductConfiguratorBulkUpdateOptionsPut /v1/{tenantId}/option/bulkBulk Update Options
OptionAPIProductConfiguratorCopyOptionPost /v1/{tenantId}/option/{sourceOptionId}/copyCopy Option
OptionAPIProductConfiguratorCreateOptionPost /v1/{tenantId}/step/{stepId}/option/createCreate Option
OptionAPIProductConfiguratorDeleteOptionDelete /v1/{tenantId}/option/{optionId}Delete Option
OptionAPIProductConfiguratorListOptionsPost /v1/{tenantId}/step/{stepId}/page-size/{pageSize}/optionsList Options
OptionAPIProductConfiguratorUpdateOptionPut /v1/{tenantId}/option/{optionId}Update Option
ProductConfiguratorAPIProductConfiguratorGetPropertyGet /v1/{tenantId}/property/{propertyId}
ProductConfiguratorAPIProductConfiguratorListPropertiesByConfigurationPost /v1/{tenantId}/configurator/{configuratorId}/page-size/{pageSize}/properties
PropertyAPIProductConfiguratorBulkCreatePropertiesPost /v1/{tenantId}/property/create/bulkBulk Create Properties
PropertyAPIProductConfiguratorBulkUpdatePropertiesPut /v1/{tenantId}/properties/bulkBulk Update Properties
PropertyAPIProductConfiguratorCreatePropertyPost /v1/{tenantId}/property/createCreate Property
PropertyAPIProductConfiguratorListPropertiesPost /v1/{tenantId}/matrix/{matrixId}/page-size/{pageSize}/propertiesList Properties
PropertyAPIProductConfiguratorUpdatePropertyPut /v1/{tenantId}/property/{propertyId}Update Property
StepAPIProductConfiguratorBulkCreateStepsPost /v1/{tenantId}/configurator/{configuratorId}/step/create/bulkBulk Create Steps
StepAPIProductConfiguratorBulkDeleteStepsPost /v1/{tenantId}/step/delete/bulkBulk Delete Steps
StepAPIProductConfiguratorCopyStepPost /v1/{tenantId}/step/{sourceStepId}/copyCopy Step
StepAPIProductConfiguratorCreateStepPost /v1/{tenantId}/configurator/{configuratorId}/step/createCreate Step
StepAPIProductConfiguratorDeleteStepDelete /v1/{tenantId}/step/{stepId}Delete Step
StepAPIProductConfiguratorUpdateStepPut /v1/{tenantId}/step/{stepId}Update Step

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

APIAuthorization

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: APIAuthorization and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		productconfigurator.ContextAPIKeys,
		map[string]productconfigurator.APIKey{
			"APIAuthorization": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

standardAuthorization

Example

auth := context.WithValue(context.Background(), productconfigurator.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, productconfigurator.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]