Skip to content
Merged
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
36 changes: 36 additions & 0 deletions lago_python_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
from .alert import (
AlertThresholdResponseList as AlertThresholdResponseList,
)
from .alert import (
TriggeredAlert as TriggeredAlert,
)
from .alert import (
ResolvedAlert as ResolvedAlert,
)
from .api_log import ApiLog as ApiLog
from .api_log import ApiLogResponse as ApiLogResponse
from .applied_coupon import AppliedCoupon as AppliedCoupon
Expand Down Expand Up @@ -144,6 +150,30 @@
from .customer_usage import (
PresentationBreakdowns as PresentationBreakdowns,
)
from .entitlement import (
PlanEntitlementPrivilegeResponse as PlanEntitlementPrivilegeResponse,
)
from .entitlement import (
PlanEntitlementPrivilegesResponse as PlanEntitlementPrivilegesResponse,
)
from .entitlement import (
PlanEntitlementResponse as PlanEntitlementResponse,
)
from .entitlement import (
PlanEntitlementsResponse as PlanEntitlementsResponse,
)
from .entitlement import (
SubscriptionEntitlementPrivilegeResponse as SubscriptionEntitlementPrivilegeResponse,
)
from .entitlement import (
SubscriptionEntitlementPrivilegesResponse as SubscriptionEntitlementPrivilegesResponse,
)
from .entitlement import (
SubscriptionEntitlementResponse as SubscriptionEntitlementResponse,
)
from .entitlement import (
SubscriptionEntitlementsResponse as SubscriptionEntitlementsResponse,
)
from .event import BatchEvent as BatchEvent
from .event import Event as Event
from .fee import Fee as Fee
Expand Down Expand Up @@ -289,6 +319,12 @@
from .tax import (
TaxResponse as TaxResponse,
)
from .usage_threshold import (
ApplicableUsageThresholdResponse as ApplicableUsageThresholdResponse,
)
from .usage_threshold import (
ApplicableUsageThresholdsResponse as ApplicableUsageThresholdsResponse,
)
from .usage_threshold import (
UsageThreshold as UsageThreshold,
)
Expand Down
33 changes: 33 additions & 0 deletions lago_python_client/models/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,36 @@ class AlertResponse(BaseResponseModel):

class AlertsResponseList(BaseResponseModel):
alerts: List[AlertResponse]


class AlertWebhookBase(BaseResponseModel):
lago_id: str
lago_organization_id: str
lago_alert_id: str
lago_subscription_id: Optional[str]
external_subscription_id: Optional[str]
lago_wallet_id: Optional[str]
external_customer_id: Optional[str]
billable_metric_code: Optional[str]
alert_name: Optional[str]
alert_code: str
alert_type: str
current_value: Optional[str]
previous_value: Optional[str]


class TriggeredAlert(AlertWebhookBase):
crossed_thresholds: AlertThresholdResponseList
triggered_at: str
# Deprecated
subscription_external_id: Optional[str]
# Deprecated
customer_external_id: Optional[str]


class ResolvedAlert(AlertWebhookBase):
recovered_thresholds: AlertThresholdResponseList
in_alarm_thresholds: List[str]
fully_resolved: bool
reason: Optional[str]
resolved_at: str
3 changes: 3 additions & 0 deletions lago_python_client/models/billing_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class BillingEntity(BaseModel):
tax_identification_number: Optional[str]
email_settings: Optional[List[str]]
billing_configuration: Optional[BillingEntityBillingConfiguration]
einvoicing: Optional[bool]


class BillingEntityUpdate(BaseModel):
Expand Down Expand Up @@ -65,6 +66,7 @@ class BillingEntityUpdate(BaseModel):
email_settings: Optional[List[str]]
billing_configuration: Optional[BillingEntityBillingConfiguration]
invoice_custom_section_codes: Optional[List[str]]
einvoicing: Optional[bool]


class BillingEntityResponse(BaseResponseModel):
Expand Down Expand Up @@ -99,5 +101,6 @@ class BillingEntityResponse(BaseResponseModel):
email_settings: Optional[List[str]]
taxes: Optional[TaxesResponse]
selected_invoice_custom_sections: Optional[InvoiceCustomSectionsResponseList]
einvoicing: Optional[bool]
created_at: datetime
updated_at: datetime
10 changes: 10 additions & 0 deletions lago_python_client/models/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class IntegrationCustomer(BaseModel):
external_customer_id: Optional[str]
integration_type: Optional[str]
integration_code: Optional[str]
code: Optional[str]
subsidiary_id: Optional[str]
sync_with_provider: Optional[bool]

