one-msg-sdk 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. one_msg_sdk/__init__.py +189 -0
  2. one_msg_sdk/api/__init__.py +14 -0
  3. one_msg_sdk/api/calling_api.py +901 -0
  4. one_msg_sdk/api/catalog_api.py +607 -0
  5. one_msg_sdk/api/channel_api.py +874 -0
  6. one_msg_sdk/api/flows_api.py +3212 -0
  7. one_msg_sdk/api/groups_api.py +1935 -0
  8. one_msg_sdk/api/messaging_api.py +7419 -0
  9. one_msg_sdk/api/profile_api.py +609 -0
  10. one_msg_sdk/api/templates_api.py +1180 -0
  11. one_msg_sdk/api/users_api.py +903 -0
  12. one_msg_sdk/api/webhooks_api.py +605 -0
  13. one_msg_sdk/api_client.py +805 -0
  14. one_msg_sdk/api_response.py +21 -0
  15. one_msg_sdk/configuration.py +635 -0
  16. one_msg_sdk/exceptions.py +219 -0
  17. one_msg_sdk/models/__init__.py +78 -0
  18. one_msg_sdk/models/add_template_request.py +108 -0
  19. one_msg_sdk/models/block_user_request.py +102 -0
  20. one_msg_sdk/models/conversational_automation.py +115 -0
  21. one_msg_sdk/models/conversational_automation_commands_inner.py +105 -0
  22. one_msg_sdk/models/create_commerce200_response.py +102 -0
  23. one_msg_sdk/models/create_commerce_request.py +106 -0
  24. one_msg_sdk/models/create_commerce_request_params.py +104 -0
  25. one_msg_sdk/models/create_groups200_response.py +107 -0
  26. one_msg_sdk/models/create_read_message200_response.py +102 -0
  27. one_msg_sdk/models/create_read_message401_response.py +89 -0
  28. one_msg_sdk/models/create_read_message_request.py +93 -0
  29. one_msg_sdk/models/delete_flows_flow_id200_response.py +109 -0
  30. one_msg_sdk/models/delete_groups_group_id200_response.py +104 -0
  31. one_msg_sdk/models/delete_media_legacy_request.py +102 -0
  32. one_msg_sdk/models/error_response.py +89 -0
  33. one_msg_sdk/models/get_commerce200_response_inner.py +106 -0
  34. one_msg_sdk/models/get_mm_lite_status200_response.py +106 -0
  35. one_msg_sdk/models/get_webhook200_response.py +102 -0
  36. one_msg_sdk/models/get_whatsapp_business_encryption200_response.py +116 -0
  37. one_msg_sdk/models/list_blocked_users200_response.py +102 -0
  38. one_msg_sdk/models/list_flows200_response.py +115 -0
  39. one_msg_sdk/models/list_messages200_response.py +104 -0
  40. one_msg_sdk/models/list_templates200_response.py +106 -0
  41. one_msg_sdk/models/message_sent_response.py +108 -0
  42. one_msg_sdk/models/patch_flows_flow_id_assets200_response.py +111 -0
  43. one_msg_sdk/models/profile_info.py +126 -0
  44. one_msg_sdk/models/retrieve_media200_response.py +110 -0
  45. one_msg_sdk/models/send_address_message_request.py +126 -0
  46. one_msg_sdk/models/send_button_request.py +103 -0
  47. one_msg_sdk/models/send_button_request_sections_inner.py +95 -0
  48. one_msg_sdk/models/send_button_request_sections_inner_reply.py +91 -0
  49. one_msg_sdk/models/send_carousel_request1.py +97 -0
  50. one_msg_sdk/models/send_contact_request.py +99 -0
  51. one_msg_sdk/models/send_contact_request_contacts_inner.py +117 -0
  52. one_msg_sdk/models/send_contact_request_contacts_inner_name.py +99 -0
  53. one_msg_sdk/models/send_contact_request_contacts_inner_org.py +93 -0
  54. one_msg_sdk/models/send_contact_request_contacts_inner_phones_inner.py +93 -0
  55. one_msg_sdk/models/send_cta_url_request.py +116 -0
  56. one_msg_sdk/models/send_file_request.py +129 -0
  57. one_msg_sdk/models/send_flow_request1.py +141 -0
  58. one_msg_sdk/models/send_flow_request1_header.py +144 -0
  59. one_msg_sdk/models/send_flow_request_header.py +144 -0
  60. one_msg_sdk/models/send_list_request.py +105 -0
  61. one_msg_sdk/models/send_list_request_sections_inner.py +99 -0
  62. one_msg_sdk/models/send_list_request_sections_inner_rows_inner.py +93 -0
  63. one_msg_sdk/models/send_location_request1.py +101 -0
  64. one_msg_sdk/models/send_location_request_request.py +91 -0
  65. one_msg_sdk/models/send_message_request.py +122 -0
  66. one_msg_sdk/models/send_order_details_request.py +128 -0
  67. one_msg_sdk/models/send_order_details_request_language.py +104 -0
  68. one_msg_sdk/models/send_order_details_request_order.py +124 -0
  69. one_msg_sdk/models/send_order_details_request_order_items_inner.py +112 -0
  70. one_msg_sdk/models/send_order_details_request_order_items_inner_amount.py +104 -0
  71. one_msg_sdk/models/send_payment_request_request.py +117 -0
  72. one_msg_sdk/models/send_reaction_request.py +93 -0
  73. one_msg_sdk/models/send_sticker_request.py +110 -0
  74. one_msg_sdk/models/send_template_request.py +107 -0
  75. one_msg_sdk/models/send_template_request_language.py +91 -0
  76. one_msg_sdk/models/set_whatsapp_business_encryption_request.py +89 -0
  77. one_msg_sdk/models/success_response.py +102 -0
  78. one_msg_sdk/models/update_me_request.py +114 -0
  79. one_msg_sdk/py.typed +0 -0
  80. one_msg_sdk/rest.py +264 -0
  81. one_msg_sdk-1.0.0.dist-info/METADATA +19 -0
  82. one_msg_sdk-1.0.0.dist-info/RECORD +85 -0
  83. one_msg_sdk-1.0.0.dist-info/WHEEL +5 -0
  84. one_msg_sdk-1.0.0.dist-info/licenses/LICENSE +21 -0
  85. one_msg_sdk-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ 1MSG WhatsApp Business API (Public)
