pluggy-sdk 1.0.0.post12__py3-none-any.whl → 1.0.0.post14__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.
@@ -0,0 +1,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pluggy API
5
+
6
+ Pluggy's main API to review data and execute connectors
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: hello@pluggy.ai
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 datetime import date
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class CUSTOM(BaseModel):
28
+ """
29
+ Schedule atribute to generate custom payments in the future
30
+ """ # noqa: E501
31
+ type: StrictStr = Field(description="Scheduled type")
32
+ dates: List[date]
33
+ additional_information: Optional[StrictStr] = Field(default=None, description="Additional information about the custom schedule", alias="additionalInformation")
34
+ __properties: ClassVar[List[str]] = ["type", "dates", "additionalInformation"]
35
+
36
+ @field_validator('type')
37
+ def type_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value not in set(['CUSTOM']):
40
+ raise ValueError("must be one of enum values ('CUSTOM')")
41
+ return value
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=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
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of CUSTOM from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of CUSTOM 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
+ "type": obj.get("type"),
95
+ "dates": obj.get("dates"),
96
+ "additionalInformation": obj.get("additionalInformation")
97
+ })
98
+ return _obj
99
+
100
+
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pluggy API
5
+
6
+ Pluggy's main API to review data and execute connectors
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: hello@pluggy.ai
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 datetime import date
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
23
+ from typing import Any, ClassVar, Dict, List, Optional, Union
24
+ from typing_extensions import Annotated
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class DAILY(BaseModel):
29
+ """
30
+ Schedule atribute to generate daily payments
31
+ """ # noqa: E501
32
+ type: StrictStr = Field(description="Scheduled type")
33
+ start_date: date = Field(description="The start date of the validity of the scheduled payment authorization.", alias="startDate")
34
+ occurrences: Optional[Union[Annotated[float, Field(le=59, strict=True, ge=3)], Annotated[int, Field(le=59, strict=True, ge=3)]]] = Field(default=None, description="Under the specified schedule frequency, how many payments will be scheduled to occur.")
35
+ __properties: ClassVar[List[str]] = ["type", "startDate", "occurrences"]
36
+
37
+ @field_validator('type')
38
+ def type_validate_enum(cls, value):
39
+ """Validates the enum"""
40
+ if value not in set(['DAILY']):
41
+ raise ValueError("must be one of enum values ('DAILY')")
42
+ return value
43
+
44
+ model_config = ConfigDict(
45
+ populate_by_name=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
50
+
51
+ def to_str(self) -> str:
52
+ """Returns the string representation of the model using alias"""
53
+ return pprint.pformat(self.model_dump(by_alias=True))
54
+
55
+ def to_json(self) -> str:
56
+ """Returns the JSON representation of the model using alias"""
57
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58
+ return json.dumps(self.to_dict())
59
+
60
+ @classmethod
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
+ """Create an instance of DAILY from a JSON string"""
63
+ return cls.from_dict(json.loads(json_str))
64
+
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ ])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of DAILY from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "type": obj.get("type"),
96
+ "startDate": obj.get("startDate"),
97
+ "occurrences": obj.get("occurrences")
98
+ })
99
+ return _obj
100
+
101
+
pluggy_sdk/models/item.py CHANGED
@@ -57,8 +57,8 @@ class Item(BaseModel):
57
57
  return value
58
58
 
59
59
  for i in value:
