Example #1
0
def php_enqueue_client(queue_id, client_id):
    body = {'concept_id': queue_id, 'user_id': client_id, 'name': "juan carlos", 'email': '*****@*****.**'}
    resp = requests.post(BASE_URL + '/turns?' + SYSTEM_ID_URI_PARAM, data=body)
    if resp.status_code >= 400:
        raise exceptions.PhpApiError(resp.json())
    else:
        return {'id': -1, 'clientId': -1, 'conceptQueueId': -1, 'state': "IN"}
Example #2
0
def php_let_through(queue_id, client_id):
    resp = requests.post(BASE_URL + '/users/' + str(client_id) + '/concepts/' + str(queue_id) + '?' + SYSTEM_ID_URI_PARAM)
    print(resp)
    print(resp.text)
    if resp.status_code >= 400:
        raise exceptions.PhpApiError(resp.json()["error"])
    else:
        return "Client swapped"
Example #3
0
def php_get_client_shop_queues(client_id):
    resp = requests.get(BASE_URL + '/users/' + str(client_id) + '/turns?' + SYSTEM_ID_URI_PARAM)
    if resp.status_code >= 400:
        if "Not Found" in resp.text:
            return []
        else:
            raise exceptions.PhpApiError(resp.json())
    else:
        return list(
            map(lambda q:
                {
                    'id': q["concept_id"],
                    'name': 'PHP Queue',
                    'position': q["turn_order"],
                    'sourceId': system_variables.PHP_SYSTEM_ID
                },
                resp.json()
            )
        )
Example #4
0
def php_get_all_queues():
    resp = requests.get(BASE_URL + '/concepts?' + SYSTEM_ID_URI_PARAM)
    if resp.status_code >= 400:
        raise exceptions.PhpApiError(resp.json())
    else:
        return list(map(lambda q: api_formatter.DTOQueue.from_php_json(q), resp.json()))
Example #5
0
def php_leave_queue(queue_id, client_id):
    resp = requests.delete(BASE_URL + '/users/' + str(client_id) + '/concepts/' + str(queue_id) + '?' + SYSTEM_ID_URI_PARAM)
    if resp.status_code >= 400:
        raise exceptions.PhpApiError(resp.json())
    else:
        return "Client removed from Queue"