Skip to content

Commit 3be1d9a

Browse files
committed
Added order update API and docs for everything
1 parent 1a8a76a commit 3be1d9a

File tree

23 files changed

+1213
-185
lines changed

23 files changed

+1213
-185
lines changed

README.md

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,82 @@ pip install integrify-clopos
6969

7070
To use these requests you need to set these environmental variables:
7171

72-
### List of requests
72+
| Variable Name | Purpose | Header equivalent | Default Value |
73+
| :--------------------- | :------------------------------------------------- | ----------------- | :-----------: |
74+
| `CLOPOS_CLIENT_ID` | Client ID given by Clopos (used only for auth) | `-` | `-` |
75+
| `CLOPOS_CLIENT_SECRET` | Client Secret given by Clopos (used only for auth) | `-` | `-` |
76+
| `CLOPOS_BRAND` | Brand that you want to request | `x-brand` | `-` |
77+
| `CLOPOS_VENUE_ID` | Venue/Branch id that you want to request | `x-venue` | `-` |
78+
79+
Note that, these values MIGHT be unset. In this case, you should send it in header of each request. Let's say you want to request menu categories of two venues separately:
80+
81+
```python
82+
# CLOPOS_CLIENT_ID, CLOPOS_CLIENT_SECRET and CLOPOS_BRAND have been set as env variables
83+
from integrify.clopos.client import CloposClient
84+
85+
venue1_id=1
86+
venue2_id=2
87+
88+
token1 = CloposClient.auth(venue_id=venue1_id).body.token
89+
categories1 = CloposClient.get_categories(headers={'x-token': token1, 'x-venue': venue1_id}).body.data
90+
91+
token2 = CloposClient.auth(venue_id=venue2_id).body.token
92+
categories2 = CloposClient.get_categories(headers={'x-token': token1, 'x-venue': venue2_id}).body.data
93+
```
7394

74-
| Sorğu funksiyası | Məqsəd | Clopos API | Callback-ə sorğu atılır |
75-
| :--------------- | :----- | :--------: | :---------------------: |
95+
If you want to fetch categories from different brand, just manually add `x-brand` to the header.
7696

77-
### Callback Sorğusu
97+
For auth, instead of headers, you will just send these as params.
7898

79-
### Callback Data formatı
99+
```python
100+
# No env was set
101+
from integrify.clopos.client import CloposClient
102+
103+
client_id='eNUKI04aYJRU6TBhh5bwUrvmEORgQoxM'
104+
client_secret='dqYkWUpDjzvKOgbP3ar8tSNKJbwMyYe1V5R7DHClfSNYkap5C5XxRA6PmzoPv1I2'
105+
brand='openapitest'
106+
venue_id='1'
107+
108+
token = CloposClient.auth(client_id=client_id, client_secret=client_secret, brand=brand, venue_id=venue_id).body.token
109+
```
110+
111+
### List of requests
112+
113+
| Request function | Purpose | Clopos API |
114+
| :-------------------- | :-------------------------- | :-------------------------: |
115+
| `auth` | Authenticate, get token | `/open-api/auth` |
116+
| `get_venues` | Get list of venues/branches | `/open-api/venues` |
117+
| `get_users` | Get list of users | `/open-api/users` |
118+
| `get_user_by_id` | Get user by id | `/open-api/users/{id}` |
119+
| `get_customers` | Get list of customers | `/open-api/customers` |
120+
| `get_customer_by_id` | Get customer by id | `/open-api/customers/{id}` |
121+
| `get_customer_groups` | Get list of customer groups | `/open-api/customer-group` |
122+
| `get_categories` | Get list of menu categories | `/open-api/categories` |
123+
| `get_category_by_id` | Get menu category by id | `/open-api/categories/{id}` |
124+
| `get_stations` | Get list of stations | `/open-api/stations` |
125+
| `get_station_by_id` | Get station by id | `/open-api/stations/{id}` |
126+
| `get_products` | Get list of products | `/open-api/products` |
127+
| `get_product_by_id` | Get product by id | `/open-api/products/{id}` |
128+
| `get_sale_types` | Get list of sale types | `/open-api/sale-types` |
129+
| `get_payment_methods` | Get list of payment methods | `/open-api/payment-methods` |
130+
| `get_orders` | Get list of orders | `/open-api/orders` |
131+
| `get_order_by_id` | Get order by id | `/open-api/orders/{id}` |
132+
| `create_order` | Create new order | `/open-api/orders` |
133+
| `get_receipts` | Get list of receipts | `/open-api/receipts` |
134+
| `get_receipt_by_id` | Get receipt by id | `/open-api/receipts/{id}` |
135+
| `create_receipt` | Create a new receipt | `/open-api/receipts` |
136+
| `delete_receipt` | Delete a receipt | `/open-api/receipts/{id}` |
137+
138+
Note that, each request should have parameter `headers={'x-token': token}`. For example:
139+
140+
```python
141+
# CLOPOS_CLIENT_ID, CLOPOS_CLIENT_SECRET, CLOPOS_BRAND and CLOPOS_VENUE_ID have been set as env variables
142+
143+
from integrify.clopos.client import CloposClient
144+
145+
token = CloposClient.auth().body.token
146+
user = CloposClient.get_user_by_id(id=1, headers={'x-token': token}).body.data
147+
```
80148

