-
Notifications
You must be signed in to change notification settings - Fork 2
/
simulation_runs.go
113 lines (93 loc) · 4.54 KB
/
simulation_runs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Code generated by the Paddle SDK Generator; DO NOT EDIT.
package paddle
import "context"
// SimulationRunStatus: Status of this simulation run..
type SimulationRunStatus string
const (
SimulationRunStatusPending SimulationRunStatus = "pending"
SimulationRunStatusCompleted SimulationRunStatus = "completed"
SimulationRunStatusCanceled SimulationRunStatus = "canceled"
)
// SimulationRun: Represents a simulation run entity.
type SimulationRun struct {
// ID: Unique Paddle ID for this simulation run, prefixed with `ntfsimrun_`.
ID string `json:"id,omitempty"`
// Status: Status of this simulation run.
Status SimulationRunStatus `json:"status,omitempty"`
// CreatedAt: RFC 3339 datetime string of when this entity was created. Set automatically by Paddle.
CreatedAt string `json:"created_at,omitempty"`
// UpdatedAt: RFC 3339 datetime string of when this entity was updated. Set automatically by Paddle.
UpdatedAt string `json:"updated_at,omitempty"`
// Type: Single event sent for this simulation, in the format `entity.event_type`.
Type SimulationTypeName `json:"type,omitempty"`
/*
Events: Events associated with this simulation run. Paddle creates a list of events for each simulation runs. Returned when the
`include` parameter is used with the `events` value.
*/
Events []SimulationEvent `json:"events,omitempty"`
}
// SimulationRunsClient is a client for the Simulation runs resource.
type SimulationRunsClient struct {
doer Doer
}
// ListSimulationRunsRequest is given as an input to ListSimulationRuns.
type ListSimulationRunsRequest struct {
// URL path parameters.
SimulationID string `in:"path=simulation_id" json:"-"`
// After is a query parameter.
// Return entities after the specified Paddle ID when working with paginated endpoints. Used in the `meta.pagination.next` URL in responses for list operations.
After *string `in:"query=after;omitempty" json:"-"`
// OrderBy is a query parameter.
/*
Order returned entities by the specified field and direction (`[ASC]` or `[DESC]`). For example, `?order_by=id[ASC]`.
Valid fields for ordering: `id`.
*/
OrderBy *string `in:"query=order_by;omitempty" json:"-"`
// PerPage is a query parameter.
/*
Set how many entities are returned per page. Paddle returns the maximum number of results if a number greater than the maximum is requested. Check `meta.pagination.per_page` in the response to see how many were returned.
Default: `50`; Maximum: `200`.
*/
PerPage *int `in:"query=per_page;omitempty" json:"-"`
// ID is a query parameter.
// Return only the IDs specified. Use a comma-separated list to get multiple entities.
ID []string `in:"query=id;omitempty" json:"-"`
// IncludeEvents allows requesting the events sub-resource as part of this request.
// If set to true, will be included on the response.
IncludeEvents bool `in:"paddle_include=events" json:"-"`
}
// ListSimulationRuns performs the GET operation on a Simulation runs resource.
func (c *SimulationRunsClient) ListSimulationRuns(ctx context.Context, req *ListSimulationRunsRequest) (res *Collection[*SimulationRun], err error) {
if err := c.doer.Do(ctx, "GET", "/simulations/{simulation_id}/runs", req, &res); err != nil {
return nil, err
}
return res, nil
}
// CreateSimulationRunRequest is given as an input to CreateSimulationRun.
type CreateSimulationRunRequest struct {
// URL path parameters.
SimulationID string `in:"path=simulation_id" json:"-"`
}
// CreateSimulationRun performs the POST operation on a Simulation runs resource.
func (c *SimulationRunsClient) CreateSimulationRun(ctx context.Context, req *CreateSimulationRunRequest) (res *SimulationRun, err error) {
if err := c.doer.Do(ctx, "POST", "/simulations/{simulation_id}/runs", req, &res); err != nil {
return nil, err
}
return res, nil
}
// GetSimulationRunRequest is given as an input to GetSimulationRun.
type GetSimulationRunRequest struct {
// URL path parameters.
SimulationID string `in:"path=simulation_id" json:"-"`
SimulationRunID string `in:"path=simulation_run_id" json:"-"`
// IncludeEvents allows requesting the events sub-resource as part of this request.
// If set to true, will be included on the response.
IncludeEvents bool `in:"paddle_include=events" json:"-"`
}
// GetSimulationRun performs the GET operation on a Simulation runs resource.
func (c *SimulationRunsClient) GetSimulationRun(ctx context.Context, req *GetSimulationRunRequest) (res *SimulationRun, err error) {
if err := c.doer.Do(ctx, "GET", "/simulations/{simulation_id}/runs/{simulation_run_id}", req, &res); err != nil {
return nil, err
}
return res, nil
}