diff --git a/Taskfile.yaml b/Taskfile.yaml index d5ec896a7..7d1303893 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -141,6 +141,7 @@ tasks: cmds: - wget https://raw.githubusercontent.com/formancehq/ledger/{{.VERSION}}/pkg/api/controllers/swagger.yaml -O swagger.yaml - sed -i -e "s/LEDGER_VERSION/{{.VERSION}}/g" swagger.yaml + - rm -rf ./sdks/{{.CLI_ARGS}}/* - > docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate -i ./swagger.yaml diff --git a/sdk/templates/go/README.mustache b/sdk/templates/go/README.mustache deleted file mode 100644 index f71cd6e36..000000000 --- a/sdk/templates/go/README.mustache +++ /dev/null @@ -1,231 +0,0 @@ -# Formance Go SDK - -{{#appDescriptionWithNewLines}} -{{{.}}} -{{/appDescriptionWithNewLines}} - -## Overview -This SDK was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate SDK. - -- API version: {{appVersion}} -- Package version: {{packageVersion}} -{{^hideGenerationTimestamp}} -- Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} -- Build package: {{generatorClass}} -{{#infoUrl}} -For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -## Installation - -```shell -go get github.com/formancehq/numary-sdk-go -``` - -Put the package under your project folder and add the following in import: - -```golang -import sw "./{{packageName}}" -``` - -To use a proxy, set the environment variable `HTTP_PROXY`: - -```golang -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 `sw.ContextServerIndex` of type `int`. - -```golang -ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1) -``` - -### Templated Server URL - -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. - -```golang -ctx := context.WithValue(context.Background(), sw.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 `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. - -``` -ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{ - "{classname}Service.{nickname}": 2, -}) -ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{ - "{classname}Service.{nickname}": { - "port": "8443", - }, -}) -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation For Models - -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) -{{/model}}{{/models}} - -## Documentation For Authorization - -{{^authMethods}} Endpoints do not require authorization. -{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} -{{#authMethods}} - -### {{{name}}} - -{{#isApiKey}} -- **Type**: API key -- **API key parameter name**: {{{keyParamName}}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - -Note, each API key must be added to a map of `map[string]APIKey` where the key is: {{keyParamName}} and passed in as the auth context for each request. - -{{/isApiKey}} -{{#isBasic}} -{{#isBasicBearer}} -- **Type**: HTTP Bearer token authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARERTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` - -Library provide utility to fetch access token : -```golang -tok, err := sw.FetchToken( - http.DefaultClient, - sw.AuthEndpoint, - "API KEY", -) -if err != nil { - panic(err) -} -auth := context.WithValue(context.Background(), sw.ContextCloudToken, tok) -r, err := client.Service.Operation(auth, args) -``` - -{{/isBasicBearer}} -{{#isBasicBasic}} -- **Type**: HTTP basic authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ - UserName: "username", - Password: "password", -}) -r, err := client.Service.Operation(auth, args) -``` - -{{/isBasicBasic}} -{{#isHttpSignature}} -- **Type**: HTTP signature authentication - -Example - -```golang - authConfig := sw.HttpSignatureAuth{ - KeyId: "my-key-id", - PrivateKeyPath: "rsa.pem", - Passphrase: "my-passphrase", - SigningScheme: sw.HttpSigningSchemeHs2019, - SignedHeaders: []string{ - sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. - sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. - "Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number. - "Date", // The date and time at which the message was originated. - "Content-Type", // The Media type of the body of the request. - "Digest", // A cryptographic digest of the request body. - }, - SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS, - SignatureMaxValidity: 5 * time.Minute, - } - var authCtx context.Context - var err error - if authCtx, err = authConfig.ContextWithValue(context.Background()); err != nil { - // Process error - } - r, err = client.Service.Operation(auth, args) - -``` -{{/isHttpSignature}} -{{/isBasic}} -{{#isOAuth}} - -- **Type**: OAuth -- **Flow**: {{{flow}}} -- **Authorization URL**: {{{authorizationUrl}}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - **{{{scope}}}**: {{{description}}} -{{/scopes}} - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. - -```golang -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, sw.ContextOAuth2, tokenSource) -r, err := client.Service.Operation(auth, args) -``` - -{{/isOAuth}} -{{/authMethods}} - -## 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 - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/sdk/templates/go/api.mustache b/sdk/templates/go/api.mustache deleted file mode 100644 index 4a94d6aaf..000000000 --- a/sdk/templates/go/api.mustache +++ /dev/null @@ -1,413 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -{{#operations}} -import ( - "bytes" - _context "context" - _ioutil "io/ioutil" - _nethttp "net/http" - _neturl "net/url" -{{#imports}} "{{import}}" -{{/imports}} -) - -// Linger please -var ( - _ _context.Context -) -{{#generateInterfaces}} - -type {{classname}} interface { - {{#operation}} - - /* - {{operationId}} {{{summary}}}{{^summary}}Method for {{operationId}}{{/summary}} - {{#notes}} - - {{{unescapedNotes}}} - {{/notes}} - - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().{{#pathParams}} - @param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}} - @return {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request - {{#isDeprecated}} - - Deprecated - {{/isDeprecated}} - */ - {{{nickname}}}(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request - - // {{nickname}}Execute executes the request{{#returnType}} - // @return {{{.}}}{{/returnType}} - {{#isDeprecated}} - // Deprecated - {{/isDeprecated}} - {{nickname}}Execute(r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) - {{/operation}} -} -{{/generateInterfaces}} - -// {{classname}}Service {{classname}} service -type {{classname}}Service service -{{#operation}} - -type {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request struct { - ctx _context.Context - ApiService {{#generateInterfaces}}{{classname}}{{/generateInterfaces}}{{^generateInterfaces}}*{{classname}}Service{{/generateInterfaces}} -{{#allParams}} - {{paramName}} {{^isPathParam}}*{{/isPathParam}}{{{dataType}}} -{{/allParams}} -} -{{#allParams}}{{^isPathParam}} -{{#description}} -// {{.}} -{{/description}} -{{#isDeprecated}} -// Deprecated -{{/isDeprecated}} -func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request { - r.{{paramName}} = &{{paramName}} - return r -}{{/isPathParam}}{{/allParams}} - -func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) { - return r.ApiService.{{nickname}}Execute(r) -} - -/* -{{operationId}} {{{summary}}}{{^summary}}Method for {{operationId}}{{/summary}} -{{#notes}} - -{{{unescapedNotes}}} -{{/notes}} - - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().{{#pathParams}} - @param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}} - @return {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request -{{#isDeprecated}} - -Deprecated -{{/isDeprecated}} -*/ -func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request { - return {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request{ - ApiService: a, - ctx: ctx, - {{#pathParams}} - {{paramName}}: {{paramName}}, - {{/pathParams}} - } -} - -// Execute executes the request{{#returnType}} -// @return {{{.}}}{{/returnType}} -{{#isDeprecated}} -// Deprecated -{{/isDeprecated}} -func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) ({{#returnType}}{{{.}}}, {{/returnType}}*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.Method{{httpMethod}} - localVarPostBody interface{} - formFiles []formFile - {{#returnType}} - localVarReturnValue {{{.}}} - {{/returnType}} - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "{{{classname}}}Service.{{{nickname}}}") - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "{{{path}}}"{{#pathParams}} - localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", _neturl.PathEscape(parameterToString(r.{{paramName}}, "{{collectionFormat}}")), -1){{/pathParams}} - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - {{#allParams}} - {{#required}} - {{^isPathParam}} - if r.{{paramName}} == nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} is required and must be specified") - } - {{/isPathParam}} - {{#minItems}} - if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minItems}} { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements") - } - {{/minItems}} - {{#maxItems}} - if len({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxItems}} { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements") - } - {{/maxItems}} - {{#minLength}} - if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) < {{minLength}} { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements") - } - {{/minLength}} - {{#maxLength}} - if strlen({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) > {{maxLength}} { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements") - } - {{/maxLength}} - {{#minimum}} - {{#isString}} - {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) - if {{paramName}}Txt < {{minimum}} { - {{/isString}} - {{^isString}} - if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} < {{minimum}} { - {{/isString}} - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}") - } - {{/minimum}} - {{#maximum}} - {{#isString}} - {{paramName}}Txt, err := atoi({{^isPathParam}}*{{/isPathParam}}r.{{paramName}}) - if {{paramName}}Txt > {{maximum}} { - {{/isString}} - {{^isString}} - if {{^isPathParam}}*{{/isPathParam}}r.{{paramName}} > {{maximum}} { - {{/isString}} - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}") - } - {{/maximum}} - {{/required}} - {{/allParams}} - - {{#queryParams}} - {{#required}} - {{#isCollectionFormatMulti}} - { - t := *r.{{paramName}} - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("{{baseName}}", parameterToString(s.Index(i), "{{collectionFormat}}")) - } - } else { - localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{collectionFormat}}")) - } - } - {{/isCollectionFormatMulti}} - {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{collectionFormat}}")) - {{/isCollectionFormatMulti}} - {{/required}} - {{^required}} - if r.{{paramName}} != nil { - {{#isCollectionFormatMulti}} - t := *r.{{paramName}} - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("{{baseName}}", parameterToString(s.Index(i), "{{collectionFormat}}")) - } - } else { - localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{collectionFormat}}")) - } - {{/isCollectionFormatMulti}} - {{^isCollectionFormatMulti}} - localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{collectionFormat}}")) - {{/isCollectionFormatMulti}} - } - {{/required}} - {{/queryParams}} - // to determine the Content-Type header -{{=<% %>=}} - localVarHTTPContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>} -<%={{ }}=%> - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header -{{=<% %>=}} - localVarHTTPHeaderAccepts := []string{<%#produces%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/produces%>} -<%={{ }}=%> - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } -{{#headerParams}} - {{#required}} - localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{collectionFormat}}") - {{/required}} - {{^required}} - if r.{{paramName}} != nil { - localVarHeaderParams["{{baseName}}"] = parameterToString(*r.{{paramName}}, "{{collectionFormat}}") - } - {{/required}} -{{/headerParams}} -{{#formParams}} -{{#isFile}} - var {{paramName}}LocalVarFormFileName string - var {{paramName}}LocalVarFileName string - var {{paramName}}LocalVarFileBytes []byte - - {{paramName}}LocalVarFormFileName = "{{baseName}}" - -{{#required}} - {{paramName}}LocalVarFile := *r.{{paramName}} -{{/required}} -{{^required}} - var {{paramName}}LocalVarFile {{dataType}} - if r.{{paramName}} != nil { - {{paramName}}LocalVarFile = *r.{{paramName}} - } -{{/required}} - if {{paramName}}LocalVarFile != nil { - fbs, _ := _ioutil.ReadAll({{paramName}}LocalVarFile) - {{paramName}}LocalVarFileBytes = fbs - {{paramName}}LocalVarFileName = {{paramName}}LocalVarFile.Name() - {{paramName}}LocalVarFile.Close() - } - formFiles = append(formFiles, formFile{fileBytes: {{paramName}}LocalVarFileBytes, fileName: {{paramName}}LocalVarFileName, formFileName: {{paramName}}LocalVarFormFileName}) -{{/isFile}} -{{^isFile}} -{{#required}} - localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{collectionFormat}}")) -{{/required}} -{{^required}} -{{#isModel}} - if r.{{paramName}} != nil { - paramJson, err := parameterToJson(*r.{{paramName}}) - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err - } - localVarFormParams.Add("{{baseName}}", paramJson) - } -{{/isModel}} -{{^isModel}} - if r.{{paramName}} != nil { - localVarFormParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{collectionFormat}}")) - } -{{/isModel}} -{{/required}} -{{/isFile}} -{{/formParams}} -{{#bodyParams}} - // body params - localVarPostBody = r.{{paramName}} -{{/bodyParams}} -{{#authMethods}} -{{#isApiKey}} -{{^isKeyInCookie}} - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - {{#vendorExtensions.x-auth-id-alias}} - if apiKey, ok := auth["{{.}}"]; ok { - var key string - if prefix, ok := auth["{{name}}"]; ok && prefix.Prefix != "" { - key = prefix.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - {{/vendorExtensions.x-auth-id-alias}} - {{^vendorExtensions.x-auth-id-alias}} - if apiKey, ok := auth["{{name}}"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - {{/vendorExtensions.x-auth-id-alias}} - {{#isKeyInHeader}} - localVarHeaderParams["{{keyParamName}}"] = key - {{/isKeyInHeader}} - {{#isKeyInQuery}} - localVarQueryParams.Add("{{keyParamName}}", key) - {{/isKeyInQuery}} - } - } - } -{{/isKeyInCookie}} -{{/isApiKey}} -{{/authMethods}} - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err - } - - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - {{#responses}} - {{#dataType}} - {{^is1xx}} - {{^is2xx}} - {{#range}} - {{#is3xx}} - if localVarHTTPResponse.StatusCode >= 300 && localVarHTTPResponse.StatusCode < 400 { - {{/is3xx}} - {{#is4xx}} - if localVarHTTPResponse.StatusCode >= 400 && localVarHTTPResponse.StatusCode < 500 { - {{/is4xx}} - {{#is5xx}} - if localVarHTTPResponse.StatusCode >= 500 - {{/is5xx}} - {{/range}} - {{^range}} - {{^wildcard}} - if localVarHTTPResponse.StatusCode == {{{code}}} { - {{/wildcard}} - {{/range}} - var v {{{dataType}}} - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr - } - newErr.model = v - {{^-last}} - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr - {{/-last}} - {{^wildcard}} - } - {{/wildcard}} - {{/is2xx}} - {{/is1xx}} - {{/dataType}} - {{/responses}} - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr - } - - {{#returnType}} - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, newErr - } - - {{/returnType}} - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, nil -} -{{/operation}} -{{/operations}} diff --git a/sdk/templates/go/api_doc.mustache b/sdk/templates/go/api_doc.mustache deleted file mode 100644 index c0c67ced0..000000000 --- a/sdk/templates/go/api_doc.mustache +++ /dev/null @@ -1,92 +0,0 @@ -# {{invokerPackage}}\{{classname}}{{#description}} - -{{.}}{{/description}} - -All URIs are relative to *{{basePath}}* - -Method | HTTP request | Description -------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}} - -{{#operations}} -{{#operation}} - -## {{{operationId}}} - -> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}(ctx{{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-export-param-name}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute() - -{{{summary}}}{{#notes}} - -{{{unespacedNotes}}}{{/notes}} - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" -{{#vendorExtensions.x-go-import}} -{{{vendorExtensions.x-go-import}}} -{{/vendorExtensions.x-go-import}} - {{goImportAlias}} "github.com/numary/numary-go" -) - -func main() { - {{#allParams}} - {{paramName}} := {{{vendorExtensions.x-go-example}}} // {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} - {{/allParams}} - - configuration := {{goImportAlias}}.NewConfiguration() - api_client := {{goImportAlias}}.NewAPIClient(configuration) - resp, r, err := api_client.{{classname}}.{{operationId}}(context.Background(){{#pathParams}}, {{paramName}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{vendorExtensions.x-export-param-name}}({{paramName}}){{/isPathParam}}{{/allParams}}.Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `{{classname}}.{{operationId}}``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - {{#returnType}} - // response from `{{operationId}}`: {{{.}}} - fmt.Fprintf(os.Stdout, "Response from `{{classname}}.{{operationId}}`: %v\n", resp) - {{/returnType}} -} -``` - -### Path Parameters - -{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}} -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/pathParams}}{{#pathParams}} -**{{paramName}}** | {{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{#defaultValue}}[default to {{.}}]{{/defaultValue}}{{/pathParams}} - -### Other Parameters - -Other parameters are passed through a pointer to a api{{{nickname}}}Request struct via the builder pattern -{{#allParams}}{{#-last}} - -Name | Type | Description | Notes -------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} -{{^isPathParam}} **{{paramName}}** | {{#isContainer}}{{#isArray}}{{#items}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**[]{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isArray}}{{#isMap}}{{#items}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**map[string]{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/items}}{{/isMap}}{{/isContainer}}{{^isContainer}}{{^isPrimitiveType}}{{^isFile}}[{{/isFile}}{{/isPrimitiveType}}**{{dataType}}**{{^isPrimitiveType}}{{^isFile}}]({{^baseType}}{{dataType}}{{/baseType}}{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}{{/isContainer}} | {{description}} | {{#defaultValue}}[default to {{.}}]{{/defaultValue}}{{/isPathParam}}{{/allParams}} - -### Return type - -{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}} (empty response body){{/returnType}} - -### Authorization - -{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} - -### HTTP request headers - -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -{{/operation}} -{{/operations}} diff --git a/sdk/templates/go/client.mustache b/sdk/templates/go/client.mustache deleted file mode 100644 index 609b362a8..000000000 --- a/sdk/templates/go/client.mustache +++ /dev/null @@ -1,608 +0,0 @@ -{{>partial_header}} -package {{packageName}} - -import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "io/ioutil" - "log" - "mime/multipart" - "net/http" - "net/http/httputil" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "time" - "unicode/utf8" - - "golang.org/x/oauth2" - {{#withAWSV4Signature}} - awsv4 "github.com/aws/aws-sdk-go/aws/signer/v4" - awscredentials "github.com/aws/aws-sdk-go/aws/credentials" - {{/withAWSV4Signature}} -) - -var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) -) - -// APIClient manages communication with the {{appName}} API v{{version}} -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - cfg *Configuration - common service // Reuse a single struct instead of allocating one for each service on the heap. - - // API Services -{{#apiInfo}} -{{#apis}} -{{#operations}} - - {{classname}} {{#generateInterfaces}}{{classname}}{{/generateInterfaces}}{{^generateInterfaces}}*{{classname}}Service{{/generateInterfaces}} -{{/operations}} -{{/apis}} -{{/apiInfo}} -} - -type service struct { - client *APIClient -} - -// NewAPIClient creates a new API client. Requires a userAgent string describing your application. -// optionally a custom http.Client to allow for advanced features such as caching. -func NewAPIClient(cfg *Configuration) *APIClient { - if cfg.HTTPClient == nil { - cfg.HTTPClient = http.DefaultClient - } - - c := &APIClient{} - c.cfg = cfg - c.common.client = c - -{{#apiInfo}} - // API Services -{{#apis}} -{{#operations}} - c.{{classname}} = (*{{classname}}Service)(&c.common) -{{/operations}} -{{/apis}} -{{/apiInfo}} - - return c -} - -func atoi(in string) (int, error) { - return strconv.Atoi(in) -} - -// selectHeaderContentType select a content type from the available list. -func selectHeaderContentType(contentTypes []string) string { - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -// selectHeaderAccept join all accept types and return -func selectHeaderAccept(accepts []string) string { - if len(accepts) == 0 { - return "" - } - - if contains(accepts, "application/json") { - return "application/json" - } - - return strings.Join(accepts, ",") -} - -// contains is a case insensitive match, finding needle in a haystack -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { - return true - } - } - return false -} - -// Verify optional parameters are of the correct type. -func typeCheckParameter(obj interface{}, expected string, name string) error { - // Make sure there is an object. - if obj == nil { - return nil - } - - // Check the type is as expected. - if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) - } - return nil -} - -// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. -func parameterToString(obj interface{}, collectionFormat string) string { - var delimiter string - - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," - } - - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } else if t, ok := obj.(time.Time); ok { - return t.Format(time.RFC3339) - } - - return fmt.Sprintf("%v", obj) -} - -// helper for converting interface{} parameters to json strings -func parameterToJson(obj interface{}) (string, error) { - jsonBuf, err := json.Marshal(obj) - if err != nil { - return "", err - } - return string(jsonBuf), err -} - -// callAPI do the request. -func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) - if err != nil { - return nil, err - } - log.Printf("\n%s\n", string(dump)) - } - - resp, err := c.cfg.HTTPClient.Do(request) - if err != nil { - return resp, err - } - - if c.cfg.Debug { - dump, err := httputil.DumpResponse(resp, true) - if err != nil { - return resp, err - } - log.Printf("\n%s\n", string(dump)) - } - return resp, err -} - -// Allow modification of underlying config for alternate implementations and testing -// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior -func (c *APIClient) GetConfig() *Configuration { - return c.cfg -} - -type formFile struct { - fileBytes []byte - fileName string - formFileName string -} - -// prepareRequest build the request -func (c *APIClient) prepareRequest( - ctx context.Context, - path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams url.Values, - formFiles []formFile) (localVarRequest *http.Request, err error) { - - var body *bytes.Buffer - - // Detect postBody type and post. - if postBody != nil { - contentType := headerParams["Content-Type"] - if contentType == "" { - contentType = detectContentType(postBody) - headerParams["Content-Type"] = contentType - } - - body, err = setBody(postBody, contentType) - if err != nil { - return nil, err - } - } - - // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { - if body != nil { - return nil, errors.New("Cannot specify postBody and multipart form at the same time.") - } - body = &bytes.Buffer{} - w := multipart.NewWriter(body) - - for k, v := range formParams { - for _, iv := range v { - if strings.HasPrefix(k, "@") { // file - err = addFile(w, k[1:], iv) - if err != nil { - return nil, err - } - } else { // form value - w.WriteField(k, iv) - } - } - } - for _, formFile := range formFiles { - if len(formFile.fileBytes) > 0 && formFile.fileName != "" { - w.Boundary() - part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(formFile.fileBytes) - if err != nil { - return nil, err - } - } - } - - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() - - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - w.Close() - } - - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { - if body != nil { - return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") - } - body = &bytes.Buffer{} - body.WriteString(formParams.Encode()) - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, err - } - - // Override request host, if applicable - if c.cfg.Host != "" { - url.Host = c.cfg.Host - } - - // Override request scheme, if applicable - if c.cfg.Scheme != "" { - url.Scheme = c.cfg.Scheme - } - - // Adding Query Param - query := url.Query() - for k, v := range queryParams { - for _, iv := range v { - query.Add(k, iv) - } - } - - // Encode the parameters. - url.RawQuery = query.Encode() - - // Generate a new request - if body != nil { - localVarRequest, err = http.NewRequest(method, url.String(), body) - } else { - localVarRequest, err = http.NewRequest(method, url.String(), nil) - } - if err != nil { - return nil, err - } - - // add header parameters, if any - if len(headerParams) > 0 { - headers := http.Header{} - for h, v := range headerParams { - headers[h] = []string{v} - } - localVarRequest.Header = headers - } - - // Add the user agent to the request. - localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) - - if ctx != nil { - // add context to the request - localVarRequest = localVarRequest.WithContext(ctx) - - // Walk through any authentication. - - // OAuth2 authentication - if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { - // We were able to grab an oauth2 token from the context - var latestToken *oauth2.Token - if latestToken, err = tok.Token(); err != nil { - return nil, err - } - - latestToken.SetAuthHeader(localVarRequest) - } - - // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { - localVarRequest.SetBasicAuth(auth.UserName, auth.Password) - } - - // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { - localVarRequest.Header.Add("Authorization", "Bearer "+auth) - } - - {{#withAWSV4Signature}} - // AWS Signature v4 Authentication - if auth, ok := ctx.Value(ContextAWSv4).(AWSv4); ok { - creds := awscredentials.NewStaticCredentials(auth.AccessKey, auth.SecretKey, auth.SessionToken) - signer := awsv4.NewSigner(creds) - var reader *strings.Reader - if body == nil { - reader = strings.NewReader("") - } else { - reader = strings.NewReader(body.String()) - } - - // Define default values for region and service to maintain backward compatibility - region := auth.Region - if region == "" { - region = "eu-west-2" - } - service := auth.Service - if service == "" { - service = "oapi" - } - - timestamp := time.Now() - _, err := signer.Sign(localVarRequest, reader, service, region, timestamp) - if err != nil { - return nil, err - } - } - {{/withAWSV4Signature}} - } - - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } -{{#withCustomMiddlewareFunction}} - - if c.cfg.Middleware != nil { - c.cfg.Middleware(localVarRequest) - } - -{{/withCustomMiddlewareFunction}} -{{#hasHttpSignatureMethods}} - if ctx != nil { - // HTTP Signature Authentication. All request headers must be set (including default headers) - // because the headers may be included in the signature. - if auth, ok := ctx.Value(ContextHttpSignatureAuth).(HttpSignatureAuth); ok { - err = SignRequest(ctx, localVarRequest, auth) - if err != nil { - return nil, err - } - } - } -{{/hasHttpSignatureMethods}} - return localVarRequest, nil -} - -func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if len(b) == 0 { - return nil - } - if s, ok := v.(*string); ok { - *s = string(b) - return nil - } - if f, ok := v.(**os.File); ok { - *f, err = ioutil.TempFile("", "HttpClientFile") - if err != nil { - return - } - _, err = (*f).Write(b) - if err != nil { - return - } - _, err = (*f).Seek(0, io.SeekStart) - return - } - if xmlCheck.MatchString(contentType) { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } - if jsonCheck.MatchString(contentType) { - if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas - if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined - if err = unmarshalObj.UnmarshalJSON(b); err != nil { - return err - } - } else { - return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err = json.Unmarshal(b, v); err != nil { // simple model - return err - } - return nil - } - return errors.New("undefined response type") -} - -// Add a file to the multipart request -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(path) - if err != nil { - return err - } - defer file.Close() - - part, err := w.CreateFormFile(fieldName, filepath.Base(path)) - if err != nil { - return err - } - _, err = io.Copy(part, file) - - return err -} - -// Prevent trying to import "fmt" -func reportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -} - -// Set request body from an interface{} -func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { - if bodyBuf == nil { - bodyBuf = &bytes.Buffer{} - } - - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if fp, ok := body.(**os.File); ok { - _, err = bodyBuf.ReadFrom(*fp) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else if jsonCheck.MatchString(contentType) { - err = json.NewEncoder(bodyBuf).Encode(body) - } else if xmlCheck.MatchString(contentType) { - err = xml.NewEncoder(bodyBuf).Encode(body) - } - - if err != nil { - return nil, err - } - - if bodyBuf.Len() == 0 { - err = fmt.Errorf("Invalid body type %s\n", contentType) - return nil, err - } - return bodyBuf, nil -} - -// detectContentType method is used to figure out `Request.Body` content type for request header -func detectContentType(body interface{}) string { - contentType := "text/plain; charset=utf-8" - kind := reflect.TypeOf(body).Kind() - - switch kind { - case reflect.Struct, reflect.Map, reflect.Ptr: - contentType = "application/json; charset=utf-8" - case reflect.String: - contentType = "text/plain; charset=utf-8" - default: - if b, ok := body.([]byte); ok { - contentType = http.DetectContentType(b) - } else if kind == reflect.Slice { - contentType = "application/json; charset=utf-8" - } - } - - return contentType -} - -// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go -type cacheControl map[string]string - -func parseCacheControl(headers http.Header) cacheControl { - cc := cacheControl{} - ccHeader := headers.Get("Cache-Control") - for _, part := range strings.Split(ccHeader, ",") { - part = strings.Trim(part, " ") - if part == "" { - continue - } - if strings.ContainsRune(part, '=') { - keyval := strings.Split(part, "=") - cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") - } else { - cc[part] = "" - } - } - return cc -} - -// CacheExpires helper function to determine remaining time before repeating a request. -func CacheExpires(r *http.Response) time.Time { - // Figure out when the cache expires. - var expires time.Time - now, err := time.Parse(time.RFC1123, r.Header.Get("date")) - if err != nil { - return time.Now() - } - respCacheControl := parseCacheControl(r.Header) - - if maxAge, ok := respCacheControl["max-age"]; ok { - lifetime, err := time.ParseDuration(maxAge + "s") - if err != nil { - expires = now - } else { - expires = now.Add(lifetime) - } - } else { - expiresHeader := r.Header.Get("Expires") - if expiresHeader != "" { - expires, err = time.Parse(time.RFC1123, expiresHeader) - if err != nil { - expires = now - } - } - } - return expires -} - -func strlen(s string) int { - return utf8.RuneCountInString(s) -} - -// GenericOpenAPIError Provides access to the body, error and model on returned errors. -type GenericOpenAPIError struct { - body []byte - error string - model interface{} -} - -// Error returns non-empty string if there was an error. -func (e GenericOpenAPIError) Error() string { - return e.error -} - -// Body returns the raw bytes of the response -func (e GenericOpenAPIError) Body() []byte { - return e.body -} - -// Model returns the unpacked model of the error -func (e GenericOpenAPIError) Model() interface{} { - return e.model -} diff --git a/sdk/templates/go/gitignore.mustache b/sdk/templates/go/gitignore.mustache deleted file mode 100644 index 3b6195563..000000000 --- a/sdk/templates/go/gitignore.mustache +++ /dev/null @@ -1,28 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof - -vendor -.idea -cloud_test.go diff --git a/sdk/templates/go/go.mod.mustache b/sdk/templates/go/go.mod.mustache deleted file mode 100644 index 3921ee182..000000000 --- a/sdk/templates/go/go.mod.mustache +++ /dev/null @@ -1,13 +0,0 @@ -module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}} - -go 1.13 - -require ( - github.com/pborman/uuid v1.2.1 - github.com/pkg/errors v0.9.1 - github.com/stretchr/testify v1.4.0 - golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99 - {{#withAWSV4Signature}} - github.com/aws/aws-sdk-go v1.34.14 - {{/withAWSV4Signature}} -) diff --git a/sdk/templates/go/model_simple.mustache b/sdk/templates/go/model_simple.mustache deleted file mode 100644 index 97884f910..000000000 --- a/sdk/templates/go/model_simple.mustache +++ /dev/null @@ -1,419 +0,0 @@ -// {{classname}} {{{description}}}{{^description}}struct for {{{classname}}}{{/description}} -type {{classname}} struct { -{{#parent}} -{{^isMap}} -{{^isArray}} - {{{parent}}} -{{/isArray}} -{{/isMap}} -{{#isArray}} - Items {{{parent}}} -{{/isArray}} -{{/parent}} -{{#vars}} -{{^-first}} -{{/-first}} -{{#description}} - // {{{.}}} -{{/description}} -{{#deprecated}} - // Deprecated -{{/deprecated}} - {{name}} {{^required}}{{^isNullable}}*{{/isNullable}}{{/required}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` -{{/vars}} -{{#isAdditionalPropertiesTrue}} - AdditionalProperties map[string]interface{} -{{/isAdditionalPropertiesTrue}} -} - -{{#isAdditionalPropertiesTrue}} -type _{{{classname}}} {{{classname}}} - -{{/isAdditionalPropertiesTrue}} -// New{{classname}} instantiates a new {{classname}} 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 -func New{{classname}}({{#requiredVars}}{{nameInCamelCase}} {{dataType}}{{^-last}}, {{/-last}}{{/requiredVars}}) *{{classname}} { - this := {{classname}}{} -{{#allVars}} -{{#required}} - this.{{name}} = {{nameInCamelCase}} -{{/required}} -{{^required}} -{{#defaultValue}} -{{^vendorExtensions.x-golang-is-container}} -{{^isReadOnly}} -{{#isNullable}} - var {{nameInCamelCase}} {{{datatypeWithEnum}}} = {{{.}}} - this.{{name}} = *New{{{dataType}}}(&{{nameInCamelCase}}) -{{/isNullable}} -{{^isNullable}} - var {{nameInCamelCase}} {{{dataType}}} = {{{.}}} - this.{{name}} = &{{nameInCamelCase}} -{{/isNullable}} -{{/isReadOnly}} -{{/vendorExtensions.x-golang-is-container}} -{{/defaultValue}} -{{/required}} -{{/allVars}} - return &this -} - -// New{{classname}}WithDefaults instantiates a new {{classname}} 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 -func New{{classname}}WithDefaults() *{{classname}} { - this := {{classname}}{} -{{#vars}} -{{#defaultValue}} -{{^vendorExtensions.x-golang-is-container}} -{{^isReadOnly}} -{{#isNullable}} -{{!we use datatypeWithEnum here, since it will represent the non-nullable name of the datatype, e.g. int64 for NullableInt64}} - var {{nameInCamelCase}} {{{datatypeWithEnum}}} = {{{.}}} - this.{{name}} = *New{{{dataType}}}(&{{nameInCamelCase}}) -{{/isNullable}} -{{^isNullable}} - var {{nameInCamelCase}} {{{dataType}}} = {{{.}}} - this.{{name}} = {{^required}}&{{/required}}{{nameInCamelCase}} -{{/isNullable}} -{{/isReadOnly}} -{{/vendorExtensions.x-golang-is-container}} -{{/defaultValue}} -{{/vars}} - return &this -} - -{{#vars}} -{{#required}} -// Get{{name}} returns the {{name}} field value -{{#isNullable}} -// If the value is explicit nil, the zero value for {{vendorExtensions.x-go-base-type}} will be returned -{{/isNullable}} -{{#deprecated}} -// Deprecated -{{/deprecated}} -func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}} { - if o == nil{{#isNullable}}{{^vendorExtensions.x-golang-is-container}} || o.{{name}}.Get() == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - var ret {{vendorExtensions.x-go-base-type}} - return ret - } - -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - return o.{{name}} -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - return *o.{{name}}.Get() -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - return o.{{name}} -{{/isNullable}} -} - -// Get{{name}}Ok returns a tuple with the {{name}} field value -// and a boolean to check if the value has been set. -{{#isNullable}} -// NOTE: If the value is an explicit nil, `nil, true` will be returned -{{/isNullable}} -{{#deprecated}} -// Deprecated -{{/deprecated}} -func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-go-base-type}}, bool) { - if o == nil {{#isNullable}}{{#vendorExtensions.x-golang-is-container}}|| o.{{name}} == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - return nil, false - } -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - return &o.{{name}}, true -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - return o.{{name}}.Get(), o.{{name}}.IsSet() -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - return &o.{{name}}, true -{{/isNullable}} -} - -// Set{{name}} sets field value -{{#deprecated}} -// Deprecated -{{/deprecated}} -func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}}) { -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - o.{{name}} = v -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - o.{{name}}.Set(&v) -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - o.{{name}} = v -{{/isNullable}} -} - -{{/required}} -{{^required}} -// Get{{name}} returns the {{name}} field value if set, zero value otherwise{{#isNullable}} (both if not set or set to explicit null){{/isNullable}}. -{{#deprecated}} -// Deprecated -{{/deprecated}} -func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}} { - if o == nil {{^isNullable}}|| o.{{name}} == nil{{/isNullable}}{{#isNullable}}{{^vendorExtensions.x-golang-is-container}}|| o.{{name}}.Get() == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - var ret {{vendorExtensions.x-go-base-type}} - return ret - } -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - return o.{{name}} -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - return *o.{{name}}.Get() -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - return *o.{{name}} -{{/isNullable}} -} - -// Get{{name}}Ok returns a tuple with the {{name}} field value if set, nil otherwise -// and a boolean to check if the value has been set. -{{#isNullable}} -// NOTE: If the value is an explicit nil, `nil, true` will be returned -{{/isNullable}} -{{#deprecated}} -// Deprecated -{{/deprecated}} -func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-go-base-type}}, bool) { - if o == nil {{^isNullable}}|| o.{{name}} == nil{{/isNullable}}{{#isNullable}}{{#vendorExtensions.x-golang-is-container}}|| o.{{name}} == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - return nil, false - } -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - return &o.{{name}}, true -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - return o.{{name}}.Get(), o.{{name}}.IsSet() -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - return o.{{name}}, true -{{/isNullable}} -} - -// Has{{name}} returns a boolean if a field has been set. -func (o *{{classname}}) Has{{name}}() bool { - if o != nil && {{^isNullable}}o.{{name}} != nil{{/isNullable}}{{#isNullable}}{{#vendorExtensions.x-golang-is-container}}o.{{name}} != nil{{/vendorExtensions.x-golang-is-container}}{{^vendorExtensions.x-golang-is-container}}o.{{name}}.IsSet(){{/vendorExtensions.x-golang-is-container}}{{/isNullable}} { - return true - } - - return false -} - -// Set{{name}} gets a reference to the given {{dataType}} and assigns it to the {{name}} field. -{{#deprecated}} -// Deprecated -{{/deprecated}} -func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}}) { -{{#isNullable}} -{{#vendorExtensions.x-golang-is-container}} - o.{{name}} = v -{{/vendorExtensions.x-golang-is-container}} -{{^vendorExtensions.x-golang-is-container}} - o.{{name}}.Set(&v) -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} -{{^isNullable}} - o.{{name}} = &v -{{/isNullable}} -} -{{#isNullable}} -{{^vendorExtensions.x-golang-is-container}} -// Set{{name}}Nil sets the value for {{name}} to be an explicit nil -func (o *{{classname}}) Set{{name}}Nil() { - o.{{name}}.Set(nil) -} - -// Unset{{name}} ensures that no value is present for {{name}}, not even an explicit nil -func (o *{{classname}}) Unset{{name}}() { - o.{{name}}.Unset() -} -{{/vendorExtensions.x-golang-is-container}} -{{/isNullable}} - -{{/required}} -{{/vars}} -func (o {{classname}}) MarshalJSON() ([]byte, error) { - toSerialize := {{#isArray}}make([]interface{}, len(o.Items)){{/isArray}}{{^isArray}}map[string]interface{}{}{{/isArray}} - {{#parent}} - {{^isMap}} - {{^isArray}} - serialized{{parent}}, err{{parent}} := json.Marshal(o.{{parent}}) - if err{{parent}} != nil { - return []byte{}, err{{parent}} - } - err{{parent}} = json.Unmarshal([]byte(serialized{{parent}}), &toSerialize) - if err{{parent}} != nil { - return []byte{}, err{{parent}} - } - {{/isArray}} - {{/isMap}} - {{#isArray}} - for i, item := range o.Items { - toSerialize[i] = item - } - {{/isArray}} - {{/parent}} - {{#vars}} - {{! if argument is nullable, only serialize it if it is set}} - {{#isNullable}} - {{#vendorExtensions.x-golang-is-container}} - {{! support for container fields is not ideal at this point because of lack of Nullable* types}} - if o.{{name}} != nil { - toSerialize["{{baseName}}"] = o.{{name}} - } - {{/vendorExtensions.x-golang-is-container}} - {{^vendorExtensions.x-golang-is-container}} - if {{#required}}true{{/required}}{{^required}}o.{{name}}.IsSet(){{/required}} { - toSerialize["{{baseName}}"] = o.{{name}}.Get() - } - {{/vendorExtensions.x-golang-is-container}} - {{/isNullable}} - {{! if argument is not nullable, don't set it if it is nil}} - {{^isNullable}} - if {{#required}}true{{/required}}{{^required}}o.{{name}} != nil{{/required}} { - toSerialize["{{baseName}}"] = o.{{name}} - } - {{/isNullable}} - {{/vars}} - {{#isAdditionalPropertiesTrue}} - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - {{/isAdditionalPropertiesTrue}} - return json.Marshal(toSerialize) -} - -{{#isAdditionalPropertiesTrue}} -func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) { -{{#parent}} -{{^isMap}} - type {{classname}}WithoutEmbeddedStruct struct { - {{#vars}} - {{^-first}} - {{/-first}} - {{#description}} - // {{{.}}} - {{/description}} - {{#deprecated}} - // Deprecated - {{/deprecated}} - {{name}} {{^required}}{{^isNullable}}*{{/isNullable}}{{/required}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` - {{/vars}} - } - - var{{{classname}}}WithoutEmbeddedStruct := {{{classname}}}WithoutEmbeddedStruct{} - - err = json.Unmarshal(bytes, &var{{{classname}}}WithoutEmbeddedStruct) - if err == nil { - var{{{classname}}} := _{{{classname}}}{} - {{#vars}} - var{{{classname}}}.{{{name}}} = var{{{classname}}}WithoutEmbeddedStruct.{{{name}}} - {{/vars}} - *o = {{{classname}}}(var{{{classname}}}) - } else { - return err - } - - var{{{classname}}} := _{{{classname}}}{} - - err = json.Unmarshal(bytes, &var{{{classname}}}) - if err == nil { - o.{{{parent}}} = var{{{classname}}}.{{{parent}}} - } else { - return err - } - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - {{#vars}} - delete(additionalProperties, "{{{baseName}}}") - {{/vars}} - - // remove fields from embedded structs - reflect{{{parent}}} := reflect.ValueOf(o.{{{parent}}}) - for i := 0; i < reflect{{{parent}}}.Type().NumField(); i++ { - t := reflect{{{parent}}}.Type().Field(i) - - if jsonTag := t.Tag.Get("json"); jsonTag != "" { - fieldName := "" - if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 { - fieldName = jsonTag[:commaIdx] - } else { - fieldName = jsonTag - } - if fieldName != "AdditionalProperties" { - delete(additionalProperties, fieldName) - } - } - } - - o.AdditionalProperties = additionalProperties - } - - return err -{{/isMap}} -{{#isMap}} - var{{{classname}}} := _{{{classname}}}{} - - if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil { - *o = {{{classname}}}(var{{{classname}}}) - } - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - {{#vars}} - delete(additionalProperties, "{{{baseName}}}") - {{/vars}} - o.AdditionalProperties = additionalProperties - } - - return err -{{/isMap}} -{{/parent}} -{{^parent}} - var{{{classname}}} := _{{{classname}}}{} - - if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil { - *o = {{{classname}}}(var{{{classname}}}) - } - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(bytes, &additionalProperties); err == nil { - {{#vars}} - delete(additionalProperties, "{{{baseName}}}") - {{/vars}} - o.AdditionalProperties = additionalProperties - } - - return err -{{/parent}} -} - -{{/isAdditionalPropertiesTrue}} -{{#isArray}} -func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) { - return json.Unmarshal(bytes, &o.Items) -} - -{{/isArray}} -{{>nullable_model}} diff --git a/sdk/templates/php/README.mustache b/sdk/templates/php/README.mustache deleted file mode 100644 index 2937cf76c..000000000 --- a/sdk/templates/php/README.mustache +++ /dev/null @@ -1,166 +0,0 @@ -# PHP API client for Numary - -{{#appDescriptionWithNewLines}} -{{{.}}} -{{/appDescriptionWithNewLines}} - -{{#infoUrl}} -For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}). -{{/infoUrl}} - -## Installation & Usage - -### Requirements - -PHP 7.3 and later. -Should also work with PHP 8.0 but has not been tested. - -### Composer - -To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: - -```json -{ - "repositories": [ - { - "type": "vcs", - "url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git" - } - ], - "require": { - "{{gitUserId}}/{{gitRepoId}}": "*@dev" - } -} -``` - -Then run `composer install` - -### Manual Installation - -Download the files and include `autoload.php`: - -```php - php_doc_auth_partial}} -$apiInstance = new {{invokerPackage}}\Api\{{classname}}( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(){{#hasAuthMethods}}, - $config{{/hasAuthMethods}} -); -{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{.}}}{{/description}} -{{/allParams}} - -try { - {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} - print_r($result);{{/returnType}} -} catch (Exception $e) { - echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; -} -{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} -``` - -## API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} -## Models - -{{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}} -{{/models}} - -## Authorization -{{^authMethods}} -All endpoints do not require authorization. -{{/authMethods}} -{{#authMethods}} -{{#last}} Authentication schemes defined for the API:{{/last}} - -### {{{name}}} -{{#isApiKey}} - -- **Type**: API key -- **API key parameter name**: {{{keyParamName}}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - -{{/isApiKey}} -{{#isBasic}} -{{#isBasicBasic}} - -- **Type**: HTTP basic authentication -{{/isBasicBasic}} -{{#isBasicBearer}} - -- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} - -Library provide utility to fetch access token from Numary authorization server - -```php -use Numary\Ledger\Api\TransactionsApi; -use Numary\Ledger\Api\Configuration; -use Numary\Ledger\Cloud\TokenFetcher; -use GuzzleHttp\Client; - -$tokenFetcher = new TokenFetcher(TokenFetcher::$endpoint, "API KEY"); -$token = $tokenFetcher->fetchToken(); -$config = new Configuration(); -$config->setAccessToken($token); -$config->setHost("https://api.numary.cloud/ledger"); -$transactionApi = new TransactionsApi(new Client(), $config); -``` - -{{/isBasicBearer}} -{{/isBasic}} -{{#isOAuth}} - -- **Type**: `OAuth` -- **Flow**: `{{{flow}}}` -- **Authorization URL**: `{{{authorizationUrl}}}` -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - - **{{{scope}}}**: {{{description}}} -{{/scopes}} -{{/isOAuth}} - -{{/authMethods}} -## Tests - -To run the tests, use: - -```bash -composer install -vendor/bin/phpunit -``` - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} -## About this package - -This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: `{{appVersion}}` -{{#artifactVersion}} - - Package version: `{{.}}` -{{/artifactVersion}} -{{^hideGenerationTimestamp}} - - Build date: `{{generatedDate}}` -{{/hideGenerationTimestamp}} -- Build package: `{{generatorClass}}` diff --git a/sdk/templates/python/.github/workflows/release.yml.mustache b/sdk/templates/python/.github/workflows/release.yml.mustache deleted file mode 100644 index 43be73525..000000000 --- a/sdk/templates/python/.github/workflows/release.yml.mustache +++ /dev/null @@ -1,20 +0,0 @@ -name: tags -on: - push: - tags: - - '*' - -jobs: - Publish: - name: 'Publish' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install Task - uses: arduino/setup-task@v1 - - run: task build - - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: {{ PYPI_SECRET }} diff --git a/sdk/templates/python/README.mustache b/sdk/templates/python/README.mustache deleted file mode 100644 index 015381e0b..000000000 --- a/sdk/templates/python/README.mustache +++ /dev/null @@ -1,56 +0,0 @@ -# Python API client for Numary - -{{#appDescriptionWithNewLines}} -{{{.}}} -{{/appDescriptionWithNewLines}} - -This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: {{appVersion}} -- Package version: {{packageVersion}} -{{^hideGenerationTimestamp}} -- Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} -- Build package: {{generatorClass}} -{{#infoUrl}} -For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -## Requirements. - -Python >= 3.6 - -## Installation & Usage -### pip install - -If the python package is hosted on a repository, you can install directly using: - -```sh -pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git -``` -(you may need to run `pip` with root permission: `sudo pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git`) - -Then import the package: -```python -import {{{packageName}}} -``` - -### Setuptools - -Install via [Setuptools](http://pypi.python.org/pypi/setuptools). - -```sh -python setup.py install --user -``` -(or `sudo python setup.py install` to install the package for all users) - -Then import the package: -```python -import {{{packageName}}} -``` - -## Getting Started - -Please follow the [installation procedure](#installation--usage) and then run the following: - -{{> README_common }} diff --git a/sdk/templates/python/setup_cfg.mustache b/sdk/templates/python/setup_cfg.mustache deleted file mode 100644 index 205f16e7a..000000000 --- a/sdk/templates/python/setup_cfg.mustache +++ /dev/null @@ -1,16 +0,0 @@ -{{#useNose}} -[nosetests] -logging-clear-handlers=true -verbosity=2 -randomize=true -exe=true -with-coverage=true -cover-package={{{packageName}}} -cover-erase=true - -{{/useNose}} -[flake8] -max-line-length=99 - -[metadata] -description-file=README.md diff --git a/sdk/templates/typescript/.github/workflows/release.yml.mustache b/sdk/templates/typescript/.github/workflows/release.yml.mustache deleted file mode 100644 index e4cb7afb1..000000000 --- a/sdk/templates/typescript/.github/workflows/release.yml.mustache +++ /dev/null @@ -1,20 +0,0 @@ -name: tags -on: - push: - tags: - - '*' - -jobs: - Publish: - name: 'Publish' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: {{ NPM_TOKEN }} diff --git a/sdk/templates/typescript/.gitignore.mustache b/sdk/templates/typescript/.gitignore.mustache deleted file mode 100644 index e69de29bb..000000000 diff --git a/sdk/templates/typescript/README.mustache b/sdk/templates/typescript/README.mustache deleted file mode 100644 index 3da8a1113..000000000 --- a/sdk/templates/typescript/README.mustache +++ /dev/null @@ -1,30 +0,0 @@ -## {{npmName}}@{{npmVersion}} - -This generator creates TypeScript/JavaScript client that utilizes {{framework}}. - -### Building - -To build and compile the typescript sources to javascript use: -``` -npm install -npm run build -``` - -### Publishing - -First build the package then run ```npm publish``` - -### Consuming - -navigate to the folder of your consuming project and run one of the following commands. - -_published:_ - -``` -npm install {{npmName}}@{{npmVersion}} --save -``` - -_unPublished (not recommended):_ - -``` -npm install PATH_TO_GENERATED_PACKAGE --save