Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Latest commit

 

History

History
131 lines (109 loc) · 5.02 KB

File metadata and controls

131 lines (109 loc) · 5.02 KB

petstore_api.paths.user.operation

Operation Method Name

Method Name Api Class Notes
create_user UserApi This api is only for tag=user
post ApiForPost This api is only for this endpoint
post User This api is only for path=/user

Table of Contents

General Info

Field Value
Summary Create user
Description This can only be done by the logged in user.
Path "/user"
HTTP Method post

Arguments

Name Type Description Notes
body typing.Union[user.UserDictInput, user.UserDict] required
content_type str optional, default is 'application/json' Selects the schema and serialization of the request body. value must be one of ['application/json']
server_index typing.Optional[int] default is None Allows one to select a different server. If not None, must be one of [0, 1, 2]
stream bool default is False if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
timeout typing.Optional[typing.Union[int, typing.Tuple]] default is None the timeout used by the rest client
skip_deserialization bool default is False when True, headers and body will be unset and an instance of api_response.ApiResponseWithoutDeserialization will be returned

RequestBody

Description

Created user object

Content Type To Schema

Content-Type Schema
"application/json" content.application_json.Schema

RequestBody content ApplicationJson Schema

type: schemas.Schema
Ref Schema Info
Ref Schema Input Type Output Type
user.User user.UserDictInput, user.UserDict user.UserDict

Return Types

HTTP Status Code Class Description
n/a api_response.ApiResponseWithoutDeserialization When skip_deserialization is True this response is returned
default Default.ApiResponse successful operation

Default

Description

successful operation

Default ApiResponse

Name Type Description Notes
response urllib3.HTTPResponse Raw response
body Unset body was not defined
headers Unset headers were not defined

Servers

Set the available servers by defining your used servers in ApiConfiguration.server_info Then select your server by setting a server index in ApiConfiguration.server_index_info or by passing server_index in to the endpoint method.

server_index Class Description
0 Server0 petstore server
1 Server1 The local server
2 Server2 staging server with no variables

Code Sample

import petstore_api
from petstore_api.configurations import api_configuration
from petstore_api.apis.tags import user_api
from pprint import pprint
used_configuration = api_configuration.ApiConfiguration(
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient(used_configuration) as api_client:
    # Create an instance of the API class
    api_instance = user_api.UserApi(api_client)

    # example passing only required values which don't have defaults set
    body = user.User.validate({
        "id": 1,
        "username": "username_example",
        "first_name": "first_name_example",
        "last_name": "last_name_example",
        "email": "email_example",
        "password": "password_example",
        "phone": "phone_example",
        "user_status": 1,
        "object_with_no_declared_props": {},
        "object_with_no_declared_props_nullable": {},
        "any_type_prop": None,
        "any_type_except_null_prop": None,
        "any_type_prop_nullable": None,
    })
    try:
        # Create user
        api_response = api_instance.create_user(
            body=body,
        )
        pprint(api_response)
    except petstore_api.ApiException as e:
        print("Exception when calling UserApi->create_user: %s\n" % e)

[Back to top] [Back to UserApi API] [Back to Endpoints] [Back to README]