[Go][experimental] provide code samples in the API doc (#6115)

* provide code samples in api doc

* update petstore samples
This commit is contained in:
William Cheng 2020-05-01 10:50:01 +08:00 committed by GitHub
parent 0032e04530
commit b23c52f2ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 2215 additions and 6 deletions

View File

@ -18,10 +18,8 @@ package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.security.SecurityScheme; import io.swagger.v3.oas.models.security.SecurityScheme;
import org.openapitools.codegen.CodegenModel; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CodegenProperty; import org.openapitools.codegen.*;
import org.openapitools.codegen.CodegenSecurity;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
@ -36,6 +34,7 @@ import static org.openapitools.codegen.utils.StringUtils.camelize;
public class GoClientExperimentalCodegen extends GoClientCodegen { public class GoClientExperimentalCodegen extends GoClientCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(GoClientExperimentalCodegen.class); private static final Logger LOGGER = LoggerFactory.getLogger(GoClientExperimentalCodegen.class);
protected String goImportAlias = "openapiclient";
public GoClientExperimentalCodegen() { public GoClientExperimentalCodegen() {
super(); super();
@ -83,11 +82,22 @@ public class GoClientExperimentalCodegen extends GoClientCodegen {
// Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS. // Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS.
Map<String, SecurityScheme> securitySchemeMap = openAPI != null ? Map<String, SecurityScheme> securitySchemeMap = openAPI != null ?
(openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null) : null; (openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null) : null;
List<CodegenSecurity> authMethods = fromSecurity(securitySchemeMap); List<CodegenSecurity> authMethods = fromSecurity(securitySchemeMap);
if (ProcessUtils.hasHttpSignatureMethods(authMethods)) { if (ProcessUtils.hasHttpSignatureMethods(authMethods)) {
supportingFiles.add(new SupportingFile("signing.mustache", "", "signing.go")); supportingFiles.add(new SupportingFile("signing.mustache", "", "signing.go"));
} }
if (additionalProperties.containsKey("goImportAlias")) {
setGoImportAlias(additionalProperties.get("goImportAlias").toString());
} else {
additionalProperties.put("goImportAlias", goImportAlias);
}
}
public void setGoImportAlias(String goImportAlias) {
this.goImportAlias = goImportAlias;
} }
@Override @Override
@ -180,7 +190,7 @@ public class GoClientExperimentalCodegen extends GoClientCodegen {
param.dataType = "NullableTime"; param.dataType = "NullableTime";
} else { } else {
param.dataType = "Nullable" + Character.toUpperCase(param.dataType.charAt(0)) param.dataType = "Nullable" + Character.toUpperCase(param.dataType.charAt(0))
+ param.dataType.substring(1); + param.dataType.substring(1);
} }
} }
} }
@ -199,4 +209,151 @@ public class GoClientExperimentalCodegen extends GoClientCodegen {
} }
} }
} }
@Override
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
objs = super.postProcessOperationsWithModels(objs, allModels);
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
HashMap<String, CodegenModel> modelMaps = new HashMap<String, CodegenModel>();
HashMap<String, Integer> processedModelMaps = new HashMap<String, Integer>();
for (Object o : allModels) {
HashMap<String, Object> h = (HashMap<String, Object>) o;
CodegenModel m = (CodegenModel) h.get("model");
modelMaps.put(m.classname, m);
}
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
for (CodegenOperation op : operationList) {
for (CodegenParameter p : op.allParams) {
p.vendorExtensions.put("x-go-example", constructExampleCode(p, modelMaps, processedModelMaps));
}
}
processedModelMaps.clear();
for (CodegenOperation operation : operationList) {
for (CodegenParameter cp : operation.allParams) {
cp.vendorExtensions.put("x-go-example", constructExampleCode(cp, modelMaps, processedModelMaps));
}
}
return objs;
}
private String constructExampleCode(CodegenParameter codegenParameter, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) {
if (codegenParameter.isListContainer) { // array
return codegenParameter.dataType + "{" + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + "}";
} else if (codegenParameter.isMapContainer) {
return "map[string]string{ \"Key\" = \"Value\" }";
} else if (codegenParameter.isPrimitiveType) { // primitive type
if (codegenParameter.isString) {
if (StringUtils.isEmpty(codegenParameter.example)) {
return "\"" + codegenParameter.example + "\"";
} else {
return "\"" + codegenParameter.paramName + "_example\"";
}
} else if (codegenParameter.isBoolean) { // boolean
if (Boolean.parseBoolean(codegenParameter.example)) {
return "true";
} else {
return "false";
}
} else if (codegenParameter.isUri) { // URL
return "URL(string: \"https://example.com\")!";
} else if (codegenParameter.isDateTime || codegenParameter.isDate) { // datetime or date
return "Get-Date";
} else{ // numeric
if (StringUtils.isEmpty(codegenParameter.example)) {
return codegenParameter.example;
} else {
return "987";
}
}
} else { // model
// look up the model
if (modelMaps.containsKey(codegenParameter.dataType)) {
return constructExampleCode(modelMaps.get(codegenParameter.dataType), modelMaps, processedModelMap);
} else {
//LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenParameter.dataType);
return "TODO";
}
}
}
private String constructExampleCode(CodegenProperty codegenProperty, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) {
if (codegenProperty.isListContainer) { // array
return codegenProperty.dataType + "{" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + ")";
} else if (codegenProperty.isMapContainer) { // map
return "map[string]string{ \"Key\" = \"Value\" }";
} else if (codegenProperty.isPrimitiveType) { // primitive type
if (codegenProperty.isString) {
if (StringUtils.isEmpty(codegenProperty.example)) {
return "\"" + codegenProperty.example + "\"";
} else {
return "\"" + codegenProperty.name + "_example\"";
}
} else if (codegenProperty.isBoolean) { // boolean
if (Boolean.parseBoolean(codegenProperty.example)) {
return "true";
} else {
return "false";
}
} else if (codegenProperty.isUri) { // URL
return "\"https://example.com\")!";
} else if (codegenProperty.isDateTime || codegenProperty.isDate) { // datetime or date
return "time.Now()";
} else{ // numeric
String example;
if (StringUtils.isEmpty(codegenProperty.example)) {
example = codegenProperty.example;
} else {
example = "123";
}
if (codegenProperty.isLong) {
return "int64(" + example + ")";
} else {
return example;
}
}
} else {
// look up the model
if (modelMaps.containsKey(codegenProperty.dataType)) {
return constructExampleCode(modelMaps.get(codegenProperty.dataType), modelMaps, processedModelMap);
} else {
//LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenProperty.dataType);
return "\"TODO\"";
}
}
}
private String constructExampleCode(CodegenModel codegenModel, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) {
String example;
// break infinite recursion. Return, in case a model is already processed in the current context.
String model = codegenModel.name;
if (processedModelMap.containsKey(model)) {
int count = processedModelMap.get(model);
if (count == 1) {
processedModelMap.put(model, 2);
} else if (count == 2) {
return "";
} else {
throw new RuntimeException("Invalid count when constructing example: " + count);
}
} else {
processedModelMap.put(model, 1);
}
example = "" + goImportAlias + "." + codegenModel.name + "{";
List<String> propertyExamples = new ArrayList<>();
for (CodegenProperty codegenProperty : codegenModel.allVars) {
propertyExamples.add(codegenProperty.name + ": " + constructExampleCode(codegenProperty, modelMaps, processedModelMap));
}
example += StringUtils.join(propertyExamples, ", ");
example += "}";
return example;
}
} }

