Skip to content

Latest commit

 

History

History
163 lines (134 loc) · 6.75 KB

File metadata and controls

163 lines (134 loc) · 6.75 KB

petstore_api.paths.fake_multiple_securities.operation

Operation Method Name

Method Name Api Class Notes
multiple_securities FakeApi This api is only for tag=fake
get ApiForGet This api is only for this endpoint
get FakeMultipleSecurities This api is only for path=/fake/multipleSecurities

Table of Contents

General Info

Field Value
Summary multiple security requirements
Path "/fake/multipleSecurities"
HTTP Method get

Arguments

Name Type Description Notes
accept_content_types typing.Tuple[str] default is ("application/json", ) Tells the server the content type(s) that are accepted by the client
security_index typing.Optional[int] default is None Allows one to select a different security definition. If not None, must be one of [0, 1, 2]
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

Return Types

HTTP Status Code Class Description
n/a api_response.ApiResponseWithoutDeserialization When skip_deserialization is True this response is returned
200 ResponseFor200.ApiResponse success

ResponseFor200

Description

success

ResponseFor200 ApiResponse

Name Type Description Notes
response urllib3.HTTPResponse Raw response
body schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO
headers Unset headers were not defined

ResponseFor200 Body

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

Body Details

ResponseFor200 content ApplicationJson Schema

type: schemas.Schema
validate method
Input Type Return Type Notes
dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO

Security

Set auth info by setting ApiConfiguration.security_scheme_info to a dict where the key is the below security scheme quoted name, and the value is an instance of the linked component security scheme class. Select the security index by setting ApiConfiguration.security_index_info or by passing in security_index into the endpoint method. See how to do this in the code sample.

  • these securities are specific to this to this endpoint
Security Index Security Scheme to Scope Names
0 no security
1 "http_basic_test" []
"api_key" []
2 "petstore_auth" [write:pets, read:pets]

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 fake_api
from pprint import pprint
# security_index 1
from petstore_api.components.security_schemes import security_scheme_http_basic_test
from petstore_api.components.security_schemes import security_scheme_api_key
# security_index 2
from petstore_api.components.security_schemes import security_scheme_petstore_auth

# security_scheme_info for security_index 0
# no auth required for this security_index
security_scheme_info: api_configuration.SecuritySchemeInfo = {}


# security_scheme_info for security_index 1
security_scheme_info: api_configuration.SecuritySchemeInfo = {
    "http_basic_test": security_scheme_http_basic_test.HttpBasicTest(
        user_id='someUserIdOrName',
        password='somePassword',
    ),
    "api_key": security_scheme_api_key.ApiKey(
        api_key='sampleApiKeyValue'
    ),
}


# security_scheme_info for security_index 2
security_scheme_info: api_configuration.SecuritySchemeInfo = {
    "petstore_auth": security_scheme_petstore_auth.PetstoreAuth(
    ),
}

security_index_info: api_configuration.SecurityIndexInfo = {
    "security": 0,  # default value
    "paths//fake/multipleSecurities/get/security": 0,
    # only set one "paths//fake/multipleSecurities/get/security": 1,
    # only set one "paths//fake/multipleSecurities/get/security": 2,
}
used_configuration = api_configuration.ApiConfiguration(
    security_scheme_info=security_scheme_info,
    security_index_info=security_index_info
)
# 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 = fake_api.FakeApi(api_client)

    # example, this endpoint has no required or optional parameters
    try:
        # multiple security requirements
        api_response = api_instance.multiple_securities()
        pprint(api_response)
    except petstore_api.ApiException as e:
        print("Exception when calling FakeApi->multiple_securities: %s\n" % e)

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