github.com/stripe/stripe-go/v76@v76.25.0/sigma/scheduledqueryrun/client.go (about) 1 // 2 // 3 // File generated from our OpenAPI spec 4 // 5 // 6 7 // Package scheduledqueryrun provides the /sigma/scheduled_query_runs APIs 8 // For more details, see: https://stripe.com/docs/api#scheduled_queries 9 package scheduledqueryrun 10 11 import ( 12 "net/http" 13 14 stripe "github.com/stripe/stripe-go/v76" 15 "github.com/stripe/stripe-go/v76/form" 16 ) 17 18 // Client is used to invoke /sigma/scheduled_query_runs APIs. 19 type Client struct { 20 B stripe.Backend 21 Key string 22 } 23 24 // Get returns the details of a sigma scheduled query run. 25 func Get(id string, params *stripe.SigmaScheduledQueryRunParams) (*stripe.SigmaScheduledQueryRun, error) { 26 return getC().Get(id, params) 27 } 28 29 // Get returns the details of a sigma scheduled query run. 30 func (c Client) Get(id string, params *stripe.SigmaScheduledQueryRunParams) (*stripe.SigmaScheduledQueryRun, error) { 31 path := stripe.FormatURLPath("/v1/sigma/scheduled_query_runs/%s", id) 32 scheduledqueryrun := &stripe.SigmaScheduledQueryRun{} 33 err := c.B.Call(http.MethodGet, path, c.Key, params, scheduledqueryrun) 34 return scheduledqueryrun, err 35 } 36 37 // List returns a list of sigma scheduled query runs. 38 func List(params *stripe.SigmaScheduledQueryRunListParams) *Iter { 39 return getC().List(params) 40 } 41 42 // List returns a list of sigma scheduled query runs. 43 func (c Client) List(listParams *stripe.SigmaScheduledQueryRunListParams) *Iter { 44 return &Iter{ 45 Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) { 46 list := &stripe.SigmaScheduledQueryRunList{} 47 err := c.B.CallRaw(http.MethodGet, "/v1/sigma/scheduled_query_runs", c.Key, b, p, list) 48 49 ret := make([]interface{}, len(list.Data)) 50 for i, v := range list.Data { 51 ret[i] = v 52 } 53 54 return ret, list, err 55 }), 56 } 57 } 58 59 // Iter is an iterator for sigma scheduled query runs. 60 type Iter struct { 61 *stripe.Iter 62 } 63 64 // SigmaScheduledQueryRun returns the sigma scheduled query run which the iterator is currently pointing to. 65 func (i *Iter) SigmaScheduledQueryRun() *stripe.SigmaScheduledQueryRun { 66 return i.Current().(*stripe.SigmaScheduledQueryRun) 67 } 68 69 // SigmaScheduledQueryRunList returns the current list object which the iterator is 70 // currently using. List objects will change as new API calls are made to 71 // continue pagination. 72 func (i *Iter) SigmaScheduledQueryRunList() *stripe.SigmaScheduledQueryRunList { 73 return i.List().(*stripe.SigmaScheduledQueryRunList) 74 } 75 76 func getC() Client { 77 return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} 78 }