81149
> [!Caution]
82150
> Integrify is unofficial library, even though it is based on official documentation.

docs/az/docs/integrations/{replace}/about.md renamed to docs/az/docs/integrations/clopos/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Clopos
22

33
???+ warning
4-
To use these requests you need to set correct environmental variables. Read more about them [here](./env.md).
4+
To use these requests you need to set correct environmental variables. Read more about them [here](./env.md).
55

66
## Official Documentation (v1.0.1) { #official-documentation }
77

docs/az/docs/integrations/{replace}/api-reference/callback.md renamed to docs/az/docs/integrations/clopos/api-reference/callback.md

File renamed without changes.

docs/az/docs/integrations/{replace}/api-reference/client.md renamed to docs/az/docs/integrations/clopos/api-reference/client.md

File renamed without changes.

docs/az/docs/integrations/{replace}/api-reference/helper-functions.md renamed to docs/az/docs/integrations/clopos/api-reference/helper-functions.md

File renamed without changes.

docs/az/docs/integrations/{replace}/api-reference/response.md renamed to docs/az/docs/integrations/clopos/api-reference/response.md

File renamed without changes.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# {Replace} mühit dəyişənləri
2+
3+
To use these requests you need to set these environmental variables:
4+
5+
| Variable Name | Purpose | Header equivalent | Default Value |
6+
| :--------------------- | :------------------------------------------------- | ----------------- | :-----------: |
7+
| `CLOPOS_CLIENT_ID` | Client ID given by Clopos (used only for auth) | `-` | `-` |
8+
| `CLOPOS_CLIENT_SECRET` | Client Secret given by Clopos (used only for auth) | `-` | `-` |
9+
| `CLOPOS_BRAND` | Brand that you want to request | `x-brand` | `-` |
10+
| `CLOPOS_VENUE_ID` | Venue/Branch id that you want to request | `x-venue` | `-` |
11+
12+
Note that, these values MIGHT be unset. In this case, you should send it in header of each request. Let's say you want to request menu categories of two venues separately:
13+
14+
```python
15+
# CLOPOS_CLIENT_ID, CLOPOS_CLIENT_SECRET and CLOPOS_BRAND have been set as env variables
16+
from integrify.clopos.client import CloposClient
17+
18+
venue1_id=1
19+
venue2_id=2
20+
21+
token1 = CloposClient.auth(venue_id=venue1_id).body.token
22+
categories1 = CloposClient.get_categories(headers={'x-token': token1, 'x-venue': venue1_id}).body.data
23+
24+
token2 = CloposClient.auth(venue_id=venue2_id).body.token
25+
categories2 = CloposClient.get_categories(headers={'x-token': token1, 'x-venue': venue2_id}).body.data
26+
```
27+
28+
If you want to fetch categories from different brand, just manually add `x-brand` to the header.
29+
30+
For auth, instead of headers, you will just send these as params.
31+
32+
```python
33+
# No env was set
34+
from integrify.clopos.client import CloposClient
35+
36+
client_id='eNUKI04aYJRU6TBhh5bwUrvmEORgQoxM'
37+
client_secret='dqYkWUpDjzvKOgbP3ar8tSNKJbwMyYe1V5R7DHClfSNYkap5C5XxRA6PmzoPv1I2'
38+
brand='openapitest'
39+
venue_id='1'
40+
41+
token = CloposClient.auth(client_id=client_id, client_secret=client_secret, brand=brand, venue_id=venue_id).body.token
42+
```
43+
44+
45+
## .env template
46+
47+
```text
48+
49+
```

