Пример #1
0
def update_collection(collection, name=None, description=None,
                      customFields=None, collections=None, tags=None,
                      api_key=None, request_kwargs=None):
    """
    Update an existing Collection.

    :param collection: The Collection to update.
    :type collection: str
    :param name: The Name of the Collection.
    :type description: str
    :param description: The Description of the Collection.
    :type description: str
    :param customFields: The Custom Fields of Collection.
    :type customFields: dict
    :param collections: The Collections of the Collection.
    :type collections: list of str
    :param tags: The Tags of the Collection.
    :type tags: list of str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return
    :rtype
    """
    kwargs = locals()
    del kwargs['request_kwargs']
    collection = kwargs.pop('collection')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/collections/{}'.format(collection)
    return utils.request(
        'PUT', url, data=kwargs, api_key=api_key, **(request_kwargs or {}))
Пример #2
0
def update_project(project_id, name=None, description=None, startsAt=None,
                   endsAt=None, tags=None, shortDomains=None,
                   customFields=None, api_key=None):
    """
    Update an existing Project.

    :param name:
    :type name: str
    :param description:
    :type description: str
    :param startsAt:
    :type startsAt: int
    :param endsAt:
    :type endsAt: int
    :param tags:
    :type tags: list of str
    :param shortDomains:
    :type shortDomains: list of str
    :param api_key:
    :type api_key: str
    :return A Project document.
    :rtype Response
    """
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    project_id = kwargs.pop('project_id')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}'.format(project_id)
    logger.debug('Updating Project {}...'.format(project_id))
    return utils.request('PUT', url, data=kwargs, api_key=api_key, accept=True)
Пример #3
0
def create_collection(name, description=None, customFields=None,
                      collections=None, tags=None, api_key=None,
                      request_kwargs=None):
    """
    Create a new Collection.

    :param name: The Name of the Collection.
    :type description: str
    :param description: The Description of the Collection.
    :type description: str
    :param customFields: The Custom Fields of Collection.
    :type customFields: dict
    :param collections: The Collections of the Collection.
    :type collections: list of str
    :param tags: The Tags of the Collection.
    :type tags: list of str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return
    :rtype
    """
    kwargs = locals()
    del kwargs['request_kwargs']
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/collections', data=kwargs, api_key=api_key,
                         **(request_kwargs or {}))
Пример #4
0
def create_application(project, name, description=None, defaultUrl=None,
                       socialNetworks=None, tags=None, customFields=None,
                       api_key=None, request_kwargs=None):
    """
    Create an Application.

    :param project: The Project of the Application.
    :type project: str
    :param name: The Name of the Application.
    :type name: str
    :param description: The Description of the Application.
    :type description: str
    :param defaultUrl: The Default URL of the Application.
    :type defaultUrl: str
    :param socialNetworks: Social Networks that the Application supports.
    :type socialNetworks: dict of dicts
    :param tags: The Tags of the Application
    :type tags: list of str
    :param customFields: The Custom Fields of Application.
    :type customFields: dict
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return:
    """
    if socialNetworks is None:
        socialNetworks = {}
    kwargs = locals()
    del kwargs['request_kwargs']
    api_key = kwargs.pop('api_key', None)
    project = kwargs.pop('project')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}/applications'.format(project)
    return utils.request('POST', url, data=kwargs, api_key=api_key,
                         **(request_kwargs or {}))
Пример #5
0
def create_action_type(name, customFields=None, tags=None, scopes=None,
                       api_key=None):
    """Create an Action Type"""
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/actions', data=kwargs, api_key=api_key)
Пример #6
0
def create_project(name, description=None, startsAt=None, endsAt=None,
                   tags=None, shortDomains=None, customFields=None,
                   api_key=None):
    """
    Create a new Project.

    :param name:
    :type name: str
    :param description:
    :type description: str
    :param startsAt:
    :type startsAt: int
    :param endsAt:
    :type endsAt: int
    :param tags:
    :type tags: list of str
    :param shortDomains:
    :type shortDomains: list of str
    :param api_key:
    :type api_key: str
    :return A Project document.
    :rtype Response
    """
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    logger.debug('Creating Project...')
    return utils.request('POST', '/projects', data=kwargs, api_key=api_key)
