Skip to content

Commit

Permalink
Update generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
silas committed Nov 29, 2024
1 parent 6902618 commit 0352b4d
Show file tree
Hide file tree
Showing 28 changed files with 591 additions and 185 deletions.
34 changes: 17 additions & 17 deletions adminapi/flows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestFlows_List(t *testing.T) {
{
"id": "string",
"state": "START_PENDING",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"type": "JOIN_ORGANIZATION",
"startTime": "2024-02-05T23:07:46.483Z",
"expireTime": "2024-02-05T23:07:46.483Z",
Expand Down Expand Up @@ -54,12 +54,12 @@ func TestFlows_CreateJoinOrganization(t *testing.T) {
tr.Body = `{
"id": "string",
"state": "START_PENDING",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"type": "JOIN_ORGANIZATION",
"organization": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestFlows_CreateJoinOrganization(t *testing.T) {
"user": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestFlows_CreateJoinOrganization(t *testing.T) {
"creator": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -207,12 +207,12 @@ func TestFlows_CreateSignup(t *testing.T) {
tr.Body = `{
"id": "string",
"state": "START_PENDING",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"type": "JOIN_ORGANIZATION",
"organization": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestFlows_CreateSignup(t *testing.T) {
"user": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -280,7 +280,7 @@ func TestFlows_CreateSignup(t *testing.T) {
"creator": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -360,12 +360,12 @@ func TestFlows_Get(t *testing.T) {
tr.Body = `{
"id": "string",
"state": "START_PENDING",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"type": "JOIN_ORGANIZATION",
"organization": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -399,7 +399,7 @@ func TestFlows_Get(t *testing.T) {
"user": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -433,7 +433,7 @@ func TestFlows_Get(t *testing.T) {
"creator": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -513,12 +513,12 @@ func TestFlows_Cancel(t *testing.T) {
tr.Body = `{
"id": "string",
"state": "START_PENDING",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"type": "JOIN_ORGANIZATION",
"organization": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -552,7 +552,7 @@ func TestFlows_Cancel(t *testing.T) {
"user": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down Expand Up @@ -586,7 +586,7 @@ func TestFlows_Cancel(t *testing.T) {
"creator": {
"id": "string",
"state": "ACTIVE",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"uniqueId": "test",
"displayName": "Test",
"email": "[email protected]",
Expand Down
66 changes: 36 additions & 30 deletions adminapi/invoices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ func TestInvoices_List(t *testing.T) {
{
"id": "string",
"state": "DRAFT",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"stateTime": "2024-02-05T23:07:46.483Z",
"externalId": "string",
"number": "string",
"currencyCode": "USD",
"description": "string",
"effectiveTime": "2024-02-05T23:07:46.483Z",
"subtotalAmount": "string",
"discountAmount": "string",
"taxAmount": "string",
"totalAmount": "string",
"dueAmount": "string",
"remainingDueAmount": "string",
"subtotalAmount": "10",
"discountAmount": "0",
"taxAmount": "0",
"totalAmount": "10",
"dueAmount": "10",
"remainingDueAmount": "0",
"dueTime": "2024-02-05T23:07:46.483Z",
"paidAmount": "string",
"paidAmount": "10",
"paymentState": "PAYMENT_METHOD_REQUIRED",
"pullTime": "2024-02-05T23:07:46.483Z",
"createTime": "2024-02-05T23:07:46.483Z",
Expand Down Expand Up @@ -65,26 +65,32 @@ func TestInvoices_Get(t *testing.T) {
tr.Body = `{
"id": "string",
"state": "DRAFT",
"stateReason": "DELETED",
"stateReason": "UPDATING",
"stateTime": "2024-02-05T23:07:46.483Z",
"connection": {
"id": "string",
"uniqueId": "test",
"displayName": "Test",
"state": "PENDING_SETUP",
"stateReason": "DELETED",
"type": "string",
"state": "ACTIVE",
"stateReason": "UPDATING",
"type": "AMAZON_COGNITO",
"delegate": {
"id": "string",
"uniqueId": "test",
"displayName": "Test",
"state": "PENDING_SETUP",
"stateReason": "DELETED",
"type": "string"
"state": "ACTIVE",
"stateReason": "UPDATING",
"type": "AMAZON_COGNITO"
},
"providers": [],
"createTime": "2024-02-05T23:07:46.483Z",
"updateTime": "2024-02-05T23:07:46.483Z",
"amazonCognito": {
"userPoolId": "string",
"region": "string",
"accessKeyId": "string",
"accessKeySecret": "string"
},
"auth0": {
"domain": "string",
"clientId": "string",
Expand Down Expand Up @@ -116,7 +122,7 @@ func TestInvoices_Get(t *testing.T) {
"currencyCode": "USD",
"description": "string",
"account": {
"fullName": "Test",
"fullName": "Jane Doe",
"email": "[email protected]",
"phoneNumber": "+12125550123",
"address": {
Expand All @@ -132,19 +138,19 @@ func TestInvoices_Get(t *testing.T) {
"startTime": "2024-02-05T23:07:46.483Z",
"endTime": "2024-02-05T23:07:46.483Z"
},
"subtotalAmount": "string",
"discountAmount": "string",
"subtotalAmount": "10",
"discountAmount": "0",
"balance": {
"startAmount": "string",
"endAmount": "string",
"appliedAmount": "string"
"startAmount": "10",
"endAmount": "10",
"appliedAmount": "10"
},
"taxAmount": "string",
"totalAmount": "string",
"dueAmount": "string",
"remainingDueAmount": "string",
"taxAmount": "0",
"totalAmount": "10",
"dueAmount": "10",
"remainingDueAmount": "0",
"dueTime": "2024-02-05T23:07:46.483Z",
"paidAmount": "string",
"paidAmount": "10",
"paymentState": "PAYMENT_METHOD_REQUIRED",
"paymentIntent": {
"stripe": {
Expand All @@ -157,8 +163,8 @@ func TestInvoices_Get(t *testing.T) {
{
"id": "string",
"quantity": 1,
"subtotalAmount": "string",
"discountAmount": "string",
"subtotalAmount": "10",
"discountAmount": "0",
"description": "string",
"externalId": "string",
"proration": true
Expand All @@ -168,8 +174,8 @@ func TestInvoices_Get(t *testing.T) {
{
"time": "2024-02-05T23:07:46.483Z",
"description": "string",
"subtotalAmount": "string",
"discountAmount": "string",
"subtotalAmount": "10",
"discountAmount": "0",
"startQuantity": 1,
"endQuantity": 1,
"startItemIds": [],
Expand Down
40 changes: 38 additions & 2 deletions adminapi/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ type Organizations interface {
Delete(ctx context.Context, organizationId string, input *OrganizationDeleteInput) (*adminv1.Organization, error)
// Un-marks specified organization for deletion.
Undelete(ctx context.Context, organizationId string, input *OrganizationUndeleteInput) (*adminv1.Organization, error)
// Hard delete the specified organization.
//
// The organization must be marked for deletion before it can be purged.
Purge(ctx context.Context, organizationId string, input *OrganizationPurgeInput) (*adminv1.PurgeOrganizationResponse, error)
// Connect specified organization to external account.
Connect(ctx context.Context, organizationId string, input *OrganizationConnectInput) (*adminv1.Organization, error)
// Disconnect specified organization from external account.
Expand Down Expand Up @@ -187,7 +191,7 @@ type OrganizationCreateInput struct {
RegionCode string
// The IANA time zone for the organization (e.g. `America/New_York`).
TimeZone string
// The billing address for the organization.
// The default address for the organization.
Address *commonv1.Address
// The sign-up time for the organization.
SignupTime time.Time
Expand Down Expand Up @@ -331,7 +335,7 @@ type OrganizationUpdateInput struct {
RegionCode types.Optional[string]
// The IANA time zone for the organization (e.g. `America/New_York`).
TimeZone types.Optional[string]
// The billing address for the organization.
// The default address for the organization.
Address types.Optional[*commonv1.Address]
// The sign-up time for the organization.
SignupTime types.Optional[time.Time]
Expand Down Expand Up @@ -483,6 +487,38 @@ func (n *organizationsImpl) Undelete(ctx context.Context, organizationId string,
return model, nil
}

// OrganizationPurgeInput is the input param for the Purge method.
type OrganizationPurgeInput struct {
}

func (n *organizationsImpl) Purge(ctx context.Context, organizationId string, input *OrganizationPurgeInput) (*adminv1.PurgeOrganizationResponse, error) {
req := internal.NewRequest(
"admin.organizations.purge",
"POST",
fmt.Sprintf("/admin/v1/organizations/%s:purge",
url.PathEscape(organizationId),
),
)

body := map[string]any{}

req.SetBody(body)

res, err := n.transport.Execute(ctx, req)
if err != nil {
return nil, err
}

model := &adminv1.PurgeOrganizationResponse{}

err = res.DecodeBody(&model)
if err != nil {
return nil, err
}

return model, nil
}

// OrganizationConnectInput is the input param for the Connect method.
type OrganizationConnectInput struct {
// The identifier of the connection.
Expand Down
Loading

0 comments on commit 0352b4d

Please sign in to comment.