mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-05 15:10:49 +00:00
[R] Use snake_case in method parameter names (#12390)
* use snake_case in method parameter names * update doc
This commit is contained in:
parent
f6263b5e08
commit
3597621fbc
@ -1,6 +1,6 @@
|
|||||||
generatorName: r
|
generatorName: r
|
||||||
outputDir: samples/client/petstore/R
|
outputDir: samples/client/petstore/R
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/r/petstore.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/r
|
templateDir: modules/openapi-generator/src/main/resources/r
|
||||||
httpUserAgent: PetstoreAgent
|
httpUserAgent: PetstoreAgent
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
|
@ -51,6 +51,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
<ul class="column-ul">
|
<ul class="column-ul">
|
||||||
<li>apiresponse</li>
|
<li>apiresponse</li>
|
||||||
<li>break</li>
|
<li>break</li>
|
||||||
|
<li>data_file</li>
|
||||||
<li>else</li>
|
<li>else</li>
|
||||||
<li>false</li>
|
<li>false</li>
|
||||||
<li>for</li>
|
<li>for</li>
|
||||||
|
@ -126,7 +126,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
"next", "break", "TRUE", "FALSE", "NULL", "Inf", "NaN",
|
"next", "break", "TRUE", "FALSE", "NULL", "Inf", "NaN",
|
||||||
"NA", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_",
|
"NA", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_",
|
||||||
// reserved words in API client
|
// reserved words in API client
|
||||||
"ApiResponse"
|
"ApiResponse", "data_file"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -294,13 +294,13 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (isReservedWord(name))
|
if (isReservedWord(name))
|
||||||
name = escapeReservedWord(name);
|
name = "var_" + name;
|
||||||
|
|
||||||
// for reserved word or word starting with number, append _
|
// for reserved word or word starting with number, append _
|
||||||
if (name.matches("^\\d.*"))
|
if (name.matches("^\\d.*"))
|
||||||
name = "Var" + name;
|
name = "var_" + name;
|
||||||
|
|
||||||
return name.replace("_", ".");
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -381,7 +381,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
if (ModelUtils.isArraySchema(p)) {
|
if (ModelUtils.isArraySchema(p)) {
|
||||||
ArraySchema ap = (ArraySchema) p;
|
ArraySchema ap = (ArraySchema) p;
|
||||||
Schema inner = ap.getItems();
|
Schema inner = ap.getItems();
|
||||||
return getSchemaType(p) + "[" + getTypeDeclaration(inner)+ "]";
|
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
|
||||||
} else if (ModelUtils.isMapSchema(p)) {
|
} else if (ModelUtils.isMapSchema(p)) {
|
||||||
Schema inner = getAdditionalProperties(p);
|
Schema inner = getAdditionalProperties(p);
|
||||||
return getSchemaType(p) + "(" + getTypeDeclaration(inner) + ")";
|
return getSchemaType(p) + "(" + getTypeDeclaration(inner) + ")";
|
||||||
@ -480,11 +480,11 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setExceptionPackageToUse(String exceptionPackage) {
|
public void setExceptionPackageToUse(String exceptionPackage) {
|
||||||
if(DEFAULT.equals(exceptionPackage))
|
if (DEFAULT.equals(exceptionPackage))
|
||||||
this.useDefaultExceptionHandling = true;
|
this.useDefaultExceptionHandling = true;
|
||||||
if(RLANG.equals(exceptionPackage)){
|
if (RLANG.equals(exceptionPackage)) {
|
||||||
supportingFiles.add(new SupportingFile("api_exception.mustache", File.separator + "R", "api_exception.R"));
|
supportingFiles.add(new SupportingFile("api_exception.mustache", File.separator + "R", "api_exception.R"));
|
||||||
this.useRlangExceptionHandling = true;
|
this.useRlangExceptionHandling = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,7 +676,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
if (Pattern.compile("\r\n|\r|\n").matcher((String) p.getDefault()).find())
|
if (Pattern.compile("\r\n|\r|\n").matcher((String) p.getDefault()).find())
|
||||||
return "'''" + p.getDefault() + "'''";
|
return "'''" + p.getDefault() + "'''";
|
||||||
else
|
else
|
||||||
return "'" + ((String) p.getDefault()).replaceAll("'","\'") + "'";
|
return "'" + ((String) p.getDefault()).replaceAll("'", "\'") + "'";
|
||||||
}
|
}
|
||||||
} else if (ModelUtils.isArraySchema(p)) {
|
} else if (ModelUtils.isArraySchema(p)) {
|
||||||
if (p.getDefault() != null) {
|
if (p.getDefault() != null) {
|
||||||
@ -817,5 +817,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.R; }
|
public GeneratorLanguage generatorLanguage() {
|
||||||
|
return GeneratorLanguage.R;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
768
modules/openapi-generator/src/test/resources/3_0/r/petstore.yaml
Normal file
768
modules/openapi-generator/src/test/resources/3_0/r/petstore.yaml
Normal file
@ -0,0 +1,768 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
servers:
|
||||||
|
- url: 'http://petstore.swagger.io/v2'
|
||||||
|
info:
|
||||||
|
description: >-
|
||||||
|
This is a sample server Petstore server. For this sample, you can use the api key
|
||||||
|
`special-key` to test the authorization filters.
|
||||||
|
version: 1.0.0
|
||||||
|
title: OpenAPI Petstore
|
||||||
|
license:
|
||||||
|
name: Apache-2.0
|
||||||
|
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
|
||||||
|
tags:
|
||||||
|
- name: pet
|
||||||
|
description: Everything about your Pets
|
||||||
|
- name: store
|
||||||
|
description: Access to Petstore orders
|
||||||
|
- name: user
|
||||||
|
description: Operations about user
|
||||||
|
paths:
|
||||||
|
/pet:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Add a new pet to the store
|
||||||
|
description: ''
|
||||||
|
operationId: addPet
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
'405':
|
||||||
|
description: Invalid input
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- 'write:pets'
|
||||||
|
- 'read:pets'
|
||||||
|
requestBody:
|
||||||
|
$ref: '#/components/requestBodies/Pet'
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Update an existing pet
|
||||||
|
description: ''
|
||||||
|
operationId: updatePet
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
'400':
|
||||||
|
description: Invalid ID supplied
|
||||||
|
'404':
|
||||||
|
description: Pet not found
|
||||||
|
'405':
|
||||||
|
description: Validation exception
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- 'write:pets'
|
||||||
|
- 'read:pets'
|
||||||
|
requestBody:
|
||||||
|
$ref: '#/components/requestBodies/Pet'
|
||||||
|
/pet/findByStatus:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Finds Pets by status
|
||||||
|
description: Multiple status values can be provided with comma separated strings
|
||||||
|
operationId: findPetsByStatus
|
||||||
|
parameters:
|
||||||
|
- name: status
|
||||||
|
in: query
|
||||||
|
description: Status values that need to be considered for filter
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: false
|
||||||
|
deprecated: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- available
|
||||||
|
- pending
|
||||||
|
- sold
|
||||||
|
default: available
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
'400':
|
||||||
|
description: Invalid status value
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- 'read:pets'
|
||||||
|
/pet/findByTags:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Finds Pets by tags
|
||||||
|
description: >-
|
||||||
|
Multiple tags can be provided with comma separated strings. Use tag1,
|
||||||
|
tag2, tag3 for testing.
|
||||||
|
operationId: findPetsByTags
|
||||||
|
parameters:
|
||||||
|
- name: tags
|
||||||
|
in: query
|
||||||
|
description: Tags to filter by
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: false
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
'400':
|
||||||
|
description: Invalid tag value
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- 'read:pets'
|
||||||
|
deprecated: true
|
||||||
|
'/pet/{petId}':
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Find pet by ID
|
||||||
|
description: Returns a single pet
|
||||||
|
operationId: getPetById
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet to return
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
'400':
|
||||||
|
description: Invalid ID supplied
|
||||||
|
'404':
|
||||||
|
description: Pet not found
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Updates a pet in the store with form data
|
||||||
|
description: ''
|
||||||
|
operationId: updatePetWithForm
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet that needs to be updated
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
'405':
|
||||||
|
description: Invalid input
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- 'write:pets'
|
||||||
|
- 'read:pets'
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/x-www-form-urlencoded:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
description: Updated name of the pet
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
description: Updated status of the pet
|
||||||
|
type: string
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Deletes a pet
|
||||||
|
description: ''
|
||||||
|
operationId: deletePet
|
||||||
|
parameters:
|
||||||
|
- name: api_key
|
||||||
|
in: header
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: Pet id to delete
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
'400':
|
||||||
|
description: Invalid pet value
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- 'write:pets'
|
||||||
|
- 'read:pets'
|
||||||
|
'/pet/{petId}/uploadImage':
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: uploads an image
|
||||||
|
description: ''
|
||||||
|
operationId: uploadFile
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet to update
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiResponse'
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- 'write:pets'
|
||||||
|
- 'read:pets'
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
additionalMetadata:
|
||||||
|
description: Additional data to pass to server
|
||||||
|
type: string
|
||||||
|
file:
|
||||||
|
description: file to upload
|
||||||
|
type: string
|
||||||
|
format: binary
|
||||||
|
/store/inventory:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Returns pet inventories by status
|
||||||
|
description: Returns a map of status codes to quantities
|
||||||
|
operationId: getInventory
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
/store/order:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Place an order for a pet
|
||||||
|
description: ''
|
||||||
|
operationId: placeOrder
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
'400':
|
||||||
|
description: Invalid Order
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
description: order placed for purchasing the pet
|
||||||
|
required: true
|
||||||
|
'/store/order/{orderId}':
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Find purchase order by ID
|
||||||
|
description: >-
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values
|
||||||
|
will generated exceptions
|
||||||
|
operationId: getOrderById
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
description: ID of pet that needs to be fetched
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
minimum: 1
|
||||||
|
maximum: 5
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
'400':
|
||||||
|
description: Invalid ID supplied
|
||||||
|
'404':
|
||||||
|
description: Order not found
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Delete purchase order by ID
|
||||||
|
description: >-
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above
|
||||||
|
1000 or nonintegers will generate API errors
|
||||||
|
operationId: deleteOrder
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
description: ID of the order that needs to be deleted
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'400':
|
||||||
|
description: Invalid ID supplied
|
||||||
|
'404':
|
||||||
|
description: Order not found
|
||||||
|
/user:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Create user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: createUser
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
description: Created user object
|
||||||
|
required: true
|
||||||
|
/user/createWithArray:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Creates list of users with given input array
|
||||||
|
description: ''
|
||||||
|
operationId: createUsersWithArrayInput
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
requestBody:
|
||||||
|
$ref: '#/components/requestBodies/UserArray'
|
||||||
|
/user/createWithList:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Creates list of users with given input array
|
||||||
|
description: ''
|
||||||
|
operationId: createUsersWithListInput
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
requestBody:
|
||||||
|
$ref: '#/components/requestBodies/UserArray'
|
||||||
|
/user/login:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Logs user into the system
|
||||||
|
description: ''
|
||||||
|
operationId: loginUser
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: query
|
||||||
|
description: The user name for login
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
|
||||||
|
- name: password
|
||||||
|
in: query
|
||||||
|
description: The password for login in clear text
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
headers:
|
||||||
|
Set-Cookie:
|
||||||
|
description: >-
|
||||||
|
Cookie authentication key for use with the `api_key`
|
||||||
|
apiKey authentication.
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
|
||||||
|
X-Rate-Limit:
|
||||||
|
description: calls per hour allowed by the user
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
X-Expires-After:
|
||||||
|
description: date in UTC when token expires
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
'400':
|
||||||
|
description: Invalid username/password supplied
|
||||||
|
/user/logout:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Logs out current logged in user session
|
||||||
|
description: ''
|
||||||
|
operationId: logoutUser
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
'/user/{username}':
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Get user by user name
|
||||||
|
description: ''
|
||||||
|
operationId: getUserByName
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: The name that needs to be fetched. Use user1 for testing.
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
'400':
|
||||||
|
description: Invalid username supplied
|
||||||
|
'404':
|
||||||
|
description: User not found
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Updated user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: updateUser
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: name that need to be deleted
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'400':
|
||||||
|
description: Invalid user supplied
|
||||||
|
'404':
|
||||||
|
description: User not found
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
description: Updated user object
|
||||||
|
required: true
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Delete user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: deleteUser
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: The name that needs to be deleted
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'400':
|
||||||
|
description: Invalid username supplied
|
||||||
|
'404':
|
||||||
|
description: User not found
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
/fake/data_file:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- fake
|
||||||
|
summary: test data_file to ensure it's escaped correctly
|
||||||
|
description: ''
|
||||||
|
operationId: fake_data_file
|
||||||
|
parameters:
|
||||||
|
- name: dummy
|
||||||
|
in: header
|
||||||
|
description: dummy required parameter
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: data_file
|
||||||
|
in: header
|
||||||
|
description: header data file
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
externalDocs:
|
||||||
|
description: Find out more about Swagger
|
||||||
|
url: 'http://swagger.io'
|
||||||
|
components:
|
||||||
|
requestBodies:
|
||||||
|
UserArray:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
description: List of user object
|
||||||
|
required: true
|
||||||
|
Pet:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
description: Pet object that needs to be added to the store
|
||||||
|
required: true
|
||||||
|
securitySchemes:
|
||||||
|
petstore_auth:
|
||||||
|
type: oauth2
|
||||||
|
flows:
|
||||||
|
implicit:
|
||||||
|
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
|
||||||
|
scopes:
|
||||||
|
'write:pets': modify pets in your account
|
||||||
|
'read:pets': read your pets
|
||||||
|
api_key:
|
||||||
|
type: apiKey
|
||||||
|
name: api_key
|
||||||
|
in: header
|
||||||
|
schemas:
|
||||||
|
Order:
|
||||||
|
title: Pet Order
|
||||||
|
description: An order for a pets from the pet store
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
petId:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
quantity:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
shipDate:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
description: Order Status
|
||||||
|
enum:
|
||||||
|
- placed
|
||||||
|
- approved
|
||||||
|
- delivered
|
||||||
|
complete:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
xml:
|
||||||
|
name: Order
|
||||||
|
Category:
|
||||||
|
title: Pet category
|
||||||
|
description: A category for a pet
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
|
||||||
|
xml:
|
||||||
|
name: Category
|
||||||
|
User:
|
||||||
|
title: a User
|
||||||
|
description: A User who is purchasing from the pet store
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
firstName:
|
||||||
|
type: string
|
||||||
|
lastName:
|
||||||
|
type: string
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
userStatus:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
description: User Status
|
||||||
|
xml:
|
||||||
|
name: User
|
||||||
|
Tag:
|
||||||
|
title: Pet Tag
|
||||||
|
description: A tag for a pet
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
xml:
|
||||||
|
name: Tag
|
||||||
|
Pet:
|
||||||
|
title: a Pet
|
||||||
|
description: A pet for sale in the pet store
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
- photoUrls
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
category:
|
||||||
|
$ref: '#/components/schemas/Category'
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: doggie
|
||||||
|
photoUrls:
|
||||||
|
type: array
|
||||||
|
xml:
|
||||||
|
name: photoUrl
|
||||||
|
wrapped: true
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
tags:
|
||||||
|
type: array
|
||||||
|
xml:
|
||||||
|
name: tag
|
||||||
|
wrapped: true
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Tag'
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
description: pet status in the store
|
||||||
|
deprecated: true
|
||||||
|
enum:
|
||||||
|
- available
|
||||||
|
- pending
|
||||||
|
- sold
|
||||||
|
xml:
|
||||||
|
name: Pet
|
||||||
|
ApiResponse:
|
||||||
|
title: An uploaded response
|
||||||
|
description: Describes the result of uploading an image resource
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
|
type: string
|
@ -6,6 +6,7 @@ NAMESPACE
|
|||||||
R/api_client.R
|
R/api_client.R
|
||||||
R/api_response.R
|
R/api_response.R
|
||||||
R/category.R
|
R/category.R
|
||||||
|
R/fake_api.R
|
||||||
R/model_api_response.R
|
R/model_api_response.R
|
||||||
R/order.R
|
R/order.R
|
||||||
R/pet.R
|
R/pet.R
|
||||||
@ -16,6 +17,7 @@ R/user.R
|
|||||||
R/user_api.R
|
R/user_api.R
|
||||||
README.md
|
README.md
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
|
docs/FakeApi.md
|
||||||
docs/ModelApiResponse.md
|
docs/ModelApiResponse.md
|
||||||
docs/Order.md
|
docs/Order.md
|
||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
|
@ -19,6 +19,7 @@ export(Tag)
|
|||||||
export(User)
|
export(User)
|
||||||
|
|
||||||
# APIs
|
# APIs
|
||||||
|
export(FakeApi)
|
||||||
export(PetApi)
|
export(PetApi)
|
||||||
export(StoreApi)
|
export(StoreApi)
|
||||||
export(UserApi)
|
export(UserApi)
|
||||||
|
127
samples/client/petstore/R/R/fake_api.R
Normal file
127
samples/client/petstore/R/R/fake_api.R
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
# OpenAPI Petstore
|
||||||
|
#
|
||||||
|
# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||||
|
#
|
||||||
|
# The version of the OpenAPI document: 1.0.0
|
||||||
|
#
|
||||||
|
# Generated by: https://openapi-generator.tech
|
||||||
|
|
||||||
|
#' @docType class
|
||||||
|
#' @title Fake operations
|
||||||
|
#' @description petstore.Fake
|
||||||
|
#' @format An \code{R6Class} generator object
|
||||||
|
#' @field apiClient Handles the client-server communication.
|
||||||
|
#'
|
||||||
|
#' @section Methods:
|
||||||
|
#' \describe{
|
||||||
|
#' \strong{ FakeDataFile } \emph{ test data_file to ensure it's escaped correctly }
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' \itemize{
|
||||||
|
#' \item \emph{ @param } dummy character
|
||||||
|
#' \item \emph{ @param } var_data_file character
|
||||||
|
#' \item \emph{ @returnType } \link{User} \cr
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' \item status code : 200 | successful operation
|
||||||
|
#'
|
||||||
|
#' \item return type : User
|
||||||
|
#' \item response headers :
|
||||||
|
#'
|
||||||
|
#' \tabular{ll}{
|
||||||
|
#' }
|
||||||
|
#' }
|
||||||
|
#'
|
||||||
|
#' }
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' @examples
|
||||||
|
#' \dontrun{
|
||||||
|
#' #################### FakeDataFile ####################
|
||||||
|
#'
|
||||||
|
#' library(petstore)
|
||||||
|
#' var.dummy <- 'dummy_example' # character | dummy required parameter
|
||||||
|
#' var.var_data_file <- 'var_data_file_example' # character | header data file
|
||||||
|
#'
|
||||||
|
#' #test data_file to ensure it's escaped correctly
|
||||||
|
#' api.instance <- FakeApi$new()
|
||||||
|
#'
|
||||||
|
#' result <- api.instance$FakeDataFile(var.dummy, var_data_file=var.var_data_file)
|
||||||
|
#'
|
||||||
|
#'
|
||||||
|
#' }
|
||||||
|
#' @importFrom R6 R6Class
|
||||||
|
#' @importFrom base64enc base64encode
|
||||||
|
#' @export
|
||||||
|
FakeApi <- R6::R6Class(
|
||||||
|
'FakeApi',
|
||||||
|
public = list(
|
||||||
|
apiClient = NULL,
|
||||||
|
initialize = function(apiClient){
|
||||||
|
if (!missing(apiClient)) {
|
||||||
|
self$apiClient <- apiClient
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self$apiClient <- ApiClient$new()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FakeDataFile = function(dummy, var_data_file=NULL, data_file=NULL, ...){
|
||||||
|
apiResponse <- self$FakeDataFileWithHttpInfo(dummy, var_data_file, data_file=data_file, ...)
|
||||||
|
resp <- apiResponse$response
|
||||||
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
|
apiResponse$content
|
||||||
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
|
apiResponse
|
||||||
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
|
apiResponse
|
||||||
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
|
apiResponse
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
FakeDataFileWithHttpInfo = function(dummy, var_data_file=NULL, data_file=NULL, ...){
|
||||||
|
args <- list(...)
|
||||||
|
queryParams <- list()
|
||||||
|
headerParams <- c()
|
||||||
|
|
||||||
|
if (missing(`dummy`)) {
|
||||||
|
stop("Missing required parameter `dummy`.")
|
||||||
|
}
|
||||||
|
|
||||||
|
headerParams['dummy'] <- `dummy`
|
||||||
|
|
||||||
|
headerParams['data_file'] <- `var_data_file`
|
||||||
|
|
||||||
|
body <- NULL
|
||||||
|
urlPath <- "/fake/data_file"
|
||||||
|
|
||||||
|
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
||||||
|
method = "GET",
|
||||||
|
queryParams = queryParams,
|
||||||
|
headerParams = headerParams,
|
||||||
|
body = body,
|
||||||
|
...)
|
||||||
|
|
||||||
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
|
# save response in a file
|
||||||
|
if (!is.null(data_file)) {
|
||||||
|
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
|
}
|
||||||
|
|
||||||
|
deserializedRespObj <- tryCatch(
|
||||||
|
self$apiClient$deserialize(resp, "User", loadNamespace("petstore")),
|
||||||
|
error = function(e){
|
||||||
|
stop("Failed to deserialize response")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
ApiResponse$new(deserializedRespObj, resp)
|
||||||
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
|
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
|
||||||
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
|
ApiResponse$new("API client error", resp)
|
||||||
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
|
ApiResponse$new("API server error", resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
@ -18,9 +18,17 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } body \link{Pet}
|
#' \item \emph{ @param } pet \link{Pet}
|
||||||
|
#' \item \emph{ @returnType } \link{Pet} \cr
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
|
#' \item status code : 200 | successful operation
|
||||||
|
#'
|
||||||
|
#' \item return type : Pet
|
||||||
|
#' \item response headers :
|
||||||
|
#'
|
||||||
|
#' \tabular{ll}{
|
||||||
|
#' }
|
||||||
#' \item status code : 405 | Invalid input
|
#' \item status code : 405 | Invalid input
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -34,8 +42,8 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } pet.id integer
|
#' \item \emph{ @param } pet_id integer
|
||||||
#' \item \emph{ @param } api.key character
|
#' \item \emph{ @param } api_key character
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \item status code : 400 | Invalid pet value
|
#' \item status code : 400 | Invalid pet value
|
||||||
@ -99,7 +107,7 @@
|
|||||||
#' Returns a single pet
|
#' Returns a single pet
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } pet.id integer
|
#' \item \emph{ @param } pet_id integer
|
||||||
#' \item \emph{ @returnType } \link{Pet} \cr
|
#' \item \emph{ @returnType } \link{Pet} \cr
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -130,9 +138,17 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } body \link{Pet}
|
#' \item \emph{ @param } pet \link{Pet}
|
||||||
|
#' \item \emph{ @returnType } \link{Pet} \cr
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
|
#' \item status code : 200 | successful operation
|
||||||
|
#'
|
||||||
|
#' \item return type : Pet
|
||||||
|
#' \item response headers :
|
||||||
|
#'
|
||||||
|
#' \tabular{ll}{
|
||||||
|
#' }
|
||||||
#' \item status code : 400 | Invalid ID supplied
|
#' \item status code : 400 | Invalid ID supplied
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -160,7 +176,7 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } pet.id integer
|
#' \item \emph{ @param } pet_id integer
|
||||||
#' \item \emph{ @param } name character
|
#' \item \emph{ @param } name character
|
||||||
#' \item \emph{ @param } status character
|
#' \item \emph{ @param } status character
|
||||||
#'
|
#'
|
||||||
@ -178,8 +194,8 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } pet.id integer
|
#' \item \emph{ @param } pet_id integer
|
||||||
#' \item \emph{ @param } additional.metadata character
|
#' \item \emph{ @param } additional_metadata character
|
||||||
#' \item \emph{ @param } file data.frame
|
#' \item \emph{ @param } file data.frame
|
||||||
#' \item \emph{ @returnType } \link{ModelApiResponse} \cr
|
#' \item \emph{ @returnType } \link{ModelApiResponse} \cr
|
||||||
#'
|
#'
|
||||||
@ -201,7 +217,7 @@
|
|||||||
#' #################### AddPet ####################
|
#' #################### AddPet ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.body <- Pet$new() # Pet | Pet object that needs to be added to the store
|
#' var.pet <- Pet$new() # Pet | Pet object that needs to be added to the store
|
||||||
#'
|
#'
|
||||||
#' #Add a new pet to the store
|
#' #Add a new pet to the store
|
||||||
#' api.instance <- PetApi$new()
|
#' api.instance <- PetApi$new()
|
||||||
@ -209,14 +225,14 @@
|
|||||||
#' # Configure OAuth2 access token for authorization: petstore_auth
|
#' # Configure OAuth2 access token for authorization: petstore_auth
|
||||||
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$AddPet(var.body)
|
#' result <- api.instance$AddPet(var.pet)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### DeletePet ####################
|
#' #################### DeletePet ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.pet.id <- 56 # integer | Pet id to delete
|
#' var.pet_id <- 56 # integer | Pet id to delete
|
||||||
#' var.api.key <- 'api.key_example' # character |
|
#' var.api_key <- 'api_key_example' # character |
|
||||||
#'
|
#'
|
||||||
#' #Deletes a pet
|
#' #Deletes a pet
|
||||||
#' api.instance <- PetApi$new()
|
#' api.instance <- PetApi$new()
|
||||||
@ -224,7 +240,7 @@
|
|||||||
#' # Configure OAuth2 access token for authorization: petstore_auth
|
#' # Configure OAuth2 access token for authorization: petstore_auth
|
||||||
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$DeletePet(var.pet.id, api.key=var.api.key)
|
#' result <- api.instance$DeletePet(var.pet_id, api_key=var.api_key)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### FindPetsByStatus ####################
|
#' #################### FindPetsByStatus ####################
|
||||||
@ -258,7 +274,7 @@
|
|||||||
#' #################### GetPetById ####################
|
#' #################### GetPetById ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.pet.id <- 56 # integer | ID of pet to return
|
#' var.pet_id <- 56 # integer | ID of pet to return
|
||||||
#'
|
#'
|
||||||
#' #Find pet by ID
|
#' #Find pet by ID
|
||||||
#' api.instance <- PetApi$new()
|
#' api.instance <- PetApi$new()
|
||||||
@ -266,13 +282,13 @@
|
|||||||
#' #Configure API key authorization: api_key
|
#' #Configure API key authorization: api_key
|
||||||
#' api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
#' api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$GetPetById(var.pet.id)
|
#' result <- api.instance$GetPetById(var.pet_id)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### UpdatePet ####################
|
#' #################### UpdatePet ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.body <- Pet$new() # Pet | Pet object that needs to be added to the store
|
#' var.pet <- Pet$new() # Pet | Pet object that needs to be added to the store
|
||||||
#'
|
#'
|
||||||
#' #Update an existing pet
|
#' #Update an existing pet
|
||||||
#' api.instance <- PetApi$new()
|
#' api.instance <- PetApi$new()
|
||||||
@ -280,13 +296,13 @@
|
|||||||
#' # Configure OAuth2 access token for authorization: petstore_auth
|
#' # Configure OAuth2 access token for authorization: petstore_auth
|
||||||
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$UpdatePet(var.body)
|
#' result <- api.instance$UpdatePet(var.pet)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### UpdatePetWithForm ####################
|
#' #################### UpdatePetWithForm ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.pet.id <- 56 # integer | ID of pet that needs to be updated
|
#' var.pet_id <- 56 # integer | ID of pet that needs to be updated
|
||||||
#' var.name <- 'name_example' # character | Updated name of the pet
|
#' var.name <- 'name_example' # character | Updated name of the pet
|
||||||
#' var.status <- 'status_example' # character | Updated status of the pet
|
#' var.status <- 'status_example' # character | Updated status of the pet
|
||||||
#'
|
#'
|
||||||
@ -296,14 +312,14 @@
|
|||||||
#' # Configure OAuth2 access token for authorization: petstore_auth
|
#' # Configure OAuth2 access token for authorization: petstore_auth
|
||||||
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$UpdatePetWithForm(var.pet.id, name=var.name, status=var.status)
|
#' result <- api.instance$UpdatePetWithForm(var.pet_id, name=var.name, status=var.status)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### UploadFile ####################
|
#' #################### UploadFile ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.pet.id <- 56 # integer | ID of pet to update
|
#' var.pet_id <- 56 # integer | ID of pet to update
|
||||||
#' var.additional.metadata <- 'additional.metadata_example' # character | Additional data to pass to server
|
#' var.additional_metadata <- 'additional_metadata_example' # character | Additional data to pass to server
|
||||||
#' var.file <- File.new('/path/to/file') # data.frame | file to upload
|
#' var.file <- File.new('/path/to/file') # data.frame | file to upload
|
||||||
#'
|
#'
|
||||||
#' #uploads an image
|
#' #uploads an image
|
||||||
@ -312,7 +328,7 @@
|
|||||||
#' # Configure OAuth2 access token for authorization: petstore_auth
|
#' # Configure OAuth2 access token for authorization: petstore_auth
|
||||||
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$UploadFile(var.pet.id, additional.metadata=var.additional.metadata, file=var.file)
|
#' result <- api.instance$UploadFile(var.pet_id, additional_metadata=var.additional_metadata, file=var.file)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' }
|
#' }
|
||||||
@ -331,8 +347,8 @@ PetApi <- R6::R6Class(
|
|||||||
self$apiClient <- ApiClient$new()
|
self$apiClient <- ApiClient$new()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
AddPet = function(body, ...){
|
AddPet = function(pet, data_file=NULL, ...){
|
||||||
apiResponse <- self$AddPetWithHttpInfo(body, ...)
|
apiResponse <- self$AddPetWithHttpInfo(pet, data_file=data_file, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -345,17 +361,17 @@ PetApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
AddPetWithHttpInfo = function(body, ...){
|
AddPetWithHttpInfo = function(pet, data_file=NULL, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`body`)) {
|
if (missing(`pet`)) {
|
||||||
stop("Missing required parameter `body`.")
|
stop("Missing required parameter `pet`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`body`)) {
|
if (!missing(`pet`)) {
|
||||||
body <- `body`$toJSONString()
|
body <- `pet`$toJSONString()
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
@ -372,7 +388,18 @@ PetApi <- R6::R6Class(
|
|||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
# save response in a file
|
||||||
|
if (!is.null(data_file)) {
|
||||||
|
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
|
}
|
||||||
|
|
||||||
|
deserializedRespObj <- tryCatch(
|
||||||
|
self$apiClient$deserialize(resp, "Pet", loadNamespace("petstore")),
|
||||||
|
error = function(e){
|
||||||
|
stop("Failed to deserialize response")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
ApiResponse$new(deserializedRespObj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
|
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
@ -381,8 +408,8 @@ PetApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DeletePet = function(pet.id, api.key=NULL, ...){
|
DeletePet = function(pet_id, api_key=NULL, ...){
|
||||||
apiResponse <- self$DeletePetWithHttpInfo(pet.id, api.key, ...)
|
apiResponse <- self$DeletePetWithHttpInfo(pet_id, api_key, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -395,21 +422,21 @@ PetApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
DeletePetWithHttpInfo = function(pet.id, api.key=NULL, ...){
|
DeletePetWithHttpInfo = function(pet_id, api_key=NULL, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`pet.id`)) {
|
if (missing(`pet_id`)) {
|
||||||
stop("Missing required parameter `pet.id`.")
|
stop("Missing required parameter `pet_id`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams['api_key'] <- `api.key`
|
headerParams['api_key'] <- `api_key`
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
urlPath <- "/pet/{petId}"
|
urlPath <- "/pet/{petId}"
|
||||||
if (!missing(`pet.id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet.id`), reserved = TRUE), urlPath)
|
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), urlPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth token
|
# OAuth token
|
||||||
@ -548,8 +575,8 @@ PetApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GetPetById = function(pet.id, data_file=NULL, ...){
|
GetPetById = function(pet_id, data_file=NULL, ...){
|
||||||
apiResponse <- self$GetPetByIdWithHttpInfo(pet.id, data_file=data_file, ...)
|
apiResponse <- self$GetPetByIdWithHttpInfo(pet_id, data_file=data_file, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -562,19 +589,19 @@ PetApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
GetPetByIdWithHttpInfo = function(pet.id, data_file=NULL, ...){
|
GetPetByIdWithHttpInfo = function(pet_id, data_file=NULL, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`pet.id`)) {
|
if (missing(`pet_id`)) {
|
||||||
stop("Missing required parameter `pet.id`.")
|
stop("Missing required parameter `pet_id`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
urlPath <- "/pet/{petId}"
|
urlPath <- "/pet/{petId}"
|
||||||
if (!missing(`pet.id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet.id`), reserved = TRUE), urlPath)
|
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), urlPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -610,8 +637,8 @@ PetApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
UpdatePet = function(body, ...){
|
UpdatePet = function(pet, data_file=NULL, ...){
|
||||||
apiResponse <- self$UpdatePetWithHttpInfo(body, ...)
|
apiResponse <- self$UpdatePetWithHttpInfo(pet, data_file=data_file, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -624,17 +651,17 @@ PetApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
UpdatePetWithHttpInfo = function(body, ...){
|
UpdatePetWithHttpInfo = function(pet, data_file=NULL, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`body`)) {
|
if (missing(`pet`)) {
|
||||||
stop("Missing required parameter `body`.")
|
stop("Missing required parameter `pet`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`body`)) {
|
if (!missing(`pet`)) {
|
||||||
body <- `body`$toJSONString()
|
body <- `pet`$toJSONString()
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
@ -651,7 +678,18 @@ PetApi <- R6::R6Class(
|
|||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
# save response in a file
|
||||||
|
if (!is.null(data_file)) {
|
||||||
|
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
|
}
|
||||||
|
|
||||||
|
deserializedRespObj <- tryCatch(
|
||||||
|
self$apiClient$deserialize(resp, "Pet", loadNamespace("petstore")),
|
||||||
|
error = function(e){
|
||||||
|
stop("Failed to deserialize response")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
ApiResponse$new(deserializedRespObj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
|
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
@ -660,8 +698,8 @@ PetApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
UpdatePetWithForm = function(pet.id, name=NULL, status=NULL, ...){
|
UpdatePetWithForm = function(pet_id, name=NULL, status=NULL, ...){
|
||||||
apiResponse <- self$UpdatePetWithFormWithHttpInfo(pet.id, name, status, ...)
|
apiResponse <- self$UpdatePetWithFormWithHttpInfo(pet_id, name, status, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -674,13 +712,13 @@ PetApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
UpdatePetWithFormWithHttpInfo = function(pet.id, name=NULL, status=NULL, ...){
|
UpdatePetWithFormWithHttpInfo = function(pet_id, name=NULL, status=NULL, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`pet.id`)) {
|
if (missing(`pet_id`)) {
|
||||||
stop("Missing required parameter `pet.id`.")
|
stop("Missing required parameter `pet_id`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- list(
|
body <- list(
|
||||||
@ -689,8 +727,8 @@ PetApi <- R6::R6Class(
|
|||||||
)
|
)
|
||||||
|
|
||||||
urlPath <- "/pet/{petId}"
|
urlPath <- "/pet/{petId}"
|
||||||
if (!missing(`pet.id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet.id`), reserved = TRUE), urlPath)
|
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), urlPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth token
|
# OAuth token
|
||||||
@ -713,8 +751,8 @@ PetApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
UploadFile = function(pet.id, additional.metadata=NULL, file=NULL, data_file=NULL, ...){
|
UploadFile = function(pet_id, additional_metadata=NULL, file=NULL, data_file=NULL, ...){
|
||||||
apiResponse <- self$UploadFileWithHttpInfo(pet.id, additional.metadata, file, data_file=data_file, ...)
|
apiResponse <- self$UploadFileWithHttpInfo(pet_id, additional_metadata, file, data_file=data_file, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -727,23 +765,23 @@ PetApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
UploadFileWithHttpInfo = function(pet.id, additional.metadata=NULL, file=NULL, data_file=NULL, ...){
|
UploadFileWithHttpInfo = function(pet_id, additional_metadata=NULL, file=NULL, data_file=NULL, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`pet.id`)) {
|
if (missing(`pet_id`)) {
|
||||||
stop("Missing required parameter `pet.id`.")
|
stop("Missing required parameter `pet_id`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- list(
|
body <- list(
|
||||||
"additionalMetadata" = additional.metadata,
|
"additionalMetadata" = additional_metadata,
|
||||||
"file" = httr::upload_file(file)
|
"file" = httr::upload_file(file)
|
||||||
)
|
)
|
||||||
|
|
||||||
urlPath <- "/pet/{petId}/uploadImage"
|
urlPath <- "/pet/{petId}/uploadImage"
|
||||||
if (!missing(`pet.id`)) {
|
if (!missing(`pet_id`)) {
|
||||||
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet.id`), reserved = TRUE), urlPath)
|
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet_id`), reserved = TRUE), urlPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
# OAuth token
|
# OAuth token
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#' For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
#' For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } order.id character
|
#' \item \emph{ @param } order_id character
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \item status code : 400 | Invalid ID supplied
|
#' \item status code : 400 | Invalid ID supplied
|
||||||
@ -56,7 +56,7 @@
|
|||||||
#' For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
#' For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } order.id integer
|
#' \item \emph{ @param } order_id integer
|
||||||
#' \item \emph{ @returnType } \link{Order} \cr
|
#' \item \emph{ @returnType } \link{Order} \cr
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -87,7 +87,7 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } body \link{Order}
|
#' \item \emph{ @param } order \link{Order}
|
||||||
#' \item \emph{ @returnType } \link{Order} \cr
|
#' \item \emph{ @returnType } \link{Order} \cr
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -115,12 +115,12 @@
|
|||||||
#' #################### DeleteOrder ####################
|
#' #################### DeleteOrder ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.order.id <- 'order.id_example' # character | ID of the order that needs to be deleted
|
#' var.order_id <- 'order_id_example' # character | ID of the order that needs to be deleted
|
||||||
#'
|
#'
|
||||||
#' #Delete purchase order by ID
|
#' #Delete purchase order by ID
|
||||||
#' api.instance <- StoreApi$new()
|
#' api.instance <- StoreApi$new()
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$DeleteOrder(var.order.id)
|
#' result <- api.instance$DeleteOrder(var.order_id)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### GetInventory ####################
|
#' #################### GetInventory ####################
|
||||||
@ -139,23 +139,23 @@
|
|||||||
#' #################### GetOrderById ####################
|
#' #################### GetOrderById ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.order.id <- 56 # integer | ID of pet that needs to be fetched
|
#' var.order_id <- 56 # integer | ID of pet that needs to be fetched
|
||||||
#'
|
#'
|
||||||
#' #Find purchase order by ID
|
#' #Find purchase order by ID
|
||||||
#' api.instance <- StoreApi$new()
|
#' api.instance <- StoreApi$new()
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$GetOrderById(var.order.id)
|
#' result <- api.instance$GetOrderById(var.order_id)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### PlaceOrder ####################
|
#' #################### PlaceOrder ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.body <- Order$new() # Order | order placed for purchasing the pet
|
#' var.order <- Order$new() # Order | order placed for purchasing the pet
|
||||||
#'
|
#'
|
||||||
#' #Place an order for a pet
|
#' #Place an order for a pet
|
||||||
#' api.instance <- StoreApi$new()
|
#' api.instance <- StoreApi$new()
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$PlaceOrder(var.body)
|
#' result <- api.instance$PlaceOrder(var.order)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' }
|
#' }
|
||||||
@ -174,8 +174,8 @@ StoreApi <- R6::R6Class(
|
|||||||
self$apiClient <- ApiClient$new()
|
self$apiClient <- ApiClient$new()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DeleteOrder = function(order.id, ...){
|
DeleteOrder = function(order_id, ...){
|
||||||
apiResponse <- self$DeleteOrderWithHttpInfo(order.id, ...)
|
apiResponse <- self$DeleteOrderWithHttpInfo(order_id, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -188,19 +188,19 @@ StoreApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
DeleteOrderWithHttpInfo = function(order.id, ...){
|
DeleteOrderWithHttpInfo = function(order_id, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`order.id`)) {
|
if (missing(`order_id`)) {
|
||||||
stop("Missing required parameter `order.id`.")
|
stop("Missing required parameter `order_id`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
urlPath <- "/store/order/{orderId}"
|
urlPath <- "/store/order/{orderId}"
|
||||||
if (!missing(`order.id`)) {
|
if (!missing(`order_id`)) {
|
||||||
urlPath <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order.id`), reserved = TRUE), urlPath)
|
urlPath <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), urlPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,8 +275,8 @@ StoreApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GetOrderById = function(order.id, data_file=NULL, ...){
|
GetOrderById = function(order_id, data_file=NULL, ...){
|
||||||
apiResponse <- self$GetOrderByIdWithHttpInfo(order.id, data_file=data_file, ...)
|
apiResponse <- self$GetOrderByIdWithHttpInfo(order_id, data_file=data_file, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -289,19 +289,19 @@ StoreApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
GetOrderByIdWithHttpInfo = function(order.id, data_file=NULL, ...){
|
GetOrderByIdWithHttpInfo = function(order_id, data_file=NULL, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`order.id`)) {
|
if (missing(`order_id`)) {
|
||||||
stop("Missing required parameter `order.id`.")
|
stop("Missing required parameter `order_id`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
urlPath <- "/store/order/{orderId}"
|
urlPath <- "/store/order/{orderId}"
|
||||||
if (!missing(`order.id`)) {
|
if (!missing(`order_id`)) {
|
||||||
urlPath <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order.id`), reserved = TRUE), urlPath)
|
urlPath <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), urlPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -333,8 +333,8 @@ StoreApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PlaceOrder = function(body, data_file=NULL, ...){
|
PlaceOrder = function(order, data_file=NULL, ...){
|
||||||
apiResponse <- self$PlaceOrderWithHttpInfo(body, data_file=data_file, ...)
|
apiResponse <- self$PlaceOrderWithHttpInfo(order, data_file=data_file, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -347,17 +347,17 @@ StoreApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
PlaceOrderWithHttpInfo = function(body, data_file=NULL, ...){
|
PlaceOrderWithHttpInfo = function(order, data_file=NULL, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`body`)) {
|
if (missing(`order`)) {
|
||||||
stop("Missing required parameter `body`.")
|
stop("Missing required parameter `order`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`body`)) {
|
if (!missing(`order`)) {
|
||||||
body <- `body`$toJSONString()
|
body <- `order`$toJSONString()
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#' This can only be done by the logged in user.
|
#' This can only be done by the logged in user.
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } body \link{User}
|
#' \item \emph{ @param } user \link{User}
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \item status code : 0 | successful operation
|
#' \item status code : 0 | successful operation
|
||||||
@ -34,7 +34,7 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } body list( \link{User} )
|
#' \item \emph{ @param } user list( \link{User} )
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \item status code : 0 | successful operation
|
#' \item status code : 0 | successful operation
|
||||||
@ -50,7 +50,7 @@
|
|||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } body list( \link{User} )
|
#' \item \emph{ @param } user list( \link{User} )
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \item status code : 0 | successful operation
|
#' \item status code : 0 | successful operation
|
||||||
@ -130,6 +130,7 @@
|
|||||||
#' \item response headers :
|
#' \item response headers :
|
||||||
#'
|
#'
|
||||||
#' \tabular{ll}{
|
#' \tabular{ll}{
|
||||||
|
#' Set-Cookie \tab Cookie authentication key for use with the `api_key` apiKey authentication. \cr
|
||||||
#' X-Rate-Limit \tab calls per hour allowed by the user \cr
|
#' X-Rate-Limit \tab calls per hour allowed by the user \cr
|
||||||
#' X-Expires-After \tab date in UTC when token expires \cr
|
#' X-Expires-After \tab date in UTC when token expires \cr
|
||||||
#' }
|
#' }
|
||||||
@ -162,7 +163,7 @@
|
|||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
#' \item \emph{ @param } username character
|
#' \item \emph{ @param } username character
|
||||||
#' \item \emph{ @param } body \link{User}
|
#' \item \emph{ @param } user \link{User}
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' \item status code : 400 | Invalid user supplied
|
#' \item status code : 400 | Invalid user supplied
|
||||||
@ -189,34 +190,43 @@
|
|||||||
#' #################### CreateUser ####################
|
#' #################### CreateUser ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.body <- User$new() # User | Created user object
|
#' var.user <- User$new() # User | Created user object
|
||||||
#'
|
#'
|
||||||
#' #Create user
|
#' #Create user
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$CreateUser(var.body)
|
#' #Configure API key authorization: api_key
|
||||||
|
#' api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
#'
|
||||||
|
#' result <- api.instance$CreateUser(var.user)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### CreateUsersWithArrayInput ####################
|
#' #################### CreateUsersWithArrayInput ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.body <- [User$new()] # array[User] | List of user object
|
#' var.user <- [User$new()] # array[User] | List of user object
|
||||||
#'
|
#'
|
||||||
#' #Creates list of users with given input array
|
#' #Creates list of users with given input array
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$CreateUsersWithArrayInput(var.body)
|
#' #Configure API key authorization: api_key
|
||||||
|
#' api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
#'
|
||||||
|
#' result <- api.instance$CreateUsersWithArrayInput(var.user)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### CreateUsersWithListInput ####################
|
#' #################### CreateUsersWithListInput ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.body <- [User$new()] # array[User] | List of user object
|
#' var.user <- [User$new()] # array[User] | List of user object
|
||||||
#'
|
#'
|
||||||
#' #Creates list of users with given input array
|
#' #Creates list of users with given input array
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$CreateUsersWithListInput(var.body)
|
#' #Configure API key authorization: api_key
|
||||||
|
#' api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
#'
|
||||||
|
#' result <- api.instance$CreateUsersWithListInput(var.user)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' #################### DeleteUser ####################
|
#' #################### DeleteUser ####################
|
||||||
@ -227,6 +237,9 @@
|
|||||||
#' #Delete user
|
#' #Delete user
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
#'
|
#'
|
||||||
|
#' #Configure API key authorization: api_key
|
||||||
|
#' api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
#'
|
||||||
#' result <- api.instance$DeleteUser(var.username)
|
#' result <- api.instance$DeleteUser(var.username)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -260,6 +273,9 @@
|
|||||||
#' #Logs out current logged in user session
|
#' #Logs out current logged in user session
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
#'
|
#'
|
||||||
|
#' #Configure API key authorization: api_key
|
||||||
|
#' api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
#'
|
||||||
#' result <- api.instance$LogoutUser()
|
#' result <- api.instance$LogoutUser()
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -267,12 +283,15 @@
|
|||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.username <- 'username_example' # character | name that need to be deleted
|
#' var.username <- 'username_example' # character | name that need to be deleted
|
||||||
#' var.body <- User$new() # User | Updated user object
|
#' var.user <- User$new() # User | Updated user object
|
||||||
#'
|
#'
|
||||||
#' #Updated user
|
#' #Updated user
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
#'
|
#'
|
||||||
#' result <- api.instance$UpdateUser(var.username, var.body)
|
#' #Configure API key authorization: api_key
|
||||||
|
#' api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
#'
|
||||||
|
#' result <- api.instance$UpdateUser(var.username, var.user)
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
#' }
|
#' }
|
||||||
@ -291,8 +310,8 @@ UserApi <- R6::R6Class(
|
|||||||
self$apiClient <- ApiClient$new()
|
self$apiClient <- ApiClient$new()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CreateUser = function(body, ...){
|
CreateUser = function(user, ...){
|
||||||
apiResponse <- self$CreateUserWithHttpInfo(body, ...)
|
apiResponse <- self$CreateUserWithHttpInfo(user, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -305,22 +324,26 @@ UserApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
CreateUserWithHttpInfo = function(body, ...){
|
CreateUserWithHttpInfo = function(user, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`body`)) {
|
if (missing(`user`)) {
|
||||||
stop("Missing required parameter `body`.")
|
stop("Missing required parameter `user`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`body`)) {
|
if (!missing(`user`)) {
|
||||||
body <- `body`$toJSONString()
|
body <- `user`$toJSONString()
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
urlPath <- "/user"
|
urlPath <- "/user"
|
||||||
|
# API key authentication
|
||||||
|
if ("api_key" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["api_key"]) > 0) {
|
||||||
|
headerParams['api_key'] <- paste(unlist(self$apiClient$apiKeys["api_key"]), collapse='')
|
||||||
|
}
|
||||||
|
|
||||||
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
||||||
method = "POST",
|
method = "POST",
|
||||||
@ -339,8 +362,8 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CreateUsersWithArrayInput = function(body, ...){
|
CreateUsersWithArrayInput = function(user, ...){
|
||||||
apiResponse <- self$CreateUsersWithArrayInputWithHttpInfo(body, ...)
|
apiResponse <- self$CreateUsersWithArrayInputWithHttpInfo(user, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -353,23 +376,27 @@ UserApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
CreateUsersWithArrayInputWithHttpInfo = function(body, ...){
|
CreateUsersWithArrayInputWithHttpInfo = function(user, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`body`)) {
|
if (missing(`user`)) {
|
||||||
stop("Missing required parameter `body`.")
|
stop("Missing required parameter `user`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`body`)) {
|
if (!missing(`user`)) {
|
||||||
body.items = paste(unlist(lapply(body, function(param){param$toJSONString()})), collapse = ",")
|
body.items = paste(unlist(lapply(user, function(param){param$toJSONString()})), collapse = ",")
|
||||||
body <- paste0('[', body.items, ']')
|
body <- paste0('[', body.items, ']')
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
urlPath <- "/user/createWithArray"
|
urlPath <- "/user/createWithArray"
|
||||||
|
# API key authentication
|
||||||
|
if ("api_key" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["api_key"]) > 0) {
|
||||||
|
headerParams['api_key'] <- paste(unlist(self$apiClient$apiKeys["api_key"]), collapse='')
|
||||||
|
}
|
||||||
|
|
||||||
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
||||||
method = "POST",
|
method = "POST",
|
||||||
@ -388,8 +415,8 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CreateUsersWithListInput = function(body, ...){
|
CreateUsersWithListInput = function(user, ...){
|
||||||
apiResponse <- self$CreateUsersWithListInputWithHttpInfo(body, ...)
|
apiResponse <- self$CreateUsersWithListInputWithHttpInfo(user, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -402,23 +429,27 @@ UserApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
CreateUsersWithListInputWithHttpInfo = function(body, ...){
|
CreateUsersWithListInputWithHttpInfo = function(user, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
|
|
||||||
if (missing(`body`)) {
|
if (missing(`user`)) {
|
||||||
stop("Missing required parameter `body`.")
|
stop("Missing required parameter `user`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`body`)) {
|
if (!missing(`user`)) {
|
||||||
body.items = paste(unlist(lapply(body, function(param){param$toJSONString()})), collapse = ",")
|
body.items = paste(unlist(lapply(user, function(param){param$toJSONString()})), collapse = ",")
|
||||||
body <- paste0('[', body.items, ']')
|
body <- paste0('[', body.items, ']')
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
urlPath <- "/user/createWithList"
|
urlPath <- "/user/createWithList"
|
||||||
|
# API key authentication
|
||||||
|
if ("api_key" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["api_key"]) > 0) {
|
||||||
|
headerParams['api_key'] <- paste(unlist(self$apiClient$apiKeys["api_key"]), collapse='')
|
||||||
|
}
|
||||||
|
|
||||||
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
||||||
method = "POST",
|
method = "POST",
|
||||||
@ -466,6 +497,10 @@ UserApi <- R6::R6Class(
|
|||||||
urlPath <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), urlPath)
|
urlPath <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), urlPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# API key authentication
|
||||||
|
if ("api_key" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["api_key"]) > 0) {
|
||||||
|
headerParams['api_key'] <- paste(unlist(self$apiClient$apiKeys["api_key"]), collapse='')
|
||||||
|
}
|
||||||
|
|
||||||
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
||||||
method = "DELETE",
|
method = "DELETE",
|
||||||
@ -625,6 +660,10 @@ UserApi <- R6::R6Class(
|
|||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
urlPath <- "/user/logout"
|
urlPath <- "/user/logout"
|
||||||
|
# API key authentication
|
||||||
|
if ("api_key" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["api_key"]) > 0) {
|
||||||
|
headerParams['api_key'] <- paste(unlist(self$apiClient$apiKeys["api_key"]), collapse='')
|
||||||
|
}
|
||||||
|
|
||||||
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
||||||
method = "GET",
|
method = "GET",
|
||||||
@ -643,8 +682,8 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new("API server error", resp)
|
ApiResponse$new("API server error", resp)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
UpdateUser = function(username, body, ...){
|
UpdateUser = function(username, user, ...){
|
||||||
apiResponse <- self$UpdateUserWithHttpInfo(username, body, ...)
|
apiResponse <- self$UpdateUserWithHttpInfo(username, user, ...)
|
||||||
resp <- apiResponse$response
|
resp <- apiResponse$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
apiResponse$content
|
apiResponse$content
|
||||||
@ -657,7 +696,7 @@ UserApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
UpdateUserWithHttpInfo = function(username, body, ...){
|
UpdateUserWithHttpInfo = function(username, user, ...){
|
||||||
args <- list(...)
|
args <- list(...)
|
||||||
queryParams <- list()
|
queryParams <- list()
|
||||||
headerParams <- c()
|
headerParams <- c()
|
||||||
@ -666,12 +705,12 @@ UserApi <- R6::R6Class(
|
|||||||
stop("Missing required parameter `username`.")
|
stop("Missing required parameter `username`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missing(`body`)) {
|
if (missing(`user`)) {
|
||||||
stop("Missing required parameter `body`.")
|
stop("Missing required parameter `user`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`body`)) {
|
if (!missing(`user`)) {
|
||||||
body <- `body`$toJSONString()
|
body <- `user`$toJSONString()
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
@ -681,6 +720,10 @@ UserApi <- R6::R6Class(
|
|||||||
urlPath <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), urlPath)
|
urlPath <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), urlPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# API key authentication
|
||||||
|
if ("api_key" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["api_key"]) > 0) {
|
||||||
|
headerParams['api_key'] <- paste(unlist(self$apiClient$apiKeys["api_key"]), collapse='')
|
||||||
|
}
|
||||||
|
|
||||||
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
|
||||||
method = "PUT",
|
method = "PUT",
|
||||||
|
@ -56,6 +56,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*FakeApi* | [**FakeDataFile**](docs/FakeApi.md#FakeDataFile) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
||||||
*PetApi* | [**AddPet**](docs/PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store
|
*PetApi* | [**AddPet**](docs/PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store
|
||||||
*PetApi* | [**DeletePet**](docs/PetApi.md#DeletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
*PetApi* | [**DeletePet**](docs/PetApi.md#DeletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||||
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#FindPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#FindPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||||
|
54
samples/client/petstore/R/docs/FakeApi.md
Normal file
54
samples/client/petstore/R/docs/FakeApi.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# FakeApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**FakeDataFile**](FakeApi.md#FakeDataFile) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
||||||
|
|
||||||
|
|
||||||
|
# **FakeDataFile**
|
||||||
|
> User FakeDataFile(dummy, var_data_file=var.var_data_file)
|
||||||
|
|
||||||
|
test data_file to ensure it's escaped correctly
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```R
|
||||||
|
library(petstore)
|
||||||
|
|
||||||
|
var.dummy <- 'dummy_example' # character | dummy required parameter
|
||||||
|
var.var_data_file <- 'var_data_file_example' # character | header data file
|
||||||
|
|
||||||
|
#test data_file to ensure it's escaped correctly
|
||||||
|
api.instance <- FakeApi$new()
|
||||||
|
result <- api.instance$FakeDataFile(var.dummy, var_data_file=var.var_data_file)
|
||||||
|
dput(result)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**dummy** | **character**| dummy required parameter |
|
||||||
|
**var_data_file** | **character**| header data file | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**User**](User.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
@ -15,32 +15,35 @@ Method | HTTP request | Description
|
|||||||
|
|
||||||
|
|
||||||
# **AddPet**
|
# **AddPet**
|
||||||
> AddPet(body)
|
> Pet AddPet(pet)
|
||||||
|
|
||||||
Add a new pet to the store
|
Add a new pet to the store
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.body <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
|
var.pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
#Add a new pet to the store
|
#Add a new pet to the store
|
||||||
api.instance <- PetApi$new()
|
api.instance <- PetApi$new()
|
||||||
# Configure OAuth2 access token for authorization: petstore_auth
|
# Configure OAuth2 access token for authorization: petstore_auth
|
||||||
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
api.instance$AddPet(var.body)
|
result <- api.instance$AddPet(var.pet)
|
||||||
|
dput(result)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
void (empty response body)
|
[**Pet**](Pet.md)
|
||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
@ -49,38 +52,41 @@ void (empty response body)
|
|||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: application/json, application/xml
|
- **Content-Type**: application/json, application/xml
|
||||||
- **Accept**: Not defined
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
### HTTP response details
|
### HTTP response details
|
||||||
| Status code | Description | Response headers |
|
| Status code | Description | Response headers |
|
||||||
|-------------|-------------|------------------|
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
| **405** | Invalid input | - |
|
| **405** | Invalid input | - |
|
||||||
|
|
||||||
# **DeletePet**
|
# **DeletePet**
|
||||||
> DeletePet(pet.id, api.key=var.api.key)
|
> DeletePet(pet_id, api_key=var.api_key)
|
||||||
|
|
||||||
Deletes a pet
|
Deletes a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.pet.id <- 56 # integer | Pet id to delete
|
var.pet_id <- 56 # integer | Pet id to delete
|
||||||
var.api.key <- 'api.key_example' # character |
|
var.api_key <- 'api_key_example' # character |
|
||||||
|
|
||||||
#Deletes a pet
|
#Deletes a pet
|
||||||
api.instance <- PetApi$new()
|
api.instance <- PetApi$new()
|
||||||
# Configure OAuth2 access token for authorization: petstore_auth
|
# Configure OAuth2 access token for authorization: petstore_auth
|
||||||
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
api.instance$DeletePet(var.pet.id, api.key=var.api.key)
|
api.instance$DeletePet(var.pet_id, api_key=var.api_key)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**pet.id** | **integer**| Pet id to delete |
|
**pet_id** | **integer**| Pet id to delete |
|
||||||
**api.key** | **character**| | [optional]
|
**api_key** | **character**| | [optional]
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -193,7 +199,7 @@ Name | Type | Description | Notes
|
|||||||
| **400** | Invalid tag value | - |
|
| **400** | Invalid tag value | - |
|
||||||
|
|
||||||
# **GetPetById**
|
# **GetPetById**
|
||||||
> Pet GetPetById(pet.id)
|
> Pet GetPetById(pet_id)
|
||||||
|
|
||||||
Find pet by ID
|
Find pet by ID
|
||||||
|
|
||||||
@ -203,13 +209,13 @@ Returns a single pet
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.pet.id <- 56 # integer | ID of pet to return
|
var.pet_id <- 56 # integer | ID of pet to return
|
||||||
|
|
||||||
#Find pet by ID
|
#Find pet by ID
|
||||||
api.instance <- PetApi$new()
|
api.instance <- PetApi$new()
|
||||||
# Configure API key authorization: api_key
|
# Configure API key authorization: api_key
|
||||||
api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
result <- api.instance$GetPetById(var.pet.id)
|
result <- api.instance$GetPetById(var.pet_id)
|
||||||
dput(result)
|
dput(result)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -217,7 +223,7 @@ dput(result)
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**pet.id** | **integer**| ID of pet to return |
|
**pet_id** | **integer**| ID of pet to return |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -240,32 +246,35 @@ Name | Type | Description | Notes
|
|||||||
| **404** | Pet not found | - |
|
| **404** | Pet not found | - |
|
||||||
|
|
||||||
# **UpdatePet**
|
# **UpdatePet**
|
||||||
> UpdatePet(body)
|
> Pet UpdatePet(pet)
|
||||||
|
|
||||||
Update an existing pet
|
Update an existing pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.body <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
|
var.pet <- Pet$new("name_example", list("photoUrls_example"), 123, Category$new(123, "name_example"), list(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store
|
||||||
|
|
||||||
#Update an existing pet
|
#Update an existing pet
|
||||||
api.instance <- PetApi$new()
|
api.instance <- PetApi$new()
|
||||||
# Configure OAuth2 access token for authorization: petstore_auth
|
# Configure OAuth2 access token for authorization: petstore_auth
|
||||||
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
api.instance$UpdatePet(var.body)
|
result <- api.instance$UpdatePet(var.pet)
|
||||||
|
dput(result)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
void (empty response body)
|
[**Pet**](Pet.md)
|
||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
@ -274,25 +283,28 @@ void (empty response body)
|
|||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: application/json, application/xml
|
- **Content-Type**: application/json, application/xml
|
||||||
- **Accept**: Not defined
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
### HTTP response details
|
### HTTP response details
|
||||||
| Status code | Description | Response headers |
|
| Status code | Description | Response headers |
|
||||||
|-------------|-------------|------------------|
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
| **400** | Invalid ID supplied | - |
|
| **400** | Invalid ID supplied | - |
|
||||||
| **404** | Pet not found | - |
|
| **404** | Pet not found | - |
|
||||||
| **405** | Validation exception | - |
|
| **405** | Validation exception | - |
|
||||||
|
|
||||||
# **UpdatePetWithForm**
|
# **UpdatePetWithForm**
|
||||||
> UpdatePetWithForm(pet.id, name=var.name, status=var.status)
|
> UpdatePetWithForm(pet_id, name=var.name, status=var.status)
|
||||||
|
|
||||||
Updates a pet in the store with form data
|
Updates a pet in the store with form data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.pet.id <- 56 # integer | ID of pet that needs to be updated
|
var.pet_id <- 56 # integer | ID of pet that needs to be updated
|
||||||
var.name <- 'name_example' # character | Updated name of the pet
|
var.name <- 'name_example' # character | Updated name of the pet
|
||||||
var.status <- 'status_example' # character | Updated status of the pet
|
var.status <- 'status_example' # character | Updated status of the pet
|
||||||
|
|
||||||
@ -300,14 +312,14 @@ var.status <- 'status_example' # character | Updated status of the pet
|
|||||||
api.instance <- PetApi$new()
|
api.instance <- PetApi$new()
|
||||||
# Configure OAuth2 access token for authorization: petstore_auth
|
# Configure OAuth2 access token for authorization: petstore_auth
|
||||||
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
api.instance$UpdatePetWithForm(var.pet.id, name=var.name, status=var.status)
|
api.instance$UpdatePetWithForm(var.pet_id, name=var.name, status=var.status)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**pet.id** | **integer**| ID of pet that needs to be updated |
|
**pet_id** | **integer**| ID of pet that needs to be updated |
|
||||||
**name** | **character**| Updated name of the pet | [optional]
|
**name** | **character**| Updated name of the pet | [optional]
|
||||||
**status** | **character**| Updated status of the pet | [optional]
|
**status** | **character**| Updated status of the pet | [optional]
|
||||||
|
|
||||||
@ -330,23 +342,25 @@ void (empty response body)
|
|||||||
| **405** | Invalid input | - |
|
| **405** | Invalid input | - |
|
||||||
|
|
||||||
# **UploadFile**
|
# **UploadFile**
|
||||||
> ModelApiResponse UploadFile(pet.id, additional.metadata=var.additional.metadata, file=var.file)
|
> ModelApiResponse UploadFile(pet_id, additional_metadata=var.additional_metadata, file=var.file)
|
||||||
|
|
||||||
uploads an image
|
uploads an image
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.pet.id <- 56 # integer | ID of pet to update
|
var.pet_id <- 56 # integer | ID of pet to update
|
||||||
var.additional.metadata <- 'additional.metadata_example' # character | Additional data to pass to server
|
var.additional_metadata <- 'additional_metadata_example' # character | Additional data to pass to server
|
||||||
var.file <- File.new('/path/to/file') # data.frame | file to upload
|
var.file <- File.new('/path/to/file') # data.frame | file to upload
|
||||||
|
|
||||||
#uploads an image
|
#uploads an image
|
||||||
api.instance <- PetApi$new()
|
api.instance <- PetApi$new()
|
||||||
# Configure OAuth2 access token for authorization: petstore_auth
|
# Configure OAuth2 access token for authorization: petstore_auth
|
||||||
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
|
||||||
result <- api.instance$UploadFile(var.pet.id, additional.metadata=var.additional.metadata, file=var.file)
|
result <- api.instance$UploadFile(var.pet_id, additional_metadata=var.additional_metadata, file=var.file)
|
||||||
dput(result)
|
dput(result)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -354,8 +368,8 @@ dput(result)
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**pet.id** | **integer**| ID of pet to update |
|
**pet_id** | **integer**| ID of pet to update |
|
||||||
**additional.metadata** | **character**| Additional data to pass to server | [optional]
|
**additional_metadata** | **character**| Additional data to pass to server | [optional]
|
||||||
**file** | **data.frame**| file to upload | [optional]
|
**file** | **data.frame**| file to upload | [optional]
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
@ -11,7 +11,7 @@ Method | HTTP request | Description
|
|||||||
|
|
||||||
|
|
||||||
# **DeleteOrder**
|
# **DeleteOrder**
|
||||||
> DeleteOrder(order.id)
|
> DeleteOrder(order_id)
|
||||||
|
|
||||||
Delete purchase order by ID
|
Delete purchase order by ID
|
||||||
|
|
||||||
@ -21,18 +21,18 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.order.id <- 'order.id_example' # character | ID of the order that needs to be deleted
|
var.order_id <- 'order_id_example' # character | ID of the order that needs to be deleted
|
||||||
|
|
||||||
#Delete purchase order by ID
|
#Delete purchase order by ID
|
||||||
api.instance <- StoreApi$new()
|
api.instance <- StoreApi$new()
|
||||||
api.instance$DeleteOrder(var.order.id)
|
api.instance$DeleteOrder(var.order_id)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**order.id** | **character**| ID of the order that needs to be deleted |
|
**order_id** | **character**| ID of the order that needs to be deleted |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ This endpoint does not need any parameter.
|
|||||||
| **200** | successful operation | - |
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
# **GetOrderById**
|
# **GetOrderById**
|
||||||
> Order GetOrderById(order.id)
|
> Order GetOrderById(order_id)
|
||||||
|
|
||||||
Find purchase order by ID
|
Find purchase order by ID
|
||||||
|
|
||||||
@ -105,11 +105,11 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.order.id <- 56 # integer | ID of pet that needs to be fetched
|
var.order_id <- 56 # integer | ID of pet that needs to be fetched
|
||||||
|
|
||||||
#Find purchase order by ID
|
#Find purchase order by ID
|
||||||
api.instance <- StoreApi$new()
|
api.instance <- StoreApi$new()
|
||||||
result <- api.instance$GetOrderById(var.order.id)
|
result <- api.instance$GetOrderById(var.order_id)
|
||||||
dput(result)
|
dput(result)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ dput(result)
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**order.id** | **integer**| ID of pet that needs to be fetched |
|
**order_id** | **integer**| ID of pet that needs to be fetched |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -140,19 +140,21 @@ No authorization required
|
|||||||
| **404** | Order not found | - |
|
| **404** | Order not found | - |
|
||||||
|
|
||||||
# **PlaceOrder**
|
# **PlaceOrder**
|
||||||
> Order PlaceOrder(body)
|
> Order PlaceOrder(order)
|
||||||
|
|
||||||
Place an order for a pet
|
Place an order for a pet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.body <- Order$new(123, 123, 123, "shipDate_example", "placed", "complete_example") # Order | order placed for purchasing the pet
|
var.order <- Order$new(123, 123, 123, "shipDate_example", "placed", "complete_example") # Order | order placed for purchasing the pet
|
||||||
|
|
||||||
#Place an order for a pet
|
#Place an order for a pet
|
||||||
api.instance <- StoreApi$new()
|
api.instance <- StoreApi$new()
|
||||||
result <- api.instance$PlaceOrder(var.body)
|
result <- api.instance$PlaceOrder(var.order)
|
||||||
dput(result)
|
dput(result)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -160,7 +162,7 @@ dput(result)
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -172,7 +174,7 @@ No authorization required
|
|||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: application/xml, application/json
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
### HTTP response details
|
### HTTP response details
|
||||||
|
@ -15,7 +15,7 @@ Method | HTTP request | Description
|
|||||||
|
|
||||||
|
|
||||||
# **CreateUser**
|
# **CreateUser**
|
||||||
> CreateUser(body)
|
> CreateUser(user)
|
||||||
|
|
||||||
Create user
|
Create user
|
||||||
|
|
||||||
@ -25,18 +25,20 @@ This can only be done by the logged in user.
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.body <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Created user object
|
var.user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Created user object
|
||||||
|
|
||||||
#Create user
|
#Create user
|
||||||
api.instance <- UserApi$new()
|
api.instance <- UserApi$new()
|
||||||
api.instance$CreateUser(var.body)
|
# Configure API key authorization: api_key
|
||||||
|
api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
api.instance$CreateUser(var.user)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | [**User**](User.md)| Created user object |
|
**user** | [**User**](User.md)| Created user object |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -44,11 +46,11 @@ void (empty response body)
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: Not defined
|
- **Accept**: Not defined
|
||||||
|
|
||||||
### HTTP response details
|
### HTTP response details
|
||||||
@ -57,26 +59,30 @@ No authorization required
|
|||||||
| **0** | successful operation | - |
|
| **0** | successful operation | - |
|
||||||
|
|
||||||
# **CreateUsersWithArrayInput**
|
# **CreateUsersWithArrayInput**
|
||||||
> CreateUsersWithArrayInput(body)
|
> CreateUsersWithArrayInput(user)
|
||||||
|
|
||||||
Creates list of users with given input array
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.body <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
|
var.user <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
|
||||||
|
|
||||||
#Creates list of users with given input array
|
#Creates list of users with given input array
|
||||||
api.instance <- UserApi$new()
|
api.instance <- UserApi$new()
|
||||||
api.instance$CreateUsersWithArrayInput(var.body)
|
# Configure API key authorization: api_key
|
||||||
|
api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
api.instance$CreateUsersWithArrayInput(var.user)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | list( [**User**](User.md) )| List of user object |
|
**user** | list( [**User**](User.md) )| List of user object |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -84,11 +90,11 @@ void (empty response body)
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: Not defined
|
- **Accept**: Not defined
|
||||||
|
|
||||||
### HTTP response details
|
### HTTP response details
|
||||||
@ -97,26 +103,30 @@ No authorization required
|
|||||||
| **0** | successful operation | - |
|
| **0** | successful operation | - |
|
||||||
|
|
||||||
# **CreateUsersWithListInput**
|
# **CreateUsersWithListInput**
|
||||||
> CreateUsersWithListInput(body)
|
> CreateUsersWithListInput(user)
|
||||||
|
|
||||||
Creates list of users with given input array
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.body <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
|
var.user <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object
|
||||||
|
|
||||||
#Creates list of users with given input array
|
#Creates list of users with given input array
|
||||||
api.instance <- UserApi$new()
|
api.instance <- UserApi$new()
|
||||||
api.instance$CreateUsersWithListInput(var.body)
|
# Configure API key authorization: api_key
|
||||||
|
api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
api.instance$CreateUsersWithListInput(var.user)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | list( [**User**](User.md) )| List of user object |
|
**user** | list( [**User**](User.md) )| List of user object |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -124,11 +134,11 @@ void (empty response body)
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: Not defined
|
- **Accept**: Not defined
|
||||||
|
|
||||||
### HTTP response details
|
### HTTP response details
|
||||||
@ -151,6 +161,8 @@ var.username <- 'username_example' # character | The name that needs to be delet
|
|||||||
|
|
||||||
#Delete user
|
#Delete user
|
||||||
api.instance <- UserApi$new()
|
api.instance <- UserApi$new()
|
||||||
|
# Configure API key authorization: api_key
|
||||||
|
api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
api.instance$DeleteUser(var.username)
|
api.instance$DeleteUser(var.username)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -166,7 +178,7 @@ void (empty response body)
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
@ -184,6 +196,8 @@ No authorization required
|
|||||||
|
|
||||||
Get user by user name
|
Get user by user name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
@ -227,6 +241,8 @@ No authorization required
|
|||||||
|
|
||||||
Logs user into the system
|
Logs user into the system
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
@ -263,7 +279,7 @@ No authorization required
|
|||||||
### HTTP response details
|
### HTTP response details
|
||||||
| Status code | Description | Response headers |
|
| Status code | Description | Response headers |
|
||||||
|-------------|-------------|------------------|
|
|-------------|-------------|------------------|
|
||||||
| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> |
|
| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication. <br> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> |
|
||||||
| **400** | Invalid username/password supplied | - |
|
| **400** | Invalid username/password supplied | - |
|
||||||
|
|
||||||
# **LogoutUser**
|
# **LogoutUser**
|
||||||
@ -271,6 +287,8 @@ No authorization required
|
|||||||
|
|
||||||
Logs out current logged in user session
|
Logs out current logged in user session
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
@ -278,6 +296,8 @@ library(petstore)
|
|||||||
|
|
||||||
#Logs out current logged in user session
|
#Logs out current logged in user session
|
||||||
api.instance <- UserApi$new()
|
api.instance <- UserApi$new()
|
||||||
|
# Configure API key authorization: api_key
|
||||||
|
api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
api.instance$LogoutUser()
|
api.instance$LogoutUser()
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -290,7 +310,7 @@ void (empty response body)
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
@ -303,7 +323,7 @@ No authorization required
|
|||||||
| **0** | successful operation | - |
|
| **0** | successful operation | - |
|
||||||
|
|
||||||
# **UpdateUser**
|
# **UpdateUser**
|
||||||
> UpdateUser(username, body)
|
> UpdateUser(username, user)
|
||||||
|
|
||||||
Updated user
|
Updated user
|
||||||
|
|
||||||
@ -314,11 +334,13 @@ This can only be done by the logged in user.
|
|||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var.username <- 'username_example' # character | name that need to be deleted
|
var.username <- 'username_example' # character | name that need to be deleted
|
||||||
var.body <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Updated user object
|
var.user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Updated user object
|
||||||
|
|
||||||
#Updated user
|
#Updated user
|
||||||
api.instance <- UserApi$new()
|
api.instance <- UserApi$new()
|
||||||
api.instance$UpdateUser(var.username, var.body)
|
# Configure API key authorization: api_key
|
||||||
|
api.instance$apiClient$apiKeys['api_key'] <- 'TODO_YOUR_API_KEY';
|
||||||
|
api.instance$UpdateUser(var.username, var.user)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
@ -326,7 +348,7 @@ api.instance$UpdateUser(var.username, var.body)
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**username** | **character**| name that need to be deleted |
|
**username** | **character**| name that need to be deleted |
|
||||||
**body** | [**User**](User.md)| Updated user object |
|
**user** | [**User**](User.md)| Updated user object |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -334,11 +356,11 @@ void (empty response body)
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/json
|
||||||
- **Accept**: Not defined
|
- **Accept**: Not defined
|
||||||
|
|
||||||
### HTTP response details
|
### HTTP response details
|
||||||
|
20
samples/client/petstore/R/tests/testthat/test_fake_api.R
Normal file
20
samples/client/petstore/R/tests/testthat/test_fake_api.R
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||||
|
# Please update as you see appropriate
|
||||||
|
|
||||||
|
context("Test FakeApi")
|
||||||
|
|
||||||
|
api.instance <- FakeApi$new()
|
||||||
|
|
||||||
|
test_that("FakeDataFile", {
|
||||||
|
# tests for FakeDataFile
|
||||||
|
# base path: http://petstore.swagger.io/v2
|
||||||
|
# test data_file to ensure it's escaped correctly
|
||||||
|
#
|
||||||
|
# @param dummy character dummy required parameter
|
||||||
|
# @param DataFile. character header data file (optional)
|
||||||
|
# @return [Void]
|
||||||
|
|
||||||
|
# uncomment below to test the operation
|
||||||
|
#expect_equal(result, "EXPECTED_RESULT")
|
||||||
|
})
|
||||||
|
|
@ -14,7 +14,7 @@ result <- petApi$AddPet(pet)
|
|||||||
|
|
||||||
test_that("AddPet", {
|
test_that("AddPet", {
|
||||||
expect_equal(petId, 123321)
|
expect_equal(petId, 123321)
|
||||||
expect_equal(result, NULL)
|
#expect_equal(result, NULL)
|
||||||
})
|
})
|
||||||
|
|
||||||
test_that("Test toJSON toJSON fromJSON fromJSONString", {
|
test_that("Test toJSON toJSON fromJSON fromJSONString", {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user