Skip to content

Commit

Permalink
Update generated code (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
silas authored Feb 14, 2024
1 parent bc3a7b8 commit 2bc9d07
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 7 deletions.
13 changes: 10 additions & 3 deletions adminapi/flows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestFlows_List(t *testing.T) {
"state": "START_PENDING",
"stateReason": "DELETED",
"type": "JOIN_ORGANIZATION",
"startTime": "2024-02-05T23:07:46.483Z",
"expireTime": "2024-02-05T23:07:46.483Z",
"ttl": "string",
"secret": "string",
Expand Down Expand Up @@ -152,6 +153,7 @@ func TestFlows_CreateJoinOrganization(t *testing.T) {
"createTime": "2024-02-05T23:07:46.483Z",
"updateTime": "2024-02-05T23:07:46.483Z"
},
"startTime": "2024-02-05T23:07:46.483Z",
"expireTime": "2024-02-05T23:07:46.483Z",
"ttl": "string",
"secret": "string",
Expand All @@ -163,7 +165,8 @@ func TestFlows_CreateJoinOrganization(t *testing.T) {
},
"signup": {
"email": "[email protected]",
"displayName": "Test"
"displayName": "Test",
"createOrganization": true
}
}`

Expand Down Expand Up @@ -288,6 +291,7 @@ func TestFlows_Get(t *testing.T) {
"createTime": "2024-02-05T23:07:46.483Z",
"updateTime": "2024-02-05T23:07:46.483Z"
},
"startTime": "2024-02-05T23:07:46.483Z",
"expireTime": "2024-02-05T23:07:46.483Z",
"ttl": "string",
"secret": "string",
Expand All @@ -299,7 +303,8 @@ func TestFlows_Get(t *testing.T) {
},
"signup": {
"email": "[email protected]",
"displayName": "Test"
"displayName": "Test",
"createOrganization": true
}
}`

Expand Down Expand Up @@ -424,6 +429,7 @@ func TestFlows_Cancel(t *testing.T) {
"createTime": "2024-02-05T23:07:46.483Z",
"updateTime": "2024-02-05T23:07:46.483Z"
},
"startTime": "2024-02-05T23:07:46.483Z",
"expireTime": "2024-02-05T23:07:46.483Z",
"ttl": "string",
"secret": "string",
Expand All @@ -435,7 +441,8 @@ func TestFlows_Cancel(t *testing.T) {
},
"signup": {
"email": "[email protected]",
"displayName": "Test"
"displayName": "Test",
"createOrganization": true
}
}`

Expand Down
2 changes: 2 additions & 0 deletions adminv1/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type Flow struct {
//
// This will not be set if the invitation was created by an admin.
Creator *User `json:"creator"`
// The start time of the flow.
StartTime time.Time `json:"startTime"`
// The time the flow will expire.
ExpireTime time.Time `json:"expireTime"`
// The expire duration of the flow.
Expand Down
2 changes: 2 additions & 0 deletions adminv1/signup_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ type SignupFlow struct {
Email string `json:"email"`
// The display name of the invitee.
DisplayName string `json:"displayName"`
// Whether to create an organization as part of the signup flow.
CreateOrganization bool `json:"createOrganization"`
}
12 changes: 8 additions & 4 deletions userapi/flows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ func TestFlows_CreateJoinOrganization(t *testing.T) {
},
"signup": {
"email": "[email protected]",
"displayName": "Test"
"displayName": "Test",
"createOrganization": true
}
}`

Expand Down Expand Up @@ -142,7 +143,8 @@ func TestFlows_Get(t *testing.T) {
},
"signup": {
"email": "[email protected]",
"displayName": "Test"
"displayName": "Test",
"createOrganization": true
}
}`

Expand Down Expand Up @@ -201,7 +203,8 @@ func TestFlows_Consume(t *testing.T) {
},
"signup": {
"email": "[email protected]",
"displayName": "Test"
"displayName": "Test",
"createOrganization": true
}
}`

Expand Down Expand Up @@ -260,7 +263,8 @@ func TestFlows_Cancel(t *testing.T) {
},
"signup": {
"email": "[email protected]",
"displayName": "Test"
"displayName": "Test",
"createOrganization": true
}
}`

Expand Down
14 changes: 14 additions & 0 deletions userapi/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ type OrganizationCreateInput struct {
//
// The maximum length is 320 characters.
Email string
// The flow identifier associated with the creation of the organization.
//
// The flow type must be `SIGNUP` and associated with the user creating the organization.
FlowId string
}

func (n *organizationsImpl) Create(ctx context.Context, input *OrganizationCreateInput) (*userv1.Organization, error) {
Expand All @@ -132,6 +136,9 @@ func (n *organizationsImpl) Create(ctx context.Context, input *OrganizationCreat
if !internal.IsEmpty(input.Email) {
body["email"] = input.Email
}
if !internal.IsEmpty(input.FlowId) {
body["flowId"] = input.FlowId
}
}

req.SetBody(body)
Expand Down Expand Up @@ -198,6 +205,10 @@ type OrganizationUpdateInput struct {
//
// The maximum length is 320 characters.
Email types.Optional[string]
// The flow identifier associated with the creation of the organization.
//
// The flow type must be `SIGNUP` and associated with the user creating the organization.
FlowId types.Optional[string]
}

func (n *organizationsImpl) Update(ctx context.Context, organizationId string, input *OrganizationUpdateInput) (*userv1.Organization, error) {
Expand All @@ -222,6 +233,9 @@ func (n *organizationsImpl) Update(ctx context.Context, organizationId string, i
if input.Email.Present {
body["email"] = input.Email.Value
}
if input.FlowId.Present {
body["flowId"] = input.FlowId.Value
}
}

req.SetBody(body)
Expand Down
4 changes: 4 additions & 0 deletions userv1/organization_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ type OrganizationInput struct {
//
// The maximum length is 320 characters.
Email *string `json:"email"`
// The flow identifier associated with the creation of the organization.
//
// The flow type must be `SIGNUP` and associated with the user creating the organization.
FlowId *string `json:"flowId"`
}
2 changes: 2 additions & 0 deletions userv1/signup_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ type SignupFlow struct {
Email string `json:"email"`
// The display name of the invitee.
DisplayName string `json:"displayName"`
// Whether to create an organization as part of the signup flow.
CreateOrganization bool `json:"createOrganization"`
}

0 comments on commit 2bc9d07

Please sign in to comment.