Skip to content

Commit 004419f

Browse files
Merge branch 'master' into users/sramaraj/file-upload-example
2 parents fa25834 + 9afac65 commit 004419f

38 files changed

+1834
-112
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @mure @spanglerco @cameronwaterman
1+
* @rbell517 @spanglerco @cameronwaterman

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ['3.9', '3.10', '3.11', '3.12']
14+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Install poetry

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
<!--next-version-placeholder-->
44

5+
## v1.9.0 (2025-02-06)
6+
7+
### Feature
8+
9+
* Add minimal client implementation for Feeds API ([#73](https://github.com/ni/nisystemlink-clients-python/issues/73)) ([`35d32b5`](https://github.com/ni/nisystemlink-clients-python/commit/35d32b580488b1365165f8c6e0a96e8148169b1d))
10+
11+
## v1.8.1 (2025-02-05)
12+
13+
### Fix
14+
15+
* Update to the latest httpx version ([#88](https://github.com/ni/nisystemlink-clients-python/issues/88)) ([`09e6e59`](https://github.com/ni/nisystemlink-clients-python/commit/09e6e59e1025d0046da08dd9743d0ac3fc0872f2))
16+
17+
## v1.8.0 (2024-11-08)
18+
19+
### Feature
20+
21+
* Add client for SystemLink products API ([#69](https://github.com/ni/nisystemlink-clients-python/issues/69)) ([`d53a9f4`](https://github.com/ni/nisystemlink-clients-python/commit/d53a9f43aee5abbf1e9db084b091390b148478a5))
22+
523
## v1.7.2 (2024-11-05)
624

725
### Fix

docs/api_reference.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ API Reference
99

1010
api_reference/core
1111
api_reference/tag
12+
api_reference/product
1213
api_reference/testmonitor
1314
api_reference/dataframe
1415
api_reference/spec
1516
api_reference/file
17+
api_reference/feeds
1618

1719
Indices and tables
1820
------------------

docs/api_reference/feeds.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. _api_tag_page:
2+
3+
nisystemlink.clients.feeds
4+
======================
5+
6+
.. autoclass:: nisystemlink.clients.feeds.FeedsClient
7+
:exclude-members: __init__
8+
9+
.. automethod:: __init__
10+
.. automethod:: create_feed
11+
.. automethod:: query_feeds
12+
.. automethod:: upload_package
13+
.. automethod:: upload_package_content
14+
.. automethod:: delete_feed
15+
16+
.. automodule:: nisystemlink.clients.feeds.models
17+
:members:
18+
:imported-members:

docs/api_reference/product.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. _api_tag_page:
2+
3+
nisystemlink.clients.product
4+
======================
5+
6+
.. autoclass:: nisystemlink.clients.product.ProductClient
7+
:exclude-members: __init__
8+
9+
.. automethod:: __init__
10+
.. automethod:: create_products
11+
.. automethod:: get_products
12+
.. automethod:: query_products
13+
.. automethod:: query_product_values
14+
.. automethod:: update_products
15+
.. automethod:: delete_product
16+
.. automethod:: delete_products
17+
18+
.. automodule:: nisystemlink.clients.product.models
19+
:members:
20+
:imported-members:
21+
22+
.. automodule:: nisystemlink.clients.product.utilities
23+
:members:

docs/getting_started.rst

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,34 @@ Subscribe to tag changes
7676
:language: python
7777
:linenos:
7878

79+
80+
Product API
81+
-------
82+
83+
Overview
84+
~~~~~~~~
85+
86+
The :class:`.ProductClient` class is the primary entry point of the Product API.
87+
88+
When constructing a :class:`.ProductClient`, you can pass an
89+
:class:`.HttpConfiguration` (like one retrieved from the
90+
:class:`.HttpConfigurationManager`), or let :class:`.ProductClient` use the
91+
default connection. The default connection depends on your environment.
92+
93+
With a :class:`.ProductClient` object, you can:
94+
95+
* Create, update, query, and delete Products
96+
97+
Examples
98+
~~~~~~~~
99+
100+
Create, query, update, and delete some products
101+
102+
.. literalinclude:: ../examples/product/products.py
103+
:language: python
104+
:linenos:
105+
106+
79107
DataFrame API
80108
-------
81109

@@ -158,7 +186,6 @@ Update and Delete Specifications
158186
:language: python
159187
:linenos:
160188

161-
162189
File API
163190
-------
164191

@@ -188,5 +215,41 @@ Get the metadata of a File using its Id and download it.
188215
Upload a File from disk or memory to SystemLink
189216

190217
.. literalinclude:: ../examples/file/upload_file.py
218+
219+
Feeds API
220+
-------
221+
222+
Overview
223+
~~~~~~~~
224+
225+
The :class:`.FeedsClient` class is the primary entry point of the Feeds API.
226+
227+
When constructing a :class:`.FeedsClient`, you can pass an
228+
:class:`.HttpConfiguration` (like one retrieved from the
229+
:class:`.HttpConfigurationManager`), or let :class:`.FeedsClient` use the
230+
default connection. The default connection depends on your environment.
231+
232+
With a :class:`.FeedsClient` object, you can:
233+
234+
* Get the list of feeds, create feed, upload package to feed and delete feed.
235+
236+
Examples
237+
~~~~~~~~
238+
239+
Create a new feed.
240+
241+
.. literalinclude:: ../examples/feeds/create_feed.py
242+
:language: python
243+
:linenos:
244+
245+
Query feeds and upload a package to feed.
246+
247+
.. literalinclude:: ../examples/feeds/query_and_upload_feeds.py
248+
:language: python
249+
:linenos:
250+
251+
Delete a feed.
252+
253+
.. literalinclude:: ../examples/feeds/delete_feed.py
191254
:language: python
192255
:linenos:

examples/feeds/create_feed.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Functionality of creating feeds APIs."""
2+
3+
from nisystemlink.clients.core import ApiException, HttpConfiguration
4+
from nisystemlink.clients.feeds._feeds_client import FeedsClient
5+
from nisystemlink.clients.feeds.models import (
6+
CreateFeedRequest,
7+
Platform,
8+
)
9+
10+
# Update the constants.
11+
FEED_NAME = ""
12+
FEED_DESCRIPTION = ""
13+
PLATFORM = Platform.WINDOWS
14+
WORKSPACE_ID = (
15+
None # None uses Default workspace. Replace with Systemlink workspace id.
16+
)
17+
18+
server_url = "" # SystemLink API URL
19+
server_api_key = "" # SystemLink API key
20+
21+
# Provide the valid API key and API URL for client initialization.
22+
client = FeedsClient(HttpConfiguration(api_key=server_api_key, server_uri=server_url))
23+
24+
# Creating Feeds.
25+
try:
26+
feed_request = CreateFeedRequest(
27+
name=FEED_NAME,
28+
description=FEED_DESCRIPTION,
29+
platform=PLATFORM,
30+
workspace=WORKSPACE_ID,
31+
)
32+
feed_details = client.create_feed(feed=feed_request)
33+
34+
print("Feed created Successfully.")
35+
print(f"Created feed details: {feed_details}")
36+
37+
except ApiException as exp:
38+
print(exp)
39+
except Exception as exp:
40+
print(exp)

examples/feeds/delete_feed.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Functionality of deleting feed API."""
2+
3+
from nisystemlink.clients.core import ApiException, HttpConfiguration
4+
from nisystemlink.clients.feeds._feeds_client import FeedsClient
5+
from nisystemlink.clients.feeds.models import Platform
6+
from nisystemlink.clients.feeds.utilities._get_feed_details import get_feed_by_name
7+
8+
# Update the constants.
9+
FEED_NAME = ""
10+
PLATFORM = Platform.WINDOWS
11+
WORKSPACE_ID = (
12+
None # None uses Default workspace. Replace with Systemlink workspace id.
13+
)
14+
15+
server_url = "" # SystemLink API URL
16+
server_api_key = "" # SystemLink API key
17+
18+
# Provide the valid API key and API URL for client initialization.
19+
client = FeedsClient(HttpConfiguration(api_key=server_api_key, server_uri=server_url))
20+
21+
# Deleting Feed.
22+
try:
23+
# Get ID of the Feed to delete by name
24+
feeds = client.query_feeds(platform=PLATFORM, workspace=WORKSPACE_ID)
25+
feed = get_feed_by_name(feeds=feeds, name=FEED_NAME)
26+
feed_id = feed.id if feed else None
27+
28+
# Delete the Feed by ID
29+
if feed_id:
30+
client.delete_feed(id=feed_id)
31+
print("Feed deleted successfully.")
32+
33+
except ApiException as exp:
34+
print(exp)
35+
except Exception as exp:
36+
print(exp)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Functionality of uploading & querying feeds APIs."""
2+
3+
from nisystemlink.clients.core import ApiException, HttpConfiguration
4+
from nisystemlink.clients.feeds._feeds_client import FeedsClient
5+
from nisystemlink.clients.feeds.models import Platform
6+
from nisystemlink.clients.feeds.utilities._get_feed_details import get_feed_by_name
7+
8+
# Update the constants.
9+
FEED_NAME = ""
10+
PLATFORM = None
11+
FEED_DESCRIPTION = ""
12+
PLATFORM = Platform.WINDOWS
13+
WORKSPACE_ID = (
14+
None # None uses Default workspace. Replace with Systemlink workspace id.
15+
)
16+
PACKAGE_PATH = ""
17+
18+
server_url = "" # SystemLink API URL
19+
server_api_key = "" # SystemLink API key
20+
21+
# Provide the valid API key and API URL for client initialization.
22+
client = FeedsClient(HttpConfiguration(api_key=server_api_key, server_uri=server_url))
23+
24+
# To upload a package to feed.
25+
try:
26+
# Get ID of the Feed to upload by name
27+
feeds = client.query_feeds(platform=PLATFORM, workspace=WORKSPACE_ID)
28+
feed = get_feed_by_name(feeds=feeds, name=FEED_NAME)
29+
feed_id = feed.id if feed else None
30+
31+
# Upload the package to Feed by ID
32+
if feed_id:
33+
client.upload_package(
34+
feed_id=feed_id,
35+
overwrite=True,
36+
package_file_path=PACKAGE_PATH,
37+
)
38+
print("Package uploaded sucessfully.")
39+
40+
except ApiException as exp:
41+
print(exp)
42+
43+
except Exception as exp:
44+
print(exp)

0 commit comments

Comments
 (0)