Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update swagger with a delete endpoint #28

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 0.0.3 [unreleased]

### API
1. [#28](https://github.com/bonitoo-io/influxdb-client-python/pull/28): Updated swagger to latest version

### Features
1. [#24](https://github.com/influxdata/influxdb-client-python/issues/24): Added possibility to write dictionary-style object

Expand Down
1 change: 1 addition & 0 deletions influxdb_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
from influxdb_client.domain.date_time_literal import DateTimeLiteral
from influxdb_client.domain.deadman_check import DeadmanCheck
from influxdb_client.domain.decimal_places import DecimalPlaces
from influxdb_client.domain.delete_predicate_request import DeletePredicateRequest
from influxdb_client.domain.dialect import Dialect
from influxdb_client.domain.document import Document
from influxdb_client.domain.document_create import DocumentCreate
Expand Down
1 change: 1 addition & 0 deletions influxdb_client/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
from influxdb_client.domain.date_time_literal import DateTimeLiteral
from influxdb_client.domain.deadman_check import DeadmanCheck
from influxdb_client.domain.decimal_places import DecimalPlaces
from influxdb_client.domain.delete_predicate_request import DeletePredicateRequest
from influxdb_client.domain.dialect import Dialect
from influxdb_client.domain.document import Document
from influxdb_client.domain.document_create import DocumentCreate
Expand Down
172 changes: 172 additions & 0 deletions influxdb_client/domain/delete_predicate_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
# coding: utf-8

"""
Influx API Service

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501

OpenAPI spec version: 0.1.0
Generated by: https://openapi-generator.tech
"""


import pprint
import re # noqa: F401

import six


class DeletePredicateRequest(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech

Do not edit the class manually.
"""

"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'start': 'datetime',
'stop': 'datetime',
'predicate': 'str'
}

attribute_map = {
'start': 'start',
'stop': 'stop',
'predicate': 'predicate'
}

def __init__(self, start=None, stop=None, predicate=None): # noqa: E501
"""DeletePredicateRequest - a model defined in OpenAPI""" # noqa: E501

self._start = None
self._stop = None
self._predicate = None
self.discriminator = None

self.start = start
self.stop = stop
if predicate is not None:
self.predicate = predicate

@property
def start(self):
"""Gets the start of this DeletePredicateRequest. # noqa: E501

RFC3339Nano. # noqa: E501

:return: The start of this DeletePredicateRequest. # noqa: E501
:rtype: datetime
"""
return self._start

@start.setter
def start(self, start):
"""Sets the start of this DeletePredicateRequest.

RFC3339Nano. # noqa: E501

:param start: The start of this DeletePredicateRequest. # noqa: E501
:type: datetime
"""
if start is None:
raise ValueError("Invalid value for `start`, must not be `None`") # noqa: E501

self._start = start

@property
def stop(self):
"""Gets the stop of this DeletePredicateRequest. # noqa: E501

RFC3339Nano. # noqa: E501

:return: The stop of this DeletePredicateRequest. # noqa: E501
:rtype: datetime
"""
return self._stop

@stop.setter
def stop(self, stop):
"""Sets the stop of this DeletePredicateRequest.

RFC3339Nano. # noqa: E501

:param stop: The stop of this DeletePredicateRequest. # noqa: E501
:type: datetime
"""
if stop is None:
raise ValueError("Invalid value for `stop`, must not be `None`") # noqa: E501

self._stop = stop

@property
def predicate(self):
"""Gets the predicate of this DeletePredicateRequest. # noqa: E501

sql where like delete statement # noqa: E501

:return: The predicate of this DeletePredicateRequest. # noqa: E501
:rtype: str
"""
return self._predicate

@predicate.setter
def predicate(self, predicate):
"""Sets the predicate of this DeletePredicateRequest.

sql where like delete statement # noqa: E501

:param predicate: The predicate of this DeletePredicateRequest. # noqa: E501
:type: str
"""

self._predicate = predicate

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}

for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value

return result

def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())

def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()

def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, DeletePredicateRequest):
return False

return self.__dict__ == other.__dict__

def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
5 changes: 2 additions & 3 deletions influxdb_client/domain/http_notification_rule_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def __init__(self, type=None, url=None): # noqa: E501
self.discriminator = None

self.type = type
self.url = url
if url is not None:
self.url = url

@property
def type(self):
Expand Down Expand Up @@ -91,8 +92,6 @@ def url(self, url):
:param url: The url of this HTTPNotificationRuleBase. # noqa: E501
:type: str
"""
if url is None:
raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501

self._url = url

Expand Down
118 changes: 118 additions & 0 deletions influxdb_client/service/default_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,124 @@ def __init__(self, api_client=None):
api_client = ApiClient()
self.api_client = api_client

def delete_post(self, delete_predicate_request, **kwargs): # noqa: E501
"""delete Time series data from InfluxDB # noqa: E501

This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_post(delete_predicate_request, async_req=True)
>>> result = thread.get()

:param async_req bool
:param DeletePredicateRequest delete_predicate_request: predicate delete request (required)
:param str zap_trace_span: OpenTracing span context
:param str org: specifies the destination organization for writes
:param str bucket: specifies the destination bucket for writes
:param str org_id: specifies the organization ID of the resource
:param str bucket_id: specifies the destination bucket ID for writes
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.delete_post_with_http_info(delete_predicate_request, **kwargs) # noqa: E501
else:
(data) = self.delete_post_with_http_info(delete_predicate_request, **kwargs) # noqa: E501
return data

def delete_post_with_http_info(self, delete_predicate_request, **kwargs): # noqa: E501
"""delete Time series data from InfluxDB # noqa: E501

This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_post_with_http_info(delete_predicate_request, async_req=True)
>>> result = thread.get()

:param async_req bool
:param DeletePredicateRequest delete_predicate_request: predicate delete request (required)
:param str zap_trace_span: OpenTracing span context
:param str org: specifies the destination organization for writes
:param str bucket: specifies the destination bucket for writes
:param str org_id: specifies the organization ID of the resource
:param str bucket_id: specifies the destination bucket ID for writes
:return: None
If the method is called asynchronously,
returns the request thread.
"""

local_var_params = locals()

all_params = ['delete_predicate_request', 'zap_trace_span', 'org', 'bucket', 'org_id', 'bucket_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')

for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_post" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'delete_predicate_request' is set
if ('delete_predicate_request' not in local_var_params or
local_var_params['delete_predicate_request'] is None):
raise ValueError("Missing the required parameter `delete_predicate_request` when calling `delete_post`") # noqa: E501

collection_formats = {}

path_params = {}

query_params = []
if 'org' in local_var_params:
query_params.append(('org', local_var_params['org'])) # noqa: E501
if 'bucket' in local_var_params:
query_params.append(('bucket', local_var_params['bucket'])) # noqa: E501
if 'org_id' in local_var_params:
query_params.append(('orgID', local_var_params['org_id'])) # noqa: E501
if 'bucket_id' in local_var_params:
query_params.append(('bucketID', local_var_params['bucket_id'])) # noqa: E501

header_params = {}
if 'zap_trace_span' in local_var_params:
header_params['Zap-Trace-Span'] = local_var_params['zap_trace_span'] # noqa: E501

form_params = []
local_var_files = {}

body_params = None
if 'delete_predicate_request' in local_var_params:
body_params = local_var_params['delete_predicate_request']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501

# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501

# Authentication setting
auth_settings = [] # noqa: E501

return self.api_client.call_api(
'/api/v2/delete', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)

def get_routes(self, **kwargs): # noqa: E501
"""Map of all top level routes available # noqa: E501

Expand Down
Loading