diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-05 06:37:07 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 06:37:07 +0000 |
| commit | 23f85471a19be634ed4c629e6b15376040bed941 (patch) | |
| tree | 57f6f80c93fdaf95486bdd50cb26abad9e63beab | |
| parent | 5a2922199efd3f57d7849cd9c78fc411922c3ab4 (diff) | |
automatic import of python-pyonfleetopeneuler20.03
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-pyonfleet.spec | 759 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 761 insertions, 0 deletions
@@ -0,0 +1 @@ +/pyonfleet-1.3.1.tar.gz diff --git a/python-pyonfleet.spec b/python-pyonfleet.spec new file mode 100644 index 0000000..d0b8217 --- /dev/null +++ b/python-pyonfleet.spec @@ -0,0 +1,759 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pyonfleet +Version: 1.3.1 +Release: 1 +Summary: Onfleet's Python API Wrapper Package +License: LICENSE +URL: http://docs.onfleet.com +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/4e/0e/f42538883adc7374d7fe32f0b68facf42e15316eb03189055ff54e1c409f/pyonfleet-1.3.1.tar.gz +BuildArch: noarch + +Requires: python3-requests +Requires: python3-ratelimit +Requires: python3-backoff + +%description +# Onfleet Python Wrapper + + +[](https://github.com/onfleet/pyonfleet/blob/master/LICENSE) +[](https://pypi.org/project/pyonfleet/) + +[](https://pypi.org/project/pyonfleet/) + +> *Read this document in another language*: +> [正體中文](https://github.com/onfleet/pyonfleet/blob/master/README.zh-tw.md) +> [Español](https://github.com/onfleet/pyonfleet/blob/master/README.es.md) + +Visit our blog post on the [API wrapper project](https://onfleet.com/blog/api-wrappers-explained/) to learn more about our initiatives. +If you have any questions, please reach us by submitting an issue [here](https://github.com/onfleet/pyonfleet/issues) or contact support@onfleet.com. + +## Table of contents +* [Table of contents](#table-of-contents) +* [Synopsis](#synopsis) +* [Installation](#installation) +* [Usage](#usage) + - [Unit testing using Docker](#unit-testing-using-docker) + - [Throttling](#throttling) + - [Responses](#responses) + - [Supported CRUD operations](#supported-crud-operations) + * [GET Requests](#get-requests) + - [Examples of `get()`](#examples-of-get) + - [Examples of `get(param)`](#examples-of-getparam) + - [Examples of `getByLocation`](#examples-of-getbylocation) + * [POST Requests](#post-requests) + - [Examples of `create()`](#examples-of-create) + * [PUT Requests](#put-requests) + - [Examples of `update()`](#examples-of-update) + - [Examples of `insertTask()`](#examples-of-inserttask) + * [DELETE Requests](#delete-requests) + - [Examples of `deleteOne()`](#examples-of-deleteone) + +## Synopsis +The Onfleet Python library provides convenient access to the Onfleet API. + +## Installation +``` +pip install pyonfleet +``` + +## Usage +Before using the API wrapper, you will need to obtain an API key from one of your organization's admins. + +Creation and integration of API keys are performed through the [Onfleet dashboard](https://onfleet.com/dashboard#/manage). + +To authenticate, you will also need to create a file named `.auth.json` under your working directory –this is where you will store your API credentials. + +The format of `.auth.json` is shown below: +```json +{ + "API_KEY": "<your_api_key>" +} +``` + +You can also opt in to not store your API key here and pass it as param to `Onfleet`: +```python +from onfleet import Onfleet + +# Option 1 - Recommended +onfleet_api = Onfleet() # Using the .auth.json file + +# Option 2 +onfleet_api = Onfleet(api_key="<your_api_key>") # Without the .auth.json file +``` + +Once the `Onfleet` object is created, you will get access to all the API endpoints as documented in the [Onfleet API documentation](https://docs.onfleet.com/). + +### Unit testing using Docker + +`docker-compose up --build` + +### Throttling +Rate limiting is enforced by the API with a threshold of 20 requests per second across all your organization's API keys. Learn more about it [here](https://docs.onfleet.com/reference#throttling). + +### Responses +Responses of this library are instances of [Response](https://2.python-requests.org//en/master/api/#requests.Response) from the `requests` library. + +### Supported CRUD operations +Here are the operations available for each entity: + +| Entity | GET | POST | PUT | DELETE | +| :-: | :-: | :-: | :-: | :-: | +| [Admins/Administrators](https://docs.onfleet.com/reference#administrators) | get() | create(body={})<br />matchMetadata(body={}) | update(id, body={}) | deleteOne(id) | +| [Containers](https://docs.onfleet.com/reference#containers) | get(workers=id)<br />get(teams=id)<br />get(organizations=id) | x | update(id, body={}) | x | +| [Destinations](https://docs.onfleet.com/reference#destinations) | get(id) | create(body={})<br />matchMetadata(body={}) | x | x | +| [Hubs](https://docs.onfleet.com/reference#hubs) | get() | create(body={}) | update(id, body={}) | x | +| [Organization](https://docs.onfleet.com/reference#organizations) | get()<br />get(id) | x | insertTask(id, body={}) | x | +| [Recipients](https://docs.onfleet.com/reference#recipients) | get(id)<br />get(name='')<br />get(phone='') | create(body={})<br />matchMetadata(body={}) | update(id, body={}) | x | +| [Tasks](https://docs.onfleet.com/reference#tasks) | get(queryParams={})<br />get(id)<br />get(shortId=id) | create(body={})<br />clone(id)<br />forceComplete(id)<br />batch(body={})<br />autoAssign(body={})<br />matchMetadata(body={}) | update(id, body={}) | deleteOne(id) | +| [Teams](https://docs.onfleet.com/reference#teams) | get()<br />get(id)<br />getWorkerEta(id, queryParams={})<br />getTasks(id, queryParams={}) | create(body={})<br />autoDispatch(id, body={}) | update(id, body={})<br />insertTask(id, body={}) | deleteOne(id) | +| [Webhooks](https://docs.onfleet.com/reference#webhooks) | get() | create(body={}) | x | deleteOne(id) | +| [Workers](https://docs.onfleet.com/reference#workers) | get()<br />get(id)<br />get(queryParams={})<br />getByLocation(queryParams={})<br />getSchedule(id)<br />getTasks(id, queryParams={}) | create(body={})<br />setSchedule(id, body={})<br />matchMetadata(body={}) | update(id, body={})<br />insertTask(id, body={}) | deleteOne(id) | + +#### GET Requests +To get all the documents within an endpoint: +```python +get() +``` + +##### Examples of `get()` +```python +onfleet_api.workers.get() +onfleet_api.workers.get(queryParams="") +``` + +Optionally you can use `queryParams` for some certain endpoints. +Refer back to [API documentation](https://docs.onfleet.com/) for endpoints that support query parameters. +```python +# Option 1 +onfleet_api.workers.get(queryParams={"phones": "<phone_number>"}) + +# Option 2 +onfleet_api.workers.get(queryParams="phones=<phone_number>") +``` + +To get one of the document within an endpoint, specify the param that you wish to search by: +```python +get(param="<value>") +``` + +##### Examples of `get(param)` +```python +onfleet_api.workers.get(id="<24_digit_ID>") +onfleet_api.workers.get(id="<24_digit_ID>", queryParams={"analytics": "true"}) + +onfleet_api.tasks.get(shortId="<shortId>") + +onfleet_api.recipients.get(phone="<phone_number>") +onfleet_api.recipients.get(name="<name>") + +onfleet_api.containers.get(workers="<worker_ID>") +onfleet_api.containers.get(teams="<team_ID>") +onfleet_api.containers.get(organizations="<organization_ID>") +``` + +To get a driver by location, use the `getByLocation` function: +```python +getByLocation(queryParams="<location_params>") +``` + +##### Examples of `getByLocation` +```python +location_params = { + "longitude": "-122.4", + "latitude": "37.7601983", + "radius": "6000", +} + +onfleet_api.workers.getByLocation(queryParams=location_params) +``` + +#### POST Requests +To create a document within an endpoint: +```python +create(body="<data>") +``` + +##### Examples of `create()` +```python +data = { + "name": "John Driver", + "phone": "+16173428853", + "teams": ["<team_ID>", "<team_ID> (optional)", "..."], + "vehicle": { + "type": "CAR", + "description": "Tesla Model S", + "licensePlate": "FKNS9A", + "color": "purple", + }, +} + +onfleet_api.workers.create(body=data) +``` + +Extended POST requests include `clone`, `forceComplete`, `batchCreate`, `autoAssign` on the *Tasks* endpoint; `setSchedule` on the *Workers* endpoint; `autoDispatch` on the *Teams* endpoint; and `matchMetadata` on all supported entities. For instance: + +```python +onfleet_api.tasks.clone(id="<24_digit_ID>") +onfleet_api.tasks.forceComplete(id="<24_digit_ID>", body="<data>") +onfleet_api.tasks.batchCreate(body="<data>") +onfleet_api.tasks.autoAssign(body="<data>") + +onfleet_api.workers.setSchedule(id="<24_digit_ID>", body="<data>") + +onfleet_api.teams.autoDispatch(id="<24_digit_ID>", body="<data>") + +onfleet_api.<entity_name_pluralized>.matchMetadata(body="<data>") +``` + +For more details, check our documentation on [`clone`](https://docs.onfleet.com/reference#clone-task), [`forceComplete`](https://docs.onfleet.com/reference#complete-task), [`batchCreate`](https://docs.onfleet.com/reference#create-tasks-in-batch), [`autoAssign`](https://docs.onfleet.com/reference#automatically-assign-list-of-tasks), [`setSchedule`](https://docs.onfleet.com/reference#set-workers-schedule), [`matchMetadata`](https://docs.onfleet.com/reference#querying-by-metadata), and [`autoDispatch`](https://docs.onfleet.com/reference#team-auto-dispatch). + + +#### PUT Requests +To update a document within an endpoint: +```python +update(id="<24_digit_ID>", body="<data>") +``` + +##### Examples of `update()` +```python +new_data = { + "name": "Jack Driver", +} + +onfleet_api.workers.update(id="<24_digit_ID>", body=new_data) +``` + +##### Examples of `insertTask()` +```python +onfleet_api.workers.insertTask(id="<24_digit_ID>", body="<data>") +``` + +#### DELETE Requests +To delete a document within an endpoint: +```python +deleteOne(id="<24_digit_ID>") +``` + +##### Examples of `deleteOne()` +```python +onfleet_api.workers.deleteOne(id="<24_digit_ID>") +``` + +*Go to [top](#onfleet-python-wrapper)*. + + +%package -n python3-pyonfleet +Summary: Onfleet's Python API Wrapper Package +Provides: python-pyonfleet +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pyonfleet +# Onfleet Python Wrapper + + +[](https://github.com/onfleet/pyonfleet/blob/master/LICENSE) +[](https://pypi.org/project/pyonfleet/) + +[](https://pypi.org/project/pyonfleet/) + +> *Read this document in another language*: +> [正體中文](https://github.com/onfleet/pyonfleet/blob/master/README.zh-tw.md) +> [Español](https://github.com/onfleet/pyonfleet/blob/master/README.es.md) + +Visit our blog post on the [API wrapper project](https://onfleet.com/blog/api-wrappers-explained/) to learn more about our initiatives. +If you have any questions, please reach us by submitting an issue [here](https://github.com/onfleet/pyonfleet/issues) or contact support@onfleet.com. + +## Table of contents +* [Table of contents](#table-of-contents) +* [Synopsis](#synopsis) +* [Installation](#installation) +* [Usage](#usage) + - [Unit testing using Docker](#unit-testing-using-docker) + - [Throttling](#throttling) + - [Responses](#responses) + - [Supported CRUD operations](#supported-crud-operations) + * [GET Requests](#get-requests) + - [Examples of `get()`](#examples-of-get) + - [Examples of `get(param)`](#examples-of-getparam) + - [Examples of `getByLocation`](#examples-of-getbylocation) + * [POST Requests](#post-requests) + - [Examples of `create()`](#examples-of-create) + * [PUT Requests](#put-requests) + - [Examples of `update()`](#examples-of-update) + - [Examples of `insertTask()`](#examples-of-inserttask) + * [DELETE Requests](#delete-requests) + - [Examples of `deleteOne()`](#examples-of-deleteone) + +## Synopsis +The Onfleet Python library provides convenient access to the Onfleet API. + +## Installation +``` +pip install pyonfleet +``` + +## Usage +Before using the API wrapper, you will need to obtain an API key from one of your organization's admins. + +Creation and integration of API keys are performed through the [Onfleet dashboard](https://onfleet.com/dashboard#/manage). + +To authenticate, you will also need to create a file named `.auth.json` under your working directory –this is where you will store your API credentials. + +The format of `.auth.json` is shown below: +```json +{ + "API_KEY": "<your_api_key>" +} +``` + +You can also opt in to not store your API key here and pass it as param to `Onfleet`: +```python +from onfleet import Onfleet + +# Option 1 - Recommended +onfleet_api = Onfleet() # Using the .auth.json file + +# Option 2 +onfleet_api = Onfleet(api_key="<your_api_key>") # Without the .auth.json file +``` + +Once the `Onfleet` object is created, you will get access to all the API endpoints as documented in the [Onfleet API documentation](https://docs.onfleet.com/). + +### Unit testing using Docker + +`docker-compose up --build` + +### Throttling +Rate limiting is enforced by the API with a threshold of 20 requests per second across all your organization's API keys. Learn more about it [here](https://docs.onfleet.com/reference#throttling). + +### Responses +Responses of this library are instances of [Response](https://2.python-requests.org//en/master/api/#requests.Response) from the `requests` library. + +### Supported CRUD operations +Here are the operations available for each entity: + +| Entity | GET | POST | PUT | DELETE | +| :-: | :-: | :-: | :-: | :-: | +| [Admins/Administrators](https://docs.onfleet.com/reference#administrators) | get() | create(body={})<br />matchMetadata(body={}) | update(id, body={}) | deleteOne(id) | +| [Containers](https://docs.onfleet.com/reference#containers) | get(workers=id)<br />get(teams=id)<br />get(organizations=id) | x | update(id, body={}) | x | +| [Destinations](https://docs.onfleet.com/reference#destinations) | get(id) | create(body={})<br />matchMetadata(body={}) | x | x | +| [Hubs](https://docs.onfleet.com/reference#hubs) | get() | create(body={}) | update(id, body={}) | x | +| [Organization](https://docs.onfleet.com/reference#organizations) | get()<br />get(id) | x | insertTask(id, body={}) | x | +| [Recipients](https://docs.onfleet.com/reference#recipients) | get(id)<br />get(name='')<br />get(phone='') | create(body={})<br />matchMetadata(body={}) | update(id, body={}) | x | +| [Tasks](https://docs.onfleet.com/reference#tasks) | get(queryParams={})<br />get(id)<br />get(shortId=id) | create(body={})<br />clone(id)<br />forceComplete(id)<br />batch(body={})<br />autoAssign(body={})<br />matchMetadata(body={}) | update(id, body={}) | deleteOne(id) | +| [Teams](https://docs.onfleet.com/reference#teams) | get()<br />get(id)<br />getWorkerEta(id, queryParams={})<br />getTasks(id, queryParams={}) | create(body={})<br />autoDispatch(id, body={}) | update(id, body={})<br />insertTask(id, body={}) | deleteOne(id) | +| [Webhooks](https://docs.onfleet.com/reference#webhooks) | get() | create(body={}) | x | deleteOne(id) | +| [Workers](https://docs.onfleet.com/reference#workers) | get()<br />get(id)<br />get(queryParams={})<br />getByLocation(queryParams={})<br />getSchedule(id)<br />getTasks(id, queryParams={}) | create(body={})<br />setSchedule(id, body={})<br />matchMetadata(body={}) | update(id, body={})<br />insertTask(id, body={}) | deleteOne(id) | + +#### GET Requests +To get all the documents within an endpoint: +```python +get() +``` + +##### Examples of `get()` +```python +onfleet_api.workers.get() +onfleet_api.workers.get(queryParams="") +``` + +Optionally you can use `queryParams` for some certain endpoints. +Refer back to [API documentation](https://docs.onfleet.com/) for endpoints that support query parameters. +```python +# Option 1 +onfleet_api.workers.get(queryParams={"phones": "<phone_number>"}) + +# Option 2 +onfleet_api.workers.get(queryParams="phones=<phone_number>") +``` + +To get one of the document within an endpoint, specify the param that you wish to search by: +```python +get(param="<value>") +``` + +##### Examples of `get(param)` +```python +onfleet_api.workers.get(id="<24_digit_ID>") +onfleet_api.workers.get(id="<24_digit_ID>", queryParams={"analytics": "true"}) + +onfleet_api.tasks.get(shortId="<shortId>") + +onfleet_api.recipients.get(phone="<phone_number>") +onfleet_api.recipients.get(name="<name>") + +onfleet_api.containers.get(workers="<worker_ID>") +onfleet_api.containers.get(teams="<team_ID>") +onfleet_api.containers.get(organizations="<organization_ID>") +``` + +To get a driver by location, use the `getByLocation` function: +```python +getByLocation(queryParams="<location_params>") +``` + +##### Examples of `getByLocation` +```python +location_params = { + "longitude": "-122.4", + "latitude": "37.7601983", + "radius": "6000", +} + +onfleet_api.workers.getByLocation(queryParams=location_params) +``` + +#### POST Requests +To create a document within an endpoint: +```python +create(body="<data>") +``` + +##### Examples of `create()` +```python +data = { + "name": "John Driver", + "phone": "+16173428853", + "teams": ["<team_ID>", "<team_ID> (optional)", "..."], + "vehicle": { + "type": "CAR", + "description": "Tesla Model S", + "licensePlate": "FKNS9A", + "color": "purple", + }, +} + +onfleet_api.workers.create(body=data) +``` + +Extended POST requests include `clone`, `forceComplete`, `batchCreate`, `autoAssign` on the *Tasks* endpoint; `setSchedule` on the *Workers* endpoint; `autoDispatch` on the *Teams* endpoint; and `matchMetadata` on all supported entities. For instance: + +```python +onfleet_api.tasks.clone(id="<24_digit_ID>") +onfleet_api.tasks.forceComplete(id="<24_digit_ID>", body="<data>") +onfleet_api.tasks.batchCreate(body="<data>") +onfleet_api.tasks.autoAssign(body="<data>") + +onfleet_api.workers.setSchedule(id="<24_digit_ID>", body="<data>") + +onfleet_api.teams.autoDispatch(id="<24_digit_ID>", body="<data>") + +onfleet_api.<entity_name_pluralized>.matchMetadata(body="<data>") +``` + +For more details, check our documentation on [`clone`](https://docs.onfleet.com/reference#clone-task), [`forceComplete`](https://docs.onfleet.com/reference#complete-task), [`batchCreate`](https://docs.onfleet.com/reference#create-tasks-in-batch), [`autoAssign`](https://docs.onfleet.com/reference#automatically-assign-list-of-tasks), [`setSchedule`](https://docs.onfleet.com/reference#set-workers-schedule), [`matchMetadata`](https://docs.onfleet.com/reference#querying-by-metadata), and [`autoDispatch`](https://docs.onfleet.com/reference#team-auto-dispatch). + + +#### PUT Requests +To update a document within an endpoint: +```python +update(id="<24_digit_ID>", body="<data>") +``` + +##### Examples of `update()` +```python +new_data = { + "name": "Jack Driver", +} + +onfleet_api.workers.update(id="<24_digit_ID>", body=new_data) +``` + +##### Examples of `insertTask()` +```python +onfleet_api.workers.insertTask(id="<24_digit_ID>", body="<data>") +``` + +#### DELETE Requests +To delete a document within an endpoint: +```python +deleteOne(id="<24_digit_ID>") +``` + +##### Examples of `deleteOne()` +```python +onfleet_api.workers.deleteOne(id="<24_digit_ID>") +``` + +*Go to [top](#onfleet-python-wrapper)*. + + +%package help +Summary: Development documents and examples for pyonfleet +Provides: python3-pyonfleet-doc +%description help +# Onfleet Python Wrapper + + +[](https://github.com/onfleet/pyonfleet/blob/master/LICENSE) +[](https://pypi.org/project/pyonfleet/) + +[](https://pypi.org/project/pyonfleet/) + +> *Read this document in another language*: +> [正體中文](https://github.com/onfleet/pyonfleet/blob/master/README.zh-tw.md) +> [Español](https://github.com/onfleet/pyonfleet/blob/master/README.es.md) + +Visit our blog post on the [API wrapper project](https://onfleet.com/blog/api-wrappers-explained/) to learn more about our initiatives. +If you have any questions, please reach us by submitting an issue [here](https://github.com/onfleet/pyonfleet/issues) or contact support@onfleet.com. + +## Table of contents +* [Table of contents](#table-of-contents) +* [Synopsis](#synopsis) +* [Installation](#installation) +* [Usage](#usage) + - [Unit testing using Docker](#unit-testing-using-docker) + - [Throttling](#throttling) + - [Responses](#responses) + - [Supported CRUD operations](#supported-crud-operations) + * [GET Requests](#get-requests) + - [Examples of `get()`](#examples-of-get) + - [Examples of `get(param)`](#examples-of-getparam) + - [Examples of `getByLocation`](#examples-of-getbylocation) + * [POST Requests](#post-requests) + - [Examples of `create()`](#examples-of-create) + * [PUT Requests](#put-requests) + - [Examples of `update()`](#examples-of-update) + - [Examples of `insertTask()`](#examples-of-inserttask) + * [DELETE Requests](#delete-requests) + - [Examples of `deleteOne()`](#examples-of-deleteone) + +## Synopsis +The Onfleet Python library provides convenient access to the Onfleet API. + +## Installation +``` +pip install pyonfleet +``` + +## Usage +Before using the API wrapper, you will need to obtain an API key from one of your organization's admins. + +Creation and integration of API keys are performed through the [Onfleet dashboard](https://onfleet.com/dashboard#/manage). + +To authenticate, you will also need to create a file named `.auth.json` under your working directory –this is where you will store your API credentials. + +The format of `.auth.json` is shown below: +```json +{ + "API_KEY": "<your_api_key>" +} +``` + +You can also opt in to not store your API key here and pass it as param to `Onfleet`: +```python +from onfleet import Onfleet + +# Option 1 - Recommended +onfleet_api = Onfleet() # Using the .auth.json file + +# Option 2 +onfleet_api = Onfleet(api_key="<your_api_key>") # Without the .auth.json file +``` + +Once the `Onfleet` object is created, you will get access to all the API endpoints as documented in the [Onfleet API documentation](https://docs.onfleet.com/). + +### Unit testing using Docker + +`docker-compose up --build` + +### Throttling +Rate limiting is enforced by the API with a threshold of 20 requests per second across all your organization's API keys. Learn more about it [here](https://docs.onfleet.com/reference#throttling). + +### Responses +Responses of this library are instances of [Response](https://2.python-requests.org//en/master/api/#requests.Response) from the `requests` library. + +### Supported CRUD operations +Here are the operations available for each entity: + +| Entity | GET | POST | PUT | DELETE | +| :-: | :-: | :-: | :-: | :-: | +| [Admins/Administrators](https://docs.onfleet.com/reference#administrators) | get() | create(body={})<br />matchMetadata(body={}) | update(id, body={}) | deleteOne(id) | +| [Containers](https://docs.onfleet.com/reference#containers) | get(workers=id)<br />get(teams=id)<br />get(organizations=id) | x | update(id, body={}) | x | +| [Destinations](https://docs.onfleet.com/reference#destinations) | get(id) | create(body={})<br />matchMetadata(body={}) | x | x | +| [Hubs](https://docs.onfleet.com/reference#hubs) | get() | create(body={}) | update(id, body={}) | x | +| [Organization](https://docs.onfleet.com/reference#organizations) | get()<br />get(id) | x | insertTask(id, body={}) | x | +| [Recipients](https://docs.onfleet.com/reference#recipients) | get(id)<br />get(name='')<br />get(phone='') | create(body={})<br />matchMetadata(body={}) | update(id, body={}) | x | +| [Tasks](https://docs.onfleet.com/reference#tasks) | get(queryParams={})<br />get(id)<br />get(shortId=id) | create(body={})<br />clone(id)<br />forceComplete(id)<br />batch(body={})<br />autoAssign(body={})<br />matchMetadata(body={}) | update(id, body={}) | deleteOne(id) | +| [Teams](https://docs.onfleet.com/reference#teams) | get()<br />get(id)<br />getWorkerEta(id, queryParams={})<br />getTasks(id, queryParams={}) | create(body={})<br />autoDispatch(id, body={}) | update(id, body={})<br />insertTask(id, body={}) | deleteOne(id) | +| [Webhooks](https://docs.onfleet.com/reference#webhooks) | get() | create(body={}) | x | deleteOne(id) | +| [Workers](https://docs.onfleet.com/reference#workers) | get()<br />get(id)<br />get(queryParams={})<br />getByLocation(queryParams={})<br />getSchedule(id)<br />getTasks(id, queryParams={}) | create(body={})<br />setSchedule(id, body={})<br />matchMetadata(body={}) | update(id, body={})<br />insertTask(id, body={}) | deleteOne(id) | + +#### GET Requests +To get all the documents within an endpoint: +```python +get() +``` + +##### Examples of `get()` +```python +onfleet_api.workers.get() +onfleet_api.workers.get(queryParams="") +``` + +Optionally you can use `queryParams` for some certain endpoints. +Refer back to [API documentation](https://docs.onfleet.com/) for endpoints that support query parameters. +```python +# Option 1 +onfleet_api.workers.get(queryParams={"phones": "<phone_number>"}) + +# Option 2 +onfleet_api.workers.get(queryParams="phones=<phone_number>") +``` + +To get one of the document within an endpoint, specify the param that you wish to search by: +```python +get(param="<value>") +``` + +##### Examples of `get(param)` +```python +onfleet_api.workers.get(id="<24_digit_ID>") +onfleet_api.workers.get(id="<24_digit_ID>", queryParams={"analytics": "true"}) + +onfleet_api.tasks.get(shortId="<shortId>") + +onfleet_api.recipients.get(phone="<phone_number>") +onfleet_api.recipients.get(name="<name>") + +onfleet_api.containers.get(workers="<worker_ID>") +onfleet_api.containers.get(teams="<team_ID>") +onfleet_api.containers.get(organizations="<organization_ID>") +``` + +To get a driver by location, use the `getByLocation` function: +```python +getByLocation(queryParams="<location_params>") +``` + +##### Examples of `getByLocation` +```python +location_params = { + "longitude": "-122.4", + "latitude": "37.7601983", + "radius": "6000", +} + +onfleet_api.workers.getByLocation(queryParams=location_params) +``` + +#### POST Requests +To create a document within an endpoint: +```python +create(body="<data>") +``` + +##### Examples of `create()` +```python +data = { + "name": "John Driver", + "phone": "+16173428853", + "teams": ["<team_ID>", "<team_ID> (optional)", "..."], + "vehicle": { + "type": "CAR", + "description": "Tesla Model S", + "licensePlate": "FKNS9A", + "color": "purple", + }, +} + +onfleet_api.workers.create(body=data) +``` + +Extended POST requests include `clone`, `forceComplete`, `batchCreate`, `autoAssign` on the *Tasks* endpoint; `setSchedule` on the *Workers* endpoint; `autoDispatch` on the *Teams* endpoint; and `matchMetadata` on all supported entities. For instance: + +```python +onfleet_api.tasks.clone(id="<24_digit_ID>") +onfleet_api.tasks.forceComplete(id="<24_digit_ID>", body="<data>") +onfleet_api.tasks.batchCreate(body="<data>") +onfleet_api.tasks.autoAssign(body="<data>") + +onfleet_api.workers.setSchedule(id="<24_digit_ID>", body="<data>") + +onfleet_api.teams.autoDispatch(id="<24_digit_ID>", body="<data>") + +onfleet_api.<entity_name_pluralized>.matchMetadata(body="<data>") +``` + +For more details, check our documentation on [`clone`](https://docs.onfleet.com/reference#clone-task), [`forceComplete`](https://docs.onfleet.com/reference#complete-task), [`batchCreate`](https://docs.onfleet.com/reference#create-tasks-in-batch), [`autoAssign`](https://docs.onfleet.com/reference#automatically-assign-list-of-tasks), [`setSchedule`](https://docs.onfleet.com/reference#set-workers-schedule), [`matchMetadata`](https://docs.onfleet.com/reference#querying-by-metadata), and [`autoDispatch`](https://docs.onfleet.com/reference#team-auto-dispatch). + + +#### PUT Requests +To update a document within an endpoint: +```python +update(id="<24_digit_ID>", body="<data>") +``` + +##### Examples of `update()` +```python +new_data = { + "name": "Jack Driver", +} + +onfleet_api.workers.update(id="<24_digit_ID>", body=new_data) +``` + +##### Examples of `insertTask()` +```python +onfleet_api.workers.insertTask(id="<24_digit_ID>", body="<data>") +``` + +#### DELETE Requests +To delete a document within an endpoint: +```python +deleteOne(id="<24_digit_ID>") +``` + +##### Examples of `deleteOne()` +```python +onfleet_api.workers.deleteOne(id="<24_digit_ID>") +``` + +*Go to [top](#onfleet-python-wrapper)*. + + +%prep +%autosetup -n pyonfleet-1.3.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pyonfleet -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.3.1-1 +- Package Spec generated @@ -0,0 +1 @@ +09aadd260df5ec5d441b2df953767abb pyonfleet-1.3.1.tar.gz |