Expand All @@ -44,6 +45,9 @@ class IntegrationCustomerResponse(BaseModel):
external_customer_id: Optional[str]
type: Optional[str]
integration_code: Optional[str]
code: Optional[str]
is_default: Optional[bool]
category: Optional[str]
subsidiary_id: Optional[str]
sync_with_provider: Optional[bool]

Expand Down Expand Up @@ -80,6 +84,7 @@ class MetadataResponseList(BaseModel):

class Customer(BaseModel):
external_id: str
account_type: Optional[str]
address_line1: Optional[str]
address_line2: Optional[str]
city: Optional[str]
Expand All @@ -89,6 +94,7 @@ class Customer(BaseModel):
legal_name: Optional[str]
legal_number: Optional[str]
net_payment_term: Optional[int]
external_salesforce_id: Optional[str]
tax_identification_number: Optional[str]
logo_url: Optional[str]
name: Optional[str]
Expand All @@ -114,6 +120,9 @@ class Customer(BaseModel):
class CustomerResponse(BaseResponseModel):
lago_id: str
external_id: str
account_type: Optional[str]
sequential_id: Optional[int]
slug: Optional[str]
address_line1: Optional[str]
address_line2: Optional[str]
city: Optional[str]
Expand All @@ -125,6 +134,7 @@ class CustomerResponse(BaseResponseModel):
legal_name: Optional[str]
legal_number: Optional[str]
net_payment_term: Optional[int]
external_salesforce_id: Optional[str]
tax_identification_number: Optional[str]
logo_url: Optional[str]
name: Optional[str]
Expand Down
52 changes: 52 additions & 0 deletions lago_python_client/models/entitlement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from typing import Any, Dict, List, Optional

from ..base_model import BaseResponseModel


class PlanEntitlementPrivilegeResponse(BaseResponseModel):
code: Optional[str]
name: Optional[str]
value_type: Optional[str]
config: Optional[Dict[str, Any]]
value: Any


class PlanEntitlementPrivilegesResponse(BaseResponseModel):
__root__: List[PlanEntitlementPrivilegeResponse]


class PlanEntitlementResponse(BaseResponseModel):
code: Optional[str]
name: Optional[str]
description: Optional[str]
privileges: Optional[PlanEntitlementPrivilegesResponse]


class PlanEntitlementsResponse(BaseResponseModel):
__root__: List[PlanEntitlementResponse]


class SubscriptionEntitlementPrivilegeResponse(BaseResponseModel):
code: Optional[str]
name: Optional[str]
value_type: Optional[str]
config: Optional[Dict[str, Any]]
value: Any
plan_value: Any
override_value: Any


class SubscriptionEntitlementPrivilegesResponse(BaseResponseModel):
__root__: List[SubscriptionEntitlementPrivilegeResponse]


class SubscriptionEntitlementResponse(BaseResponseModel):
code: Optional[str]
name: Optional[str]
description: Optional[str]
privileges: Optional[SubscriptionEntitlementPrivilegesResponse]
overrides: Optional[Dict[str, Any]]


class SubscriptionEntitlementsResponse(BaseResponseModel):
__root__: List[SubscriptionEntitlementResponse]
3 changes: 3 additions & 0 deletions lago_python_client/models/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class Organization(BaseModel):
email_settings: Optional[List[str]]
finalize_zero_amount_invoice: Optional[bool]
billing_configuration: Optional[OrganizationBillingConfiguration]
slug: Optional[str]


class OrganizationResponse(BaseResponseModel):
lago_id: Optional[str]
name: str
created_at: str
webhook_url: Optional[str]
Expand All @@ -57,3 +59,4 @@ class OrganizationResponse(BaseResponseModel):
finalize_zero_amount_invoice: Optional[bool]
billing_configuration: Optional[OrganizationBillingConfiguration]
events_store: Optional[str]
slug: Optional[str]
12 changes: 11 additions & 1 deletion lago_python_client/models/payment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Optional
from typing import Any, Dict, List, Optional

from ..base_model import BaseModel, BaseResponseModel

Expand All @@ -12,14 +12,24 @@ class Payment(BaseModel):

class PaymentResponse(BaseResponseModel):
lago_id: str
lago_customer_id: Optional[str]
external_customer_id: Optional[str]
invoice_ids: List[str]
invoice_numbers: List[str]
lago_payable_id: Optional[str]
payable_type: Optional[str]
amount_cents: int
amount_currency: str
status: Optional[str]
payment_status: str
type: str
reference: str
payment_provider_code: Optional[str]
payment_provider_type: Optional[str]
external_payment_id: Optional[str]
provider_payment_id: Optional[str]
provider_customer_id: Optional[str]
next_action: Optional[Dict[str, Any]]
created_at: str


