| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._stripe_service import StripeService |
| 4 |
from stripe._util import sanitize_id |
| 5 |
from typing import Optional, cast |
| 6 |
from typing_extensions import TYPE_CHECKING |
| 7 |
|
| 8 |
if TYPE_CHECKING: |
| 9 |
from stripe._list_object import ListObject |
| 10 |
from stripe._request_options import RequestOptions |
| 11 |
from stripe.params.reporting._report_run_create_params import ( |
| 12 |
ReportRunCreateParams, |
| 13 |
) |
| 14 |
from stripe.params.reporting._report_run_list_params import ( |
| 15 |
ReportRunListParams, |
| 16 |
) |
| 17 |
from stripe.params.reporting._report_run_retrieve_params import ( |
| 18 |
ReportRunRetrieveParams, |
| 19 |
) |
| 20 |
from stripe.reporting._report_run import ReportRun |
| 21 |
|
| 22 |
|
| 23 |
class ReportRunService(StripeService): |
| 24 |
def list( |
| 25 |
self, |
| 26 |
params: Optional["ReportRunListParams"] = None, |
| 27 |
options: Optional["RequestOptions"] = None, |
| 28 |
) -> "ListObject[ReportRun]": |
| 29 |
""" |
| 30 |
Returns a list of Report Runs, with the most recent appearing first. |
| 31 |
""" |
| 32 |
return cast( |
| 33 |
"ListObject[ReportRun]", |
| 34 |
self._request( |
| 35 |
"get", |
| 36 |
"/v1/reporting/report_runs", |
| 37 |
base_address="api", |
| 38 |
params=params, |
| 39 |
options=options, |
| 40 |
), |
| 41 |
) |
| 42 |
|
| 43 |
async def list_async( |
| 44 |
self, |
| 45 |
params: Optional["ReportRunListParams"] = None, |
| 46 |
options: Optional["RequestOptions"] = None, |
| 47 |
) -> "ListObject[ReportRun]": |
| 48 |
""" |
| 49 |
Returns a list of Report Runs, with the most recent appearing first. |
| 50 |
""" |
| 51 |
return cast( |
| 52 |
"ListObject[ReportRun]", |
| 53 |
await self._request_async( |
| 54 |
"get", |
| 55 |
"/v1/reporting/report_runs", |
| 56 |
base_address="api", |
| 57 |
params=params, |
| 58 |
options=options, |
| 59 |
), |
| 60 |
) |
| 61 |
|
| 62 |
def create( |
| 63 |
self, |
| 64 |
params: "ReportRunCreateParams", |
| 65 |
options: Optional["RequestOptions"] = None, |
| 66 |
) -> "ReportRun": |
| 67 |
""" |
| 68 |
Creates a new object and begin running the report. (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).) |
| 69 |
""" |
| 70 |
return cast( |
| 71 |
"ReportRun", |
| 72 |
self._request( |
| 73 |
"post", |
| 74 |
"/v1/reporting/report_runs", |
| 75 |
base_address="api", |
| 76 |
params=params, |
| 77 |
options=options, |
| 78 |
), |
| 79 |
) |
| 80 |
|
| 81 |
async def create_async( |
| 82 |
self, |
| 83 |
params: "ReportRunCreateParams", |
| 84 |
options: Optional["RequestOptions"] = None, |
| 85 |
) -> "ReportRun": |
| 86 |
""" |
| 87 |
Creates a new object and begin running the report. (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).) |
| 88 |
""" |
| 89 |
return cast( |
| 90 |
"ReportRun", |
| 91 |
await self._request_async( |
| 92 |
"post", |
| 93 |
"/v1/reporting/report_runs", |
| 94 |
base_address="api", |
| 95 |
params=params, |
| 96 |
options=options, |
| 97 |
), |
| 98 |
) |
| 99 |
|
| 100 |
def retrieve( |
| 101 |
self, |
| 102 |
report_run: str, |
| 103 |
params: Optional["ReportRunRetrieveParams"] = None, |
| 104 |
options: Optional["RequestOptions"] = None, |
| 105 |
) -> "ReportRun": |
| 106 |
""" |
| 107 |
Retrieves the details of an existing Report Run. |
| 108 |
""" |
| 109 |
return cast( |
| 110 |
"ReportRun", |
| 111 |
self._request( |
| 112 |
"get", |
| 113 |
"/v1/reporting/report_runs/{report_run}".format( |
| 114 |
report_run=sanitize_id(report_run), |
| 115 |
), |
| 116 |
base_address="api", |
| 117 |
params=params, |
| 118 |
options=options, |
| 119 |
), |
| 120 |
) |
| 121 |
|
| 122 |
async def retrieve_async( |
| 123 |
self, |
| 124 |
report_run: str, |
| 125 |
params: Optional["ReportRunRetrieveParams"] = None, |
| 126 |
options: Optional["RequestOptions"] = None, |
| 127 |
) -> "ReportRun": |
| 128 |
""" |
| 129 |
Retrieves the details of an existing Report Run. |
| 130 |
""" |
| 131 |
return cast( |
| 132 |
"ReportRun", |
| 133 |
await self._request_async( |
| 134 |
"get", |
| 135 |
"/v1/reporting/report_runs/{report_run}".format( |
| 136 |
report_run=sanitize_id(report_run), |
| 137 |
), |
| 138 |
base_address="api", |
| 139 |
params=params, |
| 140 |
options=options, |
| 141 |
), |
| 142 |
) |