Skip to content

Commit

Permalink
feat: Add custom action structure to the create token flow (#21)
Browse files Browse the repository at this point in the history
Co-authored-by: ProcessOut Fountain <[email protected]>
  • Loading branch information
petro-marik-cko and processout-machine authored Sep 17, 2024
1 parent 1b5b838 commit 7e97a46
Show file tree
Hide file tree
Showing 12 changed files with 1,407 additions and 26 deletions.
620 changes: 620 additions & 0 deletions export_layout.go

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions export_layout_configuration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package processout

import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"time"

"gopkg.in/processout.v4/errors"
)

// ExportLayoutConfiguration represents the ExportLayoutConfiguration API object
type ExportLayoutConfiguration struct {
// Columns is the columns that will be exported.
Columns *[]*ExportLayoutConfigurationColumn `json:"columns,omitempty"`
// Time is the time related configurations.
Time *ExportLayoutConfigurationTime `json:"time,omitempty"`
// Amount is the amount related configurations.
Amount *ExportLayoutConfigurationAmount `json:"amount,omitempty"`

client *ProcessOut
}

// SetClient sets the client for the ExportLayoutConfiguration object and its
// children
func (s *ExportLayoutConfiguration) SetClient(c *ProcessOut) *ExportLayoutConfiguration {
if s == nil {
return s
}
s.client = c
if s.Time != nil {
s.Time.SetClient(c)
}
if s.Amount != nil {
s.Amount.SetClient(c)
}

return s
}

// Prefil prefills the object with data provided in the parameter
func (s *ExportLayoutConfiguration) Prefill(c *ExportLayoutConfiguration) *ExportLayoutConfiguration {
if c == nil {
return s
}

s.Columns = c.Columns
s.Time = c.Time
s.Amount = c.Amount

return s
}

// dummyExportLayoutConfiguration is a dummy function that's only
// here because some files need specific packages and some don't.
// It's easier to include it for every file. In case you couldn't
// tell, everything is generated.
func dummyExportLayoutConfiguration() {
type dummy struct {
a bytes.Buffer
b json.RawMessage
c http.File
d strings.Reader
e time.Time
f url.URL
g io.Reader
}
errors.New(nil, "", "")
}
63 changes: 63 additions & 0 deletions export_layout_configuration_amount.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package processout

import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"time"

"gopkg.in/processout.v4/errors"
)

// ExportLayoutConfigurationAmount represents the ExportLayoutConfigurationAmount API object
type ExportLayoutConfigurationAmount struct {
// Precision is the chosen precision for the amount fields in the export.
Precision *string `json:"precision,omitempty"`
// Separator is the chosen separator for the amount fields in the export.
Separator *string `json:"separator,omitempty"`

client *ProcessOut
}

// SetClient sets the client for the ExportLayoutConfigurationAmount object and its
// children
func (s *ExportLayoutConfigurationAmount) SetClient(c *ProcessOut) *ExportLayoutConfigurationAmount {
if s == nil {
return s
}
s.client = c

return s
}

// Prefil prefills the object with data provided in the parameter
func (s *ExportLayoutConfigurationAmount) Prefill(c *ExportLayoutConfigurationAmount) *ExportLayoutConfigurationAmount {
if c == nil {
return s
}

s.Precision = c.Precision
s.Separator = c.Separator

return s
}

// dummyExportLayoutConfigurationAmount is a dummy function that's only
// here because some files need specific packages and some don't.
// It's easier to include it for every file. In case you couldn't
// tell, everything is generated.
func dummyExportLayoutConfigurationAmount() {
type dummy struct {
a bytes.Buffer
b json.RawMessage
c http.File
d strings.Reader
e time.Time
f url.URL
g io.Reader
}
errors.New(nil, "", "")
}
63 changes: 63 additions & 0 deletions export_layout_configuration_column.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package processout

import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"time"

"gopkg.in/processout.v4/errors"
)

// ExportLayoutConfigurationColumn represents the ExportLayoutConfigurationColumn API object
type ExportLayoutConfigurationColumn struct {
// Name is the name of the column. Must match with supported ones for chosen export type.
Name *string `json:"name,omitempty"`
// Rename is the rename of the chosen column if needed.
Rename *string `json:"rename,omitempty"`

client *ProcessOut
}

