Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions activitysmith_openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
""" # noqa: E501


__version__ = "1.1.0"
__version__ = "1.2.0"

# import apis into sdk package
from activitysmith_openapi.api.live_activities_api import LiveActivitiesApi
Expand Down Expand Up @@ -72,4 +72,3 @@
from activitysmith_openapi.models.send_push_notification429_response import SendPushNotification429Response
from activitysmith_openapi.models.stream_content_state import StreamContentState
from activitysmith_openapi.models.widget_metric import WidgetMetric
from activitysmith_openapi.models.widget_metric_latest_value import WidgetMetricLatestValue
6 changes: 3 additions & 3 deletions activitysmith_openapi/api/metrics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def update_metric_value(
) -> MetricValueUpdateResponse:
"""Update a widget metric value

Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters.
Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key.

:param key: Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. (required)
:type key: str
Expand Down Expand Up @@ -133,7 +133,7 @@ def update_metric_value_with_http_info(
) -> ApiResponse[MetricValueUpdateResponse]:
"""Update a widget metric value

Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters.
Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key.

:param key: Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. (required)
:type key: str
Expand Down Expand Up @@ -207,7 +207,7 @@ def update_metric_value_without_preload_content(
) -> RESTResponseType:
"""Update a widget metric value

Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters.
Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key.

:param key: Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. (required)
:type key: str
Expand Down
2 changes: 1 addition & 1 deletion activitysmith_openapi/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/1.1.0/python'
self.user_agent = 'OpenAPI-Generator/1.2.0/python'
self.client_side_validation = configuration.client_side_validation

def __enter__(self):
Expand Down
2 changes: 1 addition & 1 deletion activitysmith_openapi/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.0.0\n"\
"SDK Package Version: 1.1.0".\
"SDK Package Version: 1.2.0".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion activitysmith_openapi/docs/MetricValueUpdateResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**metric** | [**WidgetMetric**](WidgetMetric.md) | |
**success** | **bool** | |

## Example

Expand Down
2 changes: 1 addition & 1 deletion activitysmith_openapi/docs/MetricsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Method | HTTP request | Description

Update a widget metric value

Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters.
Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key.

### Example

Expand Down
2 changes: 1 addition & 1 deletion activitysmith_openapi/docs/WidgetMetric.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Name | Type | Description | Notes
**unit** | **str** | Present when format is unit. |
**unit_spacing** | [**MetricUnitSpacing**](MetricUnitSpacing.md) | |
**format** | [**MetricFormat**](MetricFormat.md) | |
**latest_value** | [**WidgetMetricLatestValue**](WidgetMetricLatestValue.md) | |
**latest_value** | **float** | Latest metric value. Numeric formats return a number. String metrics return text. |
**latest_value_at** | **datetime** | |
**created_at** | **datetime** | |
**updated_at** | **datetime** | |
Expand Down
29 changes: 0 additions & 29 deletions activitysmith_openapi/docs/WidgetMetricLatestValue.md

This file was deleted.

1 change: 0 additions & 1 deletion activitysmith_openapi/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@
from activitysmith_openapi.models.send_push_notification429_response import SendPushNotification429Response
from activitysmith_openapi.models.stream_content_state import StreamContentState
from activitysmith_openapi.models.widget_metric import WidgetMetric
from activitysmith_openapi.models.widget_metric_latest_value import WidgetMetricLatestValue
12 changes: 4 additions & 8 deletions activitysmith_openapi/models/metric_value_update_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict
from pydantic import BaseModel, ConfigDict, StrictBool
from typing import Any, ClassVar, Dict, List
from activitysmith_openapi.models.widget_metric import WidgetMetric
from typing import Optional, Set
from typing_extensions import Self

class MetricValueUpdateResponse(BaseModel):
"""
MetricValueUpdateResponse
""" # noqa: E501
metric: WidgetMetric
success: StrictBool
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["metric"]
__properties: ClassVar[List[str]] = ["success"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -72,9 +71,6 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of metric
if self.metric:
_dict['metric'] = self.metric.to_dict()
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
Expand All @@ -92,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
return cls.model_validate(obj)

_obj = cls.model_validate({
"metric": WidgetMetric.from_dict(obj["metric"]) if obj.get("metric") is not None else None
"success": obj.get("success")
})
# store additional fields in additional_properties
for _key in obj.keys():
Expand Down
41 changes: 7 additions & 34 deletions activitysmith_openapi/models/widget_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
import json

from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Union
from typing_extensions import Annotated
from activitysmith_openapi.models.metric_format import MetricFormat
from activitysmith_openapi.models.metric_unit_spacing import MetricUnitSpacing
from activitysmith_openapi.models.widget_metric_latest_value import WidgetMetricLatestValue
from typing import Optional, Set
from typing_extensions import Self

Expand All @@ -34,12 +33,12 @@ class WidgetMetric(BaseModel):
public_id: StrictStr
key: Annotated[str, Field(min_length=1, strict=True, max_length=64)]
label: Annotated[str, Field(min_length=1, strict=True, max_length=80)]
currency_code: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=3)]] = Field(description="Present when format is currency.")
unit: Optional[Annotated[str, Field(strict=True, max_length=16)]] = Field(description="Present when format is unit.")
currency_code: Annotated[str, Field(min_length=3, strict=True, max_length=3)] = Field(description="Present when format is currency.")
unit: Annotated[str, Field(strict=True, max_length=16)] = Field(description="Present when format is unit.")
unit_spacing: MetricUnitSpacing
format: MetricFormat
latest_value: Optional[WidgetMetricLatestValue]
latest_value_at: Optional[datetime]
latest_value: Union[StrictFloat, StrictInt] = Field(description="Latest metric value. Numeric formats return a number. String metrics return text.")
latest_value_at: datetime
created_at: datetime
updated_at: datetime
additional_properties: Dict[str, Any] = {}
Expand All @@ -55,9 +54,6 @@ def key_validate_regular_expression(cls, value):
@field_validator('currency_code')
def currency_code_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not re.match(r"^[A-Z]{3}$", value):
raise ValueError(r"must validate the regular expression /^[A-Z]{3}$/")
return value
Expand Down Expand Up @@ -103,34 +99,11 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of latest_value
if self.latest_value:
_dict['latest_value'] = self.latest_value.to_dict()
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
_dict[_key] = _value

# set to None if currency_code (nullable) is None
# and model_fields_set contains the field
if self.currency_code is None and "currency_code" in self.model_fields_set:
_dict['currency_code'] = None

# set to None if unit (nullable) is None
# and model_fields_set contains the field
if self.unit is None and "unit" in self.model_fields_set:
_dict['unit'] = None

# set to None if latest_value (nullable) is None
# and model_fields_set contains the field
if self.latest_value is None and "latest_value" in self.model_fields_set:
_dict['latest_value'] = None

# set to None if latest_value_at (nullable) is None
# and model_fields_set contains the field
if self.latest_value_at is None and "latest_value_at" in self.model_fields_set:
_dict['latest_value_at'] = None

return _dict

@classmethod
Expand All @@ -150,7 +123,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"unit": obj.get("unit"),
"unit_spacing": obj.get("unit_spacing"),
"format": obj.get("format"),
"latest_value": WidgetMetricLatestValue.from_dict(obj["latest_value"]) if obj.get("latest_value") is not None else None,
"latest_value": obj.get("latest_value"),
"latest_value_at": obj.get("latest_value_at"),
"created_at": obj.get("created_at"),
"updated_at": obj.get("updated_at")
Expand Down
144 changes: 0 additions & 144 deletions activitysmith_openapi/models/widget_metric_latest_value.py

This file was deleted.

Loading