Skip to content

Commit

Permalink
Generate Client Library code - Automated
Browse files Browse the repository at this point in the history
  • Loading branch information
pyansys-ci-bot authored and actions-user committed Feb 20, 2025
1 parent 6ad24f9 commit 44b01f7
Show file tree
Hide file tree
Showing 9 changed files with 1,058 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ansys-grantami-serverapi-openapi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "ansys-grantami-serverapi-openapi"
description = "Autogenerated client library for the Granta MI Server API."
version = "5.0.0.dev437"
version = "5.0.0.dev439"
license = "MIT"
authors = ["ANSYS, Inc. <pyansys.core@ansys.com>"]
maintainers = ["ANSYS, Inc. <pyansys.core@ansys.com>"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@
from .models.gsa_get_modifiable_record_version_control_exception import (
GsaGetModifiableRecordVersionControlException,
)
from .models.gsa_get_unit_conversions_request import GsaGetUnitConversionsRequest
from .models.gsa_graph import GsaGraph
from .models.gsa_graph_decoration_type import GsaGraphDecorationType
from .models.gsa_graph_type import GsaGraphType
Expand All @@ -523,6 +524,7 @@
from .models.gsa_hyperlink_target import GsaHyperlinkTarget
from .models.gsa_index_record_failure import GsaIndexRecordFailure
from .models.gsa_indirect_links import GsaIndirectLinks
from .models.gsa_input_validation_error_detail import GsaInputValidationErrorDetail
from .models.gsa_integer_aggregation import GsaIntegerAggregation
from .models.gsa_integer_aggregation_datum_criterion import GsaIntegerAggregationDatumCriterion
from .models.gsa_integer_attribute import GsaIntegerAttribute
Expand Down Expand Up @@ -930,6 +932,9 @@
from .models.gsa_text_match_behavior import GsaTextMatchBehavior
from .models.gsa_unavailable_tabular_column import GsaUnavailableTabularColumn
from .models.gsa_unit import GsaUnit
from .models.gsa_unit_conversion_set import GsaUnitConversionSet
from .models.gsa_unit_conversion_set_request import GsaUnitConversionSetRequest
from .models.gsa_unit_conversions_info import GsaUnitConversionsInfo
from .models.gsa_unit_equivalent import GsaUnitEquivalent
from .models.gsa_unit_equivalents_info import GsaUnitEquivalentsInfo
from .models.gsa_unit_mapping import GsaUnitMapping
Expand Down Expand Up @@ -1453,6 +1458,7 @@
"GsaGetJobsResponse",
"GsaGetJobsSummaryResponse",
"GsaGetModifiableRecordVersionControlException",
"GsaGetUnitConversionsRequest",
"GsaGraph",
"GsaGraphDecorationType",
"GsaGraphType",
Expand All @@ -1474,6 +1480,7 @@
"GsaHyperlinkTarget",
"GsaIndexRecordFailure",
"GsaIndirectLinks",
"GsaInputValidationErrorDetail",
"GsaIntegerAggregation",
"GsaIntegerAggregationDatumCriterion",
"GsaIntegerAttribute",
Expand Down Expand Up @@ -1847,6 +1854,9 @@
"GsaTextMatchBehavior",
"GsaUnavailableTabularColumn",
"GsaUnit",
"GsaUnitConversionSet",
"GsaUnitConversionSetRequest",
"GsaUnitConversionsInfo",
"GsaUnitEquivalent",
"GsaUnitEquivalentsInfo",
"GsaUnitMapping",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,99 @@ def _get_unit_with_http_info(self, database_key: "str", unit_guid: "str", **kwar
response_type_map=response_type_map,
)

def get_unit_conversions(
self, *, database_key: "str", body: "Optional[GsaGetUnitConversionsRequest]" = None
) -> "GsaUnitConversionsInfo":
"""Gets all the equivalent units and their conversion factors for the specified source units, including any errors that occurred.
This method makes a synchronous HTTP request.
Parameters
----------
database_key: str
body: GsaGetUnitConversionsRequest
Returns
-------
GsaUnitConversionsInfo
"""
data = self._get_unit_conversions_with_http_info(
database_key, body, _return_http_data_only=True
)
return data # type: ignore[no-any-return]

def _get_unit_conversions_with_http_info(
self,
database_key: "str",
body: "Optional[GsaGetUnitConversionsRequest]" = None,
**kwargs: Any,
) -> Any:
all_params = [
"database_key",
"body",
"_return_http_data_only",
"_preload_content",
"_request_timeout",
]

params = locals()
for key, val in params["kwargs"].items():
if key not in all_params:
raise TypeError(
f"Got an unexpected keyword argument '{key}' to method get_unit_conversions"
)
params[key] = val
del params["kwargs"]
# verify the required parameter "database_key" is set
if "database_key" not in params or params["database_key"] is None:
raise ValueError(
"Missing the required parameter 'database_key' when calling 'get_unit_conversions'"
)

collection_formats: dict[str, Any] = {}

path_params: dict[str, Any] = {}
if "database_key" in params and database_key is not None:
path_params["database-key"] = params["database_key"]

query_params: list[Any] = []

header_params: dict[str, Any] = {}

form_params: list[Any] = []
local_var_files: dict[str, Any] = {}

body_params = None
if "body" in params and body is not None:
body_params = params["body"]
# HTTP header 'Accept'
header_params["Accept"] = self.api_client.select_header_accept(["application/json"])

# HTTP header 'Content-Type'
header_params["Content-Type"] = self.api_client.select_header_content_type(
["application/json-patch+json", "application/json", "text/json", "application/*+json"]
)

response_type_map: dict[int, Optional[str]] = {
200: "GsaUnitConversionsInfo",
}

return self.api_client.call_api(
"/v1alpha/databases/{database-key}/unit-conversions",
"POST",
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
_return_http_data_only=params.get("_return_http_data_only"),
_preload_content=params.get("_preload_content", True),
_request_timeout=params.get("_request_timeout"),
collection_formats=collection_formats,
response_type_map=response_type_map,
)

def get_unit_equivalents(
self, *, database_key: "str", unit_guid: "str"
) -> "Union[GsaUnitEquivalentsInfo, None]":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@
from .gsa_get_modifiable_record_version_control_exception import (
GsaGetModifiableRecordVersionControlException,
)
from .gsa_get_unit_conversions_request import GsaGetUnitConversionsRequest
from .gsa_graph import GsaGraph
from .gsa_graph_decoration_type import GsaGraphDecorationType
from .gsa_graph_type import GsaGraphType
Expand All @@ -454,6 +455,7 @@
from .gsa_hyperlink_target import GsaHyperlinkTarget
from .gsa_index_record_failure import GsaIndexRecordFailure
from .gsa_indirect_links import GsaIndirectLinks
from .gsa_input_validation_error_detail import GsaInputValidationErrorDetail
from .gsa_integer_aggregation import GsaIntegerAggregation
from .gsa_integer_aggregation_datum_criterion import GsaIntegerAggregationDatumCriterion
from .gsa_integer_attribute import GsaIntegerAttribute
Expand Down Expand Up @@ -847,6 +849,9 @@
from .gsa_text_match_behavior import GsaTextMatchBehavior
from .gsa_unavailable_tabular_column import GsaUnavailableTabularColumn
from .gsa_unit import GsaUnit
from .gsa_unit_conversion_set import GsaUnitConversionSet
from .gsa_unit_conversion_set_request import GsaUnitConversionSetRequest
from .gsa_unit_conversions_info import GsaUnitConversionsInfo
from .gsa_unit_equivalent import GsaUnitEquivalent
from .gsa_unit_equivalents_info import GsaUnitEquivalentsInfo
from .gsa_unit_mapping import GsaUnitMapping
Expand Down Expand Up @@ -1324,6 +1329,7 @@
"GsaGetJobsResponse",
"GsaGetJobsSummaryResponse",
"GsaGetModifiableRecordVersionControlException",
"GsaGetUnitConversionsRequest",
"GsaGraph",
"GsaGraphDecorationType",
"GsaGraphType",
Expand All @@ -1345,6 +1351,7 @@
"GsaHyperlinkTarget",
"GsaIndexRecordFailure",
"GsaIndirectLinks",
"GsaInputValidationErrorDetail",
"GsaIntegerAggregation",
"GsaIntegerAggregationDatumCriterion",
"GsaIntegerAttribute",
Expand Down Expand Up @@ -1718,6 +1725,9 @@
"GsaTextMatchBehavior",
"GsaUnavailableTabularColumn",
"GsaUnit",
"GsaUnitConversionSet",
"GsaUnitConversionSetRequest",
"GsaUnitConversionsInfo",
"GsaUnitEquivalent",
"GsaUnitEquivalentsInfo",
"GsaUnitMapping",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Copyright (C) 2023 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""
MI Server API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

import re # noqa: F401
from typing import TYPE_CHECKING, Any, BinaryIO, Optional, Union # noqa: F401

from . import ModelBase, Unset, Unset_Type

if TYPE_CHECKING:
from datetime import datetime
import pathlib

from . import *


class GsaGetUnitConversionsRequest(ModelBase):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""

"""
Attributes
----------
swagger_types: dict[str, str]
The key is attribute name and the value is attribute type.
attribute_map: dict[str, str]
The key is attribute name and the value is json key in definition.
subtype_mapping: dict[str, str]
The key is the unmangled property name and the value is the corresponding type.
discriminator: Optional[str]
Name of the property used as discriminator for subtypes.
"""
swagger_types: dict[str, str] = {
"source_units": "list[GsaUnitConversionSetRequest]",
}

attribute_map: dict[str, str] = {
"source_units": "sourceUnits",
}

subtype_mapping: dict[str, str] = {
"sourceUnits": "GsaUnitConversionSetRequest",
}

discriminator: Optional[str] = None

def __init__(
self,
*,
source_units: "list[GsaUnitConversionSetRequest]",
) -> None:
"""GsaGetUnitConversionsRequest - a model defined in Swagger
Parameters
----------
source_units: list[GsaUnitConversionSetRequest]
"""
self._source_units: list[GsaUnitConversionSetRequest]

self.source_units = source_units

@property
def source_units(self) -> "list[GsaUnitConversionSetRequest]":
"""Gets the source_units of this GsaGetUnitConversionsRequest.
Returns
-------
list[GsaUnitConversionSetRequest]
The source_units of this GsaGetUnitConversionsRequest.
"""
return self._source_units

@source_units.setter
def source_units(self, source_units: "list[GsaUnitConversionSetRequest]") -> None:
"""Sets the source_units of this GsaGetUnitConversionsRequest.
Parameters
----------
source_units: list[GsaUnitConversionSetRequest]
The source_units of this GsaGetUnitConversionsRequest.
"""
# Field is not nullable
if source_units is None:
raise ValueError("Invalid value for 'source_units', must not be 'None'")
# Field is required
if source_units is Unset: # type: ignore[comparison-overlap, unused-ignore]
raise ValueError("Invalid value for 'source_units', must not be 'Unset'")
self._source_units = source_units

@classmethod
def get_real_child_model(cls, data: dict[str, str]) -> str:
"""Raises a NotImplementedError for a type without a discriminator defined.
Parameters
----------
data: ModelBase
Object representing a subclass of this class
Raises
------
NotImplementedError
This class has no discriminator, and hence no subclasses
"""
raise NotImplementedError()

def __repr__(self) -> str:
"""For 'print' and 'pprint'"""
return self.to_str()

def __eq__(self, other: Any) -> bool:
"""Returns true if both objects are equal"""
if not isinstance(other, GsaGetUnitConversionsRequest):
return False

return self.__dict__ == other.__dict__

def __ne__(self, other: Any) -> bool:
"""Returns true if both objects are not equal"""
return not self == other
Loading

0 comments on commit 44b01f7

Please sign in to comment.