View File

@ -20,6 +20,37 @@ Method | HTTP request | Description
{{{unespacedNotes}}}{{/notes}} {{{unespacedNotes}}}{{/notes}}
### Example
```go
package main
import (
"context"
"fmt"
"os"
{{goImportAlias}} "./openapi"
)
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(), {{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{{vendorExtensions.x-export-param-name}}}({{{paramName}}}){{/optionalParams}}.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 ### Path Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}} {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}}

View File

@ -16,6 +16,33 @@ To test special tags
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.Client{Client: "Client_example"} // Client | client model
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.AnotherFakeApi.Call123TestSpecialTags(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnotherFakeApi.Call123TestSpecialTags``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `Call123TestSpecialTags`: Client
fmt.Fprintf(os.Stdout, "Response from `AnotherFakeApi.Call123TestSpecialTags`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters

View File

@ -29,6 +29,31 @@ creates an XmlItem
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
xmlItem := openapiclient.XmlItem{AttributeString: "AttributeString_example", AttributeNumber: 123, AttributeInteger: 123, AttributeBoolean: true, WrappedArray: []int32{123), NameString: "NameString_example", NameNumber: 123, NameInteger: 123, NameBoolean: true, NameArray: []int32{123), NameWrappedArray: []int32{123), PrefixString: "PrefixString_example", PrefixNumber: 123, PrefixInteger: 123, PrefixBoolean: true, PrefixArray: []int32{123), PrefixWrappedArray: []int32{123), NamespaceString: "NamespaceString_example", NamespaceNumber: 123, NamespaceInteger: 123, NamespaceBoolean: true, NamespaceArray: []int32{123), NamespaceWrappedArray: []int32{123), PrefixNsString: "PrefixNsString_example", PrefixNsNumber: 123, PrefixNsInteger: 123, PrefixNsBoolean: true, PrefixNsArray: []int32{123), PrefixNsWrappedArray: []int32{123)} // XmlItem | XmlItem Body
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.CreateXmlItem(context.Background(), xmlItem).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.CreateXmlItem``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -68,6 +93,33 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := true // bool | Input boolean as post body (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeOuterBooleanSerialize(context.Background(), ).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterBooleanSerialize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeOuterBooleanSerialize`: bool
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterBooleanSerialize`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -107,6 +159,33 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.OuterComposite{MyNumber: 123, MyString: "MyString_example", MyBoolean: false} // OuterComposite | Input composite as post body (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeOuterCompositeSerialize(context.Background(), ).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterCompositeSerialize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeOuterCompositeSerialize`: OuterComposite
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterCompositeSerialize`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -146,6 +225,33 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := 987 // float32 | Input number as post body (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeOuterNumberSerialize(context.Background(), ).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterNumberSerialize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeOuterNumberSerialize`: float32
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterNumberSerialize`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -185,6 +291,33 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := "body_example" // string | Input string as post body (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeOuterStringSerialize(context.Background(), ).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterStringSerialize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeOuterStringSerialize`: string
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterStringSerialize`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -224,6 +357,31 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.FileSchemaTestClass{File: openapiclient.File{SourceURI: "SourceURI_example"}, Files: []File{openapiclient.File{SourceURI: "SourceURI_example"})} // FileSchemaTestClass |
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestBodyWithFileSchema(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithFileSchema``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -261,6 +419,32 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
query := "query_example" // string |
body := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123} // User |
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestBodyWithQueryParams(context.Background(), query, body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithQueryParams``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -301,6 +485,33 @@ To test \"client\" model
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.Client{Client: "Client_example"} // Client | client model
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestClientModel(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestClientModel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `TestClientModel`: Client
fmt.Fprintf(os.Stdout, "Response from `FakeApi.TestClientModel`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -340,6 +551,44 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイ
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
number := 987 // float32 | None
double := 987 // float64 | None
patternWithoutDelimiter := "patternWithoutDelimiter_example" // string | None
byte_ := 987 // string | None
integer := 987 // int32 | None (optional)
int32_ := 987 // int32 | None (optional)
int64_ := 987 // int64 | None (optional)
float := 987 // float32 | None (optional)
string_ := "string__example" // string | None (optional)
binary := 987 // *os.File | None (optional)
date := Get-Date // string | None (optional)
dateTime := Get-Date // time.Time | None (optional)
password := "password_example" // string | None (optional)
callback := "callback_example" // string | None (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestEndpointParameters(context.Background(), number, double, patternWithoutDelimiter, byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEndpointParameters``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -392,6 +641,38 @@ To test enum parameters
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
enumHeaderStringArray := []string{"EnumHeaderStringArray_example"} // []string | Header parameter enum test (string array) (optional)
enumHeaderString := "enumHeaderString_example" // string | Header parameter enum test (string) (optional) (default to "-efg")
enumQueryStringArray := []string{"EnumQueryStringArray_example"} // []string | Query parameter enum test (string array) (optional)
enumQueryString := "enumQueryString_example" // string | Query parameter enum test (string) (optional) (default to "-efg")
enumQueryInteger := 987 // int32 | Query parameter enum test (double) (optional)
enumQueryDouble := 987 // float64 | Query parameter enum test (double) (optional)
enumFormStringArray := []string{"Inner_example"} // []string | Form parameter enum test (string array) (optional) (default to "$")
enumFormString := "enumFormString_example" // string | Form parameter enum test (string) (optional) (default to "-efg")
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestEnumParameters(context.Background(), ).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEnumParameters``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -438,6 +719,36 @@ Fake endpoint to test group parameters (optional)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
requiredStringGroup := 987 // int32 | Required String in group parameters
requiredBooleanGroup := true // bool | Required Boolean in group parameters
requiredInt64Group := 987 // int64 | Required Integer in group parameters
stringGroup := 987 // int32 | String in group parameters (optional)
booleanGroup := true // bool | Boolean in group parameters (optional)
int64Group := 987 // int64 | Integer in group parameters (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestGroupParameters(context.Background(), requiredStringGroup, requiredBooleanGroup, requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestGroupParameters``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -480,6 +791,31 @@ No authorization required
test inline additionalProperties test inline additionalProperties
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
param := map[string]string{ "Key" = "Value" } // map[string]string | request body
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestInlineAdditionalProperties(context.Background(), param).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestInlineAdditionalProperties``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -517,6 +853,32 @@ No authorization required
test json serialization of form data test json serialization of form data
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
param := "param_example" // string | field1
param2 := "param2_example" // string | field2
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestJsonFormData(context.Background(), param, param2).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestJsonFormData``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -557,6 +919,35 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
pipe := []string{"Inner_example"} // []string |
ioutil := []string{"Inner_example"} // []string |
http := []string{"Inner_example"} // []string |
url := []string{"Inner_example"} // []string |
context := []string{"Inner_example"} // []string |
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestQueryParameterCollectionFormat(context.Background(), pipe, ioutil, http, url, context).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestQueryParameterCollectionFormat``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters

View File

@ -16,6 +16,33 @@ To test class name in snake case
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.Client{Client: "Client_example"} // Client | client model
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeClassnameTags123Api.TestClassname(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeClassnameTags123Api.TestClassname``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `TestClassname`: Client
fmt.Fprintf(os.Stdout, "Response from `FakeClassnameTags123Api.TestClassname`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters

View File

@ -22,6 +22,31 @@ Method | HTTP request | Description
Add a new pet to the store Add a new pet to the store
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.AddPet(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.AddPet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -59,6 +84,32 @@ Name | Type | Description | Notes
Deletes a pet Deletes a pet
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | Pet id to delete
apiKey := "apiKey_example" // string | (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.DeletePet(context.Background(), petId).ApiKey(apiKey).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.DeletePet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -103,6 +154,33 @@ Finds Pets by status
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
status := []string{"Status_example"} // []string | Status values that need to be considered for filter
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.FindPetsByStatus(context.Background(), status).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByStatus``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FindPetsByStatus`: []Pet
fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByStatus`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -142,6 +220,33 @@ Finds Pets by tags
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
tags := []string{"Inner_example"} // []string | Tags to filter by
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.FindPetsByTags(context.Background(), tags).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByTags``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FindPetsByTags`: []Pet
fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByTags`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -181,6 +286,33 @@ Find pet by ID
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | ID of pet to return
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.GetPetById(context.Background(), petId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.GetPetById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetPetById`: Pet
fmt.Fprintf(os.Stdout, "Response from `PetApi.GetPetById`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -222,6 +354,31 @@ Name | Type | Description | Notes
Update an existing pet Update an existing pet
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.UpdatePet(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -259,6 +416,33 @@ Name | Type | Description | Notes
Updates a pet in the store with form data Updates a pet in the store with form data
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | ID of pet that needs to be updated
name := "name_example" // string | Updated name of the pet (optional)
status := "status_example" // string | Updated status of the pet (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.UpdatePetWithForm(context.Background(), petId).Name(name).Status(status).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePetWithForm``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -302,6 +486,35 @@ Name | Type | Description | Notes
uploads an image uploads an image
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | ID of pet to update
additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional)
file := 987 // *os.File | file to upload (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.UploadFile(context.Background(), petId).AdditionalMetadata(additionalMetadata).File(file).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFile``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UploadFile`: ApiResponse
fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFile`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -345,6 +558,35 @@ Name | Type | Description | Notes
uploads an image (required) uploads an image (required)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | ID of pet to update
requiredFile := 987 // *os.File | file to upload
additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.UploadFileWithRequiredFile(context.Background(), petId, requiredFile).AdditionalMetadata(additionalMetadata).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFileWithRequiredFile``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UploadFileWithRequiredFile`: ApiResponse
fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFileWithRequiredFile`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters

View File

@ -19,6 +19,31 @@ Delete purchase order by ID
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
orderId := "orderId_example" // string | ID of the order that needs to be deleted
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.StoreApi.DeleteOrder(context.Background(), orderId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.DeleteOrder``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -62,6 +87,32 @@ Returns pet inventories by status
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.StoreApi.GetInventory(context.Background(), ).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetInventory``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetInventory`: map[string]int32
fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetInventory`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
This endpoint does not need any parameter. This endpoint does not need any parameter.
@ -97,6 +148,33 @@ Find purchase order by ID
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
orderId := 987 // int64 | ID of pet that needs to be fetched
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.StoreApi.GetOrderById(context.Background(), orderId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetOrderById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetOrderById`: Order
fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetOrderById`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -138,6 +216,33 @@ No authorization required
Place an order for a pet Place an order for a pet
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.Order{Id: int64(123), PetId: int64(123), Quantity: 123, ShipDate: "TODO", Status: "Status_example", Complete: false} // Order | order placed for purchasing the pet
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.StoreApi.PlaceOrder(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.PlaceOrder``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PlaceOrder`: Order
fmt.Fprintf(os.Stdout, "Response from `StoreApi.PlaceOrder`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters

View File

@ -23,6 +23,31 @@ Create user
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123} // User | Created user object
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.CreateUser(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -60,6 +85,31 @@ No authorization required
Creates list of users with given input array Creates list of users with given input array
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := []User{openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123}} // []User | List of user object
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.CreateUsersWithArrayInput(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithArrayInput``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -97,6 +147,31 @@ No authorization required
Creates list of users with given input array Creates list of users with given input array
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := []User{} // []User | List of user object
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.CreateUsersWithListInput(context.Background(), body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithListInput``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -136,6 +211,31 @@ Delete user
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
username := "username_example" // string | The name that needs to be deleted
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.DeleteUser(context.Background(), username).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.DeleteUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -177,6 +277,33 @@ No authorization required
Get user by user name Get user by user name
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
username := "username_example" // string | The name that needs to be fetched. Use user1 for testing.
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.GetUserByName(context.Background(), username).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.GetUserByName``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetUserByName`: User
fmt.Fprintf(os.Stdout, "Response from `UserApi.GetUserByName`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -218,6 +345,34 @@ No authorization required
Logs user into the system Logs user into the system
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
username := "username_example" // string | The user name for login
password := "password_example" // string | The password for login in clear text
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.LoginUser(context.Background(), username, password).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LoginUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `LoginUser`: string
fmt.Fprintf(os.Stdout, "Response from `UserApi.LoginUser`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -256,6 +411,30 @@ No authorization required
Logs out current logged in user session Logs out current logged in user session
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.LogoutUser(context.Background(), ).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LogoutUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
This endpoint does not need any parameter. This endpoint does not need any parameter.
@ -291,6 +470,32 @@ Updated user
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
username := "username_example" // string | name that need to be deleted
body := // User | Updated user object
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.UpdateUser(context.Background(), username, body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UpdateUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters

View File

@ -16,6 +16,33 @@ To test special tags
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
client := openapiclient.Client{Client: "Client_example"} // Client | client model
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.AnotherFakeApi.Call123TestSpecialTags(context.Background(), client).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnotherFakeApi.Call123TestSpecialTags``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `Call123TestSpecialTags`: Client
fmt.Fprintf(os.Stdout, "Response from `AnotherFakeApi.Call123TestSpecialTags`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters

View File

@ -14,6 +14,32 @@ Method | HTTP request | Description
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.DefaultApi.FooGet(context.Background(), ).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.FooGet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FooGet`: InlineResponseDefault
fmt.Fprintf(os.Stdout, "Response from `DefaultApi.FooGet`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
This endpoint does not need any parameter. This endpoint does not need any parameter.

View File

@ -27,6 +27,32 @@ Method | HTTP request | Description
Health check endpoint Health check endpoint
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeHealthGet(context.Background(), ).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeHealthGet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeHealthGet`: HealthCheckResult
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeHealthGet`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
This endpoint does not need any parameter. This endpoint does not need any parameter.
@ -62,6 +88,33 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := true // bool | Input boolean as post body (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeOuterBooleanSerialize(context.Background(), ).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterBooleanSerialize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeOuterBooleanSerialize`: bool
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterBooleanSerialize`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -101,6 +154,33 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
outerComposite := openapiclient.OuterComposite{MyNumber: 123, MyString: "MyString_example", MyBoolean: false} // OuterComposite | Input composite as post body (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeOuterCompositeSerialize(context.Background(), ).OuterComposite(outerComposite).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterCompositeSerialize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeOuterCompositeSerialize`: OuterComposite
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterCompositeSerialize`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -140,6 +220,33 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := 987 // float32 | Input number as post body (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeOuterNumberSerialize(context.Background(), ).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterNumberSerialize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeOuterNumberSerialize`: float32
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterNumberSerialize`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -179,6 +286,33 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
body := "body_example" // string | Input string as post body (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.FakeOuterStringSerialize(context.Background(), ).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterStringSerialize``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FakeOuterStringSerialize`: string
fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterStringSerialize`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -218,6 +352,31 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
fileSchemaTestClass := openapiclient.FileSchemaTestClass{File: openapiclient.File{SourceURI: "SourceURI_example"}, Files: []File{openapiclient.File{SourceURI: "SourceURI_example"})} // FileSchemaTestClass |
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestBodyWithFileSchema(context.Background(), fileSchemaTestClass).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithFileSchema``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -255,6 +414,32 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
query := "query_example" // string |
user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123} // User |
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestBodyWithQueryParams(context.Background(), query, user).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithQueryParams``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -295,6 +480,33 @@ To test \"client\" model
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
client := openapiclient.Client{Client: "Client_example"} // Client | client model
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestClientModel(context.Background(), client).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestClientModel``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `TestClientModel`: Client
fmt.Fprintf(os.Stdout, "Response from `FakeApi.TestClientModel`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -334,6 +546,44 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
number := 987 // float32 | None
double := 987 // float64 | None
patternWithoutDelimiter := "patternWithoutDelimiter_example" // string | None
byte_ := 987 // string | None
integer := 987 // int32 | None (optional)
int32_ := 987 // int32 | None (optional)
int64_ := 987 // int64 | None (optional)
float := 987 // float32 | None (optional)
string_ := "string__example" // string | None (optional)
binary := 987 // *os.File | None (optional)
date := Get-Date // string | None (optional)
dateTime := Get-Date // time.Time | None (optional)
password := "password_example" // string | None (optional)
callback := "callback_example" // string | None (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestEndpointParameters(context.Background(), number, double, patternWithoutDelimiter, byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEndpointParameters``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -386,6 +636,38 @@ To test enum parameters
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
enumHeaderStringArray := []string{"EnumHeaderStringArray_example"} // []string | Header parameter enum test (string array) (optional)
enumHeaderString := "enumHeaderString_example" // string | Header parameter enum test (string) (optional) (default to "-efg")
enumQueryStringArray := []string{"EnumQueryStringArray_example"} // []string | Query parameter enum test (string array) (optional)
enumQueryString := "enumQueryString_example" // string | Query parameter enum test (string) (optional) (default to "-efg")
enumQueryInteger := 987 // int32 | Query parameter enum test (double) (optional)
enumQueryDouble := 987 // float64 | Query parameter enum test (double) (optional)
enumFormStringArray := []string{"Inner_example"} // []string | Form parameter enum test (string array) (optional) (default to "$")
enumFormString := "enumFormString_example" // string | Form parameter enum test (string) (optional) (default to "-efg")
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestEnumParameters(context.Background(), ).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEnumParameters``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -432,6 +714,36 @@ Fake endpoint to test group parameters (optional)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
requiredStringGroup := 987 // int32 | Required String in group parameters
requiredBooleanGroup := true // bool | Required Boolean in group parameters
requiredInt64Group := 987 // int64 | Required Integer in group parameters
stringGroup := 987 // int32 | String in group parameters (optional)
booleanGroup := true // bool | Boolean in group parameters (optional)
int64Group := 987 // int64 | Integer in group parameters (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestGroupParameters(context.Background(), requiredStringGroup, requiredBooleanGroup, requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestGroupParameters``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -474,6 +786,31 @@ Name | Type | Description | Notes
test inline additionalProperties test inline additionalProperties
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
requestBody := map[string]string{ "Key" = "Value" } // map[string]string | request body
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestInlineAdditionalProperties(context.Background(), requestBody).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestInlineAdditionalProperties``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -511,6 +848,32 @@ No authorization required
test json serialization of form data test json serialization of form data
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
param := "param_example" // string | field1
param2 := "param2_example" // string | field2
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestJsonFormData(context.Background(), param, param2).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestJsonFormData``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -551,6 +914,35 @@ No authorization required
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
pipe := []string{"Inner_example"} // []string |
ioutil := []string{"Inner_example"} // []string |
http := []string{"Inner_example"} // []string |
url := []string{"Inner_example"} // []string |
context := []string{"Inner_example"} // []string |
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeApi.TestQueryParameterCollectionFormat(context.Background(), pipe, ioutil, http, url, context).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestQueryParameterCollectionFormat``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters

View File

@ -16,6 +16,33 @@ To test class name in snake case
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
client := openapiclient.Client{Client: "Client_example"} // Client | client model
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.FakeClassnameTags123Api.TestClassname(context.Background(), client).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeClassnameTags123Api.TestClassname``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `TestClassname`: Client
fmt.Fprintf(os.Stdout, "Response from `FakeClassnameTags123Api.TestClassname`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters

View File

@ -22,6 +22,31 @@ Method | HTTP request | Description
Add a new pet to the store Add a new pet to the store
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
pet := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.AddPet(context.Background(), pet).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.AddPet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -59,6 +84,32 @@ Name | Type | Description | Notes
Deletes a pet Deletes a pet
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | Pet id to delete
apiKey := "apiKey_example" // string | (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.DeletePet(context.Background(), petId).ApiKey(apiKey).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.DeletePet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -103,6 +154,33 @@ Finds Pets by status
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
status := []string{"Status_example"} // []string | Status values that need to be considered for filter
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.FindPetsByStatus(context.Background(), status).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByStatus``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FindPetsByStatus`: []Pet
fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByStatus`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -142,6 +220,33 @@ Finds Pets by tags
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
tags := []string{"Inner_example"} // []string | Tags to filter by
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.FindPetsByTags(context.Background(), tags).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByTags``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `FindPetsByTags`: []Pet
fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByTags`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -181,6 +286,33 @@ Find pet by ID
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | ID of pet to return
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.GetPetById(context.Background(), petId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.GetPetById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetPetById`: Pet
fmt.Fprintf(os.Stdout, "Response from `PetApi.GetPetById`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -222,6 +354,31 @@ Name | Type | Description | Notes
Update an existing pet Update an existing pet
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
pet := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.UpdatePet(context.Background(), pet).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePet``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -259,6 +416,33 @@ Name | Type | Description | Notes
Updates a pet in the store with form data Updates a pet in the store with form data
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | ID of pet that needs to be updated
name := "name_example" // string | Updated name of the pet (optional)
status := "status_example" // string | Updated status of the pet (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.UpdatePetWithForm(context.Background(), petId).Name(name).Status(status).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePetWithForm``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -302,6 +486,35 @@ Name | Type | Description | Notes
uploads an image uploads an image
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | ID of pet to update
additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional)
file := 987 // *os.File | file to upload (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.UploadFile(context.Background(), petId).AdditionalMetadata(additionalMetadata).File(file).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFile``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UploadFile`: ApiResponse
fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFile`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -345,6 +558,35 @@ Name | Type | Description | Notes
uploads an image (required) uploads an image (required)
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
petId := 987 // int64 | ID of pet to update
requiredFile := 987 // *os.File | file to upload
additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional)
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.PetApi.UploadFileWithRequiredFile(context.Background(), petId, requiredFile).AdditionalMetadata(additionalMetadata).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFileWithRequiredFile``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UploadFileWithRequiredFile`: ApiResponse
fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFileWithRequiredFile`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters

View File

@ -19,6 +19,31 @@ Delete purchase order by ID
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
orderId := "orderId_example" // string | ID of the order that needs to be deleted
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.StoreApi.DeleteOrder(context.Background(), orderId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.DeleteOrder``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -62,6 +87,32 @@ Returns pet inventories by status
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.StoreApi.GetInventory(context.Background(), ).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetInventory``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetInventory`: map[string]int32
fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetInventory`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
This endpoint does not need any parameter. This endpoint does not need any parameter.
@ -97,6 +148,33 @@ Find purchase order by ID
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
orderId := 987 // int64 | ID of pet that needs to be fetched
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.StoreApi.GetOrderById(context.Background(), orderId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetOrderById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetOrderById`: Order
fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetOrderById`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -138,6 +216,33 @@ No authorization required
Place an order for a pet Place an order for a pet
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
order := openapiclient.Order{Id: int64(123), PetId: int64(123), Quantity: 123, ShipDate: "TODO", Status: "Status_example", Complete: false} // Order | order placed for purchasing the pet
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.StoreApi.PlaceOrder(context.Background(), order).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.PlaceOrder``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PlaceOrder`: Order
fmt.Fprintf(os.Stdout, "Response from `StoreApi.PlaceOrder`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters

View File

@ -23,6 +23,31 @@ Create user
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123} // User | Created user object
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.CreateUser(context.Background(), user).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -60,6 +85,31 @@ No authorization required
Creates list of users with given input array Creates list of users with given input array
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
user := []User{openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123}} // []User | List of user object
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.CreateUsersWithArrayInput(context.Background(), user).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithArrayInput``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -97,6 +147,31 @@ No authorization required
Creates list of users with given input array Creates list of users with given input array
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
user := []User{} // []User | List of user object
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.CreateUsersWithListInput(context.Background(), user).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithListInput``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -136,6 +211,31 @@ Delete user
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
username := "username_example" // string | The name that needs to be deleted
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.DeleteUser(context.Background(), username).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.DeleteUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
@ -177,6 +277,33 @@ No authorization required
Get user by user name Get user by user name
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
username := "username_example" // string | The name that needs to be fetched. Use user1 for testing.
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.GetUserByName(context.Background(), username).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.GetUserByName``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetUserByName`: User
fmt.Fprintf(os.Stdout, "Response from `UserApi.GetUserByName`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -218,6 +345,34 @@ No authorization required
Logs user into the system Logs user into the system
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
username := "username_example" // string | The user name for login
password := "password_example" // string | The password for login in clear text
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.LoginUser(context.Background(), username, password).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LoginUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `LoginUser`: string
fmt.Fprintf(os.Stdout, "Response from `UserApi.LoginUser`: %v\n", resp)
}
```
### Path Parameters ### Path Parameters
@ -256,6 +411,30 @@ No authorization required
Logs out current logged in user session Logs out current logged in user session
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.LogoutUser(context.Background(), ).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LogoutUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters
This endpoint does not need any parameter. This endpoint does not need any parameter.
@ -291,6 +470,32 @@ Updated user
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)
func main() {
username := "username_example" // string | name that need to be deleted
user := // User | Updated user object
configuration := openapiclient.NewConfiguration()
api_client := openapiclient.NewAPIClient(configuration)
resp, r, err := api_client.UserApi.UpdateUser(context.Background(), username, user).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UpdateUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters ### Path Parameters