mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 06:14:29 +00:00
dc9661134d
- Removed the old CookieResult model from pyfragment.core.models and created a new one in pyfragment.services.cookies.models. - Implemented get_cookies_from_browser function in pyfragment.services.cookies.service to extract cookies directly from supported browsers. - Updated imports across various modules to reflect the new structure and removed unused imports. - Cleaned up models in ads, anonymous_numbers, giveaways, marketplace, and purchases domains by removing unnecessary __all__ declarations. - Added new example scripts for cookie extraction and various purchase functionalities. - Consolidated constants into a new pyfragment.core.constants module for better organization.
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from pyfragment.domains.base import BaseService
|
|
from pyfragment.domains.purchases.models import PremiumResult, StarsResult
|
|
from pyfragment.domains.purchases.purchase import purchase_premium, purchase_stars
|
|
from pyfragment.enums import PaymentMethod
|
|
|
|
if TYPE_CHECKING:
|
|
pass
|
|
|
|
|
|
class PurchasesService(BaseService):
|
|
async def purchase_stars(
|
|
self,
|
|
username: str,
|
|
amount: int,
|
|
show_sender: bool = True,
|
|
payment_method: PaymentMethod = PaymentMethod.GRAM,
|
|
) -> StarsResult:
|
|
return await purchase_stars(self._client, username, amount, show_sender=show_sender, payment_method=payment_method)
|
|
|
|
async def purchase_premium(
|
|
self,
|
|
username: str,
|
|
months: int,
|
|
show_sender: bool = True,
|
|
payment_method: PaymentMethod = PaymentMethod.GRAM,
|
|
) -> PremiumResult:
|
|
return await purchase_premium(self._client, username, months, show_sender=show_sender, payment_method=payment_method)
|