# 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
Class | Method | HTTP request | Description |
---|---|---|---|
BasicOperationsAPI | UrlManagerChangeUrlRewriteRequestPath | Post /urlmanager/change_url_rewrite_request_path | Change Url Rewrite Request Path |
BasicOperationsAPI | UrlManagerChangeUrlRewriteRequestPath2 | Post /urlmanager.UrlManager/ChangeUrlRewriteRequestPath | Change Url Rewrite Request Path |
BasicOperationsAPI | UrlManagerCreateUrlRewrite | Post /urlmanager/create_url_rewrite | Create Url Rewrite |
BasicOperationsAPI | UrlManagerCreateUrlRewrite2 | Post /urlmanager.UrlManager/CreateUrlRewrite | Create Url Rewrite |
BasicOperationsAPI | UrlManagerDeleteUrlRewrite | Post /urlmanager/delete_url_rewrite | Delete Url Rewrite |
BasicOperationsAPI | UrlManagerDeleteUrlRewrite2 | Post /urlmanager.UrlManager/DeleteUrlRewrite | Delete Url Rewrite |
BasicOperationsAPI | UrlManagerGetUrlRewrite | Post /urlmanager/get_url_rewrite | Get Url Rewrite |
BasicOperationsAPI | UrlManagerGetUrlRewrite2 | Post /urlmanager.UrlManager/GetUrlRewrite | Get Url Rewrite |
BasicOperationsAPI | UrlManagerListUrlRewrites | Post /urlmanager/list_url_rewrites | List Url Rewrites |
BasicOperationsAPI | UrlManagerListUrlRewrites2 | Post /urlmanager.UrlManager/ListUrlRewrites | List Url Rewrites |
BasicOperationsAPI | UrlManagerListUrlRewritesByTargetPaths | Post /urlmanager/list_url_rewrites_by_target_paths | List Url Rewrites By Target Paths |
BasicOperationsAPI | UrlManagerListUrlRewritesByTargetPaths2 | Post /urlmanager.UrlManager/ListUrlRewritesByTargetPaths | List Url Rewrites By Target Paths |
BasicOperationsAPI | UrlManagerResolveUrlRewrite | Post /urlmanager/resolve_url_rewrite | Resolve Url Rewrite |
BasicOperationsAPI | UrlManagerResolveUrlRewrite2 | Post /urlmanager.UrlManager/ResolveUrlRewrite | Resolve Url Rewrite |
Documentation For Models
- GetUrlRewriteRequestCompoundIdentifier
- ListUrlRewritesRequestFilter
- ProtobufAny
- RpcStatus
- UrlRewriteLinkRel
- UrlRewriteRedirectType
- UrlmanagerChangeUrlRewriteRequestPathRequest
- UrlmanagerCreateUrlRewriteRequest
- UrlmanagerDeleteUrlRewriteRequest
- UrlmanagerGetUrlRewriteRequest
- UrlmanagerListUrlRewritesByTargetPathsRequest
- UrlmanagerListUrlRewritesByTargetPathsResponse
- UrlmanagerListUrlRewritesRequest
- UrlmanagerListUrlRewritesResponse
- UrlmanagerResolveUrlRewriteRequest
- UrlmanagerUrlRewrite
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