67 lines
2.2 KiB
Python
67 lines
2.2 KiB
Python
# Copyright 2026 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
# pyformat: disable
|
|
|
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
|
|
from . import models, types
|
|
from ._version import (
|
|
__gen_version__,
|
|
__openapi_doc_version__,
|
|
__user_agent__,
|
|
__version__,
|
|
)
|
|
from .httpclient import AsyncHttpClient, HttpClient
|
|
from .types import OptionalNullable, UNSET
|
|
from .utils import Logger, RetryConfig, remove_suffix
|
|
from dataclasses import dataclass
|
|
from pydantic import Field
|
|
from typing import Callable, Dict, Optional, Tuple, Union
|
|
|
|
|
|
SERVERS = [
|
|
"https://generativelanguage.googleapis.com",
|
|
# Global Endpoint
|
|
]
|
|
"""Contains the list of servers available to the SDK"""
|
|
|
|
|
|
@dataclass
|
|
class SDKConfiguration:
|
|
client: Union[HttpClient, None]
|
|
client_supplied: bool
|
|
async_client: Union[AsyncHttpClient, None]
|
|
async_client_supplied: bool
|
|
debug_logger: Logger
|
|
globals: models.internal.Globals
|
|
security: Optional[Union[types.Security, Callable[[], types.Security]]] = None
|
|
server_url: Optional[str] = ""
|
|
server_idx: Optional[int] = 0
|
|
language: str = "python"
|
|
openapi_doc_version: str = __openapi_doc_version__
|
|
sdk_version: str = __version__
|
|
gen_version: str = __gen_version__
|
|
user_agent: str = __user_agent__
|
|
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
|
|
timeout_ms: Optional[int] = None
|
|
|
|
def get_server_details(self) -> Tuple[str, Dict[str, str]]:
|
|
if self.server_url is not None and self.server_url:
|
|
return remove_suffix(self.server_url, "/"), {}
|
|
if self.server_idx is None:
|
|
self.server_idx = 0
|
|
|
|
return SERVERS[self.server_idx], {}
|