Categorygithub.com/Gemini-Commerce/go-client-urlmanager
modulepackage
0.0.0-20241118164434-e61318157b9d
Repository: https://github.com/gemini-commerce/go-client-urlmanager.git
Documentation: pkg.go.dev

# README

Go API client for urlmanager

The URL Manager service provides a set of APIs for managing URL rewrites within your application. URL rewriting is a technique used to modify the appearance or structure of URLs while maintaining the functionality and accessibility of the underlying resources.

The URL Manager service offers various operations to create, retrieve, update, and delete URL rewrite configurations. These configurations allow you to define rules that map incoming URLs to different paths or destinations based on specific criteria. By using URL rewriting, you can enhance the user experience, improve SEO (Search Engine Optimization), and manage complex URL structures effectively.

To get started with the URL Manager service, you need to integrate the provided Proto API into your application. The API supports various programming languages and frameworks, making it easy to incorporate URL rewriting functionality into your existing codebase.

Once integrated, you can utilize the different API methods to create, manage, and query URL rewrite configurations based on your application's requirements.

Refer to the API documentation for detailed information on the request and response formats, authentication requirements, and example usage of each API method.

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: 1.0.0
  • 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 urlmanager "github.com/Gemini-Commerce/go-client-urlmanager"

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 urlmanager.ContextServerIndex of type int.

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

Templated Server URL

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