5
+
6
+ Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@1msg.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class SendLocationRequestRequest(BaseModel):
28
+ """
29
+ SendLocationRequestRequest
30
+ """ # noqa: E501
31
+ phone: Optional[StrictStr] = None
32
+ body: Optional[StrictStr] = None
33
+ __properties: ClassVar[List[str]] = ["phone", "body"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of SendLocationRequestRequest from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of SendLocationRequestRequest from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "phone": obj.get("phone"),
87
+ "body": obj.get("body")
88
+ })
89
+ return _obj
90
+
91
+
@@ -0,0 +1,122 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ 1MSG WhatsApp Business API (Public)
5
+
6
+ Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@1msg.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class SendMessageRequest(BaseModel):
29
+ """
30
+ Request body for sending a text message
31
+ """ # noqa: E501
32
+ body: Annotated[str, Field(min_length=1, strict=True, max_length=4096)] = Field(description="Message text, UTF-8 or UTF-16 string with emoji")
33
+ quoted_msg_id: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Message ID to quote/reply to (Cloud API wamid)", alias="quotedMsgId")
34
+ chat_id: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Chat ID in format: phone@c.us (individual) or phone@g.us (group)", alias="chatId")
35
+ phone: Optional[Annotated[int, Field(le=999999999999999, strict=True, ge=1000000000)]] = Field(default=None, description="Phone number starting with country code (alternative to chatId)")
36
+ __properties: ClassVar[List[str]] = ["body", "quotedMsgId", "chatId", "phone"]
37
+
38
+ @field_validator('quoted_msg_id')
39
+ def quoted_msg_id_validate_regular_expression(cls, value):
40
+ """Validates the regular expression"""
41
+ if value is None:
42
+ return value
43
+
44
+ if not isinstance(value, str):
45
+ value = str(value)
46
+
47
+ if not re.match(r"^wamid\..+$", value):
48
+ raise ValueError(r"must validate the regular expression /^wamid\..+$/")
49
+ return value
50
+
51
+ @field_validator('chat_id')
52
+ def chat_id_validate_regular_expression(cls, value):
53
+ """Validates the regular expression"""
54
+ if value is None:
55
+ return value
56
+
57
+ if not isinstance(value, str):
58
+ value = str(value)
59
+
60
+ if not re.match(r"^[0-9]+@[cg]\.us$", value):
61
+ raise ValueError(r"must validate the regular expression /^[0-9]+@[cg]\.us$/")
62
+ return value
63
+
64
+ model_config = ConfigDict(
65
+ validate_by_name=True,
66
+ validate_by_alias=True,
67
+ validate_assignment=True,
68
+ protected_namespaces=(),
69
+ )
70
+
71
+
72
+ def to_str(self) -> str:
73
+ """Returns the string representation of the model using alias"""
74
+ return pprint.pformat(self.model_dump(by_alias=True))
75
+
76
+ def to_json(self) -> str:
77
+ """Returns the JSON representation of the model using alias"""
78
+ return json.dumps(to_jsonable_python(self.to_dict()))
79
+
80
+ @classmethod
81
+ def from_json(cls, json_str: str) -> Optional[Self]:
82
+ """Create an instance of SendMessageRequest from a JSON string"""
83
+ return cls.from_dict(json.loads(json_str))
84
+
85
+ def to_dict(self) -> Dict[str, Any]:
86
+ """Return the dictionary representation of the model using alias.
87
+
88
+ This has the following differences from calling pydantic's
89
+ `self.model_dump(by_alias=True)`:
90
+
91
+ * `None` is only added to the output dict for nullable fields that
92
+ were set at model initialization. Other fields with value `None`
93
+ are ignored.
94
+ """
95
+ excluded_fields: Set[str] = set([
96
+ ])
97
+
98
+ _dict = self.model_dump(
99
+ by_alias=True,
100
+ exclude=excluded_fields,
101
+ exclude_none=True,
102
+ )
103
+ return _dict
104
+
105
+ @classmethod
106
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
107
+ """Create an instance of SendMessageRequest from a dict"""
108
+ if obj is None:
109
+ return None
110
+
111
+ if not isinstance(obj, dict):
112
+ return cls.model_validate(obj)
113
+
114
+ _obj = cls.model_validate({
115
+ "body": obj.get("body"),
116
+ "quotedMsgId": obj.get("quotedMsgId"),
117
+ "chatId": obj.get("chatId"),
118
+ "phone": obj.get("phone")
119
+ })
120
+ return _obj
121
+
122
+
@@ -0,0 +1,128 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ 1MSG WhatsApp Business API (Public)
5
+
6
+ Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@1msg.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from one_msg_sdk.models.send_order_details_request_language import SendOrderDetailsRequestLanguage
24
+ from one_msg_sdk.models.send_order_details_request_order import SendOrderDetailsRequestOrder
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class SendOrderDetailsRequest(BaseModel):
30
+ """
31
+ SendOrderDetailsRequest
32
+ """ # noqa: E501
33
+ phone: Optional[StrictInt] = Field(default=None, description="Recipient phone (India E.164 digits, no +). Use phone or chatId.")
34
+ chat_id: Optional[StrictStr] = Field(default=None, description="Recipient chatId (e.g. phone@c.us). Use phone or chatId.", alias="chatId")
35
+ template: StrictStr = Field(description="Approved Utility template name that includes an ORDER_DETAILS button")
36
+ namespace: StrictStr = Field(description="Template namespace from the channel / template list")
37
+ language: SendOrderDetailsRequestLanguage
38
+ params: Optional[List[Dict[str, Any]]] = Field(default=None, description="Extra template components (HEADER / BODY / etc.). If an order_details button is missing, the API appends one from order / referenceId / currency / paymentSettings. ")
39
+ reference_id: Optional[StrictStr] = Field(default=None, description="Unique order / payment reference id (maps to reference_id)", alias="referenceId")
40
+ currency: Optional[StrictStr] = Field(default=None, description="Currency code for India payments")
41
+ payment_settings: Optional[Dict[str, Any]] = Field(default=None, description="Optional payment settings (UPI / payment gateway / payment link). Forwarded as payment_settings on the order_details action. ", alias="paymentSettings")
42
+ order: SendOrderDetailsRequestOrder
43
+ additional_properties: Dict[str, Any] = {}
44
+ __properties: ClassVar[List[str]] = ["phone", "chatId", "template", "namespace", "language", "params", "referenceId", "currency", "paymentSettings", "order"]
45
+
46
+ model_config = ConfigDict(
47
+ validate_by_name=True,
48
+ validate_by_alias=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ return json.dumps(to_jsonable_python(self.to_dict()))
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
+ """Create an instance of SendOrderDetailsRequest from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ * Fields in `self.additional_properties` are added to the output dict.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ "additional_properties",
80
+ ])
81
+
82
+ _dict = self.model_dump(
83
+ by_alias=True,
84
+ exclude=excluded_fields,
85
+ exclude_none=True,
86
+ )
87
+ # override the default output from pydantic by calling `to_dict()` of language
88
+ if self.language:
89
+ _dict['language'] = self.language.to_dict()
90
+ # override the default output from pydantic by calling `to_dict()` of order
91
+ if self.order:
92
+ _dict['order'] = self.order.to_dict()
93
+ # puts key-value pairs in additional_properties in the top level
94
+ if self.additional_properties is not None:
95
+ for _key, _value in self.additional_properties.items():
96
+ _dict[_key] = _value
97
+
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of SendOrderDetailsRequest from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate({
110
+ "phone": obj.get("phone"),
111
+ "chatId": obj.get("chatId"),
112
+ "template": obj.get("template"),
113
+ "namespace": obj.get("namespace"),
114
+ "language": SendOrderDetailsRequestLanguage.from_dict(obj["language"]) if obj.get("language") is not None else None,
115
+ "params": obj.get("params"),
116
+ "referenceId": obj.get("referenceId"),
117
+ "currency": obj.get("currency"),
118
+ "paymentSettings": obj.get("paymentSettings"),
119
+ "order": SendOrderDetailsRequestOrder.from_dict(obj["order"]) if obj.get("order") is not None else None
120
+ })
121
+ # store additional fields in additional_properties
122
+ for _key in obj.keys():
123
+ if _key not in cls.__properties:
124
+ _obj.additional_properties[_key] = obj.get(_key)
125
+
126
+ return _obj
127
+
128
+
@@ -0,0 +1,104 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ 1MSG WhatsApp Business API (Public)
5
+
6
+ Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@1msg.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class SendOrderDetailsRequestLanguage(BaseModel):
28
+ """
29
+ Template language
30
+ """ # noqa: E501
31
+ code: StrictStr = Field(description="Language code")
32
+ policy: Optional[StrictStr] = Field(default=None, description="Optional language policy")
33
+ additional_properties: Dict[str, Any] = {}
34
+ __properties: ClassVar[List[str]] = ["code", "policy"]
35
+
36
+ model_config = ConfigDict(
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of SendOrderDetailsRequestLanguage from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ * Fields in `self.additional_properties` are added to the output dict.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ "additional_properties",
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # puts key-value pairs in additional_properties in the top level
78
+ if self.additional_properties is not None:
79
+ for _key, _value in self.additional_properties.items():
80
+ _dict[_key] = _value
81
+
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of SendOrderDetailsRequestLanguage from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate({
94
+ "code": obj.get("code"),
95
+ "policy": obj.get("policy")
96
+ })
97
+ # store additional fields in additional_properties
98
+ for _key in obj.keys():
99
+ if _key not in cls.__properties:
100
+ _obj.additional_properties[_key] = obj.get(_key)
101
+
102
+ return _obj
103
+
104
+
@@ -0,0 +1,124 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ 1MSG WhatsApp Business API (Public)
5
+
6
+ Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@1msg.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from one_msg_sdk.models.send_order_details_request_order_items_inner import SendOrderDetailsRequestOrderItemsInner
24
+ from one_msg_sdk.models.send_order_details_request_order_items_inner_amount import SendOrderDetailsRequestOrderItemsInnerAmount
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class SendOrderDetailsRequestOrder(BaseModel):
30
+ """
31
+ Order payload for the ORDER_DETAILS button. Typical fields: status, items[], subtotal, tax, shipping, discount. Amount objects use `{ \"offset\": 100, \"value\": <minor_units> }` (e.g. value 50000 with offset 100 = ₹500.00).
32
+ """ # noqa: E501
33
+ status: Optional[StrictStr] = Field(default=None, description="Order status")
34
+ items: List[SendOrderDetailsRequestOrderItemsInner] = Field(description="Line items")
35
+ subtotal: Optional[SendOrderDetailsRequestOrderItemsInnerAmount] = None
36
+ tax: Optional[Dict[str, Any]] = None
37
+ shipping: Optional[Dict[str, Any]] = None
38
+ discount: Optional[Dict[str, Any]] = None
39
+ additional_properties: Dict[str, Any] = {}
40
+ __properties: ClassVar[List[str]] = ["status", "items", "subtotal", "tax", "shipping", "discount"]
41
+
42
+ model_config = ConfigDict(
43
+ validate_by_name=True,
44
+ validate_by_alias=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ return json.dumps(to_jsonable_python(self.to_dict()))
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of SendOrderDetailsRequestOrder from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ * Fields in `self.additional_properties` are added to the output dict.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ "additional_properties",
76
+ ])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
84
+ _items = []
85
+ if self.items:
86
+ for _item_items in self.items:
87
+ if _item_items:
88
+ _items.append(_item_items.to_dict())
89
+ _dict['items'] = _items
90
+ # override the default output from pydantic by calling `to_dict()` of subtotal
91
+ if self.subtotal:
92
+ _dict['subtotal'] = self.subtotal.to_dict()
93
+ # puts key-value pairs in additional_properties in the top level
94
+ if self.additional_properties is not None:
95
+ for _key, _value in self.additional_properties.items():
96
+ _dict[_key] = _value
97
+
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of SendOrderDetailsRequestOrder from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate({
110
+ "status": obj.get("status"),
111
+ "items": [SendOrderDetailsRequestOrderItemsInner.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
112
+ "subtotal": SendOrderDetailsRequestOrderItemsInnerAmount.from_dict(obj["subtotal"]) if obj.get("subtotal") is not None else None,
113
+ "tax": obj.get("tax"),
114
+ "shipping": obj.get("shipping"),
115
+ "discount": obj.get("discount")
116
+ })
117
+ # store additional fields in additional_properties
118
+ for _key in obj.keys():
119
+ if _key not in cls.__properties:
120
+ _obj.additional_properties[_key] = obj.get(_key)
121
+
122
+ return _obj
123
+
124
+
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ 1MSG WhatsApp Business API (Public)
5
+
6
+ Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@1msg.io
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from one_msg_sdk.models.send_order_details_request_order_items_inner_amount import SendOrderDetailsRequestOrderItemsInnerAmount
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class SendOrderDetailsRequestOrderItemsInner(BaseModel):
29
+ """
30
+ SendOrderDetailsRequestOrderItemsInner
31
+ """ # noqa: E501
32
+ retailer_id: Optional[StrictStr] = None
33
+ name: Optional[StrictStr] = None
34
+ quantity: Optional[StrictInt] = None
35
+ amount: Optional[SendOrderDetailsRequestOrderItemsInnerAmount] = None
36
+ additional_properties: Dict[str, Any] = {}
37
+ __properties: ClassVar[List[str]] = ["retailer_id", "name", "quantity", "amount"]
38
+
39
+ model_config = ConfigDict(
40
+ validate_by_name=True,
41
+ validate_by_alias=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ return json.dumps(to_jsonable_python(self.to_dict()))
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of SendOrderDetailsRequestOrderItemsInner from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ * Fields in `self.additional_properties` are added to the output dict.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ "additional_properties",
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of amount
81
+ if self.amount:
82
+ _dict['amount'] = self.amount.to_dict()
83
+ # puts key-value pairs in additional_properties in the top level
84
+ if self.additional_properties is not None:
85
+ for _key, _value in self.additional_properties.items():
86
+ _dict[_key] = _value
87
+
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of SendOrderDetailsRequestOrderItemsInner from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "retailer_id": obj.get("retailer_id"),
101
+ "name": obj.get("name"),
102
+ "quantity": obj.get("quantity"),
103
+ "amount": SendOrderDetailsRequestOrderItemsInnerAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None
104
+ })
105
+ # store additional fields in additional_properties
106
+ for _key in obj.keys():
107
+ if _key not in cls.__properties:
108
+ _obj.additional_properties[_key] = obj.get(_key)
109
+
110
+ return _obj
111
+
112
+