github.com/stripe/stripe-go/v76@v76.25.0/reporting_reportrun.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // Status of this report run. This will be `pending` when the run is initially created.
    10  //
    11  //	When the run finishes, this will be set to `succeeded` and the `result` field will be populated.
    12  //	Rarely, we may encounter an error, at which point this will be set to `failed` and the `error` field will be populated.
    13  type ReportingReportRunStatus string
    14  
    15  // List of values that ReportingReportRunStatus can take
    16  const (
    17  	ReportingReportRunStatusFailed    ReportingReportRunStatus = "failed"
    18  	ReportingReportRunStatusPending   ReportingReportRunStatus = "pending"
    19  	ReportingReportRunStatusSucceeded ReportingReportRunStatus = "succeeded"
    20  )
    21  
    22  // Returns a list of Report Runs, with the most recent appearing first.
    23  type ReportingReportRunListParams struct {
    24  	ListParams `form:"*"`
    25  	// Only return Report Runs that were created during the given date interval.
    26  	Created *int64 `form:"created"`
    27  	// Only return Report Runs that were created during the given date interval.
    28  	CreatedRange *RangeQueryParams `form:"created"`
    29  	// Specifies which fields in the response should be expanded.
    30  	Expand []*string `form:"expand"`
    31  }
    32  
    33  // AddExpand appends a new field to expand.
    34  func (p *ReportingReportRunListParams) AddExpand(f string) {
    35  	p.Expand = append(p.Expand, &f)
    36  }
    37  
    38  // Parameters specifying how the report should be run. Different Report Types have different required and optional parameters, listed in the [API Access to Reports](https://stripe.com/docs/reporting/statements/api) documentation.
    39  type ReportingReportRunParametersParams struct {
    40  	// The set of report columns to include in the report output. If omitted, the Report Type is run with its default column set.
    41  	Columns []*string `form:"columns"`
    42  	// Connected account ID to filter for in the report run.
    43  	ConnectedAccount *string `form:"connected_account"`
    44  	// Currency of objects to be included in the report run.
    45  	Currency *string `form:"currency"`
    46  	// Ending timestamp of data to be included in the report run (exclusive).
    47  	IntervalEnd *int64 `form:"interval_end"`
    48  	// Starting timestamp of data to be included in the report run.
    49  	IntervalStart *int64 `form:"interval_start"`
    50  	// Payout ID by which to filter the report run.
    51  	Payout *string `form:"payout"`
    52  	// Category of balance transactions to be included in the report run.
    53  	ReportingCategory *string `form:"reporting_category"`
    54  	// Defaults to `Etc/UTC`. The output timezone for all timestamps in the report. A list of possible time zone values is maintained at the [IANA Time Zone Database](http://www.iana.org/time-zones). Has no effect on `interval_start` or `interval_end`.
    55  	Timezone *string `form:"timezone"`
    56  }
    57  
    58  // 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).)
    59  type ReportingReportRunParams struct {
    60  	Params `form:"*"`
    61  	// Specifies which fields in the response should be expanded.
    62  	Expand []*string `form:"expand"`
    63  	// Parameters specifying how the report should be run. Different Report Types have different required and optional parameters, listed in the [API Access to Reports](https://stripe.com/docs/reporting/statements/api) documentation.
    64  	Parameters *ReportingReportRunParametersParams `form:"parameters"`
    65  	// The ID of the [report type](https://stripe.com/docs/reporting/statements/api#report-types) to run, such as `"balance.summary.1"`.
    66  	ReportType *string `form:"report_type"`
    67  }
    68  
    69  // AddExpand appends a new field to expand.
    70  func (p *ReportingReportRunParams) AddExpand(f string) {
    71  	p.Expand = append(p.Expand, &f)
    72  }
    73  
    74  type ReportingReportRunParameters struct {
    75  	// The set of output columns requested for inclusion in the report run.
    76  	Columns []string `json:"columns"`
    77  	// Connected account ID by which to filter the report run.
    78  	ConnectedAccount string `json:"connected_account"`
    79  	// Currency of objects to be included in the report run.
    80  	Currency Currency `json:"currency"`
    81  	// Ending timestamp of data to be included in the report run. Can be any UTC timestamp between 1 second after the user specified `interval_start` and 1 second before this report's last `data_available_end` value.
    82  	IntervalEnd int64 `json:"interval_end"`
    83  	// Starting timestamp of data to be included in the report run. Can be any UTC timestamp between 1 second after this report's `data_available_start` and 1 second before the user specified `interval_end` value.
    84  	IntervalStart int64 `json:"interval_start"`
    85  	// Payout ID by which to filter the report run.
    86  	Payout string `json:"payout"`
    87  	// Category of balance transactions to be included in the report run.
    88  	ReportingCategory string `json:"reporting_category"`
    89  	// Defaults to `Etc/UTC`. The output timezone for all timestamps in the report. A list of possible time zone values is maintained at the [IANA Time Zone Database](http://www.iana.org/time-zones). Has no effect on `interval_start` or `interval_end`.
    90  	Timezone string `json:"timezone"`
    91  }
    92  
    93  // The Report Run object represents an instance of a report type generated with
    94  // specific run parameters. Once the object is created, Stripe begins processing the report.
    95  // When the report has finished running, it will give you a reference to a file
    96  // where you can retrieve your results. For an overview, see
    97  // [API Access to Reports](https://stripe.com/docs/reporting/statements/api).
    98  //
    99  // Note that certain report types can only be run based on your live-mode data (not test-mode
   100  // data), and will error when queried without a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).
   101  type ReportingReportRun struct {
   102  	APIResource
   103  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   104  	Created int64 `json:"created"`
   105  	// If something should go wrong during the run, a message about the failure (populated when
   106  	//  `status=failed`).
   107  	Error string `json:"error"`
   108  	// Unique identifier for the object.
   109  	ID string `json:"id"`
   110  	// `true` if the report is run on live mode data and `false` if it is run on test mode data.
   111  	Livemode bool `json:"livemode"`
   112  	// String representing the object's type. Objects of the same type share the same value.
   113  	Object     string                        `json:"object"`
   114  	Parameters *ReportingReportRunParameters `json:"parameters"`
   115  	// The ID of the [report type](https://stripe.com/docs/reports/report-types) to run, such as `"balance.summary.1"`.
   116  	ReportType string `json:"report_type"`
   117  	// The file object representing the result of the report run (populated when
   118  	//  `status=succeeded`).
   119  	Result *File `json:"result"`
   120  	// Status of this report run. This will be `pending` when the run is initially created.
   121  	//  When the run finishes, this will be set to `succeeded` and the `result` field will be populated.
   122  	//  Rarely, we may encounter an error, at which point this will be set to `failed` and the `error` field will be populated.
   123  	Status ReportingReportRunStatus `json:"status"`
   124  	// Timestamp at which this run successfully finished (populated when
   125  	//  `status=succeeded`). Measured in seconds since the Unix epoch.
   126  	SucceededAt int64 `json:"succeeded_at"`
   127  }
   128  
   129  // ReportingReportRunList is a list of ReportRuns as retrieved from a list endpoint.
   130  type ReportingReportRunList struct {
   131  	APIResource
   132  	ListMeta
   133  	Data []*ReportingReportRun `json:"data"`
   134  }