60
- if i not in set(['ACCOUNTS', 'TRANSACTIONS', 'CREDIT_CARDS', 'INVESTMENTS', 'INVESTMENTS_TRANSACTIONS', 'PAYMENT_DATA', 'IDENTITY', 'BROKERAGE_NOTE', 'OPPORTUNITIES', 'PORTFOLIO', 'INCOME_REPORTS', 'MOVE_SECURITY']):
61
- raise ValueError("each list item must be one of ('ACCOUNTS', 'TRANSACTIONS', 'CREDIT_CARDS', 'INVESTMENTS', 'INVESTMENTS_TRANSACTIONS', 'PAYMENT_DATA', 'IDENTITY', 'BROKERAGE_NOTE', 'OPPORTUNITIES', 'PORTFOLIO', 'INCOME_REPORTS', 'MOVE_SECURITY')")
60
+ if i not in set(['ACCOUNTS', 'CREDIT_CARDS', 'TRANSACTIONS', 'PAYMENT_DATA', 'INVESTMENTS', 'INVESTMENTS_TRANSACTIONS', 'IDENTITY', 'BROKERAGE_NOTE', 'OPPORTUNITIES', 'PORTFOLIO', 'INCOME_REPORTS', 'MOVE_SECURITY', 'LOANS', 'ACQUIRER_OPERATIONS']):
61
+ raise ValueError("each list item must be one of ('ACCOUNTS', 'CREDIT_CARDS', 'TRANSACTIONS', 'PAYMENT_DATA', 'INVESTMENTS', 'INVESTMENTS_TRANSACTIONS', 'IDENTITY', 'BROKERAGE_NOTE', 'OPPORTUNITIES', 'PORTFOLIO', 'INCOME_REPORTS', 'MOVE_SECURITY', 'LOANS', 'ACQUIRER_OPERATIONS')")
62
62
  return value
63
63
 
64
64
  model_config = ConfigDict(
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pluggy API
5
+
6
+ Pluggy's main API to review data and execute connectors
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: hello@pluggy.ai
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 datetime import date
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
23
+ from typing import Any, ClassVar, Dict, List, Optional, Union
24
+ from typing_extensions import Annotated
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class MONTHLY(BaseModel):
29
+ """
30
+ Schedule atribute to generate monthly payments
31
+ """ # noqa: E501
32
+ type: StrictStr = Field(description="Scheduled type")
33
+ start_date: date = Field(alias="startDate")
34
+ day_of_month: Union[Annotated[float, Field(le=30, strict=True, ge=2)], Annotated[int, Field(le=30, strict=True, ge=2)]] = Field(description="Day of the month on which each payment will occur. For example, if '10', the first payment will occur on the next 10th day of the month after the start date, or the same day if it is already 10th, and every 10th day after that.", alias="dayOfMonth")
35
+ occurrences: Optional[Union[Annotated[float, Field(le=23, strict=True, ge=3)], Annotated[int, Field(le=23, strict=True, ge=3)]]] = Field(default=None, description="Under the specified schedule frequency, how many payments will be scheduled to occur.")
36
+ __properties: ClassVar[List[str]] = ["type", "startDate", "dayOfMonth", "occurrences"]
37
+
38
+ @field_validator('type')
39
+ def type_validate_enum(cls, value):
40
+ """Validates the enum"""
41
+ if value not in set(['MONTHLY']):
42
+ raise ValueError("must be one of enum values ('MONTHLY')")
43
+ return value
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of MONTHLY from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of MONTHLY from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "type": obj.get("type"),
97
+ "startDate": obj.get("startDate"),
98
+ "dayOfMonth": obj.get("dayOfMonth"),
99
+ "occurrences": obj.get("occurrences")
100
+ })
101
+ return _obj
102
+
103
+
@@ -49,8 +49,8 @@ class PaymentRequest(BaseModel):
49
49
  @field_validator('status')
50
50
  def status_validate_enum(cls, value):
51
51
  """Validates the enum"""
52
- if value not in set(['CREATED', 'IN_PROGRESS', 'COMPLETED', 'ERROR']):
53
- raise ValueError("must be one of enum values ('CREATED', 'IN_PROGRESS', 'COMPLETED', 'ERROR')")
52
+ if value not in set(['CREATED', 'IN_PROGRESS', 'COMPLETED', 'SCHEDULED', 'WAITING_PAYER_AUTHORIZATION', 'ERROR', 'REFUND_IN_PROGRESS', 'REFUNDED', 'REFUND_ERROR']):
53
+ raise ValueError("must be one of enum values ('CREATED', 'IN_PROGRESS', 'COMPLETED', 'SCHEDULED', 'WAITING_PAYER_AUTHORIZATION', 'ERROR', 'REFUND_IN_PROGRESS', 'REFUNDED', 'REFUND_ERROR')")
54
54
  return value
55
55
 
