Skip to content

Latest commit

 

History

History
470 lines (392 loc) · 26.3 KB

README.md

File metadata and controls

470 lines (392 loc) · 26.3 KB

timepad

Timepad API Client (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

To rebuild use

swagger-codegen generate -c timepad/swagger_config.json -i https://api.timepad.ru/doc/interactive/swagger.json -l python -o timepad

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 1.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen For more information, please visit http://dev.timepad.ru/api/

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/eoranged/timepad.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/eoranged/timepad.git)

Then import the package:

import timepad

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import timepad

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import timepad
from timepad.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
body = timepad.CreateEvent() # CreateEvent | Описание создаваемого события (optional)

try:
    # Создать событие
    api_response = api_instance.add_event(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->add_event: %s\n" % e)

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер события
body = timepad.CreateOrder() # CreateOrder | Описание создаваемого заказа (optional)

try:
    # Создать заказ (deprecated)
    api_response = api_instance.add_order(event_id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->add_order: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
body = timepad.CreateOrganization() # CreateOrganization | Описание созданной организации (optional)

try:
    # Создать организацию
    api_response = api_instance.add_organization(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->add_organization: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер события, к которому относится заказ
order_id = 56 # int | Номер заказа

try:
    # Подтвердить заказ
    api_response = api_instance.approve_event_order(event_id, order_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->approve_event_order: %s\n" % e)

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
client_id = 'client_id_example' # str | Идентификатор клиента (optional)
redirect_uri = 'redirect_uri_example' # str | Ссылка на которую произойдёт редирект (optional)
response_type = 'response_type_example' # str | Возвращаемый тип ответа. Единственное поддерживаемое значение - token (optional)
scope = ['scope_example'] # list[str] | Запрашиваемые приложением разрешения через запятую. Возможные значения: add_events, add_organizations, edit_events, view_private_events, view_visitors, edit_visitors, add_cash_payments, edit_organizations_hooks (optional)

try:
    # Получить токен для работы с API
    api_instance.authorize(client_id=client_id, redirect_uri=redirect_uri, response_type=response_type, scope=scope)
except ApiException as e:
    print("Exception when calling DefaultApi->authorize: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
organization_id = 56 # int | Идентификатор организации
method_name = 'method_name_example' # str | Название кастомного метода
body = timepad.CallCustomMethod() # CallCustomMethod | Дополнительные параметры, передаваемые методу (optional)

try:
    # Вызвать кастомный метод
    api_response = api_instance.call_custom_method(organization_id, method_name, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->call_custom_method: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер события, к которому относится заказ
order_id = 56 # int | Номер заказа

try:
    # Удалить заказ
    api_response = api_instance.delete_event_order(event_id, order_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->delete_event_order: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер редактируемого события
body = timepad.EditEvent() # EditEvent | Список изменённых параметров события (optional)

try:
    # Изменить событие
    api_response = api_instance.edit_event(event_id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->edit_event: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер события, к которому относится заказ
order_id = 56 # int | Номер заказа
body = timepad.EditOrder() # EditOrder | Список изменённых параметров заказа (optional)

try:
    # Изменить заказ
    api_response = api_instance.edit_event_order(event_id, order_id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->edit_event_order: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер события, к которому относятся заказы
limit = 56 # int | Сколько элементов списка вывести (optional)
skip = 56 # int | С какого элемента списка начать вывод (optional)
email = 'email_example' # str | email пользователя (optional)
fields = ['fields_example'] # list[str] | Список полей, которые нужно вывести (optional)

try:
    # Получить заказы события
    api_response = api_instance.get_event_orders(event_id, limit=limit, skip=skip, email=email, fields=fields)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->get_event_orders: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
fields = ['fields_example'] # list[str] | Список полей, которые нужно вывести (optional)
limit = 56 # int | Сколько элементов списка вывести (optional)
skip = 56 # int | С какого элемента списка начать вывод (optional)
sort = ['sort_example'] # list[str] | Поле, по которому сортировать (optional)
category_ids = [56] # list[int] | Категории, к которым принадлежат события (optional)
category_ids_exclude = [56] # list[int] | Категории, к которым не принадлежат события (optional)
cities = ['cities_example'] # list[str] | Города, события из которых выводить (optional)
cities_exclude = ['cities_exclude_example'] # list[str] | Города, события из которых не выводить (optional)
organization_ids = [56] # list[int] | Номера организаций, события из которых выводить (optional)
organization_ids_exclude = [56] # list[int] | Номера организаций, события из которых не выводить (optional)
event_ids = [56] # list[int] | Номера событий, которые нужно вывести (optional)
event_ids_exclude = [56] # list[int] | Номера событий, которые нужно пропустить (optional)
keywords = ['keywords_example'] # list[str] | Слова, которые должны быть в названии или описании события (optional)
keywords_exclude = ['keywords_exclude_example'] # list[str] | Слова, которых не должно быть в названии или описании события (optional)
access_statuses = ['access_statuses_example'] # list[str] | Список режимов доступа, в которых находятся события. Возможные значения: private, draft, link_only, public. Доступно только организаторам (optional)
moderation_statuses = ['moderation_statuses_example'] # list[str] | Список уровней качества, установленных для события модератором. Возможные значения: featured, shown, hidden, not_moderated. (optional)
price_min = 56 # int | Цена, выше которой должен стоить хотя бы один билет события (optional)
price_max = 56 # int | Цена, ниже которой должен стоить хотя бы один билет события (optional)
ad_partner_percent_min = 56 # int | Хотя бы у одного вида билета события партнёрская комиссия в процентах выше этого значения (optional)
ad_partner_percent_max = 56 # int | Хотя бы у одного вида билета партнёрская комиссия в процентах ниже этого значения (optional)
ad_partner_profit_min = 56 # int | Хотя бы у одного вида билета партнёрская комиссия в рублях выше этого значения (optional)
ad_partner_profit_max = 56 # int | Хотя бы у одного вида билета партнёрская комиссия в рублях ниже этого значения (optional)
starts_at_min = '2013-10-20T19:20:30+01:00' # datetime | Дата начала события позднее этого значения (optional)
starts_at_max = '2013-10-20T19:20:30+01:00' # datetime | Дата начала события раньше этого значения (optional)
created_at_min = '2013-10-20T19:20:30+01:00' # datetime | Дата создания события на Timepad позднее этого значения (optional)
created_at_max = '2013-10-20T19:20:30+01:00' # datetime | Дата создания события на Timepad раньше этого значения (optional)

try:
    # Получить список событий
    api_response = api_instance.get_events(fields=fields, limit=limit, skip=skip, sort=sort, category_ids=category_ids, category_ids_exclude=category_ids_exclude, cities=cities, cities_exclude=cities_exclude, organization_ids=organization_ids, organization_ids_exclude=organization_ids_exclude, event_ids=event_ids, event_ids_exclude=event_ids_exclude, keywords=keywords, keywords_exclude=keywords_exclude, access_statuses=access_statuses, moderation_statuses=moderation_statuses, price_min=price_min, price_max=price_max, ad_partner_percent_min=ad_partner_percent_min, ad_partner_percent_max=ad_partner_percent_max, ad_partner_profit_min=ad_partner_profit_min, ad_partner_profit_max=ad_partner_profit_max, starts_at_min=starts_at_min, starts_at_max=starts_at_max, created_at_min=created_at_min, created_at_max=created_at_max)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->get_events: %s\n" % e)

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))

try:
    # Получить список категорий событий
    api_response = api_instance.get_events_categories()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->get_events_categories: %s\n" % e)

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))

try:
    # Получить список статусов событий
    api_response = api_instance.get_events_statuses()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->get_events_statuses: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер события, которые нужно вывести
fields = ['fields_example'] # list[str] | Список полей, которые нужно вывести (optional)

try:
    # Получить событие по ID
    api_response = api_instance.get_single_event(event_id, fields=fields)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->get_single_event: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер события, к которому относится заказ
order_id = 56 # int | Номер заказа
fields = ['fields_example'] # list[str] | Список полей, которые нужно вывести (optional)

try:
    # Получить заказ по ID
    api_response = api_instance.get_single_event_order(event_id, order_id, fields=fields)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->get_single_event_order: %s\n" % e)

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))

try:
    # Получить список статусов билетов
    api_response = api_instance.get_tickets_statuses()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->get_tickets_statuses: %s\n" % e)

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
token = 'token_example' # str | Идентификатор токена (optional)

try:
    # Получить информацию о пользователе API
    api_response = api_instance.introspect_token(token=token)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->introspect_token: %s\n" % e)

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
token = 'token_example' # str |  (optional)

try:
    # Получить информацию о пользователе API
    api_response = api_instance.introspect_token_post(token=token)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->introspect_token_post: %s\n" % e)

# Configure OAuth2 access token for authorization: timepad_implicit
configuration = timepad.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = timepad.DefaultApi(timepad.ApiClient(configuration))
event_id = 56 # int | Номер события, к которому относится заказ
order_id = 56 # int | Номер заказа

try:
    # Отклонить заказ
    api_response = api_instance.reject_event_order(event_id, order_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->reject_event_order: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to /

Class Method HTTP request Description
DefaultApi add_event POST /v1/events Создать событие
DefaultApi add_order POST /v1/events/{event_id}/orders Создать заказ (deprecated)
DefaultApi add_organization POST /v1/organizations Создать организацию
DefaultApi approve_event_order PATCH /v1/events/{event_id}/orders/{order_id}/approve Подтвердить заказ
DefaultApi authorize GET /oauth/authorize Получить токен для работы с API
DefaultApi call_custom_method POST /v1/organizations/{organization_id}/custom_method/{method_name} Вызвать кастомный метод
DefaultApi delete_event_order PATCH /v1/events/{event_id}/orders/{order_id}/delete Удалить заказ
DefaultApi edit_event POST /v1/events/{event_id} Изменить событие
DefaultApi edit_event_order PATCH /v1/events/{event_id}/orders/{order_id} Изменить заказ
DefaultApi get_event_orders GET /v1/events/{event_id}/orders Получить заказы события
DefaultApi get_events GET /v1/events Получить список событий
DefaultApi get_events_categories GET /v1/dictionary/event_categories Получить список категорий событий
DefaultApi get_events_statuses GET /v1/dictionary/event_statuses Получить список статусов событий
DefaultApi get_single_event GET /v1/events/{event_id} Получить событие по ID
DefaultApi get_single_event_order GET /v1/events/{event_id}/orders/{order_id} Получить заказ по ID
DefaultApi get_tickets_statuses GET /v1/dictionary/tickets_statuses Получить список статусов билетов
DefaultApi introspect_token GET /introspect Получить информацию о пользователе API
DefaultApi introspect_token_post POST /introspect Получить информацию о пользователе API
DefaultApi reject_event_order PATCH /v1/events/{event_id}/orders/{order_id}/reject Отклонить заказ
WebhooksApi add_hook POST /v1/organizations/{organization_id}/hooks Создать webhook для организации
WebhooksApi edit_hook POST /v1/organizations/{organization_id}/hooks/{hook_id} Изменить webhook
WebhooksApi get_hook GET /v1/organizations/{organization_id}/hooks/{hook_id} Получить webhook по ID
WebhooksApi get_hooks GET /v1/organizations/{organization_id}/hooks Получить список webhook'ов
_Api event_companies_list GET /v1/events/{event_id}/companies Получить список реквизитов компаний
_Api event_company GET /v1/events/{event_id}/companies/{company_id} Получить реквизиты юрлица по ID
_Api event_company_payments GET /v1/events/{event_id}/company_payment_requests Получить запросы на оплату от юрлица
_Api event_company_payments_0 GET /v1/events/{event_id}/company_payment_requests/{company_payment_request_id} Получить запросы на оплату от юрлица по ID
_Api event_company_payments_1 GET /v1/events/{event_id}/invoices Получить выставленные счета
_Api event_company_payments_2 GET /v1/events/{event_id}/invoices/{invoice_id} Получить счет по ID

Documentation For Models

Documentation For Authorization

timepad_implicit

  • Type: OAuth
  • Flow: implicit
  • Authorization URL: /oauth/authorize
  • Scopes:
  • ****:

Author