diff --git a/management/flow.go b/management/flow.go new file mode 100644 index 00000000..0a536a55 --- /dev/null +++ b/management/flow.go @@ -0,0 +1,161 @@ +package management + +import ( + "context" + "encoding/json" + "time" +) + +// Flow represents an Auth0 flow for flow resource. +// +// See: https://auth0.com/docs/customize/forms/intro-to-flows +type Flow struct { + // Flow identifier + ID *string `json:"id,omitempty"` + + // Flow name + Name *string `json:"name,omitempty"` + // Flow actions + Actions []interface{} `json:"actions,omitempty"` + + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + ExecutedAt *time.Time `json:"executed_at,omitempty"` +} + +// FlowList holds a list of Flow. +type FlowList struct { + List + Flows []*Flow `json:"flows"` +} + +// MarshalJSON implements the json.Marshaller interface. +func (f *Flow) MarshalJSON() ([]byte, error) { + type FlowSubset struct { + Name *string `json:"name,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + } + + return json.Marshal(&FlowSubset{ + Name: f.Name, + Actions: f.Actions, + }) +} + +// FlowVaultConnection represents an Auth0 flow vault connection resource. +// +// See: https://auth0.com/docs/customize/forms/vault +type FlowVaultConnection struct { + // Flow vault connection identifier + ID *string `json:"id,omitempty"` + + // Flow vault connection app identifier + AppID *string `json:"app_id,omitempty"` + + // Flow vault connection environment + Environment *string `json:"environment,omitempty"` + + // Flow vault connection name + Name *string `json:"name,omitempty"` + + // Flow vault connection configuration + Setup *map[string]interface{} `json:"setup,omitempty"` + + // Flow vault connection custom account name + AccountName *string `json:"account_name,omitempty"` + + // When Flow vault connection is configured + Ready *bool `json:"ready,omitempty"` + + Fingerprint *string `json:"fingerprint,omitempty"` + + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + RefreshedAt *time.Time `json:"refreshed_at,omitempty"` +} + +// FlowVaultConnectionList holds a list of flow vault connections. +type FlowVaultConnectionList struct { + List + Connections []*FlowVaultConnection `json:"connections"` +} + +// MarshalJSON implements the json.Marshaller interface. +func (f *FlowVaultConnection) MarshalJSON() ([]byte, error) { + type FlowVaultConnectionSubset struct { + AppID *string `json:"app_id,omitempty"` + Name *string `json:"name,omitempty"` + Setup *map[string]interface{} `json:"setup,omitempty"` + } + + return json.Marshal(&FlowVaultConnectionSubset{ + AppID: f.AppID, + Name: f.Name, + Setup: f.Setup, + }) +} + +// FlowManager manages Auth0 Flow resources. +type FlowManager struct { + management *Management + + // FlowVaultConnection manages flow vault connection resources. + Vault *flowVaultConnectionManager +} + +// Create a new flow. +func (m *FlowManager) Create(ctx context.Context, r *Flow, opts ...RequestOption) error { + return m.management.Request(ctx, "POST", m.management.URI("flows"), r, opts...) +} + +// Retrieve flow details. +func (m *FlowManager) Read(ctx context.Context, id string, opts ...RequestOption) (r *Flow, err error) { + err = m.management.Request(ctx, "GET", m.management.URI("flows", id), &r, opts...) + return +} + +// Update an existing flow. +func (m *FlowManager) Update(ctx context.Context, id string, r *Flow, opts ...RequestOption) error { + return m.management.Request(ctx, "PATCH", m.management.URI("flows", id), r, opts...) +} + +// Delete a flow. +func (m *FlowManager) Delete(ctx context.Context, id string, opts ...RequestOption) error { + return m.management.Request(ctx, "DELETE", m.management.URI("flows", id), nil, opts...) +} + +// List flow. +func (m *FlowManager) List(ctx context.Context, opts ...RequestOption) (r *FlowList, err error) { + err = m.management.Request(ctx, "GET", m.management.URI("flows"), &r, applyListDefaults(opts)) + return +} + +// FlowVaultConnectionManager manages flow vault connection resources. +type flowVaultConnectionManager manager + +// CreateConnection Create a new flow vault connection. +func (m *flowVaultConnectionManager) CreateConnection(ctx context.Context, r *FlowVaultConnection, opts ...RequestOption) error { + return m.management.Request(ctx, "POST", m.management.URI("flows", "vault", "connections"), r, opts...) +} + +// GetConnection Retrieve flow vault connection details. +func (m *flowVaultConnectionManager) GetConnection(ctx context.Context, id string, opts ...RequestOption) (r *FlowVaultConnection, err error) { + err = m.management.Request(ctx, "GET", m.management.URI("flows", "vault", "connections", id), &r, opts...) + return +} + +// UpdateConnection Update an existing flow vault connection. +func (m *flowVaultConnectionManager) UpdateConnection(ctx context.Context, id string, r *FlowVaultConnection, opts ...RequestOption) error { + return m.management.Request(ctx, "PATCH", m.management.URI("flows", "vault", "connections", id), r, opts...) +} + +// DeleteConnection Delete a flow vault connection. +func (m *flowVaultConnectionManager) DeleteConnection(ctx context.Context, id string, opts ...RequestOption) error { + return m.management.Request(ctx, "DELETE", m.management.URI("flows", "vault", "connections", id), nil, opts...) +} + +// GetConnectionList List flow vault connections. +func (m *flowVaultConnectionManager) GetConnectionList(ctx context.Context, opts ...RequestOption) (r *FlowVaultConnectionList, err error) { + err = m.management.Request(ctx, "GET", m.management.URI("flows", "vault", "connections"), &r, applyListDefaults(opts)) + return +} diff --git a/management/flow_test.go b/management/flow_test.go new file mode 100644 index 00000000..290093ed --- /dev/null +++ b/management/flow_test.go @@ -0,0 +1,273 @@ +package management + +import ( + "context" + "encoding/json" + "errors" + "net/http" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/auth0/go-auth0" +) + +/* +Flow tests. +*/ +func TestFlowManager_Create(t *testing.T) { + configureHTTPTestRecordings(t) + + action := httpAction{ + ID: "http_request_Id_123", + Type: "HTTP", + Action: "SEND_REQUEST", + Params: struct { + URL string `json:"url"` + Method string `json:"method"` + }{ + URL: "https://api-endpoint.com/api/v1/resource", + Method: "GET", + }, + } + + flow := &Flow{ + Name: auth0.String("test-flow"), + Actions: []interface{}{action}, + } + + err := api.Flow.Create(context.Background(), flow) + + assert.NoError(t, err) + assert.NotEmpty(t, flow.GetID()) + + t.Cleanup(func() { + cleanupFlow(t, flow.GetID()) + }) +} + +func TestFlowManager_Read(t *testing.T) { + configureHTTPTestRecordings(t) + expectedFlow := givenAFlow(t) + + actualFlow, err := api.Flow.Read(context.Background(), expectedFlow.GetID()) + + assert.NoError(t, err) + assert.Equal(t, expectedFlow, actualFlow) +} + +func TestFlowManager_Update(t *testing.T) { + configureHTTPTestRecordings(t) + expectedFlow := givenAFlow(t) + updatedFlow := &Flow{ + Name: auth0.String("update-test-flow"), + } + err := api.Flow.Update(context.Background(), expectedFlow.GetID(), updatedFlow) + + assert.NoError(t, err) + assert.Equal(t, "update-test-flow", updatedFlow.GetName()) +} + +func TestFlowManager_Delete(t *testing.T) { + configureHTTPTestRecordings(t) + expectedFlow := givenAFlow(t) + + err := api.Flow.Delete(context.Background(), expectedFlow.GetID()) + assert.NoError(t, err) +} + +func TestFlowManager_List(t *testing.T) { + configureHTTPTestRecordings(t) + flow := givenAFlow(t) + flow.Actions = nil + + flowList, err := api.Flow.List(context.Background()) + assert.NoError(t, err) + assert.Greater(t, len(flowList.Flows), 0) + assert.Contains(t, flowList.Flows, flow) +} + +func TestFlowManager_MarshalJSON(t *testing.T) { + for flow, expected := range map[*Flow]string{ + {}: `{}`, + { + Name: auth0.String("test-flow"), + }: `{"name":"test-flow"}`, + { + ID: auth0.String("some-id"), + CreatedAt: auth0.Time(time.Now()), + UpdatedAt: auth0.Time(time.Now()), + }: `{}`, + } { + payload, err := json.Marshal(flow) + assert.NoError(t, err) + assert.Equal(t, expected, string(payload)) + } +} + +type httpAction struct { + ID string `json:"id"` + Type string `json:"type"` + Action string `json:"action"` + Params struct { + URL string `json:"url"` + Method string `json:"method"` + } `json:"params"` +} + +func givenAFlow(t *testing.T) *Flow { + t.Helper() + flow := &Flow{ + Name: auth0.String("test-flow"), + } + + err := api.Flow.Create(context.Background(), flow) + assert.NoError(t, err) + t.Cleanup(func() { + cleanupFlow(t, flow.GetID()) + }) + return flow +} + +func cleanupFlow(t *testing.T, flowID string) { + t.Helper() + + err := api.Flow.Delete(context.Background(), flowID) + if err != nil { + var managementErr Error + ok := errors.As(err, &managementErr) + // We don't want to fail the test if the resource is already deleted. + // clean up, therefore we only raise non-404 errors. + // If `err` doesn't cast to management.Error, we raise it immediately. + if !ok || managementErr.Status() != http.StatusNotFound { + t.Error(err) + } + } +} + +/* +Flow Vault Connection tests. +*/ +func TestFlowVaultConnectionManager_Create(t *testing.T) { + configureHTTPTestRecordings(t) + flowVaultConnection := &FlowVaultConnection{ + AppID: auth0.String("HTTP"), + Name: auth0.String("test-vault-connection"), + Setup: &map[string]interface{}{ + "token": "my-token", + "type": "BEARER", + }, + } + + err := api.Flow.Vault.CreateConnection(context.Background(), flowVaultConnection) + + assert.NoError(t, err) + assert.NotEmpty(t, flowVaultConnection.GetID()) + + t.Cleanup(func() { + cleanupFlowVaultConnection(t, flowVaultConnection.GetID()) + }) +} + +func TestFlowVaultConnectionManager_Read(t *testing.T) { + configureHTTPTestRecordings(t) + expectedFlowVaultConnection := givenAFlowVaultConnection(t) + + actualFlowVaultConnection, err := api.Flow.Vault.GetConnection(context.Background(), expectedFlowVaultConnection.GetID()) + + assert.NoError(t, err) + assert.Equal(t, expectedFlowVaultConnection, actualFlowVaultConnection) +} + +func TestFlowVaultConnectionManager_Update(t *testing.T) { + configureHTTPTestRecordings(t) + expectedFlowVaultConnection := givenAFlowVaultConnection(t) + updatedFlowVaultConnection := &FlowVaultConnection{ + Name: auth0.String("new-connection-name"), + } + + err := api.Flow.Vault.UpdateConnection(context.Background(), expectedFlowVaultConnection.GetID(), updatedFlowVaultConnection) + + 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) { + configureHTTPTestRecordings(t) + expectedFlowVaultConnection := givenAFlowVaultConnection(t) + + err := api.Flow.Vault.DeleteConnection(context.Background(), expectedFlowVaultConnection.GetID()) + assert.NoError(t, err) +} + +func TestFlowVaultConnectionManager_List(t *testing.T) { + configureHTTPTestRecordings(t) + flowVaultConnection := givenAFlowVaultConnection(t) + + flowVaultConnectionList, err := api.Flow.Vault.GetConnectionList(context.Background()) + assert.NoError(t, err) + assert.Greater(t, len(flowVaultConnectionList.Connections), 0) + assert.Contains(t, flowVaultConnectionList.Connections, flowVaultConnection) +} + +func TestFlowVaultConnectionManager_MarshalJSON(t *testing.T) { + for connection, expected := range map[*FlowVaultConnection]string{ + {}: `{}`, + { + AppID: auth0.String("HTTP"), + Name: auth0.String("test-flow-vault-connection"), + Setup: &map[string]interface{}{ + "key": "value", + }, + }: `{"app_id":"HTTP","name":"test-flow-vault-connection","setup":{"key":"value"}}`, + { + AppID: auth0.String("AUTH0"), + Name: auth0.String("auth0-flow-vault-connection"), + }: `{"app_id":"AUTH0","name":"auth0-flow-vault-connection"}`, + { + ID: auth0.String("some-id"), + CreatedAt: auth0.Time(time.Now()), + UpdatedAt: auth0.Time(time.Now()), + }: `{}`, + } { + payload, err := json.Marshal(connection) + assert.NoError(t, err) + assert.Equal(t, expected, string(payload)) + } +} + +func givenAFlowVaultConnection(t *testing.T) *FlowVaultConnection { + flowVaultConnection := &FlowVaultConnection{ + AppID: auth0.String("HTTP"), + Name: auth0.String("test-vault-connection"), + } + + err := api.Flow.Vault.CreateConnection(context.Background(), flowVaultConnection) + if err != nil { + t.Fatal(err) + } + + t.Cleanup(func() { + cleanupFlowVaultConnection(t, flowVaultConnection.GetID()) + }) + + return flowVaultConnection +} + +func cleanupFlowVaultConnection(t *testing.T, id string) { + t.Helper() + + err := api.Flow.Vault.DeleteConnection(context.Background(), id) + if err != nil { + var managementErr Error + ok := errors.As(err, &managementErr) + // We don't want to fail the test if the resource is already deleted. + // clean up, therefore we only raise non-404 errors. + // If `err` doesn't cast to management.Error, we raise it immediately. + if !ok || managementErr.Status() != http.StatusNotFound { + t.Error(err) + } + } +} diff --git a/management/form.go b/management/form.go new file mode 100644 index 00000000..edd7613b --- /dev/null +++ b/management/form.go @@ -0,0 +1,113 @@ +package management + +import ( + "context" + "encoding/json" + "time" +) + +// Form represents an Auth0 form resource. +// +// See: https://auth0.com/docs/customize/forms +type Form struct { + // ID is the unique identifier for the form. + ID *string `json:"id,omitempty"` + + // Name is the name of the form. + Name *string `json:"name,omitempty"` + + // Messages contains custom and error messages for the form. + Messages *FormMessages `json:"messages,omitempty"` + // Languages contains the languages of the form. + Languages *FormLanguages `json:"languages,omitempty"` + // Translations holds the translations for the form. + Translations *map[string]interface{} `json:"translations,omitempty"` + + // Start defines the starting point of the form. + Start *map[string]interface{} `json:"start,omitempty"` + // Nodes represents the nodes in the form. + Nodes []interface{} `json:"nodes,omitempty"` + // Ending defines the ending point of the form. + Ending *map[string]interface{} `json:"ending,omitempty"` + + // Style contains the style of the form. + Style *map[string]interface{} `json:"style,omitempty"` + + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + EmbeddedAt *time.Time `json:"embedded_at,omitempty"` + SubmittedAt *time.Time `json:"submitted_at,omitempty"` +} + +// FormLanguages represents the languages of the form. +type FormLanguages struct { + Primary *string `json:"primary,omitempty"` + Default *string `json:"default,omitempty"` +} + +// FormMessages represents custom and error messages of the form. +type FormMessages struct { + Custom *map[string]interface{} `json:"custom,omitempty"` + Errors *map[string]interface{} `json:"errors,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface. +func (f *Form) MarshalJSON() ([]byte, error) { + type FormSubset struct { + Name *string `json:"name,omitempty"` + Languages *FormLanguages `json:"languages,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"` + Nodes []interface{} `json:"nodes,omitempty"` + Ending *map[string]interface{} `json:"ending,omitempty"` + } + + return json.Marshal(&FormSubset{ + Name: f.Name, + Languages: f.Languages, + Style: f.Style, + Messages: f.Messages, + Translations: f.Translations, + Start: f.Start, + Nodes: f.Nodes, + Ending: f.Ending, + }) +} + +// FormList holds a list of Forms. +type FormList struct { + List + Forms []*Form `json:"forms"` +} + +// FormManager manages Auth0 Form resources. +type FormManager manager + +// Create a new form. +func (m *FormManager) Create(ctx context.Context, r *Form, opts ...RequestOption) error { + return m.management.Request(ctx, "POST", m.management.URI("forms"), r, opts...) +} + +// Retrieve form details. +func (m *FormManager) Read(ctx context.Context, id string, opts ...RequestOption) (r *Form, err error) { + err = m.management.Request(ctx, "GET", m.management.URI("forms", id), &r, opts...) + return +} + +// Update an existing form. +func (m *FormManager) Update(ctx context.Context, id string, r *Form, opts ...RequestOption) error { + return m.management.Request(ctx, "PATCH", m.management.URI("forms", id), r, opts...) +} + +// Delete a form. +func (m *FormManager) Delete(ctx context.Context, id string, opts ...RequestOption) error { + return m.management.Request(ctx, "DELETE", m.management.URI("forms", id), nil, opts...) +} + +// List form. +func (m *FormManager) List(ctx context.Context, opts ...RequestOption) (r *FormList, err error) { + err = m.management.Request(ctx, "GET", m.management.URI("forms"), &r, applyListDefaults(opts)) + return +} diff --git a/management/form_test.go b/management/form_test.go new file mode 100644 index 00000000..5daf3e36 --- /dev/null +++ b/management/form_test.go @@ -0,0 +1,145 @@ +package management + +import ( + "context" + "encoding/json" + "errors" + "net/http" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/auth0/go-auth0" +) + +func TestFormManager_Create(t *testing.T) { + configureHTTPTestRecordings(t) + form := &Form{ + Name: auth0.String("test-form"), + Languages: &FormLanguages{ + Primary: auth0.String("en"), + }, + } + + err := api.Form.Create(context.Background(), form) + + assert.NoError(t, err) + assert.NotEmpty(t, form.GetID()) + + t.Cleanup(func() { + cleanupForm(t, form.GetID()) + }) +} + +func TestFormManager_Read(t *testing.T) { + configureHTTPTestRecordings(t) + expectedForm := givenAForm(t) + + actualForm, err := api.Form.Read(context.Background(), expectedForm.GetID()) + + assert.NoError(t, err) + assert.Equal(t, expectedForm, actualForm) +} + +func TestFormManager_Update(t *testing.T) { + configureHTTPTestRecordings(t) + expectedForm := givenAForm(t) + updatedForm := &Form{ + Name: auth0.String("updated-test-form"), + } + err := api.Form.Update(context.Background(), expectedForm.GetID(), updatedForm) + + assert.NoError(t, err) + assert.Equal(t, "updated-test-form", updatedForm.GetName()) + assert.Equal(t, expectedForm.GetLanguages(), updatedForm.GetLanguages()) +} + +func TestFormManager_Delete(t *testing.T) { + configureHTTPTestRecordings(t) + expectedForm := givenAForm(t) + + err := api.Form.Delete(context.Background(), expectedForm.GetID()) + assert.NoError(t, err) +} + +func TestFormManager_List(t *testing.T) { + configureHTTPTestRecordings(t) + form := givenAForm(t) + form.Ending = nil + form.Messages = nil + form.Languages = nil + form.Nodes = nil + form.Style = nil + form.Start = nil + form.Translations = nil + + formList, err := api.Form.List(context.Background()) + assert.NoError(t, err) + assert.Greater(t, len(formList.Forms), 0) + assert.Contains(t, formList.Forms, form) +} + +func TestFormManager_MarshalJSON(t *testing.T) { + for form, expected := range map[*Form]string{ + {}: `{}`, + { + Name: auth0.String("test-form"), + Languages: &FormLanguages{ + Primary: auth0.String("en"), + }, + }: `{"name":"test-form","languages":{"primary":"en"}}`, + { + Messages: &FormMessages{ + Custom: &map[string]interface{}{ + "welcome": "Welcome to the form", + }, + Errors: &map[string]interface{}{ + "required": "This field is required", + }, + }, + }: `{"messages":{"custom":{"welcome":"Welcome to the form"},"errors":{"required":"This field is required"}}}`, + { + ID: auth0.String("some-id"), + CreatedAt: auth0.Time(time.Now()), + UpdatedAt: auth0.Time(time.Now()), + }: `{}`, + } { + payload, err := json.Marshal(form) + assert.NoError(t, err) + assert.Equal(t, expected, string(payload)) + } +} + +func givenAForm(t *testing.T) *Form { + t.Helper() + form := &Form{ + Name: auth0.String("test-form"), + Languages: &FormLanguages{ + Primary: auth0.String("en"), + }, + } + + err := api.Form.Create(context.Background(), form) + assert.NoError(t, err) + t.Cleanup(func() { + cleanupForm(t, form.GetID()) + }) + return form +} + +func cleanupForm(t *testing.T, formID string) { + t.Helper() + + err := api.Form.Delete(context.Background(), formID) + if err != nil { + var managementErr Error + ok := errors.As(err, &managementErr) + // We don't want to fail the test if the resource is already deleted. + // clean up, therefore we only raise non-404 errors. + // If `err` doesn't cast to management.Error, we raise it immediately. + if !ok || managementErr.Status() != http.StatusNotFound { + t.Error(err) + } + } +} diff --git a/management/management.gen.go b/management/management.gen.go index afcaa3bf..9125f4e4 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -6931,6 +6931,302 @@ func (f *FirebaseClientAddon) String() string { return Stringify(f) } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (f *Flow) GetCreatedAt() time.Time { + if f == nil || f.CreatedAt == nil { + return time.Time{} + } + return *f.CreatedAt +} + +// GetExecutedAt returns the ExecutedAt field if it's non-nil, zero value otherwise. +func (f *Flow) GetExecutedAt() time.Time { + if f == nil || f.ExecutedAt == nil { + return time.Time{} + } + return *f.ExecutedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (f *Flow) GetID() string { + if f == nil || f.ID == nil { + return "" + } + return *f.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (f *Flow) GetName() string { + if f == nil || f.Name == nil { + return "" + } + return *f.Name +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (f *Flow) GetUpdatedAt() time.Time { + if f == nil || f.UpdatedAt == nil { + return time.Time{} + } + return *f.UpdatedAt +} + +// String returns a string representation of Flow. +func (f *Flow) String() string { + return Stringify(f) +} + +// String returns a string representation of FlowList. +func (f *FlowList) String() string { + return Stringify(f) +} + +// GetAccountName returns the AccountName field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetAccountName() string { + if f == nil || f.AccountName == nil { + return "" + } + return *f.AccountName +} + +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetAppID() string { + if f == nil || f.AppID == nil { + return "" + } + return *f.AppID +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetCreatedAt() time.Time { + if f == nil || f.CreatedAt == nil { + return time.Time{} + } + return *f.CreatedAt +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetEnvironment() string { + if f == nil || f.Environment == nil { + return "" + } + return *f.Environment +} + +// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetFingerprint() string { + if f == nil || f.Fingerprint == nil { + return "" + } + return *f.Fingerprint +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetID() string { + if f == nil || f.ID == nil { + return "" + } + return *f.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetName() string { + if f == nil || f.Name == nil { + return "" + } + return *f.Name +} + +// GetReady returns the Ready field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetReady() bool { + if f == nil || f.Ready == nil { + return false + } + return *f.Ready +} + +// GetRefreshedAt returns the RefreshedAt field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetRefreshedAt() time.Time { + if f == nil || f.RefreshedAt == nil { + return time.Time{} + } + return *f.RefreshedAt +} + +// GetSetup returns the Setup field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetSetup() map[string]interface{} { + if f == nil || f.Setup == nil { + return map[string]interface{}{} + } + return *f.Setup +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (f *FlowVaultConnection) GetUpdatedAt() time.Time { + if f == nil || f.UpdatedAt == nil { + return time.Time{} + } + return *f.UpdatedAt +} + +// String returns a string representation of FlowVaultConnection. +func (f *FlowVaultConnection) String() string { + return Stringify(f) +} + +// String returns a string representation of FlowVaultConnectionList. +func (f *FlowVaultConnectionList) String() string { + return Stringify(f) +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (f *Form) GetCreatedAt() time.Time { + if f == nil || f.CreatedAt == nil { + return time.Time{} + } + return *f.CreatedAt +} + +// GetEmbeddedAt returns the EmbeddedAt field if it's non-nil, zero value otherwise. +func (f *Form) GetEmbeddedAt() time.Time { + if f == nil || f.EmbeddedAt == nil { + return time.Time{} + } + return *f.EmbeddedAt +} + +// GetEnding returns the Ending field if it's non-nil, zero value otherwise. +func (f *Form) GetEnding() map[string]interface{} { + if f == nil || f.Ending == nil { + return map[string]interface{}{} + } + return *f.Ending +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (f *Form) GetID() string { + if f == nil || f.ID == nil { + return "" + } + return *f.ID +} + +// GetLanguages returns the Languages field. +func (f *Form) GetLanguages() *FormLanguages { + if f == nil { + return nil + } + return f.Languages +} + +// GetMessages returns the Messages field. +func (f *Form) GetMessages() *FormMessages { + if f == nil { + return nil + } + return f.Messages +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (f *Form) GetName() string { + if f == nil || f.Name == nil { + return "" + } + return *f.Name +} + +// GetStart returns the Start field if it's non-nil, zero value otherwise. +func (f *Form) GetStart() map[string]interface{} { + if f == nil || f.Start == nil { + return map[string]interface{}{} + } + return *f.Start +} + +// GetStyle returns the Style field if it's non-nil, zero value otherwise. +func (f *Form) GetStyle() map[string]interface{} { + if f == nil || f.Style == nil { + return map[string]interface{}{} + } + return *f.Style +} + +// GetSubmittedAt returns the SubmittedAt field if it's non-nil, zero value otherwise. +func (f *Form) GetSubmittedAt() time.Time { + if f == nil || f.SubmittedAt == nil { + return time.Time{} + } + return *f.SubmittedAt +} + +// GetTranslations returns the Translations field if it's non-nil, zero value otherwise. +func (f *Form) GetTranslations() map[string]interface{} { + if f == nil || f.Translations == nil { + return map[string]interface{}{} + } + return *f.Translations +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (f *Form) GetUpdatedAt() time.Time { + if f == nil || f.UpdatedAt == nil { + return time.Time{} + } + return *f.UpdatedAt +} + +// String returns a string representation of Form. +func (f *Form) String() string { + return Stringify(f) +} + +// GetDefault returns the Default field if it's non-nil, zero value otherwise. +func (f *FormLanguages) GetDefault() string { + if f == nil || f.Default == nil { + return "" + } + return *f.Default +} + +// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. +func (f *FormLanguages) GetPrimary() string { + if f == nil || f.Primary == nil { + return "" + } + return *f.Primary +} + +// String returns a string representation of FormLanguages. +func (f *FormLanguages) String() string { + return Stringify(f) +} + +// String returns a string representation of FormList. +func (f *FormList) String() string { + return Stringify(f) +} + +// GetCustom returns the Custom field if it's non-nil, zero value otherwise. +func (f *FormMessages) GetCustom() map[string]interface{} { + if f == nil || f.Custom == nil { + return map[string]interface{}{} + } + return *f.Custom +} + +// GetErrors returns the Errors field if it's non-nil, zero value otherwise. +func (f *FormMessages) GetErrors() map[string]interface{} { + if f == nil || f.Errors == nil { + return map[string]interface{}{} + } + return *f.Errors +} + +// String returns a string representation of FormMessages. +func (f *FormMessages) String() string { + return Stringify(f) +} + // GetAudience returns the Audience field if it's non-nil, zero value otherwise. func (g *Grant) GetAudience() string { if g == nil || g.Audience == nil { diff --git a/management/management.gen_test.go b/management/management.gen_test.go index 831a84e6..253b58f6 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -8611,6 +8611,384 @@ func TestFirebaseClientAddon_String(t *testing.T) { } } +func TestFlow_GetCreatedAt(tt *testing.T) { + var zeroValue time.Time + f := &Flow{CreatedAt: &zeroValue} + f.GetCreatedAt() + f = &Flow{} + f.GetCreatedAt() + f = nil + f.GetCreatedAt() +} + +func TestFlow_GetExecutedAt(tt *testing.T) { + var zeroValue time.Time + f := &Flow{ExecutedAt: &zeroValue} + f.GetExecutedAt() + f = &Flow{} + f.GetExecutedAt() + f = nil + f.GetExecutedAt() +} + +func TestFlow_GetID(tt *testing.T) { + var zeroValue string + f := &Flow{ID: &zeroValue} + f.GetID() + f = &Flow{} + f.GetID() + f = nil + f.GetID() +} + +func TestFlow_GetName(tt *testing.T) { + var zeroValue string + f := &Flow{Name: &zeroValue} + f.GetName() + f = &Flow{} + f.GetName() + f = nil + f.GetName() +} + +func TestFlow_GetUpdatedAt(tt *testing.T) { + var zeroValue time.Time + f := &Flow{UpdatedAt: &zeroValue} + f.GetUpdatedAt() + f = &Flow{} + f.GetUpdatedAt() + f = nil + f.GetUpdatedAt() +} + +func TestFlow_String(t *testing.T) { + var rawJSON json.RawMessage + v := &Flow{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestFlowList_String(t *testing.T) { + var rawJSON json.RawMessage + v := &FlowList{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestFlowVaultConnection_GetAccountName(tt *testing.T) { + var zeroValue string + f := &FlowVaultConnection{AccountName: &zeroValue} + f.GetAccountName() + f = &FlowVaultConnection{} + f.GetAccountName() + f = nil + f.GetAccountName() +} + +func TestFlowVaultConnection_GetAppID(tt *testing.T) { + var zeroValue string + f := &FlowVaultConnection{AppID: &zeroValue} + f.GetAppID() + f = &FlowVaultConnection{} + f.GetAppID() + f = nil + f.GetAppID() +} + +func TestFlowVaultConnection_GetCreatedAt(tt *testing.T) { + var zeroValue time.Time + f := &FlowVaultConnection{CreatedAt: &zeroValue} + f.GetCreatedAt() + f = &FlowVaultConnection{} + f.GetCreatedAt() + f = nil + f.GetCreatedAt() +} + +func TestFlowVaultConnection_GetEnvironment(tt *testing.T) { + var zeroValue string + f := &FlowVaultConnection{Environment: &zeroValue} + f.GetEnvironment() + f = &FlowVaultConnection{} + f.GetEnvironment() + f = nil + f.GetEnvironment() +} + +func TestFlowVaultConnection_GetFingerprint(tt *testing.T) { + var zeroValue string + f := &FlowVaultConnection{Fingerprint: &zeroValue} + f.GetFingerprint() + f = &FlowVaultConnection{} + f.GetFingerprint() + f = nil + f.GetFingerprint() +} + +func TestFlowVaultConnection_GetID(tt *testing.T) { + var zeroValue string + f := &FlowVaultConnection{ID: &zeroValue} + f.GetID() + f = &FlowVaultConnection{} + f.GetID() + f = nil + f.GetID() +} + +func TestFlowVaultConnection_GetName(tt *testing.T) { + var zeroValue string + f := &FlowVaultConnection{Name: &zeroValue} + f.GetName() + f = &FlowVaultConnection{} + f.GetName() + f = nil + f.GetName() +} + +func TestFlowVaultConnection_GetReady(tt *testing.T) { + var zeroValue bool + f := &FlowVaultConnection{Ready: &zeroValue} + f.GetReady() + f = &FlowVaultConnection{} + f.GetReady() + f = nil + f.GetReady() +} + +func TestFlowVaultConnection_GetRefreshedAt(tt *testing.T) { + var zeroValue time.Time + f := &FlowVaultConnection{RefreshedAt: &zeroValue} + f.GetRefreshedAt() + f = &FlowVaultConnection{} + f.GetRefreshedAt() + f = nil + f.GetRefreshedAt() +} + +func TestFlowVaultConnection_GetSetup(tt *testing.T) { + var zeroValue map[string]interface{} + f := &FlowVaultConnection{Setup: &zeroValue} + f.GetSetup() + f = &FlowVaultConnection{} + f.GetSetup() + f = nil + f.GetSetup() +} + +func TestFlowVaultConnection_GetUpdatedAt(tt *testing.T) { + var zeroValue time.Time + f := &FlowVaultConnection{UpdatedAt: &zeroValue} + f.GetUpdatedAt() + f = &FlowVaultConnection{} + f.GetUpdatedAt() + f = nil + f.GetUpdatedAt() +} + +func TestFlowVaultConnection_String(t *testing.T) { + var rawJSON json.RawMessage + v := &FlowVaultConnection{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestFlowVaultConnectionList_String(t *testing.T) { + var rawJSON json.RawMessage + v := &FlowVaultConnectionList{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestForm_GetCreatedAt(tt *testing.T) { + var zeroValue time.Time + f := &Form{CreatedAt: &zeroValue} + f.GetCreatedAt() + f = &Form{} + f.GetCreatedAt() + f = nil + f.GetCreatedAt() +} + +func TestForm_GetEmbeddedAt(tt *testing.T) { + var zeroValue time.Time + f := &Form{EmbeddedAt: &zeroValue} + f.GetEmbeddedAt() + f = &Form{} + f.GetEmbeddedAt() + f = nil + f.GetEmbeddedAt() +} + +func TestForm_GetEnding(tt *testing.T) { + var zeroValue map[string]interface{} + f := &Form{Ending: &zeroValue} + f.GetEnding() + f = &Form{} + f.GetEnding() + f = nil + f.GetEnding() +} + +func TestForm_GetID(tt *testing.T) { + var zeroValue string + f := &Form{ID: &zeroValue} + f.GetID() + f = &Form{} + f.GetID() + f = nil + f.GetID() +} + +func TestForm_GetLanguages(tt *testing.T) { + f := &Form{} + f.GetLanguages() + f = nil + f.GetLanguages() +} + +func TestForm_GetMessages(tt *testing.T) { + f := &Form{} + f.GetMessages() + f = nil + f.GetMessages() +} + +func TestForm_GetName(tt *testing.T) { + var zeroValue string + f := &Form{Name: &zeroValue} + f.GetName() + f = &Form{} + f.GetName() + f = nil + f.GetName() +} + +func TestForm_GetStart(tt *testing.T) { + var zeroValue map[string]interface{} + f := &Form{Start: &zeroValue} + f.GetStart() + f = &Form{} + f.GetStart() + f = nil + f.GetStart() +} + +func TestForm_GetStyle(tt *testing.T) { + var zeroValue map[string]interface{} + f := &Form{Style: &zeroValue} + f.GetStyle() + f = &Form{} + f.GetStyle() + f = nil + f.GetStyle() +} + +func TestForm_GetSubmittedAt(tt *testing.T) { + var zeroValue time.Time + f := &Form{SubmittedAt: &zeroValue} + f.GetSubmittedAt() + f = &Form{} + f.GetSubmittedAt() + f = nil + f.GetSubmittedAt() +} + +func TestForm_GetTranslations(tt *testing.T) { + var zeroValue map[string]interface{} + f := &Form{Translations: &zeroValue} + f.GetTranslations() + f = &Form{} + f.GetTranslations() + f = nil + f.GetTranslations() +} + +func TestForm_GetUpdatedAt(tt *testing.T) { + var zeroValue time.Time + f := &Form{UpdatedAt: &zeroValue} + f.GetUpdatedAt() + f = &Form{} + f.GetUpdatedAt() + f = nil + f.GetUpdatedAt() +} + +func TestForm_String(t *testing.T) { + var rawJSON json.RawMessage + v := &Form{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestFormLanguages_GetDefault(tt *testing.T) { + var zeroValue string + f := &FormLanguages{Default: &zeroValue} + f.GetDefault() + f = &FormLanguages{} + f.GetDefault() + f = nil + f.GetDefault() +} + +func TestFormLanguages_GetPrimary(tt *testing.T) { + var zeroValue string + f := &FormLanguages{Primary: &zeroValue} + f.GetPrimary() + f = &FormLanguages{} + f.GetPrimary() + f = nil + f.GetPrimary() +} + +func TestFormLanguages_String(t *testing.T) { + var rawJSON json.RawMessage + v := &FormLanguages{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestFormList_String(t *testing.T) { + var rawJSON json.RawMessage + v := &FormList{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestFormMessages_GetCustom(tt *testing.T) { + var zeroValue map[string]interface{} + f := &FormMessages{Custom: &zeroValue} + f.GetCustom() + f = &FormMessages{} + f.GetCustom() + f = nil + f.GetCustom() +} + +func TestFormMessages_GetErrors(tt *testing.T) { + var zeroValue map[string]interface{} + f := &FormMessages{Errors: &zeroValue} + f.GetErrors() + f = &FormMessages{} + f.GetErrors() + f = nil + f.GetErrors() +} + +func TestFormMessages_String(t *testing.T) { + var rawJSON json.RawMessage + v := &FormMessages{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestGrant_GetAudience(tt *testing.T) { var zeroValue string g := &Grant{Audience: &zeroValue} diff --git a/management/management.go b/management/management.go index c3f102e9..2caf05d9 100644 --- a/management/management.go +++ b/management/management.go @@ -106,6 +106,12 @@ type Management struct { // SelfServiceProfileManager manages Auth0 Self Service Profiles. SelfServiceProfile *SelfServiceProfileManager + // FormManger manages Auth0 Form. + Form *FormManager + + // FlowManger manages Auth0 Flow. + Flow *FlowManager + // EncryptionKey manages Auth0 Encryption Keys. EncryptionKey *EncryptionKeyManager @@ -209,6 +215,11 @@ func New(domain string, options ...Option) (*Management, error) { m.Ticket = (*TicketManager)(&m.common) m.User = (*UserManager)(&m.common) m.SelfServiceProfile = (*SelfServiceProfileManager)(&m.common) + m.Form = (*FormManager)(&m.common) + m.Flow = &FlowManager{ + management: m, + Vault: (*flowVaultConnectionManager)(&m.common), + } return m, nil } diff --git a/test/data/recordings/TestFlowManager_Create.yaml b/test/data/recordings/TestFlowManager_Create.yaml new file mode 100644 index 00000000..4ed51fa2 --- /dev/null +++ b/test/data/recordings/TestFlowManager_Create.yaml @@ -0,0 +1,74 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 68 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-flow","description":"A test flow","synchronous":true} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"af_qurDTCky5bEyPc3TYoyg8K","name":"test-flow","description":"A test flow","synchronous":true,"actions":[],"triggers":{"webhook":{"enabled":false,"secret":null}},"security":{"rateLimits":[]},"created_at":"2024-09-11T08:25:19.313Z","updated_at":"2024-09-11T08:25:19.313Z","executed_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 809.627ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/af_qurDTCky5bEyPc3TYoyg8K + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 276.538292ms diff --git a/test/data/recordings/TestFlowManager_Delete.yaml b/test/data/recordings/TestFlowManager_Delete.yaml new file mode 100644 index 00000000..6f56e5dc --- /dev/null +++ b/test/data/recordings/TestFlowManager_Delete.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 68 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-flow","description":"A test flow","synchronous":true} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"af_aDAy6V1KtVr2vAfLbY8dj9","name":"test-flow","description":"A test flow","synchronous":true,"actions":[],"triggers":{"webhook":{"enabled":false,"secret":null}},"security":{"rateLimits":[]},"created_at":"2024-09-11T08:25:21.466Z","updated_at":"2024-09-11T08:25:21.466Z","executed_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 236.068042ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/af_aDAy6V1KtVr2vAfLbY8dj9 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 234.751167ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/af_aDAy6V1KtVr2vAfLbY8dj9 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"statusCode":404,"error":"Not Found","message":"Flow not found"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 404 Not Found + code: 404 + duration: 225.091583ms diff --git a/test/data/recordings/TestFlowManager_List.yaml b/test/data/recordings/TestFlowManager_List.yaml new file mode 100644 index 00000000..def142f4 --- /dev/null +++ b/test/data/recordings/TestFlowManager_List.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 68 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-flow","description":"A test flow","synchronous":true} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"af_2P7B1xokW1pNuFFWizs9n8","name":"test-flow","description":"A test flow","synchronous":true,"actions":[],"triggers":{"webhook":{"enabled":false,"secret":null}},"security":{"rateLimits":[]},"created_at":"2024-09-11T08:25:22.157Z","updated_at":"2024-09-11T08:25:22.157Z","executed_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 223.510959ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"limit":50,"start":0,"total":2,"flows":[{"id":"af_2P7B1xokW1pNuFFWizs9n8","name":"test-flow","description":"A test flow","synchronous":true,"created_at":"2024-09-11T08:25:22.157Z","updated_at":"2024-09-11T08:25:22.157Z","executed_at":null},{"id":"af_sCzMbZkwNS4w6HZ79Ce2Ad","name":"Update user_metadata","description":null,"synchronous":true,"created_at":"2024-08-11T18:50:34.374Z","updated_at":"2024-08-12T12:48:29.106Z","executed_at":null}]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 258.266708ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/af_2P7B1xokW1pNuFFWizs9n8 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 227.483542ms diff --git a/test/data/recordings/TestFlowManager_Read.yaml b/test/data/recordings/TestFlowManager_Read.yaml new file mode 100644 index 00000000..34c7d45b --- /dev/null +++ b/test/data/recordings/TestFlowManager_Read.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 68 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-flow","description":"A test flow","synchronous":true} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"af_rNLb3UMhWBqNnvvNxzTrnH","name":"test-flow","description":"A test flow","synchronous":true,"actions":[],"triggers":{"webhook":{"enabled":false,"secret":null}},"security":{"rateLimits":[]},"created_at":"2024-09-11T08:25:19.858Z","updated_at":"2024-09-11T08:25:19.858Z","executed_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 261.064459ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/af_rNLb3UMhWBqNnvvNxzTrnH + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"af_rNLb3UMhWBqNnvvNxzTrnH","name":"test-flow","description":"A test flow","synchronous":true,"actions":[],"triggers":{"webhook":{"secret":null,"enabled":false}},"security":{"rateLimits":[]},"created_at":"2024-09-11T08:25:19.858Z","updated_at":"2024-09-11T08:25:19.858Z","executed_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 281.060625ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/af_rNLb3UMhWBqNnvvNxzTrnH + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 276.3395ms diff --git a/test/data/recordings/TestFlowManager_Update.yaml b/test/data/recordings/TestFlowManager_Update.yaml new file mode 100644 index 00000000..4dea6b7c --- /dev/null +++ b/test/data/recordings/TestFlowManager_Update.yaml @@ -0,0 +1,110 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 21 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-flow"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 133 + uncompressed: false + body: '{"id":"af_nMs6ocaGGsd31WFnestY6j","name":"test-flow","created_at":"2024-09-23T11:02:56.086Z","updated_at":"2024-09-23T11:02:56.086Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 2.012815792s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 28 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"update-test-flow"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/af_nMs6ocaGGsd31WFnestY6j + method: PATCH + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"af_nMs6ocaGGsd31WFnestY6j","name":"update-test-flow","created_at":"2024-09-23T11:02:56.086Z","updated_at":"2024-09-23T11:02:57.071Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 969.210541ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/af_nMs6ocaGGsd31WFnestY6j + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 433.38175ms diff --git a/test/data/recordings/TestFlowVaultConnectionManager_Create.yaml b/test/data/recordings/TestFlowVaultConnectionManager_Create.yaml new file mode 100644 index 00000000..18a7d0c1 --- /dev/null +++ b/test/data/recordings/TestFlowVaultConnectionManager_Create.yaml @@ -0,0 +1,74 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 94 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"app_id":"HTTP","name":"test-vault-connection","setup":{"token":"my-token","type":"BEARER"}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ac_ik8c7qvwKSSHsxdbfjoUN6","app_id":"HTTP","name":"test-vault-connection","account_name":"Bearer my-***ken","ready":true,"created_at":"2024-09-12T12:52:15.805Z","updated_at":"2024-09-12T12:52:15.805Z","fingerprint":"44078f05a47efb23da187165f5aada25"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 918.945875ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections/ac_ik8c7qvwKSSHsxdbfjoUN6 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 380.290334ms diff --git a/test/data/recordings/TestFlowVaultConnectionManager_Delete.yaml b/test/data/recordings/TestFlowVaultConnectionManager_Delete.yaml new file mode 100644 index 00000000..281ddd43 --- /dev/null +++ b/test/data/recordings/TestFlowVaultConnectionManager_Delete.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 49 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"app_id":"HTTP","name":"test-vault-connection"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ac_faf7YF2FwNxHdXT8BCnJih","app_id":"HTTP","name":"test-vault-connection","ready":false,"created_at":"2024-09-12T12:52:18.770Z","updated_at":"2024-09-12T12:52:18.770Z","refreshed_at":null,"fingerprint":"afdcf7ae0431402bd79eb8a4f3bc3f4a"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 327.585875ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections/ac_faf7YF2FwNxHdXT8BCnJih + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 366.0705ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections/ac_faf7YF2FwNxHdXT8BCnJih + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"statusCode":404,"error":"Not Found","message":"Connection not found"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 404 Not Found + code: 404 + duration: 325.472834ms diff --git a/test/data/recordings/TestFlowVaultConnectionManager_List.yaml b/test/data/recordings/TestFlowVaultConnectionManager_List.yaml new file mode 100644 index 00000000..7b345dc2 --- /dev/null +++ b/test/data/recordings/TestFlowVaultConnectionManager_List.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 49 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"app_id":"HTTP","name":"test-vault-connection"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ac_t9JToPSSZ4deNc6qPXZ9B9","app_id":"HTTP","name":"test-vault-connection","ready":false,"created_at":"2024-09-12T12:52:19.790Z","updated_at":"2024-09-12T12:52:19.790Z","refreshed_at":null,"fingerprint":"525eccf582f7913f5383ff4b3332ca7c"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 319.718375ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"limit":50,"start":0,"total":1,"connections":[{"id":"ac_t9JToPSSZ4deNc6qPXZ9B9","name":"test-vault-connection","app_id":"HTTP","ready":false,"created_at":"2024-09-12T12:52:19.790Z","updated_at":"2024-09-12T12:52:19.790Z","fingerprint":"525eccf582f7913f5383ff4b3332ca7c"}]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 325.612458ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections/ac_t9JToPSSZ4deNc6qPXZ9B9 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 426.515459ms diff --git a/test/data/recordings/TestFlowVaultConnectionManager_Read.yaml b/test/data/recordings/TestFlowVaultConnectionManager_Read.yaml new file mode 100644 index 00000000..d5083158 --- /dev/null +++ b/test/data/recordings/TestFlowVaultConnectionManager_Read.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 49 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"app_id":"HTTP","name":"test-vault-connection"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ac_bz9Ds2yxVLGsLmP1R68Kmv","app_id":"HTTP","name":"test-vault-connection","ready":false,"created_at":"2024-09-12T12:52:16.553Z","updated_at":"2024-09-12T12:52:16.553Z","refreshed_at":null,"fingerprint":"e5a6d604e16b993f46f3c52be398906b"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 356.341ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections/ac_bz9Ds2yxVLGsLmP1R68Kmv + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ac_bz9Ds2yxVLGsLmP1R68Kmv","app_id":"HTTP","name":"test-vault-connection","ready":false,"created_at":"2024-09-12T12:52:16.553Z","updated_at":"2024-09-12T12:52:16.553Z","fingerprint":"e5a6d604e16b993f46f3c52be398906b"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 340.83575ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections/ac_bz9Ds2yxVLGsLmP1R68Kmv + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 378.442042ms diff --git a/test/data/recordings/TestFlowVaultConnectionManager_Update.yaml b/test/data/recordings/TestFlowVaultConnectionManager_Update.yaml new file mode 100644 index 00000000..f4b735ad --- /dev/null +++ b/test/data/recordings/TestFlowVaultConnectionManager_Update.yaml @@ -0,0 +1,110 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 49 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"app_id":"HTTP","name":"test-vault-connection"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ac_6t5kdaPvkcH3WQ6BnELSDa","app_id":"HTTP","name":"test-vault-connection","ready":false,"created_at":"2024-09-12T12:52:17.605Z","updated_at":"2024-09-12T12:52:17.605Z","refreshed_at":null,"fingerprint":"af9152e9fc291c0a4c364c8755753ad2"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 409.098667ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 31 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"new-connection-name"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections/ac_6t5kdaPvkcH3WQ6BnELSDa + method: PATCH + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ac_6t5kdaPvkcH3WQ6BnELSDa","app_id":"HTTP","name":"new-connection-name","ready":false,"created_at":"2024-09-12T12:52:17.605Z","updated_at":"2024-09-12T12:52:18.049Z","refreshed_at":null,"fingerprint":"6724a8a63ea2e97f62af6e378f93a0ba"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 411.437125ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/flows/vault/connections/ac_6t5kdaPvkcH3WQ6BnELSDa + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 355.213041ms diff --git a/test/data/recordings/TestFormManager_Create.yaml b/test/data/recordings/TestFormManager_Create.yaml new file mode 100644 index 00000000..a46a61a7 --- /dev/null +++ b/test/data/recordings/TestFormManager_Create.yaml @@ -0,0 +1,74 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 122 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-form","description":"A test form","languages":{"primary":"en"},"style":{"version":"MODERN","theme":"SOFT"}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ap_j91isQddxJsWYUQ8XiMZYG","name":"test-form","description":"A test form","messages":{"custom":{},"errors":{}},"languages":{"primary":"en","default":null},"translations":{},"start":{"hiddenFields":[],"nextNode":null,"coordinates":null},"nodes":[],"ending":{"content":null,"redirection":null,"callback":null,"afterSubmit":{"flowId":null,"email":null},"resumeFlow":true,"coordinates":null},"social":[],"style":{"version":"MODERN","theme":"SOFT","css":null},"tags":[],"created_at":"2024-09-10T07:07:13.165Z","updated_at":"2024-09-10T07:07:13.165Z","embedded_at":null,"submitted_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 673.800542ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms/ap_j91isQddxJsWYUQ8XiMZYG + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 237.859ms diff --git a/test/data/recordings/TestFormManager_Delete.yaml b/test/data/recordings/TestFormManager_Delete.yaml new file mode 100644 index 00000000..fd7992c0 --- /dev/null +++ b/test/data/recordings/TestFormManager_Delete.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 122 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-form","description":"A test form","languages":{"primary":"en"},"style":{"version":"MODERN","theme":"SOFT"}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ap_7EX8RtfuSC7WR21wT6cfcn","name":"test-form","description":"A test form","messages":{"custom":{},"errors":{}},"languages":{"primary":"en","default":null},"translations":{},"start":{"hiddenFields":[],"nextNode":null,"coordinates":null},"nodes":[],"ending":{"content":null,"redirection":null,"callback":null,"afterSubmit":{"flowId":null,"email":null},"resumeFlow":true,"coordinates":null},"social":[],"style":{"version":"MODERN","theme":"SOFT","css":null},"tags":[],"created_at":"2024-09-10T07:08:13.805Z","updated_at":"2024-09-10T07:08:13.805Z","embedded_at":null,"submitted_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 722.728792ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms/ap_7EX8RtfuSC7WR21wT6cfcn + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 252.674542ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms/ap_7EX8RtfuSC7WR21wT6cfcn + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"statusCode":404,"error":"Not Found","message":"Form not found"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 404 Not Found + code: 404 + duration: 232.700542ms diff --git a/test/data/recordings/TestFormManager_List.yaml b/test/data/recordings/TestFormManager_List.yaml new file mode 100644 index 00000000..7312de5c --- /dev/null +++ b/test/data/recordings/TestFormManager_List.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 122 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-form","description":"A test form","languages":{"primary":"en"},"style":{"version":"MODERN","theme":"SOFT"}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ap_imxbc76XhpAQkuXuarhfyw","name":"test-form","description":"A test form","messages":{"custom":{},"errors":{}},"languages":{"primary":"en","default":null},"translations":{},"start":{"hiddenFields":[],"nextNode":null,"coordinates":null},"nodes":[],"ending":{"content":null,"redirection":null,"callback":null,"afterSubmit":{"flowId":null,"email":null},"resumeFlow":true,"coordinates":null},"social":[],"style":{"version":"MODERN","theme":"SOFT","css":null},"tags":[],"created_at":"2024-09-10T07:08:31.305Z","updated_at":"2024-09-10T07:08:31.305Z","embedded_at":null,"submitted_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 595.066ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms?include_totals=true&per_page=50 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"limit":50,"start":0,"total":3,"forms":[{"id":"ap_oKKYYRKoVD1CCuFgoAo5DN","name":"Onboarding User","description":null,"flow_count":1,"created_at":"2024-08-11T18:50:34.406Z","updated_at":"2024-08-12T11:06:32.728Z","embedded_at":null,"submitted_at":null},{"id":"ap_vHcEKGZJ5oaTYTePwe2W1T","name":"policies flow","description":null,"flow_count":1,"created_at":"2024-08-12T11:13:33.350Z","updated_at":"2024-08-12T11:14:25.590Z","embedded_at":null,"submitted_at":null},{"id":"ap_imxbc76XhpAQkuXuarhfyw","name":"test-form","description":"A test form","flow_count":0,"created_at":"2024-09-10T07:08:31.305Z","updated_at":"2024-09-10T07:08:31.305Z","embedded_at":null,"submitted_at":null}]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 229.992542ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms/ap_imxbc76XhpAQkuXuarhfyw + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 270.743792ms diff --git a/test/data/recordings/TestFormManager_Read.yaml b/test/data/recordings/TestFormManager_Read.yaml new file mode 100644 index 00000000..92a50a16 --- /dev/null +++ b/test/data/recordings/TestFormManager_Read.yaml @@ -0,0 +1,109 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 122 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-form","description":"A test form","languages":{"primary":"en"},"style":{"version":"MODERN","theme":"SOFT"}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ap_c5NKEedYrkydpHacL4ii5v","name":"test-form","description":"A test form","messages":{"custom":{},"errors":{}},"languages":{"primary":"en","default":null},"translations":{},"start":{"hiddenFields":[],"nextNode":null,"coordinates":null},"nodes":[],"ending":{"content":null,"redirection":null,"callback":null,"afterSubmit":{"flowId":null,"email":null},"resumeFlow":true,"coordinates":null},"social":[],"style":{"version":"MODERN","theme":"SOFT","css":null},"tags":[],"created_at":"2024-09-10T07:07:28.264Z","updated_at":"2024-09-10T07:07:28.264Z","embedded_at":null,"submitted_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 686.781375ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms/ap_c5NKEedYrkydpHacL4ii5v + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ap_c5NKEedYrkydpHacL4ii5v","name":"test-form","description":"A test form","messages":{"custom":{},"errors":{}},"languages":{"default":null,"primary":"en"},"translations":{},"start":{"nextNode":null,"coordinates":null,"hiddenFields":[]},"nodes":[],"ending":{"content":null,"redirection":null,"callback":null,"afterSubmit":{"email":null,"flowId":null},"coordinates":null,"resumeFlow":true},"social":[],"style":{"css":null,"theme":"SOFT","version":"MODERN"},"tags":[],"created_at":"2024-09-10T07:07:28.264Z","updated_at":"2024-09-10T07:07:28.264Z","embedded_at":null,"submitted_at":null}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 248.503541ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms/ap_c5NKEedYrkydpHacL4ii5v + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 237.425041ms diff --git a/test/data/recordings/TestFormManager_Update.yaml b/test/data/recordings/TestFormManager_Update.yaml new file mode 100644 index 00000000..48805d28 --- /dev/null +++ b/test/data/recordings/TestFormManager_Update.yaml @@ -0,0 +1,110 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 50 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-form","languages":{"primary":"en"}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 192 + uncompressed: false + body: '{"id":"ap_8594yY9xHBqMJtJskjeMWq","name":"test-form","languages":{"primary":"en"},"ending":{"resume_flow":true},"created_at":"2024-09-23T11:09:12.797Z","updated_at":"2024-09-23T11:09:12.797Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 2.093616334s + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 29 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"updated-test-form"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms/ap_8594yY9xHBqMJtJskjeMWq + method: PATCH + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"ap_8594yY9xHBqMJtJskjeMWq","name":"updated-test-form","languages":{"primary":"en"},"ending":{"resume_flow":true},"created_at":"2024-09-23T11:09:12.797Z","updated_at":"2024-09-23T11:09:13.273Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 465.88375ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.10.0 + url: https://go-auth0-dev.eu.auth0.com/api/v2/forms/ap_8594yY9xHBqMJtJskjeMWq + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 435.335625ms