Skip to content

Commit

Permalink
SDK-4929 pr updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalshit27 committed Sep 17, 2024
1 parent a5e7526 commit 39d9047
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 102 deletions.
4 changes: 2 additions & 2 deletions management/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ type Flow struct {
// Security configuration for flow executions
Security *map[string]interface{} `json:"security,omitempty"`

// Number of flows linked to this flow
FlowCount *int `json:"flow_count,omitempty"`
// Number of forms linked to this flow
FormCount *int `json:"form_count,omitempty"`

CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions management/flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func TestFlowManager_Update(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "Updated flow description test", updatedFlow.GetDescription())
assert.Equal(t, expectedFlow.GetName(), updatedFlow.GetName())
assert.Equal(t, expectedFlow.GetSynchronous(), updatedFlow.GetSynchronous())
}

func TestFlowManager_Delete(t *testing.T) {
Expand Down Expand Up @@ -172,6 +173,7 @@ func TestFlowVaultConnectionManager_Update(t *testing.T) {

assert.NoError(t, err)
assert.Equal(t, "new-connection-name", updatedFlowVaultConnection.GetName())
assert.Equal(t, expectedFlowVaultConnection.GetAppID(), updatedFlowVaultConnection.GetAppID())
}

func TestFlowVaultConnectionManager_Delete(t *testing.T) {
Expand Down
14 changes: 5 additions & 9 deletions management/form.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Form struct {
// Languages contains the languages of the form.
Languages *FormLanguages `json:"languages,omitempty"`
// Style contains the style of the form.
Style *FormStyle `json:"style,omitempty"`
Style *map[string]interface{} `json:"style,omitempty"`

// FlowCount is the count of flows in the form.
FlowCount *int `json:"flow_count,omitempty"`
Expand All @@ -41,6 +41,9 @@ type Form struct {
// Tags are the tags associated with the form.
Tags *[]string `json:"tags,omitempty"`

// Form related links
Links *map[string]interface{} `json:"links,omitempty"`

CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
EmbeddedAt *time.Time `json:"embedded_at,omitempty"`
Expand All @@ -59,20 +62,13 @@ type FormMessages struct {
Errors *map[string]interface{} `json:"errors,omitempty"`
}

// FormStyle represents the style of the form.
type FormStyle struct {
CSS *string `json:"css,omitempty"`
Version *string `json:"version,omitempty"`
Theme *string `json:"theme,omitempty"`
}

// MarshalJSON implements the json.Marshaller interface.
func (f *Form) MarshalJSON() ([]byte, error) {
type FormSubset struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Languages *FormLanguages `json:"languages,omitempty"`
Style *FormStyle `json:"style,omitempty"`
Style *map[string]interface{} `json:"style,omitempty"`
Messages *FormMessages `json:"messages,omitempty"`
Translations *map[string]interface{} `json:"translations,omitempty"`
Start *map[string]interface{} `json:"start,omitempty"`
Expand Down
21 changes: 12 additions & 9 deletions management/form_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ func TestFormManager_Create(t *testing.T) {
Languages: &FormLanguages{
Primary: auth0.String("en"),
},
Style: &FormStyle{
Theme: auth0.String("SOFT"),
Version: auth0.String("MODERN"),
Style: &map[string]interface{}{
"theme": auth0.String("SOFT"),
"version": auth0.String("MODERN"),
},
}

Expand Down Expand Up @@ -58,6 +58,8 @@ func TestFormManager_Update(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "Updated Description test", updatedForm.GetDescription())
assert.Equal(t, expectedForm.GetName(), updatedForm.GetName())
assert.Equal(t, expectedForm.GetLanguages(), updatedForm.GetLanguages())
assert.Equal(t, expectedForm.GetStyle(), updatedForm.GetStyle())
}

func TestFormManager_Delete(t *testing.T) {
Expand Down Expand Up @@ -87,10 +89,11 @@ func TestFormManager_MarshalJSON(t *testing.T) {
Languages: &FormLanguages{
Primary: auth0.String("en"),
},
Style: &FormStyle{
Theme: auth0.String("SOFT"),
Style: &map[string]interface{}{
"theme": auth0.String("SOFT"),
"version": auth0.String("MODERN"),
},
}: `{"name":"test-form","description":"A test form","languages":{"primary":"en"},"style":{"theme":"SOFT"}}`,
}: `{"name":"test-form","description":"A test form","languages":{"primary":"en"},"style":{"theme":"SOFT","version":"MODERN"}}`,
{
Messages: &FormMessages{
Custom: &map[string]interface{}{
Expand Down Expand Up @@ -130,9 +133,9 @@ func givenAForm(t *testing.T) *Form {
Languages: &FormLanguages{
Primary: auth0.String("en"),
},
Style: &FormStyle{
Theme: auth0.String("SOFT"),
Version: auth0.String("MODERN"),
Style: &map[string]interface{}{
"theme": auth0.String("SOFT"),
"version": auth0.String("MODERN"),
},
}

Expand Down
55 changes: 17 additions & 38 deletions management/management.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 19 additions & 44 deletions management/management.gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 39d9047

Please sign in to comment.