56
56
  model_config = ConfigDict(
@@ -18,33 +18,33 @@ import json
18
18
  import pprint
19
19
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
20
20
  from typing import Any, List, Optional
21
- from pluggy_sdk.models.schedule_type_custom import ScheduleTypeCustom
22
- from pluggy_sdk.models.schedule_type_daily import ScheduleTypeDaily
23
- from pluggy_sdk.models.schedule_type_monthly import ScheduleTypeMonthly
24
- from pluggy_sdk.models.schedule_type_single import ScheduleTypeSingle
25
- from pluggy_sdk.models.schedule_type_weekly import ScheduleTypeWeekly
21
+ from pluggy_sdk.models.custom import CUSTOM
22
+ from pluggy_sdk.models.daily import DAILY
23
+ from pluggy_sdk.models.monthly import MONTHLY
24
+ from pluggy_sdk.models.single import SINGLE
25
+ from pluggy_sdk.models.weekly import WEEKLY
26
26
  from pydantic import StrictStr, Field
27
27
  from typing import Union, List, Set, Optional, Dict
28
28
  from typing_extensions import Literal, Self
29
29
 
30
- PAYMENTREQUESTSCHEDULE_ONE_OF_SCHEMAS = ["ScheduleTypeCustom", "ScheduleTypeDaily", "ScheduleTypeMonthly", "ScheduleTypeSingle", "ScheduleTypeWeekly"]
30
+ PAYMENTREQUESTSCHEDULE_ONE_OF_SCHEMAS = ["CUSTOM", "DAILY", "MONTHLY", "SINGLE", "WEEKLY"]
31
31
 
32
32
  class PaymentRequestSchedule(BaseModel):
33
33
  """
34
34
  PaymentRequestSchedule
35
35
  """
36
- # data type: ScheduleTypeSingle
37
- oneof_schema_1_validator: Optional[ScheduleTypeSingle] = None
38
- # data type: ScheduleTypeDaily
39
- oneof_schema_2_validator: Optional[ScheduleTypeDaily] = None
40
- # data type: ScheduleTypeWeekly
41
- oneof_schema_3_validator: Optional[ScheduleTypeWeekly] = None
42
- # data type: ScheduleTypeMonthly
43
- oneof_schema_4_validator: Optional[ScheduleTypeMonthly] = None
44
- # data type: ScheduleTypeCustom
45
- oneof_schema_5_validator: Optional[ScheduleTypeCustom] = None
46
- actual_instance: Optional[Union[ScheduleTypeCustom, ScheduleTypeDaily, ScheduleTypeMonthly, ScheduleTypeSingle, ScheduleTypeWeekly]] = None
47
- one_of_schemas: Set[str] = { "ScheduleTypeCustom", "ScheduleTypeDaily", "ScheduleTypeMonthly", "ScheduleTypeSingle", "ScheduleTypeWeekly" }
36
+ # data type: SINGLE
37
+ oneof_schema_1_validator: Optional[SINGLE] = None
38
+ # data type: DAILY
39
+ oneof_schema_2_validator: Optional[DAILY] = None
40
+ # data type: WEEKLY
41
+ oneof_schema_3_validator: Optional[WEEKLY] = None
42
+ # data type: MONTHLY
43
+ oneof_schema_4_validator: Optional[MONTHLY] = None
44
+ # data type: CUSTOM
45
+ oneof_schema_5_validator: Optional[CUSTOM] = None
46
+ actual_instance: Optional[Union[CUSTOM, DAILY, MONTHLY, SINGLE, WEEKLY]] = None
47
+ one_of_schemas: Set[str] = { "CUSTOM", "DAILY", "MONTHLY", "SINGLE", "WEEKLY" }
48
48
 
49
49
  model_config = ConfigDict(
50
50
  validate_assignment=True,
@@ -70,37 +70,37 @@ class PaymentRequestSchedule(BaseModel):
70
70
  instance = PaymentRequestSchedule.model_construct()
71
71
  error_messages = []
72
72
  match = 0
73
- # validate data type: ScheduleTypeSingle
74
- if not isinstance(v, ScheduleTypeSingle):
75
- error_messages.append(f"Error! Input type `{type(v)}` is not `ScheduleTypeSingle`")
73
+ # validate data type: SINGLE
74
+ if not isinstance(v, SINGLE):
75
+ error_messages.append(f"Error! Input type `{type(v)}` is not `SINGLE`")
76
76
  else:
77
77
  match += 1
78
- # validate data type: ScheduleTypeDaily
79
- if not isinstance(v, ScheduleTypeDaily):
80
- error_messages.append(f"Error! Input type `{type(v)}` is not `ScheduleTypeDaily`")
78
+ # validate data type: DAILY
79
+ if not isinstance(v, DAILY):
80
+ error_messages.append(f"Error! Input type `{type(v)}` is not `DAILY`")
81
81
  else:
82
82
  match += 1
83
- # validate data type: ScheduleTypeWeekly
84
- if not isinstance(v, ScheduleTypeWeekly):
85
- error_messages.append(f"Error! Input type `{type(v)}` is not `ScheduleTypeWeekly`")
83
+ # validate data type: WEEKLY
84
+ if not isinstance(v, WEEKLY):
85
+ error_messages.append(f"Error! Input type `{type(v)}` is not `WEEKLY`")
86
86
  else:
87
87
  match += 1
88
- # validate data type: ScheduleTypeMonthly
89
- if not isinstance(v, ScheduleTypeMonthly):
90
- error_messages.append(f"Error! Input type `{type(v)}` is not `ScheduleTypeMonthly`")
88
+ # validate data type: MONTHLY
89
+ if not isinstance(v, MONTHLY):
90
+ error_messages.append(f"Error! Input type `{type(v)}` is not `MONTHLY`")
91
91
  else:
92
92
  match += 1
93
- # validate data type: ScheduleTypeCustom
94
- if not isinstance(v, ScheduleTypeCustom):
95
- error_messages.append(f"Error! Input type `{type(v)}` is not `ScheduleTypeCustom`")
93
+ # validate data type: CUSTOM
94
+ if not isinstance(v, CUSTOM):
95
+ error_messages.append(f"Error! Input type `{type(v)}` is not `CUSTOM`")
96
96
  else:
97
97
  match += 1
98
98
  if match > 1:
99
99
  # more than 1 match
100
- raise ValueError("Multiple matches found when setting `actual_instance` in PaymentRequestSchedule with oneOf schemas: ScheduleTypeCustom, ScheduleTypeDaily, ScheduleTypeMonthly, ScheduleTypeSingle, ScheduleTypeWeekly. Details: " + ", ".join(error_messages))
100
+ raise ValueError("Multiple matches found when setting `actual_instance` in PaymentRequestSchedule with oneOf schemas: CUSTOM, DAILY, MONTHLY, SINGLE, WEEKLY. Details: " + ", ".join(error_messages))
101
101
  elif match == 0:
102
102
  # no match
103
- raise ValueError("No match found when setting `actual_instance` in PaymentRequestSchedule with oneOf schemas: ScheduleTypeCustom, ScheduleTypeDaily, ScheduleTypeMonthly, ScheduleTypeSingle, ScheduleTypeWeekly. Details: " + ", ".join(error_messages))
103
+ raise ValueError("No match found when setting `actual_instance` in PaymentRequestSchedule with oneOf schemas: CUSTOM, DAILY, MONTHLY, SINGLE, WEEKLY. Details: " + ", ".join(error_messages))
104
104
  else:
105
105
  return v
106
106
 
@@ -115,43 +115,43 @@ class PaymentRequestSchedule(BaseModel):
115
115
  error_messages = []
116
116
  match = 0
117
117
 
118
- # deserialize data into ScheduleTypeSingle
118
+ # deserialize data into SINGLE
119
119
  try:
120
- instance.actual_instance = ScheduleTypeSingle.from_json(json_str)
120
+ instance.actual_instance = SINGLE.from_json(json_str)
121
121
  match += 1
122
122
  except (ValidationError, ValueError) as e:
123
123
  error_messages.append(str(e))
124
- # deserialize data into ScheduleTypeDaily
124
+ # deserialize data into DAILY
125
125
  try:
126
- instance.actual_instance = ScheduleTypeDaily.from_json(json_str)
126
+ instance.actual_instance = DAILY.from_json(json_str)
127
127
  match += 1
128
128
  except (ValidationError, ValueError) as e:
129
129
  error_messages.append(str(e))
130
- # deserialize data into ScheduleTypeWeekly
130
+ # deserialize data into WEEKLY
131
131
  try:
132
- instance.actual_instance = ScheduleTypeWeekly.from_json(json_str)
132
+ instance.actual_instance = WEEKLY.from_json(json_str)
133
133
  match += 1
134
134
  except (ValidationError, ValueError) as e:
135
135
  error_messages.append(str(e))
136
- # deserialize data into ScheduleTypeMonthly
136
+ # deserialize data into MONTHLY
137
137
  try:
138
- instance.actual_instance = ScheduleTypeMonthly.from_json(json_str)
138
+ instance.actual_instance = MONTHLY.from_json(json_str)
139
139
  match += 1
140
140
  except (ValidationError, ValueError) as e:
141
141
  error_messages.append(str(e))
142
- # deserialize data into ScheduleTypeCustom
142
+ # deserialize data into CUSTOM
143
143
  try:
144
- instance.actual_instance = ScheduleTypeCustom.from_json(json_str)
144
+ instance.actual_instance = CUSTOM.from_json(json_str)
145
145
  match += 1
146
146
  except (ValidationError, ValueError) as e:
147
147
  error_messages.append(str(e))
148
148
 
149
149
  if match > 1:
150
150
  # more than 1 match
151
- raise ValueError("Multiple matches found when deserializing the JSON string into PaymentRequestSchedule with oneOf schemas: ScheduleTypeCustom, ScheduleTypeDaily, ScheduleTypeMonthly, ScheduleTypeSingle, ScheduleTypeWeekly. Details: " + ", ".join(error_messages))
151
+ raise ValueError("Multiple matches found when deserializing the JSON string into PaymentRequestSchedule with oneOf schemas: CUSTOM, DAILY, MONTHLY, SINGLE, WEEKLY. Details: " + ", ".join(error_messages))
152
152
  elif match == 0:
153
153
  # no match
154
- raise ValueError("No match found when deserializing the JSON string into PaymentRequestSchedule with oneOf schemas: ScheduleTypeCustom, ScheduleTypeDaily, ScheduleTypeMonthly, ScheduleTypeSingle, ScheduleTypeWeekly. Details: " + ", ".join(error_messages))
154
+ raise ValueError("No match found when deserializing the JSON string into PaymentRequestSchedule with oneOf schemas: CUSTOM, DAILY, MONTHLY, SINGLE, WEEKLY. Details: " + ", ".join(error_messages))
155
155
  else:
156
156
  return instance
157
157
 
@@ -165,7 +165,7 @@ class PaymentRequestSchedule(BaseModel):
165
165
  else:
166
166
  return json.dumps(self.actual_instance)
167
167
 
168
- def to_dict(self) -> Optional[Union[Dict[str, Any], ScheduleTypeCustom, ScheduleTypeDaily, ScheduleTypeMonthly, ScheduleTypeSingle, ScheduleTypeWeekly]]:
168
+ def to_dict(self) -> Optional[Union[Dict[str, Any], CUSTOM, DAILY, MONTHLY, SINGLE, WEEKLY]]:
169
169
  """Returns the dict representation of the actual instance"""
170
170
  if self.actual_instance is None:
171
171
  return None
@@ -0,0 +1,121 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pluggy API
5
+
6
+ Pluggy's main API to review data and execute connectors
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: hello@pluggy.ai
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 datetime import datetime
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
23
+ from typing import Any, ClassVar, Dict, List, Optional, Union
24
+ from pluggy_sdk.models.payroll_loan_client import PayrollLoanClient
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class PayrollLoan(BaseModel):
29
+ """
30
+ Information related to a payroll loan
31
+ """ # noqa: E501
32
+ contract_code: StrictStr = Field(description="Contract code given by the contracting institution", alias="contractCode")
33
+ cnpj_original_contract_creditor: Optional[StrictStr] = Field(default=None, description="CNPJ of the original creditor of the contract", alias="cnpjOriginalContractCreditor")
34
+ nominal_interest_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Nominal interest rate", alias="nominalInterestRate")
35
+ efective_interest_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Effective interest rate", alias="efectiveInterestRate")
36
+ cet_annual_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="CET annual rate", alias="cetAnnualRate")
37
+ cet_month_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="CET monthly rate", alias="cetMonthRate")
38
+ currency_code: Optional[StrictStr] = Field(default=None, description="Code referencing the currency of the loan", alias="currencyCode")
39
+ amortization_regime: Optional[StrictStr] = Field(default=None, description="Amortization regime", alias="amortizationRegime")
40
+ installments_quantity: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Number of installments", alias="installmentsQuantity")
41
+ installments_value: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Installment value", alias="installmentsValue")
42
+ due_date_first_installment: Optional[datetime] = Field(default=None, description="Due date of the first installment", alias="dueDateFirstInstallment")
43
+ due_date_last_installment: Optional[datetime] = Field(default=None, description="Due date of the last installment", alias="dueDateLastInstallment")
44
+ cnpj_correspondent_banking: Optional[StrictStr] = Field(default=None, description="CNPJ of the correspondent banking", alias="cnpjCorrespondentBanking")
45
+ operation_hiring_date: Optional[datetime] = Field(default=None, description="Operation hiring date", alias="operationHiringDate")
46
+ client: PayrollLoanClient
47
+ __properties: ClassVar[List[str]] = ["contractCode", "cnpjOriginalContractCreditor", "nominalInterestRate", "efectiveInterestRate", "cetAnnualRate", "cetMonthRate", "currencyCode", "amortizationRegime", "installmentsQuantity", "installmentsValue", "dueDateFirstInstallment", "dueDateLastInstallment", "cnpjCorrespondentBanking", "operationHiringDate", "client"]
48
+
49
+ model_config = ConfigDict(
50
+ populate_by_name=True,
51
+ validate_assignment=True,
52
+ protected_namespaces=(),
53
+ )
54
+
55
+
56
+ def to_str(self) -> str:
57
+ """Returns the string representation of the model using alias"""
58
+ return pprint.pformat(self.model_dump(by_alias=True))
59
+
60
+ def to_json(self) -> str:
61
+ """Returns the JSON representation of the model using alias"""
62
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
63
+ return json.dumps(self.to_dict())
64
+
65
+ @classmethod
66
+ def from_json(cls, json_str: str) -> Optional[Self]:
67
+ """Create an instance of PayrollLoan from a JSON string"""
68
+ return cls.from_dict(json.loads(json_str))
69
+
70
+ def to_dict(self) -> Dict[str, Any]:
71
+ """Return the dictionary representation of the model using alias.
72
+
73
+ This has the following differences from calling pydantic's
74
+ `self.model_dump(by_alias=True)`:
75
+
76
+ * `None` is only added to the output dict for nullable fields that
77
+ were set at model initialization. Other fields with value `None`
78
+ are ignored.
79
+ """
80
+ excluded_fields: Set[str] = set([
81
+ ])
82
+
83
+ _dict = self.model_dump(
84
+ by_alias=True,
85
+ exclude=excluded_fields,
86
+ exclude_none=True,
87
+ )
88
+ # override the default output from pydantic by calling `to_dict()` of client
89
+ if self.client:
90
+ _dict['client'] = self.client.to_dict()
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of PayrollLoan from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate({
103
+ "contractCode": obj.get("contractCode"),
104
+ "cnpjOriginalContractCreditor": obj.get("cnpjOriginalContractCreditor"),
105
+ "nominalInterestRate": obj.get("nominalInterestRate"),
106
+ "efectiveInterestRate": obj.get("efectiveInterestRate"),
107
+ "cetAnnualRate": obj.get("cetAnnualRate"),
108
+ "cetMonthRate": obj.get("cetMonthRate"),
109
+ "currencyCode": obj.get("currencyCode"),
110
+ "amortizationRegime": obj.get("amortizationRegime"),
111
+ "installmentsQuantity": obj.get("installmentsQuantity"),
112
+ "installmentsValue": obj.get("installmentsValue"),
113
+ "dueDateFirstInstallment": obj.get("dueDateFirstInstallment"),
114
+ "dueDateLastInstallment": obj.get("dueDateLastInstallment"),
115
+ "cnpjCorrespondentBanking": obj.get("cnpjCorrespondentBanking"),
116
+ "operationHiringDate": obj.get("operationHiringDate"),
117
+ "client": PayrollLoanClient.from_dict(obj["client"]) if obj.get("client") is not None else None
118
+ })
119
+ return _obj
120
+
121
+