docs/az/docs/integrations/{replace}/env.md

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Clopos
2+
3+
???+ warning
4+
To use these requests you need to set correct environmental variables. Read more about them [here](./env.md).
5+
6+
## Official Documentation (v1.0.1) { #official-documentation }
7+
8+
[English](https://developer.clopos.com/)
9+
10+
## List of requests { #list-of-requests }
11+
12+
| Request function | Purpose | Clopos API |
13+
| :-------------------- | :-------------------------- | :-------------------------: |
14+
| `auth` | Authenticate, get token | `/open-api/auth` |
15+
| `get_venues` | Get list of venues/branches | `/open-api/venues` |
16+
| `get_users` | Get list of users | `/open-api/users` |
17+
| `get_user_by_id` | Get user by id | `/open-api/users/{id}` |
18+
| `get_customers` | Get list of customers | `/open-api/customers` |
19+
| `get_customer_by_id` | Get customer by id | `/open-api/customers/{id}` |
20+
| `get_customer_groups` | Get list of customer groups | `/open-api/customer-group` |
21+
| `get_categories` | Get list of menu categories | `/open-api/categories` |
22+
| `get_category_by_id` | Get menu category by id | `/open-api/categories/{id}` |
23+
| `get_stations` | Get list of stations | `/open-api/stations` |
24+
| `get_station_by_id` | Get station by id | `/open-api/stations/{id}` |
25+
| `get_products` | Get list of products | `/open-api/products` |
26+
| `get_product_by_id` | Get product by id | `/open-api/products/{id}` |
27+
| `get_sale_types` | Get list of sale types | `/open-api/sale-types` |
28+
| `get_payment_methods` | Get list of payment methods | `/open-api/payment-methods` |
29+
| `get_orders` | Get list of orders | `/open-api/orders` |
30+
| `get_order_by_id` | Get order by id | `/open-api/orders/{id}` |
31+
| `create_order` | Create new order | `/open-api/orders` |
32+
| `get_receipts` | Get list of receipts | `/open-api/receipts` |
33+
| `get_receipt_by_id` | Get receipt by id | `/open-api/receipts/{id}` |
34+
| `create_receipt` | Create a new receipt | `/open-api/receipts` |
35+
| `delete_receipt` | Delete a receipt | `/open-api/receipts/{id}` |
36+
37+
## Usage
38+
39+
First of all, one should use `auth` method to acquire token. This token is used in all future API calls. Bear in mind that, these tokens are active for one hour. After one hour, token automatically expires, and you should again use `auth` to get a new one. This workflow responsibility falls on user.
40+
41+
After acquiring token, for any subsequent call, just use `headers={'token': token}` argument for any call. For other arguments that specific APIs might need, please check [API reference](api-reference/client.md).
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Clopos client API Reference
2+
3+
???+ note
4+
5+
Below shown examples are for sync requests. To use async requests, just import async client,
6+
and call same-name functions with `await`:
7+
8+
```python
9+
from integrify.clopos import CloposAsyncRequest
10+
```
11+
12+
::: integrify.clopos.client.CloposRequest
13+
handler: python
14+
options:
15+
separate_signature: true
16+
17+
::: integrify.clopos.client.CloposAsyncRequest
18+
handler: python
19+
options:
20+
separate_signature: true
21+
22+
???+ note
23+
24+
These are already create class objects, considered for direct use. Otherwise, you should create
25+
instance at every call, such as: `CloposClientClass().auth()`
26+
27+
::: integrify.clopos.client.CloposClientClass
28+
handler: python
29+
options:
30+
separate_signature: true
31+
members:
32+
- auth
33+
- get_venues
34+
- get_users
35+
- get_user_by_id
36+
- get_customers
37+
- get_customer_by_id
38+
- get_customer_groups
39+
- get_categories
40+
- get_category_by_id
41+
- get_stations
42+
- get_station_by_id
43+
- get_products
44+
- get_product_by_id
45+
- get_sale_types
46+
- get_payment_methods
47+
- get_orders
48+
- get_order_by_id
49+
- create_order
50+
- update_order
51+
- get_receipts
52+
- get_receipt_by_id
53+
- create_receipt
54+
- delete_receipt

0 commit comments

Comments
 (0)