File: _createable_api_resource.py

package info (click to toggle)
python-stripe 12.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,864 kB
  • sloc: python: 157,573; makefile: 13; sh: 9
file content (14 lines) | stat: -rw-r--r-- 382 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from stripe._api_resource import APIResource
from typing import TypeVar, cast
from stripe._stripe_object import StripeObject

T = TypeVar("T", bound=StripeObject)


class CreateableAPIResource(APIResource[T]):
    @classmethod
    def create(cls, **params) -> T:
        return cast(
            T,
            cls._static_request("post", cls.class_url(), params=params),
        )