-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into dependabot/pip/development/virtualenv…
…-20.24.1
- Loading branch information
Showing
23 changed files
with
330 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.3.1 | ||
current_version = 0.3.4 | ||
commit = False | ||
tag = False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
- name: gitleaks | ||
uses: zricethezav/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: pip install -r req.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,58 @@ | ||
|
||
# === Using a Filtering for List calls === | ||
from emnify import EMnify | ||
from emnify import constants as emnify_constants | ||
|
||
emnify_client = EMnify(app_token='your_application_token') | ||
# To operate the emnify SDK, you need to generate an application token. | ||
# Step-by-step guide: https://www.emnify.com/developer-blog/how-to-use-an-application-token-for-api-authentication | ||
emnify_client = EMnify(app_token='YOUR_TOKEN') | ||
|
||
# Some methods that return multiple objects allow sorting and filtering. | ||
# This allows us to optimize processing time, since using filtering we can immediately get the necessary objects with | ||
# the necessary qualities, and sorting allows us to set the order in which objects are displayed. | ||
# Instead of sending several requests in search of the required object, we can reduce their number to one. | ||
# API reference: https://emnify.github.io/emnify-sdk-python/autoapi/index.html | ||
|
||
# For example - we want to find all SIM`s with specific customer organisation, first one for instance. | ||
# We need to initiate the model for filtering by specifying the necessary parameters in it as arguments. | ||
# This optimizes processing time because: | ||
# - Filtering lets you only retrieve the objects you need. | ||
# - Sorting allows you to set the order that objects are displayed. | ||
# Instead of sending several requests to get the required object, you only need one. | ||
|
||
# === Example: Filter a list of SIM cards === | ||
|
||
# This example finds all SIMs for a specific customer organization. | ||
# Start by initiating the model for filtering by specifying the necessary parameters as arguments. | ||
sim_filter = emnify_client.sim.get_sim_filter_model(customer_org=1) | ||
# To get the filtering model for filling, you need to get it as a property of a manager | ||
# for SIM cards, this would be get_sim_filter_model, for Devices it would be a get_device_filter_model | ||
|
||
# After initializing the model object, it must be passed as an argument that makes a request to get a list of objects. | ||
# Next, you need to get the filtering model for filling as a property of a manager. | ||
# For SIM cards: get_sim_filter_model | ||
# For devices: get_device_filter_model | ||
|
||
# After initializing the model object, pass it as an argument to request a list of objects. | ||
sims = emnify_client.sim.get_sim_list(filter_model=sim_filter) | ||
# sims now contains the objects we need with client organization 1 | ||
# Now, sims contains the objects for customer organization 1. | ||
|
||
# We can pass several parameters for filtering for a more detailed search for the necessary objects. | ||
# For a more detailed search, pass several parameters for filtering: | ||
sim_filter = emnify_client.sim.get_sim_filter_model( | ||
customer_org=1, | ||
status=emnify_constants.SimStatusesID.ACTIVATED_ID.value, | ||
production_date='2019-01-25' | ||
) | ||
|
||
# The request to get a list of SIM cards also has a separate filter, | ||
# which is passed as an argument to the filtering function - without a device. | ||
|
||
# The list SIM cards request also has a separate filter, passed as an argument. | ||
# The following example searches for SIMs without a device: | ||
sims_without_assigned_device = emnify_client.sim.get_sim_list(without_device=True) | ||
|
||
# === Example: Sort all devices === | ||
|
||
# === Using a Sorting for List calls === | ||
# Just like filtering, sorting allows us to reduce processing time by ordering objects in the server. | ||
# Thus, it is easier for you to group objects according to a certain attribute by specifying it in sorting. | ||
# Like filtering, sorting reduces processing time by ordering objects in the server. | ||
# Sorting also enables you to group objects by specifying a particular attribute. | ||
|
||
# For example - we want to get all devices sorted by last updated date | ||
# All sorting is done by using enums | ||
# The following example sorts all devices by the last updated date. | ||
# Note: All sorting uses enums. | ||
sort_parameter = emnify_client.devices.get_device_sort_enum.LAST_UPDATED.value | ||
|
||
# After choosing a parameter for filtering, we need to pass it as an argument sort_enum | ||
# After choosing a filtering parameter, pass it as an argument to sort_enum: | ||
sorted_devices = emnify_client.devices.get_devices_list( | ||
sort_enum=sort_parameter | ||
) | ||
|
||
# Now we got a list of devices, at the beginning of which are the recently updated devices | ||
# Now, you have a list of devices with the most recently updated at the top. | ||
for latest_device in sorted_devices: | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.