Skip to content

Commit 652b82e

Browse files
authored
Merge pull request #69 from pinecone-io/deleted_count
Add DeleteResponse.deleted_count
2 parents a92d794 + 8d998aa commit 652b82e

File tree

10 files changed

+364
-62
lines changed

10 files changed

+364
-62
lines changed

pinecone/core/client/api/vector_operations_api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
none_type,
2727
validate_and_convert_types
2828
)
29+
from pinecone.core.client.model.delete_response import DeleteResponse
2930
from pinecone.core.client.model.describe_index_stats_response import DescribeIndexStatsResponse
3031
from pinecone.core.client.model.fetch_response import FetchResponse
3132
from pinecone.core.client.model.query_request import QueryRequest
@@ -86,7 +87,7 @@ def __delete(
8687
async_req (bool): execute request asynchronously
8788
8889
Returns:
89-
{str: (bool, date, datetime, dict, float, int, list, str, none_type)}
90+
DeleteResponse
9091
If the method is called asynchronously, returns the request
9192
thread.
9293
"""
@@ -113,7 +114,7 @@ def __delete(
113114

114115
self.delete = _Endpoint(
115116
settings={
116-
'response_type': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},),
117+
'response_type': (DeleteResponse,),
117118
'auth': [
118119
'ApiKeyAuth'
119120
],
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
#
2+
# Copyright (c) 2020-2021 Pinecone Systems Inc. All right reserved.
3+
#
4+
5+
"""
6+
Pinecone API
7+
8+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
9+
10+
The version of the OpenAPI document: version not set
11+
Contact: support@pinecone.io
12+
Generated by: https://openapi-generator.tech
13+
"""
14+
15+
16+
import re # noqa: F401
17+
import sys # noqa: F401
18+
19+
from pinecone.core.client.model_utils import ( # noqa: F401
20+
ApiTypeError,
21+
ModelComposed,
22+
ModelNormal,
23+
ModelSimple,
24+
cached_property,
25+
change_keys_js_to_python,
26+
convert_js_args_to_python_args,
27+
date,
28+
datetime,
29+
file_type,
30+
none_type,
31+
validate_get_composed_info,
32+
)
33+
from ..model_utils import OpenApiModel
34+
from pinecone.core.client.exceptions import ApiAttributeError
35+
36+
37+
38+
class DeleteResponse(ModelNormal):
39+
"""NOTE: This class is auto generated by OpenAPI Generator.
40+
Ref: https://openapi-generator.tech
41+
42+
Do not edit the class manually.
43+
44+
Attributes:
45+
allowed_values (dict): The key is the tuple path to the attribute
46+
and the for var_name this is (var_name,). The value is a dict
47+
with a capitalized key describing the allowed value and an allowed
48+
value. These dicts store the allowed enum values.
49+
attribute_map (dict): The key is attribute name
50+
and the value is json key in definition.
51+
discriminator_value_class_map (dict): A dict to go from the discriminator
52+
variable value to the discriminator class name.
53+
validations (dict): The key is the tuple path to the attribute
54+
and the for var_name this is (var_name,). The value is a dict
55+
that stores validations for max_length, min_length, max_items,
56+
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
57+
inclusive_minimum, and regex.
58+
additional_properties_type (tuple): A tuple of classes accepted
59+
as additional properties values.
60+
"""
61+
62+
allowed_values = {
63+
}
64+
65+
validations = {
66+
}
67+
68+
@cached_property
69+
def additional_properties_type():
70+
"""
71+
This must be a method because a model may have properties that are
72+
of type self, this must run after the class is loaded
73+
"""
74+
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
75+
76+
_nullable = False
77+
78+
@cached_property
79+
def openapi_types():
80+
"""
81+
This must be a method because a model may have properties that are
82+
of type self, this must run after the class is loaded
83+
84+
Returns
85+
openapi_types (dict): The key is attribute name
86+
and the value is attribute type.
87+
"""
88+
return {
89+
'deleted_count': (int,), # noqa: E501
90+
}
91+
92+
@cached_property
93+
def discriminator():
94+
return None
95+
96+
97+
attribute_map = {
98+
'deleted_count': 'deletedCount', # noqa: E501
99+
}
100+
101+
read_only_vars = {
102+
}
103+
104+
_composed_schemas = {}
105+
106+
@classmethod
107+
@convert_js_args_to_python_args
108+
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
109+
"""DeleteResponse - a model defined in OpenAPI
110+
111+
Keyword Args:
112+
_check_type (bool): if True, values for parameters in openapi_types
113+
will be type checked and a TypeError will be
114+
raised if the wrong type is input.
115+
Defaults to True
116+
_path_to_item (tuple/list): This is a list of keys or values to
117+
drill down to the model in received_data
118+
when deserializing a response
119+
_spec_property_naming (bool): True if the variable names in the input data
120+
are serialized names, as specified in the OpenAPI document.
121+
False if the variable names in the input data
122+
are pythonic names, e.g. snake case (default)
123+
_configuration (Configuration): the instance to use when
124+
deserializing a file_type parameter.
125+
If passed, type conversion is attempted
126+
If omitted no type conversion is done.
127+
_visited_composed_classes (tuple): This stores a tuple of
128+
classes that we have traveled through so that
129+
if we see that class again we will not use its
130+
discriminator again.
131+
When traveling through a discriminator, the
132+
composed schema that is
133+
is traveled through is added to this set.
134+
For example if Animal has a discriminator
135+
petType and we pass in "Dog", and the class Dog
136+
allOf includes Animal, we move through Animal
137+
once using the discriminator, and pick Dog.
138+
Then in Dog, we will make an instance of the
139+
Animal class but this time we won't travel
140+
through its discriminator because we passed in
141+
_visited_composed_classes = (Animal,)
142+
deleted_count (int): The number of vectors deleted. 0 for requests with delete_all.. [optional] # noqa: E501
143+
"""
144+
145+
_check_type = kwargs.pop('_check_type', True)
146+
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
147+
_path_to_item = kwargs.pop('_path_to_item', ())
148+
_configuration = kwargs.pop('_configuration', None)
149+
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
150+
151+
self = super(OpenApiModel, cls).__new__(cls)
152+
153+
if args:
154+
raise ApiTypeError(
155+
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
156+
args,
157+
self.__class__.__name__,
158+
),
159+
path_to_item=_path_to_item,
160+
valid_classes=(self.__class__,),
161+
)
162+
163+
self._data_store = {}
164+
self._check_type = _check_type
165+
self._spec_property_naming = _spec_property_naming
166+
self._path_to_item = _path_to_item
167+
self._configuration = _configuration
168+
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
169+
170+
for var_name, var_value in kwargs.items():
171+
if var_name not in self.attribute_map and \
172+
self._configuration is not None and \
173+
self._configuration.discard_unknown_keys and \
174+
self.additional_properties_type is None:
175+
# discard variable.
176+
continue
177+
setattr(self, var_name, var_value)
178+
return self
179+
180+
required_properties = set([
181+
'_data_store',
182+
'_check_type',
183+
'_spec_property_naming',
184+
'_path_to_item',
185+
'_configuration',
186+
'_visited_composed_classes',
187+
])
188+
189+
@convert_js_args_to_python_args
190+
def __init__(self, *args, **kwargs): # noqa: E501
191+
"""DeleteResponse - a model defined in OpenAPI
192+
193+
Keyword Args:
194+
_check_type (bool): if True, values for parameters in openapi_types
195+
will be type checked and a TypeError will be
196+
raised if the wrong type is input.
197+
Defaults to True
198+
_path_to_item (tuple/list): This is a list of keys or values to
199+
drill down to the model in received_data
200+
when deserializing a response
201+
_spec_property_naming (bool): True if the variable names in the input data
202+
are serialized names, as specified in the OpenAPI document.
203+
False if the variable names in the input data
204+
are pythonic names, e.g. snake case (default)
205+
_configuration (Configuration): the instance to use when
206+
deserializing a file_type parameter.
207+
If passed, type conversion is attempted
208+
If omitted no type conversion is done.
209+
_visited_composed_classes (tuple): This stores a tuple of
210+
classes that we have traveled through so that
211+
if we see that class again we will not use its
212+
discriminator again.
213+
When traveling through a discriminator, the
214+
composed schema that is
215+
is traveled through is added to this set.
216+
For example if Animal has a discriminator
217+
petType and we pass in "Dog", and the class Dog
218+
allOf includes Animal, we move through Animal
219+
once using the discriminator, and pick Dog.
220+
Then in Dog, we will make an instance of the
221+
Animal class but this time we won't travel
222+
through its discriminator because we passed in
223+
_visited_composed_classes = (Animal,)
224+
deleted_count (int): The number of vectors deleted. 0 for requests with delete_all.. [optional] # noqa: E501
225+
"""
226+
227+
_check_type = kwargs.pop('_check_type', True)
228+
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
229+
_path_to_item = kwargs.pop('_path_to_item', ())
230+
_configuration = kwargs.pop('_configuration', None)
231+
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
232+
233+
if args:
234+
raise ApiTypeError(
235+
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
236+
args,
237+
self.__class__.__name__,
238+
),
239+
path_to_item=_path_to_item,
240+
valid_classes=(self.__class__,),
241+
)
242+
243+
self._data_store = {}
244+
self._check_type = _check_type
245+
self._spec_property_naming = _spec_property_naming
246+
self._path_to_item = _path_to_item
247+
self._configuration = _configuration
248+
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
249+
250+
for var_name, var_value in kwargs.items():
251+
if var_name not in self.attribute_map and \
252+
self._configuration is not None and \
253+
self._configuration.discard_unknown_keys and \
254+
self.additional_properties_type is None:
255+
# discard variable.
256+
continue
257+
setattr(self, var_name, var_value)
258+
if var_name in self.read_only_vars:
259+
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
260+
f"class with read only attributes.")

pinecone/core/client/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from pinecone.core.client.model.approximated_config import ApproximatedConfig
1717
from pinecone.core.client.model.create_request import CreateRequest
18+
from pinecone.core.client.model.delete_response import DeleteResponse
1819
from pinecone.core.client.model.describe_index_stats_response import DescribeIndexStatsResponse
1920
from pinecone.core.client.model.fetch_response import FetchResponse
2021
from pinecone.core.client.model.hnsw_config import HnswConfig

0 commit comments

Comments
 (0)