// SetClient sets the client for the ExportLayoutConfigurationColumn object and its
// children
func (s *ExportLayoutConfigurationColumn) SetClient(c *ProcessOut) *ExportLayoutConfigurationColumn {
if s == nil {
return s
}
s.client = c

return s
}

// Prefil prefills the object with data provided in the parameter
func (s *ExportLayoutConfigurationColumn) Prefill(c *ExportLayoutConfigurationColumn) *ExportLayoutConfigurationColumn {
if c == nil {
return s
}

s.Name = c.Name
s.Rename = c.Rename

return s
}

// dummyExportLayoutConfigurationColumn is a dummy function that's only
// here because some files need specific packages and some don't.
// It's easier to include it for every file. In case you couldn't
// tell, everything is generated.
func dummyExportLayoutConfigurationColumn() {
type dummy struct {
a bytes.Buffer
b json.RawMessage
c http.File
d strings.Reader
e time.Time
f url.URL
g io.Reader
}
errors.New(nil, "", "")
}
63 changes: 63 additions & 0 deletions export_layout_configuration_configuration_options_amount.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package processout

import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"time"

"gopkg.in/processout.v4/errors"
)

// ExportLayoutConfigurationConfigurationOptionsAmount represents the ExportLayoutConfigurationConfigurationOptionsAmount API object
type ExportLayoutConfigurationConfigurationOptionsAmount struct {
// Precision is the precision options for configuration.
Precision *[]string `json:"precision,omitempty"`
// Separator is the separator options for configuration.
Separator *[]string `json:"separator,omitempty"`

client *ProcessOut
}

// SetClient sets the client for the ExportLayoutConfigurationConfigurationOptionsAmount object and its
// children
func (s *ExportLayoutConfigurationConfigurationOptionsAmount) SetClient(c *ProcessOut) *ExportLayoutConfigurationConfigurationOptionsAmount {
if s == nil {
return s
}
s.client = c

return s
}

// Prefil prefills the object with data provided in the parameter
func (s *ExportLayoutConfigurationConfigurationOptionsAmount) Prefill(c *ExportLayoutConfigurationConfigurationOptionsAmount) *ExportLayoutConfigurationConfigurationOptionsAmount {
if c == nil {
return s
}

s.Precision = c.Precision
s.Separator = c.Separator

return s
}

// dummyExportLayoutConfigurationConfigurationOptionsAmount is a dummy function that's only
// here because some files need specific packages and some don't.
// It's easier to include it for every file. In case you couldn't
// tell, everything is generated.
func dummyExportLayoutConfigurationConfigurationOptionsAmount() {
type dummy struct {
a bytes.Buffer
b json.RawMessage
c http.File
d strings.Reader
e time.Time
f url.URL
g io.Reader
}
errors.New(nil, "", "")
}
60 changes: 60 additions & 0 deletions export_layout_configuration_configuration_options_time.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package processout

import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"time"

"gopkg.in/processout.v4/errors"
)

// ExportLayoutConfigurationConfigurationOptionsTime represents the ExportLayoutConfigurationConfigurationOptionsTime API object
type ExportLayoutConfigurationConfigurationOptionsTime struct {
// Format is the format options for configuration.
Format *[]string `json:"format,omitempty"`

client *ProcessOut
}

// SetClient sets the client for the ExportLayoutConfigurationConfigurationOptionsTime object and its
// children
func (s *ExportLayoutConfigurationConfigurationOptionsTime) SetClient(c *ProcessOut) *ExportLayoutConfigurationConfigurationOptionsTime {
if s == nil {
return s
}
s.client = c

return s
}

// Prefil prefills the object with data provided in the parameter
func (s *ExportLayoutConfigurationConfigurationOptionsTime) Prefill(c *ExportLayoutConfigurationConfigurationOptionsTime) *ExportLayoutConfigurationConfigurationOptionsTime {
if c == nil {
return s
}

s.Format = c.Format

return s
}

// dummyExportLayoutConfigurationConfigurationOptionsTime is a dummy function that's only
// here because some files need specific packages and some don't.
// It's easier to include it for every file. In case you couldn't
// tell, everything is generated.
func dummyExportLayoutConfigurationConfigurationOptionsTime() {
type dummy struct {
a bytes.Buffer
b json.RawMessage
c http.File
d strings.Reader
e time.Time
f url.URL
g io.Reader
}
errors.New(nil, "", "")
}
Loading

0 comments on commit 7e97a46

Please sign in to comment.