Пример #7
0
def update_reactor(project_id, application_id, script=None, bundle=None, manifest=None,
                   api_key=None):
    """
    Update a Reactor Script.

    :param project_id: The Project of the Application.
    :type project_id: str
    :param application_id: The Application to update the Reactor script for.
    :type application_id: str
    :param script: The reactor script.
    :type script: str
    :param bundle: The reactor script bundle.
    :type bundle: dict
    :param manifest: The reactor script manifest.
    :type manifest: str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return:
    """
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    application_id = kwargs.pop('application_id')
    bundle = kwargs.pop('bundle', None)

    assertions.validate_field_specs(kwargs, reactor_field_specs)
    url = '/projects/{}/applications/{}/reactorScript'.format(project_id, application_id)

    return utils.request('PUT', url, data=None if bundle else kwargs, api_key=api_key, files=bundle)
Пример #8
0
def create_product(name, description=None, brand=None, categories=None,
                   photos=None, url=None, identifiers=None, properties=None,
                   tags=None, customFields=None, api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/products', data=kwargs, api_key=api_key)
Пример #9
0
def update_collection(collection_id, name=None, description=None,
                      customFields=None, collections=None, tags=None,
                      api_key=None):
    """
    Update an existing Collection.

    :param collection_id: The Collection to update.
    :type collection_id: str
    :param name:
    :type description: str
    :param description:
    :type description: str
    :param customFields:
    :type customFields: list of str
    :param collections:
    :type collections: list of str
    :param tags:
    :type tags: list of str
    :param api_key:
    :type api_key: str
    :return
    :rtype
    """
    kwargs = locals()
    collection_id = kwargs.pop('collection_id')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/collections/{}'.format(collection_id)
    return utils.request(
        'PUT', url, data=kwargs, api_key=api_key)
Пример #10
0
def update_collection(collection_id,
                      name=None,
                      description=None,
                      customFields=None,
                      collections=None,
                      tags=None,
                      api_key=None):
    """
    Update an existing Collection.

    :param collection_id: The Collection to update.
    :type collection_id: str
    :param name:
    :type description: str
    :param description:
    :type description: str
    :param customFields:
    :type customFields: list of str
    :param collections:
    :type collections: list of str
    :param tags:
    :type tags: list of str
    :param api_key:
    :type api_key: str
    :return
    :rtype
    """
    kwargs = locals()
    collection_id = kwargs.pop('collection_id')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/collections/{}'.format(collection_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #11
0
def update_collection(collection,
                      name=None,
                      description=None,
                      customFields=None,
                      collections=None,
                      tags=None,
                      api_key=None):
    """
    Update an existing Collection.

    :param collection: The Collection to update.
    :type collection: str
    :param name: The Name of the Collection.
    :type description: str
    :param description: The Description of the Collection.
    :type description: str
    :param customFields: The Custom Fields of Collection.
    :type customFields: dict
    :param collections: The Collections of the Collection.
    :type collections: list of str
    :param tags: The Tags of the Collection.
    :type tags: list of str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return
    :rtype
    """
    kwargs = locals()
    collection = kwargs.pop('collection')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/collections/{}'.format(collection)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #12
0
def create_thng(name, description=None, product=None, location=None,
                identifiers=None, properties=None, tags=None, collections=None,
                customFields=None, api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/thngs', data=kwargs, api_key=api_key)
Пример #13
0
def update_reactor_bundle(project_id, application_id, bundle_bytes,
                          api_key=None, request_kwargs=None):
    """
    Update a Reactor via a bundle of files; A zip file containing main.js,
    package.json, etc.

    :param project_id: The ID of the Project.
    :type project_id: str
    :param application_id: The ID for the Application that is a child of the
                           Project for which the reactor script will be scoped
                           to.
    :type application_id: str
    :param bundle_bytes: The bytes that make up the Zip file containing the
                         bundle of files.
    :type bundle_bytes: bytes
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return:
    """
    kwargs = locals()
    del kwargs['request_kwargs']
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    assertions.datatype_str('project_id', project_id)
    application_id = kwargs.pop('application_id')
    assertions.datatype_str('application_id', application_id)
    assertions.validate_field_specs(kwargs, reactor_bundle_field_specs)
    url = '/projects/{}/applications/{}/reactorScript'.format(
        project_id, application_id)
    files = {'file': bundle_bytes}
    return utils.request('PUT', url, files=files, api_key=api_key,
                         **(request_kwargs or {}))
Пример #14
0
def create_property_on_product(product_id, key, value, timestamp=None,
                               api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/products/{}/properties'.format(product_id)
    return utils.request('POST', url, data=kwargs, api_key=api_key)
Пример #15
0
def create_project(name,
                   description=None,
                   startsAt=None,
                   endsAt=None,
                   tags=None,
                   shortDomains=None,
                   customFields=None,
                   api_key=None):
    """
    Create a new Project.

    :param name:
    :type name: str
    :param description:
    :type description: str
    :param startsAt:
    :type startsAt: int
    :param endsAt:
    :type endsAt: int
    :param tags:
    :type tags: list of str
    :param shortDomains:
    :type shortDomains: list of str
    :param api_key:
    :type api_key: str
    :return A Project document.
    :rtype Response
    """
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    logger.debug('Creating Project...')
    return utils.request('POST', '/projects', data=kwargs, api_key=api_key)
Пример #16
0
def update_property_on_thng(thngId, key, value, timestamp=None, api_key=None):
    kwargs = locals()
    thngId = kwargs.pop('thngId')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/thngs/{}/properties'.format(thngId)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #17
0
def update_reactor_script(project_id, application_id, script, manifest='',
                          type_='simple', api_key=None):
    """
    Update the Reactor with a single script text file and an optional manifest.

    :param project_id: The ID of the Project.
    :type project_id: str
    :param application_id: The ID for the Application that is a child of the
                           Project for which the reactor script will be scoped
                           to.
    :type application_id: str
    :param script: The reactor script body.
    :type script: str
    :param manifest: The manifest file for running the script. A packages.json
                     file, basically.
    :type manifest: str
    :param type_: The reactor script type. Possible values are simple, bundle.
                  Default is simple
    :type type_: str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return:
    """
    kwargs = locals()
    kwargs['type'] = kwargs.pop('type_')
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    assertions.datatype_str('project_id', project_id)
    application_id = kwargs.pop('application_id')
    assertions.datatype_str('application_id', application_id)
    assertions.validate_field_specs(kwargs, reactor_script_field_specs)
    url = '/projects/{}/applications/{}/reactorScript'.format(
        project_id, application_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #18
0
def create_collection_action(type_,
                             collection,
                             timestamp=None,
                             identifiers=None,
                             location=None,
                             locationSource=None,
                             context=None,
                             customFields=None,
                             api_key=None,
                             request_kwargs=None):
    """Create an Action for a Collection."""
    kwargs = locals()
    del kwargs['request_kwargs']
    kwargs['type'] = kwargs['type_']
    del kwargs['type_']
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, action_field_specs)

    url = '/collections/{}/actions/{}'.format(collection, type_)

    return utils.request('POST',
                         url,
                         data=kwargs,
                         api_key=api_key,
                         **(request_kwargs or {}))
Пример #19
0
def create_collection(name,
                      description=None,
                      customFields=None,
                      collections=None,
                      tags=None,
                      api_key=None):
    """
    Create a new Collection.

    :param name: The Name of the Collection.
    :type description: str
    :param description: The Description of the Collection.
    :type description: str
    :param customFields: The Custom Fields of Collection.
    :type customFields: dict
    :param collections: The Collections of the Collection.
    :type collections: list of str
    :param tags: The Tags of the Collection.
    :type tags: list of str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return
    :rtype
    """
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/collections', data=kwargs, api_key=api_key)
Пример #20
0
def update_reactor_bundle(project_id, application_id, bundle_bytes,
                          api_key=None):
    """
    Update a Reactor via a bundle of files; A zip file containing main.js,
    package.json, etc.

    :param project_id: The ID of the Project.
    :type project_id: str
    :param application_id: The ID for the Application that is a child of the
                           Project for which the reactor script will be scoped
                           to.
    :type application_id: str
    :param bundle_bytes: The bytes that make up the Zip file containing the
                         bundle of files.
    :type bundle_bytes: bytes
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return:
    """
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    assertions.datatype_str('project_id', project_id)
    application_id = kwargs.pop('application_id')
    assertions.datatype_str('application_id', application_id)
    assertions.validate_field_specs(kwargs, reactor_bundle_field_specs)
    url = '/projects/{}/applications/{}/reactorScript'.format(
        project_id, application_id)
    files = {'file': bundle_bytes}
    return utils.request('PUT', url, files=files, api_key=api_key)
Пример #21
0
def update_location(thng, position=None, timestamp=None, api_key=None,
                    request_kwargs=None):
    data = {'position': position, 'timestamp': timestamp}
    assertions.validate_field_specs(data, field_specs)
    url = '/thngs/{}/location'.format(thng)
    return utils.request('PUT', url, data=data, api_key=api_key,
                         **(request_kwargs or {}))
Пример #22
0
def update_user(user,
                email=None,
                firstName=None,
                lastName=None,
                password=None,
                birthday=None,
                gender=None,
                timezone=None,
                locale=None,
                photo=None,
                customFields=None,
                tags=None,
                api_key=None,
                request_kwargs=None):
    """Update an Application User."""
    kwargs = locals()
    del kwargs['request_kwargs']
    user = kwargs.pop('user')
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/users/{}'.format(user)
    return utils.request('PUT',
                         url,
                         data=kwargs,
                         api_key=api_key,
                         **(request_kwargs or {}))
Пример #23
0
def create_collection(name,
                      description=None,
                      customFields=None,
                      collections=None,
                      tags=None,
                      api_key=None):
    """
    Create a new Collection.

    :param name:
    :type description: str
    :param description:
    :type description: str
    :param customFields:
    :type customFields: list of str
    :param collections:
    :type collections: list of str
    :param tags:
    :type tags: list of str
    :param api_key:
    :type api_key: str
    :return
    :rtype
    """
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/collections', data=kwargs, api_key=api_key)
Пример #24
0
def update_application(project_id, application_id, name=None, description=None,
                       defaultUrl=None, socialNetworks=None, tags=None,
                       customFields=None, api_key=None):
    """
    Update an Application.

    :param project_id: The Project of the Application.
    :type project_id: str
    :param application_id: The Application to update the details for.
    :type application_id: str
    :param name: The Name of the Application.
    :type name: str
    :param description: The Description of the Application.
    :type description: str
    :param defaultUrl: The Default URL of the Application.
    :type defaultUrl: str
    :param socialNetworks: Social Networks that the Application supports.
    :type socialNetworks: dict of dicts
    :param tags: The Tags of the Application.
    :type tags: list of str
    :param customFields: The Custom Fields of Application.
    :type customFields: dict
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return:
    """
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    application_id = kwargs.pop('application_id')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}/applications/{}'.format(project_id, application_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key, accept=True)
Пример #25
0
def update_place(place_id, name=None, position=None, address=None, description=None,
                 icon=None, tags=None, customFields=None):
    kwargs = locals()
    place_id = kwargs.pop('place_id')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/places/{}'.format(place_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #26
0
def create_user(email, firstName=None, lastName=None, password=None,
                birthday=None, gender=None, timezone=None, locale=None,
                photo=None, customFields=None, tags=None, api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request(
        'POST', '/auth/evrythng/users', data=kwargs, api_key=api_key)
def upsert_thng_properties(thng, key_values, **request_kwargs):
    """Create/Update multiple Properties on a Thng.

    POST /thngs/{$thng}/properties
    [{"key": "motion", "value": 20}, {"key": "temperature", "value": 98}]
    """
    for key_value in key_values:
        assertions.validate_field_specs(key_value, field_specs)
    return _upsert_properties('thngs', thng, key_values, **request_kwargs)
Пример #28
0
def create_place(name, position=None, address=None, description=None,
                 icon=None, tags=None, customFields=None, api_key=None,
                 request_kwargs=None):
    kwargs = locals()
    del kwargs['request_kwargs']
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/places', data=kwargs, api_key=api_key,
                         **(request_kwargs or {}))
Пример #29
0
def update_action_type(name, customFields=None, tags=None, scopes=None,
                       api_key=None):
    kwargs = locals()
    kwargs['type'] = kwargs['type_']
    del kwargs['type_']
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/actions/{}'.format(type_)
    return utils.request('POST', '/actions', data=kwargs, api_key=api_key)
Пример #30
0
def update_product(product_id, name=None, description=None, brand=None,
                   categories=None, photos=None, url=None, identifiers=None,
                   properties=None, tags=None, customFields=None, api_key=None):
    kwargs = locals()
    product_id = kwargs.pop('product_id')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/products/{}'.format(product_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #31
0
def login_user(email, password, app_api_key):
    """Login an Application User."""
    kwargs = locals()
    app_api_key = kwargs.pop('app_api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST',
                         '/auth/evrythng',
                         data=kwargs,
                         api_key=app_api_key)
Пример #32
0
def upsert_thng_properties(thng_id, key_values, api_key=None):
    """Create/Update multiple Properties on a Thng.

    POST /thngs/{$thng_id}/properties
    [{"key": "motion", "value": 20}, {"key": "temperature", "value": 98}]
    """
    for key_value in key_values:
        assertions.validate_field_specs(key_value, field_specs)
    return _upsert_properties('thngs', thng_id, key_values, api_key=api_key)
Пример #33
0
def upsert_product_properties(product_id, key_values, **request_kwargs):
    """Create/Update multiple Properties on a Product.

    POST /products/{$product_id}/properties
    [{"key": "max_wattage", "value": 40}, {"key": "sku", "value": "abc123"}]
    """
    for key_value in key_values:
        assertions.validate_field_specs(key_value, field_specs)
    return _upsert_properties('products', product_id, key_values, **request_kwargs)
Пример #34
0
def create_action_type(name,
                       customFields=None,
                       tags=None,
                       scopes=None,
                       api_key=None):
    """Create an Action Type"""
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/actions', data=kwargs, api_key=api_key)
Пример #35
0
def update_action_type(name, customFields=None, tags=None, scopes=None,
                       api_key=None, request_kwargs=None):
    """Update an Action Type"""
    kwargs = locals()
    del kwargs['request_kwargs']
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/actions/{}'.format(name)
    return utils.request('POST', '/actions', data=kwargs, api_key=api_key,
                         **(request_kwargs or {}))
Пример #36
0
def update_application(project_id, application_id, name=None, description=None,
                       defaultUrl=None, socialNetworks=None, tags=None,
                       customFields=None, api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    application_id = kwargs.pop('application_id')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}/applications/{}'.format(project_id, application_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key, accept=True)
Пример #37
0
def update_user(user_id, email=None, firstName=None, lastName=None,
                password=None, birthday=None, gender=None, timezone=None,
                localte=None, photo=None, customFields=None, tags=None,
                api_key=None):
    kwargs = locals()
    user_id = kwargs.pop('user_id')
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/users/{}'.format(user_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #38
0
def update_thng(thng_id, name=None, description=None, product=None,
                location=None, identifiers=None, properties=None, tags=None,
                collections=None, customFields=None, api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    thng_id = kwargs.pop('thng_id')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/thngs/{}'.format(thng_id)
    return utils.request(
        'PUT', url, data=kwargs, api_key=api_key)
Пример #39
0
def update_place(place, name=None, position=None, address=None,
                 description=None, icon=None, tags=None, customFields=None,
                 api_key=None, request_kwargs=None):
    kwargs = locals()
    del kwargs['request_kwargs']
    place = kwargs.pop('place')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/places/{}'.format(place)
    return utils.request('PUT', url, data=kwargs, api_key=api_key,
                         **(request_kwargs or {}))
Пример #40
0
def create_application(project_id, name, description=None, defaultUrl=None,
                       socialNetworks=None, tags=None, customFields=None,
                       api_key=None):
    if socialNetworks is None:
        socialNetworks = {}
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}/applications'.format(project_id)
    return utils.request('POST', url, data=kwargs, api_key=api_key)
Пример #41
0
def update_thng(thng, name=None, description=None, product=None,
                location=None, identifiers=None, properties=None, tags=None,
                collections=None, customFields=None, scopes=None, api_key=None,
                request_kwargs=None):
    kwargs = locals()
    del kwargs['request_kwargs']
    api_key = kwargs.pop('api_key')
    thng = kwargs.pop('thng')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/thngs/{}'.format(thng)
    return utils.request(
        'PUT', url, data=kwargs, api_key=api_key, **(request_kwargs or {}))
Пример #42
0
def create_place(name,
                 position=None,
                 address=None,
                 description=None,
                 icon=None,
                 tags=None,
                 customFields=None,
                 api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/places', data=kwargs, api_key=api_key)
Пример #43
0
def update_action_type(name,
                       customFields=None,
                       tags=None,
                       scopes=None,
                       api_key=None):
    kwargs = locals()
    kwargs['type'] = kwargs['type_']
    del kwargs['type_']
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/actions/{}'.format(type_)
    return utils.request('POST', '/actions', data=kwargs, api_key=api_key)
Пример #44
0
def update_location(thng,
                    position=None,
                    timestamp=None,
                    api_key=None,
                    request_kwargs=None):
    data = {'position': position, 'timestamp': timestamp}
    assertions.validate_field_specs(data, field_specs)
    url = '/thngs/{}/location'.format(thng)
    return utils.request('PUT',
                         url,
                         data=data,
                         api_key=api_key,
                         **(request_kwargs or {}))
Пример #45
0
def create_product(name,
                   description=None,
                   brand=None,
                   categories=None,
                   photos=None,
                   url=None,
                   identifiers=None,
                   properties=None,
                   tags=None,
                   customFields=None,
                   api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST', '/products', data=kwargs, api_key=api_key)
Пример #46
0
def create_application(project_id,
                       name,
                       description=None,
                       defaultUrl=None,
                       socialNetworks=None,
                       tags=None,
                       customFields=None,
                       api_key=None):
    if socialNetworks is None:
        socialNetworks = {}
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}/applications'.format(project_id)
    return utils.request('POST', url, data=kwargs, api_key=api_key)
Пример #47
0
def update_application(project_id,
                       application_id,
                       name=None,
                       description=None,
                       defaultUrl=None,
                       socialNetworks=None,
                       tags=None,
                       customFields=None,
                       api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    project_id = kwargs.pop('project_id')
    application_id = kwargs.pop('application_id')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}/applications/{}'.format(project_id, application_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key, accept=True)
Пример #48
0
def create_thng_action(type_,
                       thng,
                       timestamp=None,
                       identifiers=None,
                       location=None,
                       locationSource=None,
                       context=None,
                       customFields=None,
                       api_key=None):
    """Create an Action for a Thng."""
    kwargs = locals()
    kwargs['type'] = kwargs['type_']
    del kwargs['type_']
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, action_field_specs)
    url = '/thngs/{}/actions/{}'.format(thng, type_)
    return utils.request('POST', url, data=kwargs, api_key=api_key)
Пример #49
0
def update_application(project,
                       application_id,
                       name=None,
                       description=None,
                       defaultUrl=None,
                       socialNetworks=None,
                       tags=None,
                       customFields=None,
                       api_key=None,
                       request_kwargs=None):
    """
    Update an Application.

    :param project: The Project of the Application.
    :type project: str
    :param application_id: The Application to update the details for.
    :type application_id: str
    :param name: The Name of the Application.
    :type name: str
    :param description: The Description of the Application.
    :type description: str
    :param defaultUrl: The Default URL of the Application.
    :type defaultUrl: str
    :param socialNetworks: Social Networks that the Application supports.
    :type socialNetworks: dict of dicts
    :param tags: The Tags of the Application.
    :type tags: list of str
    :param customFields: The Custom Fields of Application.
    :type customFields: dict
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return:
    """
    kwargs = locals()
    del kwargs['request_kwargs']
    api_key = kwargs.pop('api_key', None)
    project = kwargs.pop('project')
    application_id = kwargs.pop('application_id')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}/applications/{}'.format(project, application_id)
    return utils.request('PUT',
                         url,
                         data=kwargs,
                         api_key=api_key,
                         accept=True,
                         **(request_kwargs or {}))
Пример #50
0
def create_action(type_,
                  thng=None,
                  product=None,
                  collection=None,
                  timestamp=None,
                  identifiers=None,
                  location=None,
                  locationSource=None,
                  context=None,
                  customFields=None,
                  api_key=None):
    kwargs = locals()
    kwargs['type'] = kwargs['type_']
    del kwargs['type_']
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/actions/{}'.format(type_)
    return utils.request('POST', '/actions', data=kwargs, api_key=api_key)
Пример #51
0
def update_product(product_id,
                   name=None,
                   description=None,
                   brand=None,
                   categories=None,
                   photos=None,
                   url=None,
                   identifiers=None,
                   properties=None,
                   tags=None,
                   customFields=None,
                   api_key=None):
    kwargs = locals()
    product_id = kwargs.pop('product_id')
    api_key = kwargs.pop('api_key')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/products/{}'.format(product_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #52
0
def update_user(user_id,
                email=None,
                firstName=None,
                lastName=None,
                password=None,
                birthday=None,
                gender=None,
                timezone=None,
                localte=None,
                photo=None,
                customFields=None,
                tags=None,
                api_key=None):
    kwargs = locals()
    user_id = kwargs.pop('user_id')
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/users/{}'.format(user_id)
    return utils.request('PUT', url, data=kwargs, api_key=api_key)
Пример #53
0
def create_user(email,
                firstName=None,
                lastName=None,
                password=None,
                birthday=None,
                gender=None,
                timezone=None,
                locale=None,
                photo=None,
                customFields=None,
                tags=None,
                api_key=None):
    kwargs = locals()
    api_key = kwargs.pop('api_key', None)
    assertions.validate_field_specs(kwargs, field_specs)
    return utils.request('POST',
                         '/auth/evrythng/users',
                         data=kwargs,
                         api_key=api_key)
Пример #54
0
def update_project(project,
                   name=None,
                   description=None,
                   startsAt=None,
                   endsAt=None,
                   tags=None,
                   shortDomains=None,
                   customFields=None,
                   api_key=None,
                   request_kwargs=None):
    """
    Update an existing Project.

    :param name:
    :type name: str
    :param description:
    :type description: str
    :param startsAt:
    :type startsAt: int
    :param endsAt:
    :type endsAt: int
    :param tags:
    :type tags: list of str
    :param shortDomains:
    :type shortDomains: list of str
    :param api_key:
    :type api_key: str
    :return A Project document.
    :rtype Response
    """
    kwargs = locals()
    del kwargs['request_kwargs']
    api_key = kwargs.pop('api_key')
    project = kwargs.pop('project')
    assertions.validate_field_specs(kwargs, field_specs)
    url = '/projects/{}'.format(project)
    logger.debug('Updating Project {}...'.format(project))
    return utils.request('PUT',
                         url,
                         data=kwargs,
                         api_key=api_key,
                         accept=True,
                         **(request_kwargs or {}))