openapi-generator/samples/client/petstore/javascript-es6/docs/FakeApi.md
Stian Liknes 24104dac35 Add option modelPropertyNaming to javascript generator (#299)
* Add option modelPropertyNaming to javascript generator

Fixes 6530

* Update Petstore sample
2018-06-14 19:19:23 +08:00

13 KiB

OpenApiPetstore.FakeApi

All URIs are relative to http://petstore.swagger.io:80/v2

Method HTTP request Description
fakeOuterBooleanSerialize POST /fake/outer/boolean
fakeOuterCompositeSerialize POST /fake/outer/composite
fakeOuterNumberSerialize POST /fake/outer/number
fakeOuterStringSerialize POST /fake/outer/string
testBodyWithQueryParams PUT /fake/body-with-query-params
testClientModel PATCH /fake To test "client" model
testEndpointParameters POST /fake Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
testEnumParameters GET /fake To test enum parameters
testInlineAdditionalProperties POST /fake/inline-additionalProperties test inline additionalProperties
testJsonFormData GET /fake/jsonFormData test json serialization of form data

fakeOuterBooleanSerialize

Boolean fakeOuterBooleanSerialize(opts)

Test serialization of outer boolean types

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let opts = {
  'body': true // Boolean | Input boolean as post body
};
apiInstance.fakeOuterBooleanSerialize(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body Boolean Input boolean as post body [optional]

Return type

Boolean

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

fakeOuterCompositeSerialize

OuterComposite fakeOuterCompositeSerialize(opts)

Test serialization of object with outer number type

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let opts = {
  'outerComposite': new OpenApiPetstore.OuterComposite() // OuterComposite | Input composite as post body
};
apiInstance.fakeOuterCompositeSerialize(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
outerComposite OuterComposite Input composite as post body [optional]

Return type

OuterComposite

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

fakeOuterNumberSerialize

Number fakeOuterNumberSerialize(opts)

Test serialization of outer number types

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let opts = {
  'body': 3.4 // Number | Input number as post body
};
apiInstance.fakeOuterNumberSerialize(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body Number Input number as post body [optional]

Return type

Number

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

fakeOuterStringSerialize

String fakeOuterStringSerialize(opts)

Test serialization of outer string types

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let opts = {
  'body': "body_example" // String | Input string as post body
};
apiInstance.fakeOuterStringSerialize(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body String Input string as post body [optional]

Return type

String

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

testBodyWithQueryParams

testBodyWithQueryParams(query, user)

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let query = "query_example"; // String | 
let user = new OpenApiPetstore.User(); // User | 
apiInstance.testBodyWithQueryParams(query, user, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
query String
user User

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

testClientModel

Client testClientModel(client)

To test "client" model

To test "client" model

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let client = new OpenApiPetstore.Client(); // Client | client model
apiInstance.testClientModel(client, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
client Client client model

Return type

Client

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

testEndpointParameters

testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts)

Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트

Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트

Example

import OpenApiPetstore from 'open_api_petstore';
let defaultClient = OpenApiPetstore.ApiClient.instance;

// Configure HTTP basic authorization: http_basic_test
let http_basic_test = defaultClient.authentications['http_basic_test'];
http_basic_test.username = 'YOUR USERNAME';
http_basic_test.password = 'YOUR PASSWORD';

let apiInstance = new OpenApiPetstore.FakeApi();
let _number = 3.4; // Number | None
let _double = 3.4; // Number | None
let patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
let _byte = null; // Blob | None
let opts = {
  'integer': 56, // Number | None
  'int32': 56, // Number | None
  'int64': 789, // Number | None
  '_float': 3.4, // Number | None
  '_string': "_string_example", // String | None
  'binary': "/path/to/file", // File | None
  '_date': new Date("2013-10-20"), // Date | None
  'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None
  'password': "password_example", // String | None
  'callback': "callback_example" // String | None
};
apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
_number Number None
_double Number None
patternWithoutDelimiter String None
_byte Blob None
integer Number None [optional]
int32 Number None [optional]
int64 Number None [optional]
_float Number None [optional]
_string String None [optional]
binary File None [optional]
_date Date None [optional]
dateTime Date None [optional]
password String None [optional]
callback String None [optional]

Return type

null (empty response body)

Authorization

http_basic_test

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: Not defined

testEnumParameters

testEnumParameters(opts)

To test enum parameters

To test enum parameters

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let opts = {
  'enumHeaderStringArray': ["'$'"], // [String] | Header parameter enum test (string array)
  'enumHeaderString': "'-efg'", // String | Header parameter enum test (string)
  'enumQueryStringArray': ["'$'"], // [String] | Query parameter enum test (string array)
  'enumQueryString': "'-efg'", // String | Query parameter enum test (string)
  'enumQueryInteger': 56, // Number | Query parameter enum test (double)
  'enumQueryDouble': 3.4, // Number | Query parameter enum test (double)
  'enumFormStringArray': "'$'", // [String] | Form parameter enum test (string array)
  'enumFormString': "'-efg'" // String | Form parameter enum test (string)
};
apiInstance.testEnumParameters(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
enumHeaderStringArray **[String]** Header parameter enum test (string array) [optional]
enumHeaderString String Header parameter enum test (string) [optional] [default to '-efg']
enumQueryStringArray **[String]** Query parameter enum test (string array) [optional]
enumQueryString String Query parameter enum test (string) [optional] [default to '-efg']
enumQueryInteger Number Query parameter enum test (double) [optional]
enumQueryDouble Number Query parameter enum test (double) [optional]
enumFormStringArray **[String]** Form parameter enum test (string array) [optional] [default to '$']
enumFormString String Form parameter enum test (string) [optional] [default to '-efg']

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: Not defined

testInlineAdditionalProperties

testInlineAdditionalProperties(requestBody)

test inline additionalProperties

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let requestBody = {key: "inner_example"}; // {String: String} | request body
apiInstance.testInlineAdditionalProperties(requestBody, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
requestBody {String: String} request body

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

testJsonFormData

testJsonFormData(param, param2)

test json serialization of form data

Example

import OpenApiPetstore from 'open_api_petstore';

let apiInstance = new OpenApiPetstore.FakeApi();
let param = "param_example"; // String | field1
let param2 = "param2_example"; // String | field2
apiInstance.testJsonFormData(param, param2, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
param String field1
param2 String field2

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: Not defined