ctx := context.WithValue(context.Background(), urlmanager.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 urlmanager.ContextOperationServerIndices and urlmanager.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to https://urlmanager.api.gogemini.io

ClassMethodHTTP requestDescription
BasicOperationsAPIUrlManagerChangeUrlRewriteRequestPathPost /urlmanager/change_url_rewrite_request_pathChange Url Rewrite Request Path
BasicOperationsAPIUrlManagerChangeUrlRewriteRequestPath2Post /urlmanager.UrlManager/ChangeUrlRewriteRequestPathChange Url Rewrite Request Path
BasicOperationsAPIUrlManagerCreateUrlRewritePost /urlmanager/create_url_rewriteCreate Url Rewrite
BasicOperationsAPIUrlManagerCreateUrlRewrite2Post /urlmanager.UrlManager/CreateUrlRewriteCreate Url Rewrite
BasicOperationsAPIUrlManagerDeleteUrlRewritePost /urlmanager/delete_url_rewriteDelete Url Rewrite
BasicOperationsAPIUrlManagerDeleteUrlRewrite2Post /urlmanager.UrlManager/DeleteUrlRewriteDelete Url Rewrite
BasicOperationsAPIUrlManagerGetUrlRewritePost /urlmanager/get_url_rewriteGet Url Rewrite
BasicOperationsAPIUrlManagerGetUrlRewrite2Post /urlmanager.UrlManager/GetUrlRewriteGet Url Rewrite
BasicOperationsAPIUrlManagerListUrlRewritesPost /urlmanager/list_url_rewritesList Url Rewrites
BasicOperationsAPIUrlManagerListUrlRewrites2Post /urlmanager.UrlManager/ListUrlRewritesList Url Rewrites
BasicOperationsAPIUrlManagerListUrlRewritesByTargetPathsPost /urlmanager/list_url_rewrites_by_target_pathsList Url Rewrites By Target Paths
BasicOperationsAPIUrlManagerListUrlRewritesByTargetPaths2Post /urlmanager.UrlManager/ListUrlRewritesByTargetPathsList Url Rewrites By Target Paths
BasicOperationsAPIUrlManagerResolveUrlRewritePost /urlmanager/resolve_url_rewriteResolve Url Rewrite
BasicOperationsAPIUrlManagerResolveUrlRewrite2Post /urlmanager.UrlManager/ResolveUrlRewriteResolve Url Rewrite

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

Authorization

  • 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: Authorization and passed in as the auth context for each request.

Example

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

standardAuthorization

  • Type: OAuth
  • Flow: implicit
  • Authorization URL:
  • Scopes: N/A

Example

auth := context.WithValue(context.Background(), urlmanager.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, urlmanager.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]

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
IsNil checks if an input is nil.
NewAPIClient creates a new API client.
NewAPIResponse returns a new APIResponse object.
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
NewConfiguration returns a new Configuration object.
NewGetUrlRewriteRequestCompoundIdentifier instantiates a new GetUrlRewriteRequestCompoundIdentifier object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewGetUrlRewriteRequestCompoundIdentifierWithDefaults instantiates a new GetUrlRewriteRequestCompoundIdentifier object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListUrlRewritesRequestFilter instantiates a new ListUrlRewritesRequestFilter object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListUrlRewritesRequestFilterWithDefaults instantiates a new ListUrlRewritesRequestFilter object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
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
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
NewProtobufAny instantiates a new ProtobufAny object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewProtobufAnyWithDefaults instantiates a new ProtobufAny object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewRpcStatus instantiates a new RpcStatus object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewRpcStatusWithDefaults instantiates a new RpcStatus object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerChangeUrlRewriteRequestPathRequest instantiates a new UrlmanagerChangeUrlRewriteRequestPathRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerChangeUrlRewriteRequestPathRequestWithDefaults instantiates a new UrlmanagerChangeUrlRewriteRequestPathRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerCreateUrlRewriteRequest instantiates a new UrlmanagerCreateUrlRewriteRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerCreateUrlRewriteRequestWithDefaults instantiates a new UrlmanagerCreateUrlRewriteRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerDeleteUrlRewriteRequest instantiates a new UrlmanagerDeleteUrlRewriteRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerDeleteUrlRewriteRequestWithDefaults instantiates a new UrlmanagerDeleteUrlRewriteRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerGetUrlRewriteRequest instantiates a new UrlmanagerGetUrlRewriteRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerGetUrlRewriteRequestWithDefaults instantiates a new UrlmanagerGetUrlRewriteRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerListUrlRewritesByTargetPathsRequest instantiates a new UrlmanagerListUrlRewritesByTargetPathsRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerListUrlRewritesByTargetPathsRequestWithDefaults instantiates a new UrlmanagerListUrlRewritesByTargetPathsRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerListUrlRewritesByTargetPathsResponse instantiates a new UrlmanagerListUrlRewritesByTargetPathsResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerListUrlRewritesByTargetPathsResponseWithDefaults instantiates a new UrlmanagerListUrlRewritesByTargetPathsResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerListUrlRewritesRequest instantiates a new UrlmanagerListUrlRewritesRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerListUrlRewritesRequestWithDefaults instantiates a new UrlmanagerListUrlRewritesRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerListUrlRewritesResponse instantiates a new UrlmanagerListUrlRewritesResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerListUrlRewritesResponseWithDefaults instantiates a new UrlmanagerListUrlRewritesResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerResolveUrlRewriteRequest instantiates a new UrlmanagerResolveUrlRewriteRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerResolveUrlRewriteRequestWithDefaults instantiates a new UrlmanagerResolveUrlRewriteRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlmanagerUrlRewrite instantiates a new UrlmanagerUrlRewrite object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUrlmanagerUrlRewriteWithDefaults instantiates a new UrlmanagerUrlRewrite object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUrlRewriteLinkRelFromValue returns a pointer to a valid UrlRewriteLinkRel for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewUrlRewriteRedirectTypeFromValue returns a pointer to a valid UrlRewriteRedirectType for the value passed as argument, or an error if the value passed is not allowed by the enum.
PtrBool is a helper routine that returns a pointer to given boolean value.
PtrFloat32 is a helper routine that returns a pointer to given float value.
PtrFloat64 is a helper routine that returns a pointer to given float value.
PtrInt is a helper routine that returns a pointer to given integer value.
PtrInt32 is a helper routine that returns a pointer to given integer value.
PtrInt64 is a helper routine that returns a pointer to given integer value.
PtrString is a helper routine that returns a pointer to given string value.
PtrTime is helper routine that returns a pointer to given Time value.

# Constants

List of UrlRewriteLinkRel.
List of UrlRewriteLinkRel.
List of UrlRewriteLinkRel.
List of UrlRewriteLinkRel.
List of UrlRewriteRedirectType.
List of UrlRewriteRedirectType.
List of UrlRewriteRedirectType.
List of UrlRewriteRedirectType.

# Variables

All allowed values of UrlRewriteLinkRel enum.
All allowed values of UrlRewriteRedirectType enum.
ContextAPIKeys takes a string apikey as authentication for the request.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOperationServerIndices uses a server configuration from the index mapping.
ContextOperationServerVariables overrides a server configuration variables using operation specific values.
ContextServerIndex uses a server configuration from the index.
ContextServerVariables overrides a server configuration variables.
No description provided by the author
No description provided by the author

# Structs

APIClient manages communication with the Url Manager Service API v1.0.0 In most cases there should be only one, shared, APIClient.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
APIResponse stores the API response returned by the server.
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
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.
Configuration stores the configuration of the API client.
GenericOpenAPIError Provides access to the body, error and model on returned errors.
GetUrlRewriteRequestCompoundIdentifier struct for GetUrlRewriteRequestCompoundIdentifier.
ListUrlRewritesRequestFilter struct for ListUrlRewritesRequestFilter.
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
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
ProtobufAny struct for ProtobufAny.
RpcStatus struct for RpcStatus.
ServerConfiguration stores the information about a server.
ServerVariable stores the information about a server variable.
UrlmanagerChangeUrlRewriteRequestPathRequest struct for UrlmanagerChangeUrlRewriteRequestPathRequest.
UrlmanagerCreateUrlRewriteRequest struct for UrlmanagerCreateUrlRewriteRequest.
UrlmanagerDeleteUrlRewriteRequest struct for UrlmanagerDeleteUrlRewriteRequest.
UrlmanagerGetUrlRewriteRequest struct for UrlmanagerGetUrlRewriteRequest.
UrlmanagerListUrlRewritesByTargetPathsRequest struct for UrlmanagerListUrlRewritesByTargetPathsRequest.
UrlmanagerListUrlRewritesByTargetPathsResponse struct for UrlmanagerListUrlRewritesByTargetPathsResponse.
UrlmanagerListUrlRewritesRequest struct for UrlmanagerListUrlRewritesRequest.
UrlmanagerListUrlRewritesResponse struct for UrlmanagerListUrlRewritesResponse.
UrlmanagerResolveUrlRewriteRequest struct for UrlmanagerResolveUrlRewriteRequest.
UrlmanagerUrlRewrite struct for UrlmanagerUrlRewrite.

# Interfaces

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

# Type aliases

BasicOperationsAPIService BasicOperationsAPI service.
ServerConfigurations stores multiple ServerConfiguration items.
UrlRewriteLinkRel the model 'UrlRewriteLinkRel'.
UrlRewriteRedirectType the model 'UrlRewriteRedirectType'.