Expand Down
5 changes: 5 additions & 0 deletions lago_python_client/models/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from ..base_model import BaseResponseModel
from .charge import Charges, ChargesOverrides, ChargesResponse
from .entitlement import PlanEntitlementsResponse
from .fixed_charge import (
FixedCharges,
FixedChargesOverrides,
Expand All @@ -16,6 +17,7 @@
)
from .tax import TaxesResponse
from .usage_threshold import (
ApplicableUsageThresholdsResponse,
UsageThresholds,
UsageThresholdsOverrides,
UsageThresholdsResponse,
Expand Down Expand Up @@ -63,6 +65,9 @@ class PlanResponse(BaseResponseModel):
usage_thresholds: Optional[UsageThresholdsResponse]
taxes: Optional[TaxesResponse]
metadata: Optional[Dict[str, Optional[str]]]
pending_deletion: Optional[bool]
entitlements: Optional[PlanEntitlementsResponse]
applicable_usage_thresholds: Optional[ApplicableUsageThresholdsResponse]


class PlanOverrides(BaseModel):
Expand Down
8 changes: 7 additions & 1 deletion lago_python_client/models/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
from lago_python_client.base_model import BaseModel

from ..base_model import BaseResponseModel
from .entitlement import SubscriptionEntitlementsResponse
from .invoice_custom_section import AppliedInvoiceCustomSections, InvoiceCustomSectionInput
from .payment_method import PaymentMethod
from .plan import PlanOverrides
from .usage_threshold import ApplicableUsageThresholdsResponse, UsageThresholdsOverrides


class ActivationRuleInput(BaseModel):
Expand All @@ -28,6 +30,8 @@ class Subscription(BaseModel):
billing_entity_code: Optional[str]
purchase_order_number: Optional[str]
activation_rules: Optional[List[ActivationRuleInput]]
progressive_billing_disabled: Optional[bool]
usage_thresholds: Optional[UsageThresholdsOverrides]


class Subscriptions(BaseModel):
Expand Down Expand Up @@ -63,7 +67,6 @@ class SubscriptionResponse(BaseResponseModel):
terminated_at: Optional[str]
ending_at: Optional[str]
trial_ended_at: Optional[str]
subscription_date: Optional[str]
subscription_at: Optional[str]
previous_plan_code: Optional[str]
next_plan_code: Optional[str]
Expand All @@ -80,6 +83,9 @@ class SubscriptionResponse(BaseResponseModel):
cancellation_reason: Optional[str]
activated_at: Optional[str]
activation_rules: Optional[List[ActivationRuleResponse]]
progressive_billing_disabled: Optional[bool]
Comment thread
vincent-pochet marked this conversation as resolved.
Resolved
entitlements: Optional[SubscriptionEntitlementsResponse]
applicable_usage_thresholds: Optional[ApplicableUsageThresholdsResponse]


class SubscriptionsResponse(BaseResponseModel):
Expand Down
10 changes: 10 additions & 0 deletions lago_python_client/models/usage_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ class UsageThresholdsResponse(BaseResponseModel):
__root__: List[UsageThresholdResponse]


class ApplicableUsageThresholdResponse(BaseResponseModel):
threshold_display_name: Optional[str]
amount_cents: Optional[int]
recurring: Optional[bool]


class ApplicableUsageThresholdsResponse(BaseResponseModel):
__root__: List[ApplicableUsageThresholdResponse]


class UsageThresholdOverrides(BaseModel):
amount_cents: Optional[int]
threshold_display_name: Optional[str]
Expand Down
1 change: 1 addition & 0 deletions lago_python_client/models/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class Wallet(BaseModel):
name: Optional[str]
code: Optional[str]
priority: Optional[int]
transaction_priority: Optional[int]
paid_credits: Optional[str]
granted_credits: Optional[str]
expiration_at: Optional[str]
Expand Down
2 changes: 2 additions & 0 deletions lago_python_client/models/wallet_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class WalletTransaction(BaseModel):
purchase_order_number: Optional[str]
payment_method: Optional[PaymentMethod]
invoice_custom_section: Optional[InvoiceCustomSectionInput]
priority: Optional[int]
voided_transaction_id: Optional[str]


class WalletTransactionResponse(BaseResponseModel):
Expand Down
2 changes: 1 addition & 1 deletion lago_python_client/wallets/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def create(self, input_object: BaseModel) -> Mapping[str, Any]:
origin=self.base_url,
path_parts=(self.API_RESOURCE,),
),
content=to_json({"wallet_transaction": input_object.dict()}),
content=to_json({"wallet_transaction": input_object.dict(exclude_none=True)}),
headers=make_headers(api_key=self.api_key),
)

Expand Down
Loading
Loading