nisystemlink.clients.product
- class nisystemlink.clients.product.ProductClient(configuration=None)[source]
- __init__(configuration=None)[source]
Initialize an instance.
- Parameters
configuration (
Optional
[nisystemlink.clients.core.HttpConfiguration
]) – Defines the web server to connect to and information about how to connect. If not provided, theHttpConfigurationManager
is used to obtain the configuration.- Raises
ApiException – if unable to communicate with the Product Service.
- create_products(products)[source]
Creates one or more products and returns errors for failed creations.
- Parameters
products (
List
[nisystemlink.clients.product.models.Product
]) – A list of products to attempt to create.- Return type
nisystemlink.clients.product.models.CreateProductsPartialSuccess
- Returns: A list of created products, products that failed to create, and errors for
failures.
- Raises
ApiException – if unable to communicate with the
/nitestmonitor
service of provided invalid arguments.
- query_product_values(query)[source]
Queries for products that match the query and returns a list of the requested field.
- Parameters
query (
nisystemlink.clients.product.models.QueryProductValuesRequest
) – The query for the fields you want.- Return type
List
[str
]- Returns
A list of the values of the field you requested.
- Raises
ApiException – if unable to communicate with the
/nitestmonitor
Service or providedinvalid arguments. –
- update_products(products, replace=False)[source]
Updates a list of products with optional field replacement.
- Parameters
products – A list of products to update. Products are matched for update by id.
replace –
Replace the existing fields instead of merging them. Defaults to False. If this is True, then keywords and properties for the product will be
replaced by what is in the products provided in this request.
- If this is False, then the keywords and properties in this request will
merge with what is already present in the server resource.
- Return type
nisystemlink.clients.product.models.CreateProductsPartialSuccess
- Returns: A list of updates products, products that failed to update, and errors for
failures.
- Raises
ApiException – if unable to communicate with the
/nitestmonitor
Service or provided an invalid argument.
- delete_product(id)[source]
Deletes a single product by id.
- Parameters
id (str) – Unique ID of a product.
- Raises
ApiException – if unable to communicate with the
/nitestmonitor
Service or provided an invalid argument.- Return type
None
- delete_products(ids)[source]
Deletes multiple products.
- Parameters
ids (List[str]) – List of unique IDs of products.
- Return type
Optional
[nisystemlink.clients.product.models.DeleteProductsPartialSuccess
]- Returns
A partial success if any products failed to delete, or None if all products were deleted successfully.
- Raises
ApiException – if unable to communicate with the
/nitestmonitor
Service or provided an invalid argument.
- pydantic model nisystemlink.clients.product.models.CreateProductsPartialSuccess[source]
Show JSON schema
{ "title": "CreateProductsPartialSuccess", "description": "Base class for models that are serialized to and from JSON.", "type": "object", "properties": { "products": { "title": "Products", "type": "array", "items": { "$ref": "#/definitions/Product" } }, "failed": { "title": "Failed", "type": "array", "items": { "$ref": "#/definitions/Product" } }, "error": { "$ref": "#/definitions/ApiError" } }, "required": [ "products" ], "definitions": { "Product": { "title": "Product", "description": "Contains information about a product.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "partNumber": { "title": "Partnumber", "type": "string" }, "name": { "title": "Name", "type": "string" }, "family": { "title": "Family", "type": "string" }, "updatedAt": { "title": "Updatedat", "type": "string", "format": "date-time" }, "fileIds": { "title": "Fileids", "type": "array", "items": { "type": "string" } }, "keywords": { "title": "Keywords", "type": "array", "items": { "type": "string" } }, "properties": { "title": "Properties", "type": "object", "additionalProperties": { "type": "string" } }, "workspace": { "title": "Workspace", "type": "string" } }, "required": [ "partNumber" ] }, "ApiError": { "title": "ApiError", "description": "Represents the standard error structure for SystemLink API responses.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "code": { "title": "Code", "type": "integer" }, "message": { "title": "Message", "type": "string" }, "args": { "title": "Args", "default": [], "type": "array", "items": { "type": "string" } }, "resourceType": { "title": "Resourcetype", "type": "string" }, "resourceId": { "title": "Resourceid", "type": "string" }, "innerErrors": { "title": "Innererrors", "default": [], "type": "array", "items": { "$ref": "#/definitions/ApiError" } } } } } }
-
field error:
Optional
[ApiError
] = None Error messages for products that were not created.
If this is None, then all products were successfully created.
-
field error:
- pydantic model nisystemlink.clients.product.models.DeleteProductsPartialSuccess[source]
The result of deleting multiple products when one or more products could not be deleted.
Show JSON schema
{ "title": "DeleteProductsPartialSuccess", "description": "The result of deleting multiple products when one or more products could not be deleted.", "type": "object", "properties": { "ids": { "title": "Ids", "type": "array", "items": { "type": "string" } }, "failed": { "title": "Failed", "type": "array", "items": { "type": "string" } }, "error": { "$ref": "#/definitions/ApiError" } }, "required": [ "ids" ], "definitions": { "ApiError": { "title": "ApiError", "description": "Represents the standard error structure for SystemLink API responses.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "code": { "title": "Code", "type": "integer" }, "message": { "title": "Message", "type": "string" }, "args": { "title": "Args", "default": [], "type": "array", "items": { "type": "string" } }, "resourceType": { "title": "Resourcetype", "type": "string" }, "resourceId": { "title": "Resourceid", "type": "string" }, "innerErrors": { "title": "Innererrors", "default": [], "type": "array", "items": { "$ref": "#/definitions/ApiError" } } } } } }
-
field failed:
Optional
[List
[str
]] = None The IDs of the products that could not be deleted.
-
field ids:
List
[str
] [Required] The IDs of the products that were successfully deleted.
-
field failed:
- pydantic model nisystemlink.clients.product.models.PagedProducts[source]
The response for a Products query containing matched products.
Show JSON schema
{ "title": "PagedProducts", "description": "The response for a Products query containing matched products.", "type": "object", "properties": { "continuationToken": { "title": "Continuationtoken", "type": "string" }, "products": { "title": "Products", "type": "array", "items": { "$ref": "#/definitions/Product" } }, "totalCount": { "title": "Totalcount", "type": "integer" } }, "required": [ "products" ], "definitions": { "Product": { "title": "Product", "description": "Contains information about a product.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "partNumber": { "title": "Partnumber", "type": "string" }, "name": { "title": "Name", "type": "string" }, "family": { "title": "Family", "type": "string" }, "updatedAt": { "title": "Updatedat", "type": "string", "format": "date-time" }, "fileIds": { "title": "Fileids", "type": "array", "items": { "type": "string" } }, "keywords": { "title": "Keywords", "type": "array", "items": { "type": "string" } }, "properties": { "title": "Properties", "type": "object", "additionalProperties": { "type": "string" } }, "workspace": { "title": "Workspace", "type": "string" } }, "required": [ "partNumber" ] } } }
- Fields
-
field total_count:
Optional
[int
] = None The total number of products that match the query.
- pydantic model nisystemlink.clients.product.models.Product[source]
Contains information about a product.
Show JSON schema
{ "title": "Product", "description": "Contains information about a product.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "partNumber": { "title": "Partnumber", "type": "string" }, "name": { "title": "Name", "type": "string" }, "family": { "title": "Family", "type": "string" }, "updatedAt": { "title": "Updatedat", "type": "string", "format": "date-time" }, "fileIds": { "title": "Fileids", "type": "array", "items": { "type": "string" } }, "keywords": { "title": "Keywords", "type": "array", "items": { "type": "string" } }, "properties": { "title": "Properties", "type": "object", "additionalProperties": { "type": "string" } }, "workspace": { "title": "Workspace", "type": "string" } }, "required": [ "partNumber" ] }
-
field family:
Optional
[str
] = None The family that that this product belongs to.
Usually the family is a grouping above product name. A family usually has multiple product names within it.
-
field file_ids:
Optional
[List
[str
]] = None A list of file ids that are attached to this product.
-
field id:
Optional
[str
] = None The globally unique id of the product.
-
field keywords:
Optional
[List
[str
]] = None A list of keywords that categorize this product.
-
field name:
Optional
[str
] = None The name of the product.
Usually the name is used to refer to several part numbers that all have the same name but different revisions or versions.
-
field part_number:
str
[Required] The part number is the unique identifier of a product within a single org.
Usually the part number refers to a specific revision or version of a given product.
-
field properties:
Optional
[Dict
[str
,str
]] = None A list of custom properties for this product.
-
field updated_at:
Optional
[datetime
] = None The last time that this product was updated.
-
field workspace:
Optional
[str
] = None The id of the workspace that this product belongs to.
-
field family:
- class nisystemlink.clients.product.models.ProductField(value)[source]
The valid ways to order a product query.
- pydantic model nisystemlink.clients.product.models.QueryProductValuesRequest[source]
Show JSON schema
{ "title": "QueryProductValuesRequest", "description": "Base class for models that are serialized to and from JSON.", "type": "object", "properties": { "filter": { "title": "Filter", "type": "string" }, "substitutions": { "title": "Substitutions", "type": "array", "items": { "type": "string" } }, "field": { "$ref": "#/definitions/ProductField" }, "startsWith": { "title": "Startswith", "type": "string" } }, "definitions": { "ProductField": { "title": "ProductField", "description": "The valid ways to order a product query.", "enum": [ "ID", "FAMILY", "PART_NUMBER", "NAME", "UPDATED_AT" ], "type": "string" } } }
- Fields
-
field field:
Optional
[ProductField
] = None The product field to return for this query.
-
field starts_with:
Optional
[str
] = None Only return string parameters prefixed by this value (case sensitive).
- pydantic model nisystemlink.clients.product.models.QueryProductsRequest[source]
Show JSON schema
{ "title": "QueryProductsRequest", "description": "Base class for models that are serialized to and from JSON.", "type": "object", "properties": { "filter": { "title": "Filter", "type": "string" }, "substitutions": { "title": "Substitutions", "type": "array", "items": { "type": "string" } }, "orderBy": { "$ref": "#/definitions/ProductField" }, "descending": { "title": "Descending", "type": "boolean" }, "take": { "title": "Take", "type": "integer" }, "continuationToken": { "title": "Continuationtoken", "type": "string" }, "returnCount": { "title": "Returncount", "type": "boolean" } }, "definitions": { "ProductField": { "title": "ProductField", "description": "The valid ways to order a product query.", "enum": [ "ID", "FAMILY", "PART_NUMBER", "NAME", "UPDATED_AT" ], "type": "string" } } }
-
field continuation_token:
Optional
[str
] = None Allows users to continue the query at the next product that matches the given criteria.
To retrieve the next page of products, pass the continuation token from the previous page in the next request. The service responds with the next page of data and provides a new continuation token. To paginate results, continue sending requests with the newest continuation token provided in each response.
-
field descending:
Optional
[bool
] = None Specifies whether to return the products in descending order.
By default, this value is false and products are sorted in ascending order.
-
field order_by:
Optional
[ProductField
] = None Specifies the fields to use to sort the products.
By default, products are sorted by id
-
field return_count:
Optional
[bool
] = None If true, the response will include a count of all products matching the filter.
By default, this value is False and count is not returned. Note that returning the count may incur performance penalties as the service may have to do a complete walk of the database to compute count.
-
field take:
Optional
[int
] = None Maximum number of products to return in the current API response.
Uses the default if the specified value is negative. The default value is 1000 products.
-
field continuation_token: