Skip to content

Commit def9413

Browse files
authored
initial codegen (#519)
## Problem Describe the purpose of this change. What problem is being solved and why? ## Solution Describe the approach you took. Link to any relevant bugs, issues, docs, or other resources. ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan Describe specific steps for validating this change.
1 parent 7f96c60 commit def9413

17 files changed

+3591
-2
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# flake8: noqa
2+
3+
"""
4+
Pinecone Knowledge Base Data Plane API
5+
6+
Pinecone Knowledge Base builds on the vector database to make it easy to store, search and retrieve your data. # noqa: E501
7+
8+
This file is @generated using OpenAPI.
9+
10+
The version of the OpenAPI document: unstable
11+
12+
"""
13+
14+
__version__ = "1.0.0"
15+
16+
# import ApiClient
17+
from pinecone.openapi_support.api_client import ApiClient
18+
19+
# import Configuration
20+
from pinecone.config.openapi_configuration import Configuration
21+
22+
# import exceptions
23+
from pinecone.openapi_support.exceptions import PineconeException
24+
from pinecone.openapi_support.exceptions import PineconeApiAttributeError
25+
from pinecone.openapi_support.exceptions import PineconeApiTypeError
26+
from pinecone.openapi_support.exceptions import PineconeApiValueError
27+
from pinecone.openapi_support.exceptions import PineconeApiKeyError
28+
from pinecone.openapi_support.exceptions import PineconeApiException
29+
30+
API_VERSION = "unstable"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# do not import all apis into this module because that uses a lot of memory and stack frames
2+
# if you need the ability to import all apis from one package, import them with
3+
# from pinecone.core.openapi.ckb_knowledge_data.apis import DocumentOperationsApi

pinecone/core/openapi/ckb_knowledge_data/api/document_operations_api.py

Lines changed: 598 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# flake8: noqa
2+
3+
# Import all APIs into this package.
4+
# If you have many APIs here with many many models used in each API this may
5+
# raise a `RecursionError`.
6+
# In order to avoid this, import only the API that you directly need like:
7+
#
8+
# from .api.document_operations_api import DocumentOperationsApi
9+
#
10+
# or import this package, but before doing it, use:
11+
#
12+
# import sys
13+
# sys.setrecursionlimit(n)
14+
15+
# Import APIs into API package:
16+
from pinecone.core.openapi.ckb_knowledge_data.api.document_operations_api import (
17+
DocumentOperationsApi,
18+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# we can not import model classes here because that would create a circular
2+
# reference which would not work in python2
3+
# do not import all models into this module because that uses a lot of memory and stack frames
4+
# if you need the ability to import all models from one package, import them with
5+
# from {{packageName}.models import ModelA, ModelB
Lines changed: 304 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,304 @@
1+
"""
2+
Pinecone Knowledge Base Data Plane API
3+
4+
Pinecone Knowledge Base builds on the vector database to make it easy to store, search and retrieve your data. # noqa: E501
5+
6+
This file is @generated using OpenAPI.
7+
8+
The version of the OpenAPI document: unstable
9+
10+
"""
11+
12+
from pinecone.openapi_support.model_utils import ( # noqa: F401
13+
PineconeApiTypeError,
14+
ModelComposed,
15+
ModelNormal,
16+
ModelSimple,
17+
OpenApiModel,
18+
cached_property,
19+
change_keys_js_to_python,
20+
convert_js_args_to_python_args,
21+
date,
22+
datetime,
23+
file_type,
24+
none_type,
25+
validate_get_composed_info,
26+
)
27+
from pinecone.openapi_support.exceptions import PineconeApiAttributeError
28+
29+
30+
def lazy_import():
31+
from pinecone.core.openapi.ckb_knowledge_data.model.lsn_status import LSNStatus
32+
from pinecone.core.openapi.ckb_knowledge_data.model.usage import Usage
33+
34+
globals()["LSNStatus"] = LSNStatus
35+
globals()["Usage"] = Usage
36+
37+
38+
from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar
39+
from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property
40+
41+
T = TypeVar("T", bound="DeleteDocumentResponse")
42+
43+
44+
class DeleteDocumentResponse(ModelNormal):
45+
"""NOTE: This class is @generated using OpenAPI.
46+
47+
Do not edit the class manually.
48+
49+
Attributes:
50+
allowed_values (dict): The key is the tuple path to the attribute
51+
and the for var_name this is (var_name,). The value is a dict
52+
with a capitalized key describing the allowed value and an allowed
53+
value. These dicts store the allowed enum values.
54+
attribute_map (dict): The key is attribute name
55+
and the value is json key in definition.
56+
discriminator_value_class_map (dict): A dict to go from the discriminator
57+
variable value to the discriminator class name.
58+
validations (dict): The key is the tuple path to the attribute
59+
and the for var_name this is (var_name,). The value is a dict
60+
that stores validations for max_length, min_length, max_items,
61+
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
62+
inclusive_minimum, and regex.
63+
additional_properties_type (tuple): A tuple of classes accepted
64+
as additional properties values.
65+
"""
66+
67+
_data_store: Dict[str, Any]
68+
_check_type: bool
69+
70+
allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {}
71+
72+
validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {}
73+
74+
@cached_class_property
75+
def additional_properties_type(cls):
76+
"""
77+
This must be a method because a model may have properties that are
78+
of type self, this must run after the class is loaded
79+
"""
80+
lazy_import()
81+
return (bool, dict, float, int, list, str, none_type) # noqa: E501
82+
83+
_nullable = False
84+
85+
@cached_class_property
86+
def openapi_types(cls):
87+
"""
88+
This must be a method because a model may have properties that are
89+
of type self, this must run after the class is loaded
90+
91+
Returns
92+
openapi_types (dict): The key is attribute name
93+
and the value is attribute type.
94+
"""
95+
lazy_import()
96+
return {
97+
"id": (str,), # noqa: E501
98+
"namespace": (str,), # noqa: E501
99+
"usage": (Usage,), # noqa: E501
100+
"lsn_status": (LSNStatus,), # noqa: E501
101+
}
102+
103+
@cached_class_property
104+
def discriminator(cls):
105+
return None
106+
107+
attribute_map: Dict[str, str] = {
108+
"id": "_id", # noqa: E501
109+
"namespace": "namespace", # noqa: E501
110+
"usage": "usage", # noqa: E501
111+
"lsn_status": "_lsn_status", # noqa: E501
112+
}
113+
114+
read_only_vars: Set[str] = set([])
115+
116+
_composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {}
117+
118+
@classmethod
119+
@convert_js_args_to_python_args
120+
def _from_openapi_data(cls: Type[T], id, namespace, usage, lsn_status, *args, **kwargs) -> T: # noqa: E501
121+
"""DeleteDocumentResponse - a model defined in OpenAPI
122+
123+
Args:
124+
id (str): Identifier of the document to be deleted.
125+
namespace (str): Namespace of the document to be deleted.
126+
usage (Usage):
127+
lsn_status (LSNStatus):
128+
129+
Keyword Args:
130+
_check_type (bool): if True, values for parameters in openapi_types
131+
will be type checked and a TypeError will be
132+
raised if the wrong type is input.
133+
Defaults to True
134+
_path_to_item (tuple/list): This is a list of keys or values to
135+
drill down to the model in received_data
136+
when deserializing a response
137+
_spec_property_naming (bool): True if the variable names in the input data
138+
are serialized names, as specified in the OpenAPI document.
139+
False if the variable names in the input data
140+
are pythonic names, e.g. snake case (default)
141+
_configuration (Configuration): the instance to use when
142+
deserializing a file_type parameter.
143+
If passed, type conversion is attempted
144+
If omitted no type conversion is done.
145+
_visited_composed_classes (tuple): This stores a tuple of
146+
classes that we have traveled through so that
147+
if we see that class again we will not use its
148+
discriminator again.
149+
When traveling through a discriminator, the
150+
composed schema that is
151+
is traveled through is added to this set.
152+
For example if Animal has a discriminator
153+
petType and we pass in "Dog", and the class Dog
154+
allOf includes Animal, we move through Animal
155+
once using the discriminator, and pick Dog.
156+
Then in Dog, we will make an instance of the
157+
Animal class but this time we won't travel
158+
through its discriminator because we passed in
159+
_visited_composed_classes = (Animal,)
160+
"""
161+
162+
_enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False)
163+
_enforce_validations = kwargs.pop("_enforce_validations", False)
164+
_check_type = kwargs.pop("_check_type", True)
165+
_spec_property_naming = kwargs.pop("_spec_property_naming", False)
166+
_path_to_item = kwargs.pop("_path_to_item", ())
167+
_configuration = kwargs.pop("_configuration", None)
168+
_visited_composed_classes = kwargs.pop("_visited_composed_classes", ())
169+
170+
self = super(OpenApiModel, cls).__new__(cls)
171+
172+
if args:
173+
raise PineconeApiTypeError(
174+
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments."
175+
% (args, self.__class__.__name__),
176+
path_to_item=_path_to_item,
177+
valid_classes=(self.__class__,),
178+
)
179+
180+
self._data_store = {}
181+
self._enforce_allowed_values = _enforce_allowed_values
182+
self._enforce_validations = _enforce_validations
183+
self._check_type = _check_type
184+
self._spec_property_naming = _spec_property_naming
185+
self._path_to_item = _path_to_item
186+
self._configuration = _configuration
187+
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
188+
189+
self.id = id
190+
self.namespace = namespace
191+
self.usage = usage
192+
self.lsn_status = lsn_status
193+
for var_name, var_value in kwargs.items():
194+
if (
195+
var_name not in self.attribute_map
196+
and self._configuration is not None
197+
and self._configuration.discard_unknown_keys
198+
and self.additional_properties_type is None
199+
):
200+
# discard variable.
201+
continue
202+
setattr(self, var_name, var_value)
203+
return self
204+
205+
required_properties = set(
206+
[
207+
"_enforce_allowed_values",
208+
"_enforce_validations",
209+
"_data_store",
210+
"_check_type",
211+
"_spec_property_naming",
212+
"_path_to_item",
213+
"_configuration",
214+
"_visited_composed_classes",
215+
]
216+
)
217+
218+
@convert_js_args_to_python_args
219+
def __init__(self, id, namespace, usage, lsn_status, *args, **kwargs) -> None: # noqa: E501
220+
"""DeleteDocumentResponse - a model defined in OpenAPI
221+
222+
Args:
223+
id (str): Identifier of the document to be deleted.
224+
namespace (str): Namespace of the document to be deleted.
225+
usage (Usage):
226+
lsn_status (LSNStatus):
227+
228+
Keyword Args:
229+
_check_type (bool): if True, values for parameters in openapi_types
230+
will be type checked and a TypeError will be
231+
raised if the wrong type is input.
232+
Defaults to True
233+
_path_to_item (tuple/list): This is a list of keys or values to
234+
drill down to the model in received_data
235+
when deserializing a response
236+
_spec_property_naming (bool): True if the variable names in the input data
237+
are serialized names, as specified in the OpenAPI document.
238+
False if the variable names in the input data
239+
are pythonic names, e.g. snake case (default)
240+
_configuration (Configuration): the instance to use when
241+
deserializing a file_type parameter.
242+
If passed, type conversion is attempted
243+
If omitted no type conversion is done.
244+
_visited_composed_classes (tuple): This stores a tuple of
245+
classes that we have traveled through so that
246+
if we see that class again we will not use its
247+
discriminator again.
248+
When traveling through a discriminator, the
249+
composed schema that is
250+
is traveled through is added to this set.
251+
For example if Animal has a discriminator
252+
petType and we pass in "Dog", and the class Dog
253+
allOf includes Animal, we move through Animal
254+
once using the discriminator, and pick Dog.
255+
Then in Dog, we will make an instance of the
256+
Animal class but this time we won't travel
257+
through its discriminator because we passed in
258+
_visited_composed_classes = (Animal,)
259+
"""
260+
261+
_enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True)
262+
_enforce_validations = kwargs.pop("_enforce_validations", True)
263+
_check_type = kwargs.pop("_check_type", True)
264+
_spec_property_naming = kwargs.pop("_spec_property_naming", False)
265+
_path_to_item = kwargs.pop("_path_to_item", ())
266+
_configuration = kwargs.pop("_configuration", None)
267+
_visited_composed_classes = kwargs.pop("_visited_composed_classes", ())
268+
269+
if args:
270+
raise PineconeApiTypeError(
271+
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments."
272+
% (args, self.__class__.__name__),
273+
path_to_item=_path_to_item,
274+
valid_classes=(self.__class__,),
275+
)
276+
277+
self._data_store = {}
278+
self._enforce_allowed_values = _enforce_allowed_values
279+
self._enforce_validations = _enforce_validations
280+
self._check_type = _check_type
281+
self._spec_property_naming = _spec_property_naming
282+
self._path_to_item = _path_to_item
283+
self._configuration = _configuration
284+
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
285+
286+
self.id = id
287+
self.namespace = namespace
288+
self.usage = usage
289+
self.lsn_status = lsn_status
290+
for var_name, var_value in kwargs.items():
291+
if (
292+
var_name not in self.attribute_map
293+
and self._configuration is not None
294+
and self._configuration.discard_unknown_keys
295+
and self.additional_properties_type is None
296+
):
297+
# discard variable.
298+
continue
299+
setattr(self, var_name, var_value)
300+
if var_name in self.read_only_vars:
301+
raise PineconeApiAttributeError(
302+
f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
303+
f"class with read only attributes."
304+
)

0 commit comments

Comments
 (0)