diff --git a/client.go b/client.go index f5133f7..84c9430 100644 --- a/client.go +++ b/client.go @@ -36,15 +36,17 @@ type Client struct { Hidden *HiddenService // Meta: Meta information about the API. Meta *MetaService - // Modeling: Modeling API for updating your 3D files using the KittyCAD engine. + // Modeling: Modeling API for updating your 3D files using the Zoo engine. Modeling *ModelingService // Oauth2: Endpoints that implement OAuth 2.0 grant flows. Oauth2 *Oauth2Service + // Org: An organization is a group of users of the Zoo API. Here, we can add users to an org and perform operations on orgs. + Org *OrgService // Payment: Operations around payments and billing. Payment *PaymentService // Unit: Unit conversion operations. Unit *UnitService - // User: A user is someone who uses the KittyCAD API. Here, we can create, delete, and list users. We can also get information about a user. Operations will only be authorized if the user is requesting information about themselves. + // User: A user is someone who uses the Zoo API. Here, we can create, delete, and list users. We can also get information about a user. Operations will only be authorized if the user is requesting information about themselves. User *UserService } @@ -78,17 +80,20 @@ type HiddenService service // MetaService: Meta information about the API. type MetaService service -// ModelingService: Modeling API for updating your 3D files using the KittyCAD engine. +// ModelingService: Modeling API for updating your 3D files using the Zoo engine. type ModelingService service // Oauth2Service: Endpoints that implement OAuth 2.0 grant flows. type Oauth2Service service +// OrgService: An organization is a group of users of the Zoo API. Here, we can add users to an org and perform operations on orgs. +type OrgService service + // PaymentService: Operations around payments and billing. type PaymentService service // UnitService: Unit conversion operations. type UnitService service -// UserService: A user is someone who uses the KittyCAD API. Here, we can create, delete, and list users. We can also get information about a user. Operations will only be authorized if the user is requesting information about themselves. +// UserService: A user is someone who uses the Zoo API. Here, we can create, delete, and list users. We can also get information about a user. Operations will only be authorized if the user is requesting information about themselves. type UserService service diff --git a/examples_test.go b/examples_test.go index 7d61cc3..c3ed84a 100644 --- a/examples_test.go +++ b/examples_test.go @@ -458,7 +458,13 @@ func ExampleFileService_CreateDensity() { // Parameters // // - `lang`: The language code is written in. +// +//
JSON schema +// +// ```json { "description": "The language code is written in.", "oneOf": [ { "description": "The `go` programming language.", "type": "string", "enum": [ "go" ] }, { "description": "The `python` programming language.", "type": "string", "enum": [ "python" ] }, { "description": "The `node` programming language.", "type": "string", "enum": [ "node" ] } ] } ```
+// // - `output` +// // - `body` func ExampleExecutorService_CreateFileExecution() { client, err := kittycad.NewClientFromEnv("your apps user agent") @@ -704,6 +710,419 @@ func ExampleOauth2Service_ProviderConsent() { } +// Get: Get an org. +// This endpoint requires authentication by an org admin. It gets the authenticated user's org. +func ExampleOrgService_Get() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Org.Get() + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// Create: Create an org. +// This endpoint requires authentication by a Zoo user that is not already in an org. It creates a new org for the authenticated user and makes them an admin. +// +// Parameters +// +// - `body`: The user-modifiable parts of an organization. +func ExampleOrgService_Create() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Org.Create(kittycad.OrgDetails{AllowUsersInDomainToAutoJoin: true, BillingEmail: "example@example.com", Domain: "some-string", Image: kittycad.URL{&url.URL{Scheme: "https", Host: "example.com"}}, Name: "some-string", Phone: "+1-555-555-555"}) + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// Update: Update an org. +// This endpoint requires authentication by an org admin. It updates the authenticated user's org. +// +// Parameters +// +// - `body`: The user-modifiable parts of an organization. +func ExampleOrgService_Update() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Org.Update(kittycad.OrgDetails{AllowUsersInDomainToAutoJoin: true, BillingEmail: "example@example.com", Domain: "some-string", Image: kittycad.URL{&url.URL{Scheme: "https", Host: "example.com"}}, Name: "some-string", Phone: "+1-555-555-555"}) + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// Delete: Delete an org. +// In order to delete an org, you must first delete all of its members, except yourself. +// You must also have no outstanding invoices or unpaid balances. +// This endpoint requires authentication by an org admin. It deletes the authenticated user's org. +func ExampleOrgService_Delete() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + if err := client.Org.Delete(); err != nil { + panic(err) + } + +} + +// OrgList: List API calls for your org. +// This includes all API calls that were made by users in the org. +// This endpoint requires authentication by an org admin. It returns the API calls for the authenticated user's org. +// The API calls are returned in order of creation, with the most recently created API calls first. +// +// Parameters +// +// - `limit` +// +// - `pageToken` +// +// - `sortBy`: Supported set of sort modes for scanning by created_at only. +// +// Currently, we only support scanning in ascending order. +func ExampleAPICallService_OrgList() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.APICall.OrgList(123, "some-string", "") + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// GetForOrg: Get an API call for an org. +// This endpoint requires authentication by an org admin. It returns details of the requested API call for the user's org. +// +// Parameters +// +// - `id` +func ExampleAPICallService_GetForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.APICall.GetForOrg(kittycad.ParseUUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// ListMembers: List members of your org. +// This endpoint requires authentication by an org admin. It lists the members of the authenticated user's org. +// +// Parameters +// +// - `limit` +// +// - `pageToken` +// +// - `sortBy`: Supported set of sort modes for scanning by created_at only. +// +// Currently, we only support scanning in ascending order. +// +// - `role`: The roles for users in an organization. +func ExampleOrgService_ListMembers() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Org.ListMembers(123, "some-string", "", "") + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// CreateMember: Add a member to your org. +// This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org. +// +// Parameters +// +// - `body`: Data for adding a member to an org. +func ExampleOrgService_CreateMember() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Org.CreateMember(kittycad.AddOrgMember{Email: "example@example.com", Role: ""}) + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// GetMember: Get a member of your org. +// This endpoint requires authentication by an org admin. It gets the specified member of the authenticated user's org. +// +// Parameters +// +// - `userId`: A UUID usually v4 or v7 +func ExampleOrgService_GetMember() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Org.GetMember(kittycad.ParseUUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// UpdateMember: Update a member of your org. +// This endpoint requires authentication by an org admin. It updates the specified member of the authenticated user's org. +// +// Parameters +// +// - `userId`: A UUID usually v4 or v7 +// - `body`: Data for updating a member of an org. +func ExampleOrgService_UpdateMember() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Org.UpdateMember(kittycad.ParseUUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8"), kittycad.UpdateMemberToOrgBody{Role: ""}) + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// DeleteMember: Remove a member from your org. +// This endpoint requires authentication by an org admin. It removes the specified member from the authenticated user's org. +// +// Parameters +// +// - `userId`: A UUID usually v4 or v7 +func ExampleOrgService_DeleteMember() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + if err := client.Org.DeleteMember(kittycad.ParseUUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8")); err != nil { + panic(err) + } + +} + +// GetInformationForOrg: Get payment info about your org. +// This includes billing address, phone, and name. +// This endpoint requires authentication by an org admin. It gets the payment information for the authenticated user's org. +func ExamplePaymentService_GetInformationForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Payment.GetInformationForOrg() + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// CreateInformationForOrg: Create payment info for your org. +// This includes billing address, phone, and name. +// This endpoint requires authentication by the org admin. It creates the payment information for the authenticated user's org. +// +// Parameters +// +// - `body`: The billing information for payments. +func ExamplePaymentService_CreateInformationForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Payment.CreateInformationForOrg(kittycad.BillingInfo{Address: kittycad.AddressDetails{City: "some-string", Country: "some-string", State: "some-string", Street1: "some-string", Street2: "some-string", Zip: "some-string"}, Name: "some-string", Phone: "+1-555-555-555"}) + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// UpdateInformationForOrg: Update payment info for your org. +// This includes billing address, phone, and name. +// This endpoint requires authentication by an org admin. It updates the payment information for the authenticated user's org. +// +// Parameters +// +// - `body`: The billing information for payments. +func ExamplePaymentService_UpdateInformationForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Payment.UpdateInformationForOrg(kittycad.BillingInfo{Address: kittycad.AddressDetails{City: "some-string", Country: "some-string", State: "some-string", Street1: "some-string", Street2: "some-string", Zip: "some-string"}, Name: "some-string", Phone: "+1-555-555-555"}) + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// DeleteInformationForOrg: Delete payment info for your org. +// This includes billing address, phone, and name. +// This endpoint requires authentication by an org admin. It deletes the payment information for the authenticated user's org. +func ExamplePaymentService_DeleteInformationForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + if err := client.Payment.DeleteInformationForOrg(); err != nil { + panic(err) + } + +} + +// GetBalanceForOrg: Get balance for your org. +// This endpoint requires authentication by an org admin. It gets the balance information for the authenticated user's org. +func ExamplePaymentService_GetBalanceForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Payment.GetBalanceForOrg() + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// CreateIntentForOrg: Create a payment intent for your org. +// This endpoint requires authentication by the org admin. It creates a new payment intent for the authenticated user's org's org. +func ExamplePaymentService_CreateIntentForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Payment.CreateIntentForOrg() + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// ListInvoicesForOrg: List invoices for your org. +// This endpoint requires authentication by an org admin. It lists invoices for the authenticated user's org. +func ExamplePaymentService_ListInvoicesForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Payment.ListInvoicesForOrg() + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// ListMethodsForOrg: List payment methods for your org. +// This endpoint requires authentication by an org admin. It lists payment methods for the authenticated user's org. +func ExamplePaymentService_ListMethodsForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Payment.ListMethodsForOrg() + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + +// DeleteMethodForOrg: Delete a payment method for your org. +// This endpoint requires authentication by an org admin. It deletes the specified payment method for the authenticated user's org. +// +// Parameters +// +// - `id` +func ExamplePaymentService_DeleteMethodForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + if err := client.Payment.DeleteMethodForOrg("some-string"); err != nil { + panic(err) + } + +} + +// ValidateCustomerTaxInformationForOrg: Validate an orgs's information is correct and valid for automatic tax. +// This endpoint requires authentication by an org admin. It will return an error if the org's information is not valid for automatic tax. Otherwise, it will return an empty successful response. +func ExamplePaymentService_ValidateCustomerTaxInformationForOrg() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + if err := client.Payment.ValidateCustomerTaxInformationForOrg(); err != nil { + panic(err) + } + +} + // Ping: Return pong. func ExampleMetaService_Ping() { client, err := kittycad.NewClientFromEnv("your apps user agent") @@ -1152,13 +1571,17 @@ func ExampleAPITokenService_ListForUser() { // CreateForUser: Create a new API token for your user. // This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user. +// +// Parameters +// +// - `label` func ExampleAPITokenService_CreateForUser() { client, err := kittycad.NewClientFromEnv("your apps user agent") if err != nil { panic(err) } - result, err := client.APIToken.CreateForUser() + result, err := client.APIToken.CreateForUser("some-string") if err != nil { panic(err) } @@ -1242,6 +1665,24 @@ func ExampleUserService_GetOnboardingSelf() { } +// GetUser: Get a user's org. +// This endpoint requires authentication by any Zoo user. It gets the authenticated user's org. +// If the user is not a member of an org, this endpoint will return a 404. +func ExampleOrgService_GetUser() { + client, err := kittycad.NewClientFromEnv("your apps user agent") + if err != nil { + panic(err) + } + + result, err := client.Org.GetUser() + if err != nil { + panic(err) + } + + fmt.Printf("%#v", result) + +} + // GetInformationForUser: Get payment info about your user. // This includes billing address, phone, and name. // This endpoint requires authentication by any Zoo user. It gets the payment information for the authenticated user. @@ -1273,7 +1714,7 @@ func ExamplePaymentService_CreateInformationForUser() { panic(err) } - result, err := client.Payment.CreateInformationForUser(kittycad.BillingInfo{Address: kittycad.NewAddress{City: "some-string", Country: "some-string", State: "some-string", Street1: "some-string", Street2: "some-string", UserID: kittycad.ParseUUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8"), Zip: "some-string"}, Name: "some-string", Phone: "+1-555-555-555"}) + result, err := client.Payment.CreateInformationForUser(kittycad.BillingInfo{Address: kittycad.AddressDetails{City: "some-string", Country: "some-string", State: "some-string", Street1: "some-string", Street2: "some-string", Zip: "some-string"}, Name: "some-string", Phone: "+1-555-555-555"}) if err != nil { panic(err) } @@ -1295,7 +1736,7 @@ func ExamplePaymentService_UpdateInformationForUser() { panic(err) } - result, err := client.Payment.UpdateInformationForUser(kittycad.BillingInfo{Address: kittycad.NewAddress{City: "some-string", Country: "some-string", State: "some-string", Street1: "some-string", Street2: "some-string", UserID: kittycad.ParseUUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8"), Zip: "some-string"}, Name: "some-string", Phone: "+1-555-555-555"}) + result, err := client.Payment.UpdateInformationForUser(kittycad.BillingInfo{Address: kittycad.AddressDetails{City: "some-string", Country: "some-string", State: "some-string", Street1: "some-string", Street2: "some-string", Zip: "some-string"}, Name: "some-string", Phone: "+1-555-555-555"}) if err != nil { panic(err) } @@ -1405,8 +1846,8 @@ func ExamplePaymentService_DeleteMethodForUser() { } -// ValidateCustomerTaxInformationForUser: Validate a customer's information is correct and valid for automatic tax. -// This endpoint requires authentication by any Zoo user. It will return an error if the customer's information is not valid for automatic tax. Otherwise, it will return an empty successful response. +// ValidateCustomerTaxInformationForUser: Validate a user's information is correct and valid for automatic tax. +// This endpoint requires authentication by any Zoo user. It will return an error if the user's information is not valid for automatic tax. Otherwise, it will return an empty successful response. func ExamplePaymentService_ValidateCustomerTaxInformationForUser() { client, err := kittycad.NewClientFromEnv("your apps user agent") if err != nil { diff --git a/go.mod b/go.mod index f76ef53..5d602e3 100644 --- a/go.mod +++ b/go.mod @@ -23,8 +23,8 @@ require ( github.com/perimeterx/marshmallow v1.1.4 // indirect go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 488a50c..21bab77 100644 --- a/go.sum +++ b/go.sum @@ -68,8 +68,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -77,8 +77,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/kittycad.go.patch.json b/kittycad.go.patch.json index e03608c..1353c14 100644 --- a/kittycad.go.patch.json +++ b/kittycad.go.patch.json @@ -153,7 +153,7 @@ }, { "value": { - "example": "// CreateFileExecution: Execute a Zoo program in a specific language.\n// \n// \n// Parameters\n// \n// \t- `lang`: The language code is written in.\n// \t- `output`\n// \t- `body`\n// \n// CreateFileExecution: Execute a Zoo program in a specific language.\n// Parameters\n//\n// - `lang`: The language code is written in.\n// - `output`\n// - `body`\nfunc ExampleExecutorService_CreateFileExecution() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Executor.CreateFileExecution(\"\", \"some-string\", []byte(\"some-binary\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "example": "// CreateFileExecution: Execute a Zoo program in a specific language.\n// \n// \n// Parameters\n// \n// \t- `lang`: The language code is written in.\n// \t\t\n// \t\t\u003cdetails\u003e\u003csummary\u003eJSON schema\u003c/summary\u003e\n// \t\t\n// \t\t```json { \"description\": \"The language code is written in.\", \"oneOf\": [ { \"description\": \"The `go` programming language.\", \"type\": \"string\", \"enum\": [ \"go\" ] }, { \"description\": \"The `python` programming language.\", \"type\": \"string\", \"enum\": [ \"python\" ] }, { \"description\": \"The `node` programming language.\", \"type\": \"string\", \"enum\": [ \"node\" ] } ] } ``` \u003c/details\u003e\n// \t- `output`\n// \t- `body`\n// \n// CreateFileExecution: Execute a Zoo program in a specific language.\n// Parameters\n//\n// - `lang`: The language code is written in.\n//\n// \u003cdetails\u003e\u003csummary\u003eJSON schema\u003c/summary\u003e\n//\n// ```json { \"description\": \"The language code is written in.\", \"oneOf\": [ { \"description\": \"The `go` programming language.\", \"type\": \"string\", \"enum\": [ \"go\" ] }, { \"description\": \"The `python` programming language.\", \"type\": \"string\", \"enum\": [ \"python\" ] }, { \"description\": \"The `node` programming language.\", \"type\": \"string\", \"enum\": [ \"node\" ] } ] } ``` \u003c/details\u003e\n//\n// - `output`\n//\n// - `body`\nfunc ExampleExecutorService_CreateFileExecution() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Executor.CreateFileExecution(\"\", \"some-string\", []byte(\"some-binary\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#ExecutorService.CreateFileExecution" }, "op": "add", @@ -247,6 +247,174 @@ "op": "add", "path": "/paths/~1oauth2~1provider~1{provider}~1consent/get/x-go" }, + { + "value": { + "example": "// Delete: Delete an org.\n// \n// In order to delete an org, you must first delete all of its members, except yourself.\n// You must also have no outstanding invoices or unpaid balances.\n// This endpoint requires authentication by an org admin. It deletes the authenticated user's org.\n// \n// Delete: Delete an org.\n// In order to delete an org, you must first delete all of its members, except yourself.\n// You must also have no outstanding invoices or unpaid balances.\n// This endpoint requires authentication by an org admin. It deletes the authenticated user's org.\nfunc ExampleOrgService_Delete() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Org.Delete(); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.Delete" + }, + "op": "add", + "path": "/paths/~1org/delete/x-go" + }, + { + "value": { + "example": "// Get: Get an org.\n// \n// This endpoint requires authentication by an org admin. It gets the authenticated user's org.\n// \n// Get: Get an org.\n// This endpoint requires authentication by an org admin. It gets the authenticated user's org.\nfunc ExampleOrgService_Get() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Org.Get()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.Get" + }, + "op": "add", + "path": "/paths/~1org/get/x-go" + }, + { + "value": { + "example": "// Create: Create an org.\n// \n// This endpoint requires authentication by a Zoo user that is not already in an org. It creates a new org for the authenticated user and makes them an admin.\n// \n// \n// Parameters\n// \n// \t- `body`: The user-modifiable parts of an organization.\n// \n// Create: Create an org.\n// This endpoint requires authentication by a Zoo user that is not already in an org. It creates a new org for the authenticated user and makes them an admin.\n//\n// Parameters\n//\n// - `body`: The user-modifiable parts of an organization.\nfunc ExampleOrgService_Create() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Org.Create(kittycad.OrgDetails{AllowUsersInDomainToAutoJoin: true, BillingEmail: \"example@example.com\", Domain: \"some-string\", Image: kittycad.URL{\u0026url.URL{Scheme: \"https\", Host: \"example.com\"}}, Name: \"some-string\", Phone: \"+1-555-555-555\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.Create" + }, + "op": "add", + "path": "/paths/~1org/post/x-go" + }, + { + "value": { + "example": "// Update: Update an org.\n// \n// This endpoint requires authentication by an org admin. It updates the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `body`: The user-modifiable parts of an organization.\n// \n// Update: Update an org.\n// This endpoint requires authentication by an org admin. It updates the authenticated user's org.\n//\n// Parameters\n//\n// - `body`: The user-modifiable parts of an organization.\nfunc ExampleOrgService_Update() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Org.Update(kittycad.OrgDetails{AllowUsersInDomainToAutoJoin: true, BillingEmail: \"example@example.com\", Domain: \"some-string\", Image: kittycad.URL{\u0026url.URL{Scheme: \"https\", Host: \"example.com\"}}, Name: \"some-string\", Phone: \"+1-555-555-555\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.Update" + }, + "op": "add", + "path": "/paths/~1org/put/x-go" + }, + { + "value": { + "example": "// OrgList: List API calls for your org.\n// \n// This includes all API calls that were made by users in the org.\n// This endpoint requires authentication by an org admin. It returns the API calls for the authenticated user's org.\n// The API calls are returned in order of creation, with the most recently created API calls first.\n// \n// \n// Parameters\n// \n// \t- `limit`\n// \t- `pageToken`\n// \t- `sortBy`: Supported set of sort modes for scanning by created_at only.\n// \t\t\n// \t\tCurrently, we only support scanning in ascending order.\n// \n// OrgList: List API calls for your org.\n// This includes all API calls that were made by users in the org.\n// This endpoint requires authentication by an org admin. It returns the API calls for the authenticated user's org.\n// The API calls are returned in order of creation, with the most recently created API calls first.\n//\n// Parameters\n//\n// - `limit`\n//\n// - `pageToken`\n//\n// - `sortBy`: Supported set of sort modes for scanning by created_at only.\n//\n// Currently, we only support scanning in ascending order.\nfunc ExampleAPICallService_OrgList() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.APICall.OrgList(123, \"some-string\", \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#APICallService.OrgList" + }, + "op": "add", + "path": "/paths/~1org~1api-calls/get/x-go" + }, + { + "value": { + "example": "// GetForOrg: Get an API call for an org.\n// \n// This endpoint requires authentication by an org admin. It returns details of the requested API call for the user's org.\n// \n// \n// Parameters\n// \n// \t- `id`\n// \n// GetForOrg: Get an API call for an org.\n// This endpoint requires authentication by an org admin. It returns details of the requested API call for the user's org.\n//\n// Parameters\n//\n// - `id`\nfunc ExampleAPICallService_GetForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.APICall.GetForOrg(kittycad.ParseUUID(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#APICallService.GetForOrg" + }, + "op": "add", + "path": "/paths/~1org~1api-calls~1{id}/get/x-go" + }, + { + "value": { + "example": "// ListMembers: List members of your org.\n// \n// This endpoint requires authentication by an org admin. It lists the members of the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `limit`\n// \t- `pageToken`\n// \t- `sortBy`: Supported set of sort modes for scanning by created_at only.\n// \t\t\n// \t\tCurrently, we only support scanning in ascending order.\n// \t- `role`: The roles for users in an organization.\n// \n// ListMembers: List members of your org.\n// This endpoint requires authentication by an org admin. It lists the members of the authenticated user's org.\n//\n// Parameters\n//\n// - `limit`\n//\n// - `pageToken`\n//\n// - `sortBy`: Supported set of sort modes for scanning by created_at only.\n//\n// Currently, we only support scanning in ascending order.\n//\n// - `role`: The roles for users in an organization.\nfunc ExampleOrgService_ListMembers() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Org.ListMembers(123, \"some-string\", \"\", \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.ListMembers" + }, + "op": "add", + "path": "/paths/~1org~1members/get/x-go" + }, + { + "value": { + "example": "// CreateMember: Add a member to your org.\n// \n// This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `body`: Data for adding a member to an org.\n// \n// CreateMember: Add a member to your org.\n// This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.\n//\n// Parameters\n//\n// - `body`: Data for adding a member to an org.\nfunc ExampleOrgService_CreateMember() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Org.CreateMember(kittycad.AddOrgMember{Email: \"example@example.com\", Role: \"\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.CreateMember" + }, + "op": "add", + "path": "/paths/~1org~1members/post/x-go" + }, + { + "value": { + "example": "// DeleteMember: Remove a member from your org.\n// \n// This endpoint requires authentication by an org admin. It removes the specified member from the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `userId`: A UUID usually v4 or v7\n// \n// DeleteMember: Remove a member from your org.\n// This endpoint requires authentication by an org admin. It removes the specified member from the authenticated user's org.\n//\n// Parameters\n//\n// - `userId`: A UUID usually v4 or v7\nfunc ExampleOrgService_DeleteMember() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Org.DeleteMember(kittycad.ParseUUID(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\")); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.DeleteMember" + }, + "op": "add", + "path": "/paths/~1org~1members~1{user_id}/delete/x-go" + }, + { + "value": { + "example": "// GetMember: Get a member of your org.\n// \n// This endpoint requires authentication by an org admin. It gets the specified member of the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `userId`: A UUID usually v4 or v7\n// \n// GetMember: Get a member of your org.\n// This endpoint requires authentication by an org admin. It gets the specified member of the authenticated user's org.\n//\n// Parameters\n//\n// - `userId`: A UUID usually v4 or v7\nfunc ExampleOrgService_GetMember() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Org.GetMember(kittycad.ParseUUID(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.GetMember" + }, + "op": "add", + "path": "/paths/~1org~1members~1{user_id}/get/x-go" + }, + { + "value": { + "example": "// UpdateMember: Update a member of your org.\n// \n// This endpoint requires authentication by an org admin. It updates the specified member of the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `userId`: A UUID usually v4 or v7\n// \t- `body`: Data for updating a member of an org.\n// \n// UpdateMember: Update a member of your org.\n// This endpoint requires authentication by an org admin. It updates the specified member of the authenticated user's org.\n//\n// Parameters\n//\n// - `userId`: A UUID usually v4 or v7\n// - `body`: Data for updating a member of an org.\nfunc ExampleOrgService_UpdateMember() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Org.UpdateMember(kittycad.ParseUUID(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"), kittycad.UpdateMemberToOrgBody{Role: \"\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.UpdateMember" + }, + "op": "add", + "path": "/paths/~1org~1members~1{user_id}/put/x-go" + }, + { + "value": { + "example": "// DeleteInformationForOrg: Delete payment info for your org.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by an org admin. It deletes the payment information for the authenticated user's org.\n// \n// DeleteInformationForOrg: Delete payment info for your org.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by an org admin. It deletes the payment information for the authenticated user's org.\nfunc ExamplePaymentService_DeleteInformationForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Payment.DeleteInformationForOrg(); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.DeleteInformationForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment/delete/x-go" + }, + { + "value": { + "example": "// GetInformationForOrg: Get payment info about your org.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by an org admin. It gets the payment information for the authenticated user's org.\n// \n// GetInformationForOrg: Get payment info about your org.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by an org admin. It gets the payment information for the authenticated user's org.\nfunc ExamplePaymentService_GetInformationForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.GetInformationForOrg()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.GetInformationForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment/get/x-go" + }, + { + "value": { + "example": "// CreateInformationForOrg: Create payment info for your org.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by the org admin. It creates the payment information for the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `body`: The billing information for payments.\n// \n// CreateInformationForOrg: Create payment info for your org.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by the org admin. It creates the payment information for the authenticated user's org.\n//\n// Parameters\n//\n// - `body`: The billing information for payments.\nfunc ExamplePaymentService_CreateInformationForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.CreateInformationForOrg(kittycad.BillingInfo{Address: kittycad.AddressDetails{City: \"some-string\", Country: \"some-string\", State: \"some-string\", Street1: \"some-string\", Street2: \"some-string\", Zip: \"some-string\"}, Name: \"some-string\", Phone: \"+1-555-555-555\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.CreateInformationForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment/post/x-go" + }, + { + "value": { + "example": "// UpdateInformationForOrg: Update payment info for your org.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by an org admin. It updates the payment information for the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `body`: The billing information for payments.\n// \n// UpdateInformationForOrg: Update payment info for your org.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by an org admin. It updates the payment information for the authenticated user's org.\n//\n// Parameters\n//\n// - `body`: The billing information for payments.\nfunc ExamplePaymentService_UpdateInformationForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.UpdateInformationForOrg(kittycad.BillingInfo{Address: kittycad.AddressDetails{City: \"some-string\", Country: \"some-string\", State: \"some-string\", Street1: \"some-string\", Street2: \"some-string\", Zip: \"some-string\"}, Name: \"some-string\", Phone: \"+1-555-555-555\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.UpdateInformationForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment/put/x-go" + }, + { + "value": { + "example": "// GetBalanceForOrg: Get balance for your org.\n// \n// This endpoint requires authentication by an org admin. It gets the balance information for the authenticated user's org.\n// \n// GetBalanceForOrg: Get balance for your org.\n// This endpoint requires authentication by an org admin. It gets the balance information for the authenticated user's org.\nfunc ExamplePaymentService_GetBalanceForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.GetBalanceForOrg()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.GetBalanceForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment~1balance/get/x-go" + }, + { + "value": { + "example": "// CreateIntentForOrg: Create a payment intent for your org.\n// \n// This endpoint requires authentication by the org admin. It creates a new payment intent for the authenticated user's org's org.\n// \n// CreateIntentForOrg: Create a payment intent for your org.\n// This endpoint requires authentication by the org admin. It creates a new payment intent for the authenticated user's org's org.\nfunc ExamplePaymentService_CreateIntentForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.CreateIntentForOrg()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.CreateIntentForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment~1intent/post/x-go" + }, + { + "value": { + "example": "// ListInvoicesForOrg: List invoices for your org.\n// \n// This endpoint requires authentication by an org admin. It lists invoices for the authenticated user's org.\n// \n// ListInvoicesForOrg: List invoices for your org.\n// This endpoint requires authentication by an org admin. It lists invoices for the authenticated user's org.\nfunc ExamplePaymentService_ListInvoicesForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.ListInvoicesForOrg()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.ListInvoicesForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment~1invoices/get/x-go" + }, + { + "value": { + "example": "// ListMethodsForOrg: List payment methods for your org.\n// \n// This endpoint requires authentication by an org admin. It lists payment methods for the authenticated user's org.\n// \n// ListMethodsForOrg: List payment methods for your org.\n// This endpoint requires authentication by an org admin. It lists payment methods for the authenticated user's org.\nfunc ExamplePaymentService_ListMethodsForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.ListMethodsForOrg()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.ListMethodsForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment~1methods/get/x-go" + }, + { + "value": { + "example": "// DeleteMethodForOrg: Delete a payment method for your org.\n// \n// This endpoint requires authentication by an org admin. It deletes the specified payment method for the authenticated user's org.\n// \n// \n// Parameters\n// \n// \t- `id`\n// \n// DeleteMethodForOrg: Delete a payment method for your org.\n// This endpoint requires authentication by an org admin. It deletes the specified payment method for the authenticated user's org.\n//\n// Parameters\n//\n// - `id`\nfunc ExamplePaymentService_DeleteMethodForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Payment.DeleteMethodForOrg(\"some-string\"); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.DeleteMethodForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment~1methods~1{id}/delete/x-go" + }, + { + "value": { + "example": "// ValidateCustomerTaxInformationForOrg: Validate an orgs's information is correct and valid for automatic tax.\n// \n// This endpoint requires authentication by an org admin. It will return an error if the org's information is not valid for automatic tax. Otherwise, it will return an empty successful response.\n// \n// ValidateCustomerTaxInformationForOrg: Validate an orgs's information is correct and valid for automatic tax.\n// This endpoint requires authentication by an org admin. It will return an error if the org's information is not valid for automatic tax. Otherwise, it will return an empty successful response.\nfunc ExamplePaymentService_ValidateCustomerTaxInformationForOrg() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Payment.ValidateCustomerTaxInformationForOrg(); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.ValidateCustomerTaxInformationForOrg" + }, + "op": "add", + "path": "/paths/~1org~1payment~1tax/get/x-go" + }, { "value": { "example": "// Ping: Return pong.\n// \n// Ping: Return pong.\nfunc ExampleMetaService_Ping() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Meta.Ping()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", @@ -409,7 +577,7 @@ }, { "value": { - "example": "// CreateForUser: Create a new API token for your user.\n// \n// This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user.\n// \n// CreateForUser: Create a new API token for your user.\n// This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user.\nfunc ExampleAPITokenService_CreateForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.APIToken.CreateForUser()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "example": "// CreateForUser: Create a new API token for your user.\n// \n// This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user.\n// \n// \n// Parameters\n// \n// \t- `label`\n// \n// CreateForUser: Create a new API token for your user.\n// This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user.\n//\n// Parameters\n//\n// - `label`\nfunc ExampleAPITokenService_CreateForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.APIToken.CreateForUser(\"some-string\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#APITokenService.CreateForUser" }, "op": "add", @@ -447,6 +615,14 @@ "op": "add", "path": "/paths/~1user~1onboarding/get/x-go" }, + { + "value": { + "example": "// GetUser: Get a user's org.\n// \n// This endpoint requires authentication by any Zoo user. It gets the authenticated user's org.\n// If the user is not a member of an org, this endpoint will return a 404.\n// \n// GetUser: Get a user's org.\n// This endpoint requires authentication by any Zoo user. It gets the authenticated user's org.\n// If the user is not a member of an org, this endpoint will return a 404.\nfunc ExampleOrgService_GetUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Org.GetUser()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#OrgService.GetUser" + }, + "op": "add", + "path": "/paths/~1user~1org/get/x-go" + }, { "value": { "example": "// DeleteInformationForUser: Delete payment info for your user.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It deletes the payment information for the authenticated user.\n// \n// DeleteInformationForUser: Delete payment info for your user.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It deletes the payment information for the authenticated user.\nfunc ExamplePaymentService_DeleteInformationForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Payment.DeleteInformationForUser(); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", @@ -465,7 +641,7 @@ }, { "value": { - "example": "// CreateInformationForUser: Create payment info for your user.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It creates the payment information for the authenticated user.\n// \n// \n// Parameters\n// \n// \t- `body`: The billing information for payments.\n// \n// CreateInformationForUser: Create payment info for your user.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It creates the payment information for the authenticated user.\n//\n// Parameters\n//\n// - `body`: The billing information for payments.\nfunc ExamplePaymentService_CreateInformationForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.CreateInformationForUser(kittycad.BillingInfo{Address: kittycad.NewAddress{City: \"some-string\", Country: \"some-string\", State: \"some-string\", Street1: \"some-string\", Street2: \"some-string\", UserID: kittycad.ParseUUID(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"), Zip: \"some-string\"}, Name: \"some-string\", Phone: \"+1-555-555-555\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "example": "// CreateInformationForUser: Create payment info for your user.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It creates the payment information for the authenticated user.\n// \n// \n// Parameters\n// \n// \t- `body`: The billing information for payments.\n// \n// CreateInformationForUser: Create payment info for your user.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It creates the payment information for the authenticated user.\n//\n// Parameters\n//\n// - `body`: The billing information for payments.\nfunc ExamplePaymentService_CreateInformationForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.CreateInformationForUser(kittycad.BillingInfo{Address: kittycad.AddressDetails{City: \"some-string\", Country: \"some-string\", State: \"some-string\", Street1: \"some-string\", Street2: \"some-string\", Zip: \"some-string\"}, Name: \"some-string\", Phone: \"+1-555-555-555\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.CreateInformationForUser" }, "op": "add", @@ -473,7 +649,7 @@ }, { "value": { - "example": "// UpdateInformationForUser: Update payment info for your user.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It updates the payment information for the authenticated user.\n// \n// \n// Parameters\n// \n// \t- `body`: The billing information for payments.\n// \n// UpdateInformationForUser: Update payment info for your user.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It updates the payment information for the authenticated user.\n//\n// Parameters\n//\n// - `body`: The billing information for payments.\nfunc ExamplePaymentService_UpdateInformationForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.UpdateInformationForUser(kittycad.BillingInfo{Address: kittycad.NewAddress{City: \"some-string\", Country: \"some-string\", State: \"some-string\", Street1: \"some-string\", Street2: \"some-string\", UserID: kittycad.ParseUUID(\"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"), Zip: \"some-string\"}, Name: \"some-string\", Phone: \"+1-555-555-555\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", + "example": "// UpdateInformationForUser: Update payment info for your user.\n// \n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It updates the payment information for the authenticated user.\n// \n// \n// Parameters\n// \n// \t- `body`: The billing information for payments.\n// \n// UpdateInformationForUser: Update payment info for your user.\n// This includes billing address, phone, and name.\n// This endpoint requires authentication by any Zoo user. It updates the payment information for the authenticated user.\n//\n// Parameters\n//\n// - `body`: The billing information for payments.\nfunc ExamplePaymentService_UpdateInformationForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := client.Payment.UpdateInformationForUser(kittycad.BillingInfo{Address: kittycad.AddressDetails{City: \"some-string\", Country: \"some-string\", State: \"some-string\", Street1: \"some-string\", Street2: \"some-string\", Zip: \"some-string\"}, Name: \"some-string\", Phone: \"+1-555-555-555\"})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%#v\", result)\n\n}\n", "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.UpdateInformationForUser" }, "op": "add", @@ -521,7 +697,7 @@ }, { "value": { - "example": "// ValidateCustomerTaxInformationForUser: Validate a customer's information is correct and valid for automatic tax.\n// \n// This endpoint requires authentication by any Zoo user. It will return an error if the customer's information is not valid for automatic tax. Otherwise, it will return an empty successful response.\n// \n// ValidateCustomerTaxInformationForUser: Validate a customer's information is correct and valid for automatic tax.\n// This endpoint requires authentication by any Zoo user. It will return an error if the customer's information is not valid for automatic tax. Otherwise, it will return an empty successful response.\nfunc ExamplePaymentService_ValidateCustomerTaxInformationForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Payment.ValidateCustomerTaxInformationForUser(); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", + "example": "// ValidateCustomerTaxInformationForUser: Validate a user's information is correct and valid for automatic tax.\n// \n// This endpoint requires authentication by any Zoo user. It will return an error if the user's information is not valid for automatic tax. Otherwise, it will return an empty successful response.\n// \n// ValidateCustomerTaxInformationForUser: Validate a user's information is correct and valid for automatic tax.\n// This endpoint requires authentication by any Zoo user. It will return an error if the user's information is not valid for automatic tax. Otherwise, it will return an empty successful response.\nfunc ExamplePaymentService_ValidateCustomerTaxInformationForUser() {\n\tclient, err := kittycad.NewClientFromEnv(\"your apps user agent\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := client.Payment.ValidateCustomerTaxInformationForUser(); err != nil {\n\t\tpanic(err)\n\t}\n\n}\n", "libDocsLink": "https://pkg.go.dev/github.com/kittycad/kittycad.go/#PaymentService.ValidateCustomerTaxInformationForUser" }, "op": "add", diff --git a/lib.go b/lib.go index 99eb2a9..38a96f1 100644 --- a/lib.go +++ b/lib.go @@ -64,6 +64,7 @@ func NewClient(token, userAgent string) (*Client, error) { client.Meta = &MetaService{client: client} client.Modeling = &ModelingService{client: client} client.Oauth2 = &Oauth2Service{client: client} + client.Org = &OrgService{client: client} client.Payment = &PaymentService{client: client} client.Unit = &UnitService{client: client} client.User = &UserService{client: client} diff --git a/paths.go b/paths.go index 927068f..b5749b6 100644 --- a/paths.go +++ b/paths.go @@ -942,7 +942,13 @@ func (s *FileService) CreateDensity(materialMass float64, materialMassUnit UnitM // Parameters // // - `lang`: The language code is written in. +// +//
JSON schema +// +// ```json { "description": "The language code is written in.", "oneOf": [ { "description": "The `go` programming language.", "type": "string", "enum": [ "go" ] }, { "description": "The `python` programming language.", "type": "string", "enum": [ "python" ] }, { "description": "The `node` programming language.", "type": "string", "enum": [ "node" ] } ] } ```
+// // - `output` +// // - `body` func (s *ExecutorService) CreateFileExecution(lang CodeLanguage, output string, body []byte) (*CodeOutput, error) { // Create the url. @@ -1225,7 +1231,1001 @@ func (s *MetaService) InternalGetAPITokenForDiscordUser(discordId string) (*APIT if resp.Body == nil { return nil, errors.New("request returned an empty body in the response") } - var decoded APIToken + var decoded APIToken + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// Logout: This endpoint removes the session cookie for a user. +// This is used in logout scenarios. +func (s *HiddenService) Logout() error { + // Create the url. + path := "/logout" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("POST", uri, nil) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return err + } + + // Return. + return nil + +} + +// DeviceAuthRequest: Start an OAuth 2.0 Device Authorization Grant. +// This endpoint is designed to be accessed from an *unauthenticated* API client. It generates and records a `device_code` and `user_code` which must be verified and confirmed prior to a token being granted. +// +// Parameters +// +// - `body`: The request parameters for the OAuth 2.0 Device Authorization Grant flow. +func (s *Oauth2Service) DeviceAuthRequest(body DeviceAuthRequestForm) error { + // Create the url. + path := "/oauth2/device/auth" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as a form. + form := url.Values{} + encoder := schema.NewEncoder() + err := encoder.Encode(body, form) + if err != nil { + return fmt.Errorf("encoding form body request failed: %v", err) + } + b := strings.NewReader(form.Encode()) + + // Create the request. + req, err := http.NewRequest("POST", uri, b) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return err + } + + // Return. + return nil + +} + +// DeviceAuthConfirm: Confirm an OAuth 2.0 Device Authorization Grant. +// This endpoint is designed to be accessed by the user agent (browser), not the client requesting the token. So we do not actually return the token here; it will be returned in response to the poll on `/oauth2/device/token`. +// +// Parameters +// +// - `body`: The request parameters to verify the `user_code` for the OAuth 2.0 Device Authorization Grant. +func (s *Oauth2Service) DeviceAuthConfirm(body DeviceAuthVerifyParams) error { + // Create the url. + path := "/oauth2/device/confirm" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as json. + b := new(bytes.Buffer) + if err := json.NewEncoder(b).Encode(body); err != nil { + return fmt.Errorf("encoding json body request failed: %v", err) + } + + // Create the request. + req, err := http.NewRequest("POST", uri, b) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/json") + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return err + } + + // Return. + return nil + +} + +// DeviceAccessToken: Request a device access token. +// This endpoint should be polled by the client until the user code is verified and the grant is confirmed. +// +// Parameters +// +// - `body`: The form for a device access token request. +func (s *Oauth2Service) DeviceAccessToken(body DeviceAccessTokenRequestForm) error { + // Create the url. + path := "/oauth2/device/token" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as a form. + form := url.Values{} + encoder := schema.NewEncoder() + err := encoder.Encode(body, form) + if err != nil { + return fmt.Errorf("encoding form body request failed: %v", err) + } + b := strings.NewReader(form.Encode()) + + // Create the request. + req, err := http.NewRequest("POST", uri, b) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return err + } + + // Return. + return nil + +} + +// DeviceAuthVerify: Verify an OAuth 2.0 Device Authorization Grant. +// This endpoint should be accessed in a full user agent (e.g., a browser). If the user is not logged in, we redirect them to the login page and use the `callback_url` parameter to get them to the UI verification form upon logging in. If they are logged in, we redirect them to the UI verification form on the website. +// +// Parameters +// +// - `userCode` +func (s *Oauth2Service) DeviceAuthVerify(userCode string) error { + // Create the url. + path := "/oauth2/device/verify" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "user_code": userCode, + }); err != nil { + return fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return err + } + + // Return. + return nil + +} + +// ProviderCallback: Listen for callbacks for the OAuth 2.0 provider. +// Parameters +// +// - `provider`: An account provider. +// - `code` +// - `state` +func (s *Oauth2Service) ProviderCallback(provider AccountProvider, code string, state string) error { + // Create the url. + path := "/oauth2/provider/{{.provider}}/callback" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "provider": string(provider), + "code": code, + "state": state, + }); err != nil { + return fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return err + } + + // Return. + return nil + +} + +// ProviderConsent: Get the consent URL and other information for the OAuth 2.0 provider. +// Parameters +// +// - `provider`: An account provider. +// - `callbackUrl` +func (s *Oauth2Service) ProviderConsent(provider AccountProvider, callbackUrl string) (*Oauth2ClientInfo, error) { + // Create the url. + path := "/oauth2/provider/{{.provider}}/consent" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "provider": string(provider), + "callback_url": callbackUrl, + }); err != nil { + return nil, fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded Oauth2ClientInfo + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// Get: Get an org. +// This endpoint requires authentication by an org admin. It gets the authenticated user's org. +func (s *OrgService) Get() (*Org, error) { + // Create the url. + path := "/org" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded Org + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// Create: Create an org. +// This endpoint requires authentication by a Zoo user that is not already in an org. It creates a new org for the authenticated user and makes them an admin. +// +// Parameters +// +// - `body`: The user-modifiable parts of an organization. +func (s *OrgService) Create(body OrgDetails) (*Org, error) { + // Create the url. + path := "/org" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as json. + b := new(bytes.Buffer) + if err := json.NewEncoder(b).Encode(body); err != nil { + return nil, fmt.Errorf("encoding json body request failed: %v", err) + } + + // Create the request. + req, err := http.NewRequest("POST", uri, b) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/json") + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded Org + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// Update: Update an org. +// This endpoint requires authentication by an org admin. It updates the authenticated user's org. +// +// Parameters +// +// - `body`: The user-modifiable parts of an organization. +func (s *OrgService) Update(body OrgDetails) (*Org, error) { + // Create the url. + path := "/org" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as json. + b := new(bytes.Buffer) + if err := json.NewEncoder(b).Encode(body); err != nil { + return nil, fmt.Errorf("encoding json body request failed: %v", err) + } + + // Create the request. + req, err := http.NewRequest("PUT", uri, b) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/json") + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded Org + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// Delete: Delete an org. +// In order to delete an org, you must first delete all of its members, except yourself. +// You must also have no outstanding invoices or unpaid balances. +// This endpoint requires authentication by an org admin. It deletes the authenticated user's org. +func (s *OrgService) Delete() error { + // Create the url. + path := "/org" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("DELETE", uri, nil) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return err + } + + // Return. + return nil + +} + +// OrgList: List API calls for your org. +// This includes all API calls that were made by users in the org. +// This endpoint requires authentication by an org admin. It returns the API calls for the authenticated user's org. +// The API calls are returned in order of creation, with the most recently created API calls first. +// +// Parameters +// +// - `limit` +// +// - `pageToken` +// +// - `sortBy`: Supported set of sort modes for scanning by created_at only. +// +// Currently, we only support scanning in ascending order. +func (s *APICallService) OrgList(limit int, pageToken string, sortBy CreatedAtSortMode) (*APICallWithPriceResultsPage, error) { + // Create the url. + path := "/org/api-calls" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "limit": strconv.Itoa(limit), + "page_token": pageToken, + "sort_by": string(sortBy), + }); err != nil { + return nil, fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded APICallWithPriceResultsPage + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// GetForOrg: Get an API call for an org. +// This endpoint requires authentication by an org admin. It returns details of the requested API call for the user's org. +// +// Parameters +// +// - `id` +func (s *APICallService) GetForOrg(id UUID) (*APICallWithPrice, error) { + // Create the url. + path := "/org/api-calls/{{.id}}" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "id": id.String(), + }); err != nil { + return nil, fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded APICallWithPrice + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// ListMembers: List members of your org. +// This endpoint requires authentication by an org admin. It lists the members of the authenticated user's org. +// +// Parameters +// +// - `limit` +// +// - `pageToken` +// +// - `sortBy`: Supported set of sort modes for scanning by created_at only. +// +// Currently, we only support scanning in ascending order. +// +// - `role`: The roles for users in an organization. +func (s *OrgService) ListMembers(limit int, pageToken string, sortBy CreatedAtSortMode, role OrgRole) (*OrgMemberResultsPage, error) { + // Create the url. + path := "/org/members" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "limit": strconv.Itoa(limit), + "page_token": pageToken, + "sort_by": string(sortBy), + "role": string(role), + }); err != nil { + return nil, fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded OrgMemberResultsPage + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// CreateMember: Add a member to your org. +// This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org. +// +// Parameters +// +// - `body`: Data for adding a member to an org. +func (s *OrgService) CreateMember(body AddOrgMember) (*OrgMember, error) { + // Create the url. + path := "/org/members" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as json. + b := new(bytes.Buffer) + if err := json.NewEncoder(b).Encode(body); err != nil { + return nil, fmt.Errorf("encoding json body request failed: %v", err) + } + + // Create the request. + req, err := http.NewRequest("POST", uri, b) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/json") + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded OrgMember + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// GetMember: Get a member of your org. +// This endpoint requires authentication by an org admin. It gets the specified member of the authenticated user's org. +// +// Parameters +// +// - `userId`: A UUID usually v4 or v7 +func (s *OrgService) GetMember(userId UUID) (*OrgMember, error) { + // Create the url. + path := "/org/members/{{.user_id}}" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "user_id": userId.String(), + }); err != nil { + return nil, fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded OrgMember + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// UpdateMember: Update a member of your org. +// This endpoint requires authentication by an org admin. It updates the specified member of the authenticated user's org. +// +// Parameters +// +// - `userId`: A UUID usually v4 or v7 +// - `body`: Data for updating a member of an org. +func (s *OrgService) UpdateMember(userId UUID, body UpdateMemberToOrgBody) (*OrgMember, error) { + // Create the url. + path := "/org/members/{{.user_id}}" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as json. + b := new(bytes.Buffer) + if err := json.NewEncoder(b).Encode(body); err != nil { + return nil, fmt.Errorf("encoding json body request failed: %v", err) + } + + // Create the request. + req, err := http.NewRequest("PUT", uri, b) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/json") + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "user_id": userId.String(), + }); err != nil { + return nil, fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded OrgMember + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// DeleteMember: Remove a member from your org. +// This endpoint requires authentication by an org admin. It removes the specified member from the authenticated user's org. +// +// Parameters +// +// - `userId`: A UUID usually v4 or v7 +func (s *OrgService) DeleteMember(userId UUID) error { + // Create the url. + path := "/org/members/{{.user_id}}" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("DELETE", uri, nil) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "user_id": userId.String(), + }); err != nil { + return fmt.Errorf("expanding URL with parameters failed: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return err + } + + // Return. + return nil + +} + +// GetInformationForOrg: Get payment info about your org. +// This includes billing address, phone, and name. +// This endpoint requires authentication by an org admin. It gets the payment information for the authenticated user's org. +func (s *PaymentService) GetInformationForOrg() (*Customer, error) { + // Create the url. + path := "/org/payment" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded Customer + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// CreateInformationForOrg: Create payment info for your org. +// This includes billing address, phone, and name. +// This endpoint requires authentication by the org admin. It creates the payment information for the authenticated user's org. +// +// Parameters +// +// - `body`: The billing information for payments. +func (s *PaymentService) CreateInformationForOrg(body BillingInfo) (*Customer, error) { + // Create the url. + path := "/org/payment" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as json. + b := new(bytes.Buffer) + if err := json.NewEncoder(b).Encode(body); err != nil { + return nil, fmt.Errorf("encoding json body request failed: %v", err) + } + + // Create the request. + req, err := http.NewRequest("POST", uri, b) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/json") + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded Customer + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + +// UpdateInformationForOrg: Update payment info for your org. +// This includes billing address, phone, and name. +// This endpoint requires authentication by an org admin. It updates the payment information for the authenticated user's org. +// +// Parameters +// +// - `body`: The billing information for payments. +func (s *PaymentService) UpdateInformationForOrg(body BillingInfo) (*Customer, error) { + // Create the url. + path := "/org/payment" + uri := resolveRelative(s.client.server, path) + + // Encode the request body as json. + b := new(bytes.Buffer) + if err := json.NewEncoder(b).Encode(body); err != nil { + return nil, fmt.Errorf("encoding json body request failed: %v", err) + } + + // Create the request. + req, err := http.NewRequest("PUT", uri, b) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Add our headers. + req.Header.Add("Content-Type", "application/json") + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded Customer if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { return nil, fmt.Errorf("error decoding response body: %v", err) } @@ -1235,15 +2235,16 @@ func (s *MetaService) InternalGetAPITokenForDiscordUser(discordId string) (*APIT } -// Logout: This endpoint removes the session cookie for a user. -// This is used in logout scenarios. -func (s *HiddenService) Logout() error { +// DeleteInformationForOrg: Delete payment info for your org. +// This includes billing address, phone, and name. +// This endpoint requires authentication by an org admin. It deletes the payment information for the authenticated user's org. +func (s *PaymentService) DeleteInformationForOrg() error { // Create the url. - path := "/logout" + path := "/org/payment" uri := resolveRelative(s.client.server, path) // Create the request. - req, err := http.NewRequest("POST", uri, nil) + req, err := http.NewRequest("DELETE", uri, nil) if err != nil { return fmt.Errorf("error creating request: %v", err) } @@ -1265,204 +2266,182 @@ func (s *HiddenService) Logout() error { } -// DeviceAuthRequest: Start an OAuth 2.0 Device Authorization Grant. -// This endpoint is designed to be accessed from an *unauthenticated* API client. It generates and records a `device_code` and `user_code` which must be verified and confirmed prior to a token being granted. -// -// Parameters -// -// - `body`: The request parameters for the OAuth 2.0 Device Authorization Grant flow. -func (s *Oauth2Service) DeviceAuthRequest(body DeviceAuthRequestForm) error { +// GetBalanceForOrg: Get balance for your org. +// This endpoint requires authentication by an org admin. It gets the balance information for the authenticated user's org. +func (s *PaymentService) GetBalanceForOrg() (*CustomerBalance, error) { // Create the url. - path := "/oauth2/device/auth" + path := "/org/payment/balance" uri := resolveRelative(s.client.server, path) - // Encode the request body as a form. - form := url.Values{} - encoder := schema.NewEncoder() - err := encoder.Encode(body, form) - if err != nil { - return fmt.Errorf("encoding form body request failed: %v", err) - } - b := strings.NewReader(form.Encode()) - // Create the request. - req, err := http.NewRequest("POST", uri, b) + req, err := http.NewRequest("GET", uri, nil) if err != nil { - return fmt.Errorf("error creating request: %v", err) + return nil, fmt.Errorf("error creating request: %v", err) } - // Add our headers. - req.Header.Add("Content-Type", "application/x-www-form-urlencoded") - // Send the request. resp, err := s.client.client.Do(req) if err != nil { - return fmt.Errorf("error sending request: %v", err) + return nil, fmt.Errorf("error sending request: %v", err) } defer resp.Body.Close() // Check the response. if err := checkResponse(resp); err != nil { - return err + return nil, err } - // Return. - return nil + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded CustomerBalance + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil } -// DeviceAuthConfirm: Confirm an OAuth 2.0 Device Authorization Grant. -// This endpoint is designed to be accessed by the user agent (browser), not the client requesting the token. So we do not actually return the token here; it will be returned in response to the poll on `/oauth2/device/token`. -// -// Parameters -// -// - `body`: The request parameters to verify the `user_code` for the OAuth 2.0 Device Authorization Grant. -func (s *Oauth2Service) DeviceAuthConfirm(body DeviceAuthVerifyParams) error { +// CreateIntentForOrg: Create a payment intent for your org. +// This endpoint requires authentication by the org admin. It creates a new payment intent for the authenticated user's org's org. +func (s *PaymentService) CreateIntentForOrg() (*PaymentIntent, error) { // Create the url. - path := "/oauth2/device/confirm" + path := "/org/payment/intent" uri := resolveRelative(s.client.server, path) - // Encode the request body as json. - b := new(bytes.Buffer) - if err := json.NewEncoder(b).Encode(body); err != nil { - return fmt.Errorf("encoding json body request failed: %v", err) - } - // Create the request. - req, err := http.NewRequest("POST", uri, b) + req, err := http.NewRequest("POST", uri, nil) if err != nil { - return fmt.Errorf("error creating request: %v", err) + return nil, fmt.Errorf("error creating request: %v", err) } - // Add our headers. - req.Header.Add("Content-Type", "application/json") - // Send the request. resp, err := s.client.client.Do(req) if err != nil { - return fmt.Errorf("error sending request: %v", err) + return nil, fmt.Errorf("error sending request: %v", err) } defer resp.Body.Close() // Check the response. if err := checkResponse(resp); err != nil { - return err + return nil, err } - // Return. - return nil + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded PaymentIntent + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil } -// DeviceAccessToken: Request a device access token. -// This endpoint should be polled by the client until the user code is verified and the grant is confirmed. -// -// Parameters -// -// - `body`: The form for a device access token request. -func (s *Oauth2Service) DeviceAccessToken(body DeviceAccessTokenRequestForm) error { +// ListInvoicesForOrg: List invoices for your org. +// This endpoint requires authentication by an org admin. It lists invoices for the authenticated user's org. +func (s *PaymentService) ListInvoicesForOrg() (*[]Invoice, error) { // Create the url. - path := "/oauth2/device/token" + path := "/org/payment/invoices" uri := resolveRelative(s.client.server, path) - // Encode the request body as a form. - form := url.Values{} - encoder := schema.NewEncoder() - err := encoder.Encode(body, form) - if err != nil { - return fmt.Errorf("encoding form body request failed: %v", err) - } - b := strings.NewReader(form.Encode()) - // Create the request. - req, err := http.NewRequest("POST", uri, b) + req, err := http.NewRequest("GET", uri, nil) if err != nil { - return fmt.Errorf("error creating request: %v", err) + return nil, fmt.Errorf("error creating request: %v", err) } - // Add our headers. - req.Header.Add("Content-Type", "application/x-www-form-urlencoded") - // Send the request. resp, err := s.client.client.Do(req) if err != nil { - return fmt.Errorf("error sending request: %v", err) + return nil, fmt.Errorf("error sending request: %v", err) } defer resp.Body.Close() // Check the response. if err := checkResponse(resp); err != nil { - return err + return nil, err } - // Return. - return nil + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded []Invoice + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil } -// DeviceAuthVerify: Verify an OAuth 2.0 Device Authorization Grant. -// This endpoint should be accessed in a full user agent (e.g., a browser). If the user is not logged in, we redirect them to the login page and use the `callback_url` parameter to get them to the UI verification form upon logging in. If they are logged in, we redirect them to the UI verification form on the website. -// -// Parameters -// -// - `userCode` -func (s *Oauth2Service) DeviceAuthVerify(userCode string) error { +// ListMethodsForOrg: List payment methods for your org. +// This endpoint requires authentication by an org admin. It lists payment methods for the authenticated user's org. +func (s *PaymentService) ListMethodsForOrg() (*[]PaymentMethod, error) { // Create the url. - path := "/oauth2/device/verify" + path := "/org/payment/methods" uri := resolveRelative(s.client.server, path) // Create the request. req, err := http.NewRequest("GET", uri, nil) if err != nil { - return fmt.Errorf("error creating request: %v", err) - } - - // Add the parameters to the url. - if err := expandURL(req.URL, map[string]string{ - "user_code": userCode, - }); err != nil { - return fmt.Errorf("expanding URL with parameters failed: %v", err) + return nil, fmt.Errorf("error creating request: %v", err) } // Send the request. resp, err := s.client.client.Do(req) if err != nil { - return fmt.Errorf("error sending request: %v", err) + return nil, fmt.Errorf("error sending request: %v", err) } defer resp.Body.Close() // Check the response. if err := checkResponse(resp); err != nil { - return err + return nil, err } - // Return. - return nil + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded []PaymentMethod + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil } -// ProviderCallback: Listen for callbacks for the OAuth 2.0 provider. +// DeleteMethodForOrg: Delete a payment method for your org. +// This endpoint requires authentication by an org admin. It deletes the specified payment method for the authenticated user's org. +// // Parameters // -// - `provider`: An account provider. -// - `code` -// - `state` -func (s *Oauth2Service) ProviderCallback(provider AccountProvider, code string, state string) error { +// - `id` +func (s *PaymentService) DeleteMethodForOrg(id string) error { // Create the url. - path := "/oauth2/provider/{{.provider}}/callback" + path := "/org/payment/methods/{{.id}}" uri := resolveRelative(s.client.server, path) // Create the request. - req, err := http.NewRequest("GET", uri, nil) + req, err := http.NewRequest("DELETE", uri, nil) if err != nil { return fmt.Errorf("error creating request: %v", err) } // Add the parameters to the url. if err := expandURL(req.URL, map[string]string{ - "provider": string(provider), - "code": code, - "state": state, + "id": id, }); err != nil { return fmt.Errorf("expanding URL with parameters failed: %v", err) } @@ -1484,53 +2463,33 @@ func (s *Oauth2Service) ProviderCallback(provider AccountProvider, code string, } -// ProviderConsent: Get the consent URL and other information for the OAuth 2.0 provider. -// Parameters -// -// - `provider`: An account provider. -// - `callbackUrl` -func (s *Oauth2Service) ProviderConsent(provider AccountProvider, callbackUrl string) (*Oauth2ClientInfo, error) { +// ValidateCustomerTaxInformationForOrg: Validate an orgs's information is correct and valid for automatic tax. +// This endpoint requires authentication by an org admin. It will return an error if the org's information is not valid for automatic tax. Otherwise, it will return an empty successful response. +func (s *PaymentService) ValidateCustomerTaxInformationForOrg() error { // Create the url. - path := "/oauth2/provider/{{.provider}}/consent" + path := "/org/payment/tax" uri := resolveRelative(s.client.server, path) // Create the request. req, err := http.NewRequest("GET", uri, nil) if err != nil { - return nil, fmt.Errorf("error creating request: %v", err) - } - - // Add the parameters to the url. - if err := expandURL(req.URL, map[string]string{ - "provider": string(provider), - "callback_url": callbackUrl, - }); err != nil { - return nil, fmt.Errorf("expanding URL with parameters failed: %v", err) + return fmt.Errorf("error creating request: %v", err) } // Send the request. resp, err := s.client.client.Do(req) if err != nil { - return nil, fmt.Errorf("error sending request: %v", err) + return fmt.Errorf("error sending request: %v", err) } defer resp.Body.Close() // Check the response. if err := checkResponse(resp); err != nil { - return nil, err - } - - // Decode the body from the response. - if resp.Body == nil { - return nil, errors.New("request returned an empty body in the response") - } - var decoded Oauth2ClientInfo - if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { - return nil, fmt.Errorf("error decoding response body: %v", err) + return err } - // Return the response. - return &decoded, nil + // Return. + return nil } @@ -2567,7 +3526,11 @@ func (s *APITokenService) ListForUser(limit int, pageToken string, sortBy Create // CreateForUser: Create a new API token for your user. // This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user. -func (s *APITokenService) CreateForUser() (*APIToken, error) { +// +// Parameters +// +// - `label` +func (s *APITokenService) CreateForUser(label string) (*APIToken, error) { // Create the url. path := "/user/api-tokens" uri := resolveRelative(s.client.server, path) @@ -2578,6 +3541,13 @@ func (s *APITokenService) CreateForUser() (*APIToken, error) { return nil, fmt.Errorf("error creating request: %v", err) } + // Add the parameters to the url. + if err := expandURL(req.URL, map[string]string{ + "label": label, + }); err != nil { + return nil, fmt.Errorf("expanding URL with parameters failed: %v", err) + } + // Send the request. resp, err := s.client.client.Do(req) if err != nil { @@ -2775,6 +3745,46 @@ func (s *UserService) GetOnboardingSelf() (*Onboarding, error) { } +// GetUser: Get a user's org. +// This endpoint requires authentication by any Zoo user. It gets the authenticated user's org. +// If the user is not a member of an org, this endpoint will return a 404. +func (s *OrgService) GetUser() (*UserOrgInfo, error) { + // Create the url. + path := "/user/org" + uri := resolveRelative(s.client.server, path) + + // Create the request. + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + } + + // Send the request. + resp, err := s.client.client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %v", err) + } + defer resp.Body.Close() + + // Check the response. + if err := checkResponse(resp); err != nil { + return nil, err + } + + // Decode the body from the response. + if resp.Body == nil { + return nil, errors.New("request returned an empty body in the response") + } + var decoded UserOrgInfo + if err := json.NewDecoder(resp.Body).Decode(&decoded); err != nil { + return nil, fmt.Errorf("error decoding response body: %v", err) + } + + // Return the response. + return &decoded, nil + +} + // GetInformationForUser: Get payment info about your user. // This includes billing address, phone, and name. // This endpoint requires authentication by any Zoo user. It gets the payment information for the authenticated user. @@ -3149,8 +4159,8 @@ func (s *PaymentService) DeleteMethodForUser(id string) error { } -// ValidateCustomerTaxInformationForUser: Validate a customer's information is correct and valid for automatic tax. -// This endpoint requires authentication by any Zoo user. It will return an error if the customer's information is not valid for automatic tax. Otherwise, it will return an empty successful response. +// ValidateCustomerTaxInformationForUser: Validate a user's information is correct and valid for automatic tax. +// This endpoint requires authentication by any Zoo user. It will return an error if the user's information is not valid for automatic tax. Otherwise, it will return an empty successful response. func (s *PaymentService) ValidateCustomerTaxInformationForUser() error { // Create the url. path := "/user/payment/tax" diff --git a/spec.json b/spec.json index dbe5e98..7228c2b 100644 --- a/spec.json +++ b/spec.json @@ -305,8 +305,7 @@ "/ai/text-to-cad/{output_format}": { "post": { "tags": [ - "ai", - "beta" + "ai" ], "summary": "Generate a CAD model from text.", "description": "Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.\nThis operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.\nOne thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.\nThis is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.", @@ -3209,13 +3208,14 @@ } } }, - "/ping": { + "/org": { "get": { "tags": [ - "meta" + "orgs" ], - "summary": "Return pong.", - "operationId": "ping", + "summary": "Get an org.", + "description": "This endpoint requires authentication by an org admin. It gets the authenticated user's org.", + "operationId": "get_org", "responses": { "200": { "description": "successful operation", @@ -3256,7 +3256,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Pong" + "$ref": "#/components/schemas/Org" } } } @@ -3268,46 +3268,24 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/unit/conversion/angle/{input_unit}/{output_unit}": { - "get": { + }, + "put": { "tags": [ - "unit" + "orgs" ], - "summary": "Convert angle units.", - "description": "Convert an angle unit value to another angle unit value. This is a nice endpoint to use for helper functions.", - "operationId": "get_angle_unit_conversion", - "parameters": [ - { - "in": "path", - "name": "input_unit", - "description": "The source format of the unit.", - "required": true, - "schema": { - "$ref": "#/components/schemas/UnitAngle" - } - }, - { - "in": "path", - "name": "output_unit", - "description": "The output format of the unit.", - "required": true, - "schema": { - "$ref": "#/components/schemas/UnitAngle" + "summary": "Update an org.", + "description": "This endpoint requires authentication by an org admin. It updates the authenticated user's org.", + "operationId": "update_org", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrgDetails" + } } }, - { - "in": "query", - "name": "value", - "description": "The initial value.", - "required": true, - "schema": { - "type": "number", - "format": "double" - } - } - ], + "required": true + }, "responses": { "200": { "description": "successful operation", @@ -3348,7 +3326,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnitAngleConversion" + "$ref": "#/components/schemas/Org" } } } @@ -3360,49 +3338,27 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/unit/conversion/area/{input_unit}/{output_unit}": { - "get": { + }, + "post": { "tags": [ - "unit" + "orgs" ], - "summary": "Convert area units.", - "description": "Convert an area unit value to another area unit value. This is a nice endpoint to use for helper functions.", - "operationId": "get_area_unit_conversion", - "parameters": [ - { - "in": "path", - "name": "input_unit", - "description": "The source format of the unit.", - "required": true, - "schema": { - "$ref": "#/components/schemas/UnitArea" - } - }, - { - "in": "path", - "name": "output_unit", - "description": "The output format of the unit.", - "required": true, - "schema": { - "$ref": "#/components/schemas/UnitArea" + "summary": "Create an org.", + "description": "This endpoint requires authentication by a Zoo user that is not already in an org. It creates a new org for the authenticated user and makes them an admin.", + "operationId": "create_org", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrgDetails" + } } }, - { - "in": "query", - "name": "value", - "description": "The initial value.", - "required": true, - "schema": { - "type": "number", - "format": "double" - } - } - ], + "required": true + }, "responses": { - "200": { - "description": "successful operation", + "201": { + "description": "successful creation", "headers": { "Access-Control-Allow-Credentials": { "description": "Access-Control-Allow-Credentials header.", @@ -3440,7 +3396,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnitAreaConversion" + "$ref": "#/components/schemas/Org" } } } @@ -3452,49 +3408,18 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/unit/conversion/current/{input_unit}/{output_unit}": { - "get": { + }, + "delete": { "tags": [ - "unit" - ], - "summary": "Convert current units.", - "description": "Convert a current unit value to another current unit value. This is a nice endpoint to use for helper functions.", - "operationId": "get_current_unit_conversion", - "parameters": [ - { - "in": "path", - "name": "input_unit", - "description": "The source format of the unit.", - "required": true, - "schema": { - "$ref": "#/components/schemas/UnitCurrent" - } - }, - { - "in": "path", - "name": "output_unit", - "description": "The output format of the unit.", - "required": true, - "schema": { - "$ref": "#/components/schemas/UnitCurrent" - } - }, - { - "in": "query", - "name": "value", - "description": "The initial value.", - "required": true, - "schema": { - "type": "number", - "format": "double" - } - } + "orgs", + "hidden" ], + "summary": "Delete an org.", + "description": "In order to delete an org, you must first delete all of its members, except yourself.\nYou must also have no outstanding invoices or unpaid balances.\nThis endpoint requires authentication by an org admin. It deletes the authenticated user's org.", + "operationId": "delete_org", "responses": { - "200": { - "description": "successful operation", + "204": { + "description": "successful deletion", "headers": { "Access-Control-Allow-Credentials": { "description": "Access-Control-Allow-Credentials header.", @@ -3528,13 +3453,6 @@ "type": "string" } } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnitCurrentConversion" - } - } } }, "4XX": { @@ -3544,49 +3462,17 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/unit/conversion/energy/{input_unit}/{output_unit}": { - "get": { + }, + "options": { "tags": [ - "unit" - ], - "summary": "Convert energy units.", - "description": "Convert a energy unit value to another energy unit value. This is a nice endpoint to use for helper functions.", - "operationId": "get_energy_unit_conversion", - "parameters": [ - { - "in": "path", - "name": "input_unit", - "description": "The source format of the unit.", - "required": true, - "schema": { - "$ref": "#/components/schemas/UnitEnergy" - } - }, - { - "in": "path", - "name": "output_unit", - "description": "The output format of the unit.", - "required": true, - "schema": { - "$ref": "#/components/schemas/UnitEnergy" - } - }, - { - "in": "query", - "name": "value", - "description": "The initial value.", - "required": true, - "schema": { - "type": "number", - "format": "double" - } - } + "hidden" ], + "summary": "OPTIONS endpoint.", + "description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.", + "operationId": "options_create_org", "responses": { - "200": { - "description": "successful operation", + "204": { + "description": "successful operation, no content", "headers": { "Access-Control-Allow-Credentials": { "description": "Access-Control-Allow-Credentials header.", @@ -3620,13 +3506,6 @@ "type": "string" } } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UnitEnergyConversion" - } - } } }, "4XX": { @@ -3638,41 +3517,40 @@ } } }, - "/unit/conversion/force/{input_unit}/{output_unit}": { + "/org/api-calls": { "get": { "tags": [ - "unit" + "api-calls" ], - "summary": "Convert force units.", - "description": "Convert a force unit value to another force unit value. This is a nice endpoint to use for helper functions.", - "operationId": "get_force_unit_conversion", + "summary": "List API calls for your org.", + "description": "This includes all API calls that were made by users in the org.\nThis endpoint requires authentication by an org admin. It returns the API calls for the authenticated user's org.\nThe API calls are returned in order of creation, with the most recently created API calls first.", + "operationId": "org_list_api_calls", "parameters": [ { - "in": "path", - "name": "input_unit", - "description": "The source format of the unit.", - "required": true, + "in": "query", + "name": "limit", + "description": "Maximum number of items returned by a single call", "schema": { - "$ref": "#/components/schemas/UnitForce" + "nullable": true, + "type": "integer", + "format": "uint32", + "minimum": 1 } }, { - "in": "path", - "name": "output_unit", - "description": "The output format of the unit.", - "required": true, + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", "schema": { - "$ref": "#/components/schemas/UnitForce" + "nullable": true, + "type": "string" } }, { "in": "query", - "name": "value", - "description": "The initial value.", - "required": true, + "name": "sort_by", "schema": { - "type": "number", - "format": "double" + "$ref": "#/components/schemas/CreatedAtSortMode" } } ], @@ -3716,7 +3594,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnitForceConversion" + "$ref": "#/components/schemas/ApiCallWithPriceResultsPage" } } } @@ -3727,17 +3605,1927 @@ "5XX": { "$ref": "#/components/responses/Error" } + }, + "x-dropshot-pagination": { + "required": [] } } }, - "/unit/conversion/frequency/{input_unit}/{output_unit}": { + "/org/api-calls/{id}": { "get": { "tags": [ - "unit" + "api-calls" ], - "summary": "Convert frequency units.", - "description": "Convert a frequency unit value to another frequency unit value. This is a nice endpoint to use for helper functions.", - "operationId": "get_frequency_unit_conversion", + "summary": "Get an API call for an org.", + "description": "This endpoint requires authentication by an org admin. It returns details of the requested API call for the user's org.", + "operationId": "get_api_call_for_org", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "The ID of the API call.", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiCallWithPrice" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/members": { + "get": { + "tags": [ + "orgs" + ], + "summary": "List members of your org.", + "description": "This endpoint requires authentication by an org admin. It lists the members of the authenticated user's org.", + "operationId": "list_org_members", + "parameters": [ + { + "in": "query", + "name": "limit", + "description": "Maximum number of items returned by a single call", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint32", + "minimum": 1 + } + }, + { + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", + "schema": { + "nullable": true, + "type": "string" + } + }, + { + "in": "query", + "name": "sort_by", + "schema": { + "$ref": "#/components/schemas/CreatedAtSortMode" + } + }, + { + "in": "query", + "name": "role", + "description": "The organization role to filter by.", + "schema": { + "$ref": "#/components/schemas/OrgRole" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrgMemberResultsPage" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + }, + "x-dropshot-pagination": { + "required": [] + } + }, + "post": { + "tags": [ + "orgs" + ], + "summary": "Add a member to your org.", + "description": "This endpoint requires authentication by an org admin. It adds the specified member to the authenticated user's org.", + "operationId": "create_org_member", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddOrgMember" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrgMember" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "options": { + "tags": [ + "hidden" + ], + "summary": "OPTIONS endpoint.", + "description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.", + "operationId": "options_create_org_member", + "responses": { + "204": { + "description": "successful operation, no content", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/members/{user_id}": { + "get": { + "tags": [ + "orgs" + ], + "summary": "Get a member of your org.", + "description": "This endpoint requires authentication by an org admin. It gets the specified member of the authenticated user's org.", + "operationId": "get_org_member", + "parameters": [ + { + "in": "path", + "name": "user_id", + "description": "The user id of the org member.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrgMember" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "put": { + "tags": [ + "orgs" + ], + "summary": "Update a member of your org.", + "description": "This endpoint requires authentication by an org admin. It updates the specified member of the authenticated user's org.", + "operationId": "update_org_member", + "parameters": [ + { + "in": "path", + "name": "user_id", + "description": "The user id of the org member.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateMemberToOrgBody" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrgMember" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "delete": { + "tags": [ + "orgs" + ], + "summary": "Remove a member from your org.", + "description": "This endpoint requires authentication by an org admin. It removes the specified member from the authenticated user's org.", + "operationId": "delete_org_member", + "parameters": [ + { + "in": "path", + "name": "user_id", + "description": "The user id of the org member.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Uuid" + } + } + ], + "responses": { + "204": { + "description": "successful deletion", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "options": { + "tags": [ + "hidden" + ], + "summary": "OPTIONS endpoint.", + "description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.", + "operationId": "options_update_org_member", + "parameters": [ + { + "in": "path", + "name": "user_id", + "description": "The user id of the org member.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Uuid" + } + } + ], + "responses": { + "204": { + "description": "successful operation, no content", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/payment": { + "get": { + "tags": [ + "payments" + ], + "summary": "Get payment info about your org.", + "description": "This includes billing address, phone, and name.\nThis endpoint requires authentication by an org admin. It gets the payment information for the authenticated user's org.", + "operationId": "get_payment_information_for_org", + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Customer" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "put": { + "tags": [ + "payments" + ], + "summary": "Update payment info for your org.", + "description": "This includes billing address, phone, and name.\nThis endpoint requires authentication by an org admin. It updates the payment information for the authenticated user's org.", + "operationId": "update_payment_information_for_org", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingInfo" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Customer" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "post": { + "tags": [ + "payments" + ], + "summary": "Create payment info for your org.", + "description": "This includes billing address, phone, and name.\nThis endpoint requires authentication by the org admin. It creates the payment information for the authenticated user's org.", + "operationId": "create_payment_information_for_org", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingInfo" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Customer" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "delete": { + "tags": [ + "payments" + ], + "summary": "Delete payment info for your org.", + "description": "This includes billing address, phone, and name.\nThis endpoint requires authentication by an org admin. It deletes the payment information for the authenticated user's org.", + "operationId": "delete_payment_information_for_org", + "responses": { + "204": { + "description": "successful deletion", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "options": { + "tags": [ + "hidden" + ], + "summary": "OPTIONS endpoint.", + "description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.", + "operationId": "options_payment_information_for_org", + "responses": { + "204": { + "description": "successful operation, no content", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/payment/balance": { + "get": { + "tags": [ + "payments" + ], + "summary": "Get balance for your org.", + "description": "This endpoint requires authentication by an org admin. It gets the balance information for the authenticated user's org.", + "operationId": "get_payment_balance_for_org", + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerBalance" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/payment/intent": { + "post": { + "tags": [ + "payments", + "hidden" + ], + "summary": "Create a payment intent for your org.", + "description": "This endpoint requires authentication by the org admin. It creates a new payment intent for the authenticated user's org's org.", + "operationId": "create_payment_intent_for_org", + "responses": { + "201": { + "description": "successful creation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentIntent" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "options": { + "tags": [ + "hidden" + ], + "summary": "OPTIONS endpoint.", + "description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.", + "operationId": "options_create_payment_intent_for_org", + "responses": { + "204": { + "description": "successful operation, no content", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/payment/invoices": { + "get": { + "tags": [ + "payments" + ], + "summary": "List invoices for your org.", + "description": "This endpoint requires authentication by an org admin. It lists invoices for the authenticated user's org.", + "operationId": "list_invoices_for_org", + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "title": "Array_of_Invoice", + "type": "array", + "items": { + "$ref": "#/components/schemas/Invoice" + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/payment/methods": { + "get": { + "tags": [ + "payments" + ], + "summary": "List payment methods for your org.", + "description": "This endpoint requires authentication by an org admin. It lists payment methods for the authenticated user's org.", + "operationId": "list_payment_methods_for_org", + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "title": "Array_of_PaymentMethod", + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentMethod" + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/payment/methods/{id}": { + "delete": { + "tags": [ + "payments", + "hidden" + ], + "summary": "Delete a payment method for your org.", + "description": "This endpoint requires authentication by an org admin. It deletes the specified payment method for the authenticated user's org.", + "operationId": "delete_payment_method_for_org", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "The ID of the payment method.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "successful deletion", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "options": { + "tags": [ + "hidden" + ], + "summary": "OPTIONS endpoint.", + "description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.", + "operationId": "options_payment_methods_for_org", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "The ID of the payment method.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "successful operation, no content", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/org/payment/tax": { + "get": { + "tags": [ + "payments", + "hidden" + ], + "summary": "Validate an orgs's information is correct and valid for automatic tax.", + "description": "This endpoint requires authentication by an org admin. It will return an error if the org's information is not valid for automatic tax. Otherwise, it will return an empty successful response.", + "operationId": "validate_customer_tax_information_for_org", + "responses": { + "204": { + "description": "successful operation, no content", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/ping": { + "get": { + "tags": [ + "meta" + ], + "summary": "Return pong.", + "operationId": "ping", + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pong" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/unit/conversion/angle/{input_unit}/{output_unit}": { + "get": { + "tags": [ + "unit" + ], + "summary": "Convert angle units.", + "description": "Convert an angle unit value to another angle unit value. This is a nice endpoint to use for helper functions.", + "operationId": "get_angle_unit_conversion", + "parameters": [ + { + "in": "path", + "name": "input_unit", + "description": "The source format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitAngle" + } + }, + { + "in": "path", + "name": "output_unit", + "description": "The output format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitAngle" + } + }, + { + "in": "query", + "name": "value", + "description": "The initial value.", + "required": true, + "schema": { + "type": "number", + "format": "double" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnitAngleConversion" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/unit/conversion/area/{input_unit}/{output_unit}": { + "get": { + "tags": [ + "unit" + ], + "summary": "Convert area units.", + "description": "Convert an area unit value to another area unit value. This is a nice endpoint to use for helper functions.", + "operationId": "get_area_unit_conversion", + "parameters": [ + { + "in": "path", + "name": "input_unit", + "description": "The source format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitArea" + } + }, + { + "in": "path", + "name": "output_unit", + "description": "The output format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitArea" + } + }, + { + "in": "query", + "name": "value", + "description": "The initial value.", + "required": true, + "schema": { + "type": "number", + "format": "double" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnitAreaConversion" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/unit/conversion/current/{input_unit}/{output_unit}": { + "get": { + "tags": [ + "unit" + ], + "summary": "Convert current units.", + "description": "Convert a current unit value to another current unit value. This is a nice endpoint to use for helper functions.", + "operationId": "get_current_unit_conversion", + "parameters": [ + { + "in": "path", + "name": "input_unit", + "description": "The source format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitCurrent" + } + }, + { + "in": "path", + "name": "output_unit", + "description": "The output format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitCurrent" + } + }, + { + "in": "query", + "name": "value", + "description": "The initial value.", + "required": true, + "schema": { + "type": "number", + "format": "double" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnitCurrentConversion" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/unit/conversion/energy/{input_unit}/{output_unit}": { + "get": { + "tags": [ + "unit" + ], + "summary": "Convert energy units.", + "description": "Convert a energy unit value to another energy unit value. This is a nice endpoint to use for helper functions.", + "operationId": "get_energy_unit_conversion", + "parameters": [ + { + "in": "path", + "name": "input_unit", + "description": "The source format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitEnergy" + } + }, + { + "in": "path", + "name": "output_unit", + "description": "The output format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitEnergy" + } + }, + { + "in": "query", + "name": "value", + "description": "The initial value.", + "required": true, + "schema": { + "type": "number", + "format": "double" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnitEnergyConversion" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/unit/conversion/force/{input_unit}/{output_unit}": { + "get": { + "tags": [ + "unit" + ], + "summary": "Convert force units.", + "description": "Convert a force unit value to another force unit value. This is a nice endpoint to use for helper functions.", + "operationId": "get_force_unit_conversion", + "parameters": [ + { + "in": "path", + "name": "input_unit", + "description": "The source format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitForce" + } + }, + { + "in": "path", + "name": "output_unit", + "description": "The output format of the unit.", + "required": true, + "schema": { + "$ref": "#/components/schemas/UnitForce" + } + }, + { + "in": "query", + "name": "value", + "description": "The initial value.", + "required": true, + "schema": { + "type": "number", + "format": "double" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnitForceConversion" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/unit/conversion/frequency/{input_unit}/{output_unit}": { + "get": { + "tags": [ + "unit" + ], + "summary": "Convert frequency units.", + "description": "Convert a frequency unit value to another frequency unit value. This is a nice endpoint to use for helper functions.", + "operationId": "get_frequency_unit_conversion", "parameters": [ { "in": "path", @@ -4972,6 +6760,17 @@ "summary": "Create a new API token for your user.", "description": "This endpoint requires authentication by any Zoo user. It creates a new API token for the authenticated user.", "operationId": "create_api_token_for_user", + "parameters": [ + { + "in": "query", + "name": "label", + "description": "An optional label for the API token.", + "schema": { + "nullable": true, + "type": "string" + } + } + ], "responses": { "201": { "description": "successful creation", @@ -5237,8 +7036,63 @@ } ], "responses": { - "204": { - "description": "successful operation, no content", + "204": { + "description": "successful operation, no content", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/user/extended": { + "get": { + "tags": [ + "users" + ], + "summary": "Get extended information about your user.", + "description": "Get the user information for the authenticated user.\nAlternatively, you can also use the `/users-extended/me` endpoint.", + "operationId": "get_user_self_extended", + "responses": { + "200": { + "description": "successful operation", "headers": { "Access-Control-Allow-Credentials": { "description": "Access-Control-Allow-Credentials header.", @@ -5272,6 +7126,13 @@ "type": "string" } } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExtendedUser" + } + } } }, "4XX": { @@ -5283,14 +7144,15 @@ } } }, - "/user/extended": { + "/user/onboarding": { "get": { "tags": [ - "users" + "users", + "hidden" ], - "summary": "Get extended information about your user.", - "description": "Get the user information for the authenticated user.\nAlternatively, you can also use the `/users-extended/me` endpoint.", - "operationId": "get_user_self_extended", + "summary": "Get your user's onboarding status.", + "description": "Checks key part of their api usage to determine their onboarding progress", + "operationId": "get_user_onboarding_self", "responses": { "200": { "description": "successful operation", @@ -5331,7 +7193,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExtendedUser" + "$ref": "#/components/schemas/Onboarding" } } } @@ -5345,15 +7207,15 @@ } } }, - "/user/onboarding": { + "/user/org": { "get": { "tags": [ - "users", - "hidden" + "orgs", + "users" ], - "summary": "Get your user's onboarding status.", - "description": "Checks key part of their api usage to determine their onboarding progress", - "operationId": "get_user_onboarding_self", + "summary": "Get a user's org.", + "description": "This endpoint requires authentication by any Zoo user. It gets the authenticated user's org.\nIf the user is not a member of an org, this endpoint will return a 404.", + "operationId": "get_user_org", "responses": { "200": { "description": "successful operation", @@ -5394,7 +7256,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Onboarding" + "$ref": "#/components/schemas/UserOrgInfo" } } } @@ -6163,8 +8025,8 @@ "payments", "hidden" ], - "summary": "Validate a customer's information is correct and valid for automatic tax.", - "description": "This endpoint requires authentication by any Zoo user. It will return an error if the customer's information is not valid for automatic tax. Otherwise, it will return an empty successful response.", + "summary": "Validate a user's information is correct and valid for automatic tax.", + "description": "This endpoint requires authentication by any Zoo user. It will return an error if the user's information is not valid for automatic tax. Otherwise, it will return an empty successful response.", "operationId": "validate_customer_tax_information_for_user", "responses": { "204": { @@ -6465,8 +8327,7 @@ }, "post": { "tags": [ - "ai", - "beta" + "ai" ], "summary": "Give feedback to a specific text-to-CAD response.", "description": "This endpoint requires authentication by any Zoo user. The user must be the owner of the text-to-CAD model, in order to give feedback.", @@ -7153,18 +9014,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "AccountProvider": { "description": "An account provider.", @@ -7192,6 +9041,66 @@ } ] }, + "AddOrgMember": { + "description": "Data for adding a member to an org.", + "type": "object", + "properties": { + "email": { + "description": "The email address of the user to add to the org.", + "type": "string", + "format": "email" + }, + "role": { + "description": "The organization role to give the user.", + "allOf": [ + { + "$ref": "#/components/schemas/OrgRole" + } + ] + } + }, + "required": [ + "email", + "role" + ] + }, + "AddressDetails": { + "description": "Address details.", + "type": "object", + "properties": { + "city": { + "description": "The city component.", + "type": "string" + }, + "country": { + "description": "The country component. This is a two-letter ISO country code.", + "allOf": [ + { + "$ref": "#/components/schemas/CountryCode" + } + ] + }, + "state": { + "description": "The state component.", + "type": "string" + }, + "street1": { + "description": "The first street component.", + "type": "string" + }, + "street2": { + "description": "The second street component.", + "type": "string" + }, + "zip": { + "description": "The zip component.", + "type": "string" + } + }, + "required": [ + "country" + ] + }, "AiFeedback": { "description": "Human feedback on an AI response.", "oneOf": [ @@ -7700,6 +9609,15 @@ "type": "integer", "format": "int32" }, + "org_id": { + "nullable": true, + "description": "The organization ID of the API call if it is billable through an organization.", + "allOf": [ + { + "$ref": "#/components/schemas/Uuid" + } + ] + }, "origin": { "description": "The origin of the API call.", "type": "string" @@ -7845,6 +9763,11 @@ "description": "If the token is valid. We never delete API tokens, but we can mark them as invalid. We save them for ever to preserve the history of the API token.", "type": "boolean" }, + "label": { + "nullable": true, + "description": "An optional label for the API token.", + "type": "string" + }, "token": { "description": "The API token itself.", "allOf": [ @@ -8890,7 +10813,7 @@ "description": "The address of the customer.", "allOf": [ { - "$ref": "#/components/schemas/NewAddress" + "$ref": "#/components/schemas/AddressDetails" } ] }, @@ -9143,7 +11066,7 @@ } }, "CodeLanguage": { - "description": "The language code is written in.", + "description": "The language code is written in.\n\n
JSON schema\n\n```json { \"description\": \"The language code is written in.\", \"oneOf\": [ { \"description\": \"The `go` programming language.\", \"type\": \"string\", \"enum\": [ \"go\" ] }, { \"description\": \"The `python` programming language.\", \"type\": \"string\", \"enum\": [ \"python\" ] }, { \"description\": \"The `node` programming language.\", \"type\": \"string\", \"enum\": [ \"node\" ] } ] } ```
", "oneOf": [ { "description": "The `go` programming language.", @@ -9169,7 +11092,7 @@ ] }, "CodeOutput": { - "description": "Output of the code being executed.", + "description": "Output of the code being executed.\n\n
JSON schema\n\n```json { \"description\": \"Output of the code being executed.\", \"type\": \"object\", \"properties\": { \"output_files\": { \"description\": \"The contents of the files requested if they were passed.\", \"type\": \"array\", \"items\": { \"$ref\": \"#/components/schemas/OutputFile\" } }, \"stderr\": { \"description\": \"The stderr of the code.\", \"default\": \"\", \"type\": \"string\" }, \"stdout\": { \"description\": \"The stdout of the code.\", \"default\": \"\", \"type\": \"string\" } } } ```
", "type": "object", "properties": { "output_files": { @@ -9701,7 +11624,7 @@ "description": "The customer's address.", "allOf": [ { - "$ref": "#/components/schemas/NewAddress" + "$ref": "#/components/schemas/AddressDetails" } ] }, @@ -9765,7 +11688,7 @@ ] }, "CustomerBalance": { - "description": "A balance for a user.\n\nThis holds information about the financial balance for the user.", + "description": "A balance for a customer.\n\nThis holds information about the financial balance for the customer.", "type": "object", "properties": { "created_at": { @@ -9782,27 +11705,35 @@ } ] }, + "map_id": { + "description": "The mapping id of the user or org.", + "allOf": [ + { + "$ref": "#/components/schemas/Uuid" + } + ] + }, "monthly_credits_remaining": { "title": "double", - "description": "The monthy credits remaining in the balance. This gets re-upped every month, but if the credits are not used for a month they do not carry over to the next month. It is a stable amount granted to the user per month.", + "description": "The monthy credits remaining in the balance. This gets re-upped every month, but if the credits are not used for a month they do not carry over to the next month. It is a stable amount granted to the customer per month.", "type": "number", "format": "money-usd" }, "pre_pay_cash_remaining": { "title": "double", - "description": "The amount of pre-pay cash remaining in the balance. This number goes down as the user uses their pre-paid credits. The reason we track this amount is if a user ever wants to withdraw their pre-pay cash, we can use this amount to determine how much to give them. Say a user has $100 in pre-paid cash, their bill is worth, $50 after subtracting any other credits (like monthly etc.) Their bill is $50, their pre-pay cash remaining will be subtracted by 50 to pay the bill and their `pre_pay_credits_remaining` will be subtracted by 50 to pay the bill. This way if they want to withdraw money after, they can only withdraw $50 since that is the amount of cash they have remaining.", + "description": "The amount of pre-pay cash remaining in the balance. This number goes down as the customer uses their pre-paid credits. The reason we track this amount is if a customer ever wants to withdraw their pre-pay cash, we can use this amount to determine how much to give them. Say a customer has $100 in pre-paid cash, their bill is worth, $50 after subtracting any other credits (like monthly etc.) Their bill is $50, their pre-pay cash remaining will be subtracted by 50 to pay the bill and their `pre_pay_credits_remaining` will be subtracted by 50 to pay the bill. This way if they want to withdraw money after, they can only withdraw $50 since that is the amount of cash they have remaining.", "type": "number", "format": "money-usd" }, "pre_pay_credits_remaining": { "title": "double", - "description": "The amount of credits remaining in the balance. This is typically the amount of cash * some multiplier they get for pre-paying their account. This number lowers every time a bill is paid with the balance. This number increases every time a user adds funds to their balance. This may be through a subscription or a one off payment.", + "description": "The amount of credits remaining in the balance. This is typically the amount of cash * some multiplier they get for pre-paying their account. This number lowers every time a bill is paid with the balance. This number increases every time a customer adds funds to their balance. This may be through a subscription or a one off payment.", "type": "number", "format": "money-usd" }, "total_due": { "title": "double", - "description": "This includes any outstanding, draft, or open invoices and any pending invoice items. This does not include any credits the user has on their account.", + "description": "This includes any outstanding, draft, or open invoices and any pending invoice items. This does not include any credits the customer has on their account.", "type": "number", "format": "money-usd" }, @@ -9811,25 +11742,17 @@ "description": "The date and time the balance was last updated.", "type": "string", "format": "date-time" - }, - "user_id": { - "description": "The user ID the balance belongs to.", - "allOf": [ - { - "$ref": "#/components/schemas/Uuid" - } - ] } }, "required": [ "created_at", "id", + "map_id", "monthly_credits_remaining", "pre_pay_cash_remaining", "pre_pay_credits_remaining", "total_due", - "updated_at", - "user_id" + "updated_at" ] }, "Density": { @@ -14570,52 +16493,6 @@ "entities_selected" ] }, - "NewAddress": { - "description": "The struct that is used to create a new record. This is automatically generated and has all the same fields as the main struct only it is missing the `id`.", - "type": "object", - "properties": { - "city": { - "description": "The city component.", - "type": "string" - }, - "country": { - "description": "The country component. This is a two-letter ISO country code.", - "allOf": [ - { - "$ref": "#/components/schemas/CountryCode" - } - ] - }, - "state": { - "description": "The state component.", - "type": "string" - }, - "street1": { - "description": "The first street component.", - "type": "string" - }, - "street2": { - "description": "The second street component.", - "type": "string" - }, - "user_id": { - "description": "The user ID that this address belongs to.", - "allOf": [ - { - "$ref": "#/components/schemas/Uuid" - } - ] - }, - "zip": { - "description": "The zip component.", - "type": "string" - } - }, - "required": [ - "country", - "user_id" - ] - }, "OAuth2ClientInfo": { "description": "Information about an OAuth 2.0 client.", "type": "object", @@ -15457,35 +17334,289 @@ } ] }, - "Onboarding": { - "description": "Onboarding details", + "Onboarding": { + "description": "Onboarding details", + "type": "object", + "properties": { + "first_call_from_modeling_app_date": { + "nullable": true, + "title": "DateTime", + "description": "When the user first used the modeling app.", + "type": "string", + "format": "date-time" + }, + "first_call_from_text_to_cad_date": { + "nullable": true, + "title": "DateTime", + "description": "When the user first used text-to-CAD.", + "type": "string", + "format": "date-time" + }, + "first_token_date": { + "nullable": true, + "title": "DateTime", + "description": "When the user created their first token.", + "type": "string", + "format": "date-time" + } + } + }, + "Org": { + "description": "An organization.", + "type": "object", + "properties": { + "allow_users_in_domain_to_auto_join": { + "nullable": true, + "description": "If we should allow all future users who are created with email addresses from this domain to join the org.", + "type": "boolean" + }, + "billing_email": { + "description": "The billing email address of the org.", + "type": "string", + "format": "email" + }, + "billing_email_verified": { + "nullable": true, + "title": "DateTime", + "description": "The date and time the billing email address was verified.", + "type": "string", + "format": "date-time" + }, + "block": { + "nullable": true, + "description": "If the org should be blocked and the reason why.", + "allOf": [ + { + "$ref": "#/components/schemas/BlockReason" + } + ] + }, + "created_at": { + "title": "DateTime", + "description": "The date and time the org was created.", + "type": "string", + "format": "date-time" + }, + "domain": { + "nullable": true, + "description": "The org's domain.", + "type": "string" + }, + "id": { + "description": "The unique identifier for the org.", + "allOf": [ + { + "$ref": "#/components/schemas/Uuid" + } + ] + }, + "image": { + "nullable": true, + "title": "String", + "description": "The image for the org. This is a URL.", + "type": "string", + "format": "uri" + }, + "name": { + "description": "The name of the org.", + "type": "string" + }, + "phone": { + "title": "String", + "description": "The org's phone number.", + "default": "", + "type": "string", + "format": "phone" + }, + "stripe_id": { + "nullable": true, + "description": "The org's stripe id.", + "type": "string" + }, + "updated_at": { + "title": "DateTime", + "description": "The date and time the org was last updated.", + "type": "string", + "format": "date-time" + } + }, + "required": [ + "created_at", + "id", + "updated_at" + ] + }, + "OrgDetails": { + "description": "The user-modifiable parts of an organization.", "type": "object", "properties": { - "first_call_from_modeling_app_date": { + "allow_users_in_domain_to_auto_join": { + "nullable": true, + "description": "If we should allow all future users who are created with email addresses from this domain to join the org.", + "type": "boolean" + }, + "billing_email": { + "description": "The billing email address of the org.", + "type": "string", + "format": "email" + }, + "domain": { + "nullable": true, + "description": "The org's domain.", + "type": "string" + }, + "image": { "nullable": true, + "title": "String", + "description": "The image for the org. This is a URL.", + "type": "string", + "format": "uri" + }, + "name": { + "description": "The name of the org.", + "type": "string" + }, + "phone": { + "title": "String", + "description": "The org's phone number.", + "default": "", + "type": "string", + "format": "phone" + } + } + }, + "OrgMember": { + "description": "A member of an organization.", + "type": "object", + "properties": { + "company": { + "description": "The user's company.", + "type": "string" + }, + "created_at": { "title": "DateTime", - "description": "When the user first used the modeling app.", + "description": "The date and time the user was created.", "type": "string", "format": "date-time" }, - "first_call_from_text_to_cad_date": { + "discord": { + "description": "The user's Discord handle.", + "type": "string" + }, + "email": { + "description": "The email address of the user.", + "type": "string", + "format": "email" + }, + "email_verified": { "nullable": true, "title": "DateTime", - "description": "When the user first used text-to-CAD.", + "description": "The date and time the email address was verified.", "type": "string", "format": "date-time" }, - "first_token_date": { - "nullable": true, + "first_name": { + "description": "The user's first name.", + "type": "string" + }, + "github": { + "description": "The user's GitHub handle.", + "type": "string" + }, + "id": { + "description": "The unique identifier for the user.", + "allOf": [ + { + "$ref": "#/components/schemas/Uuid" + } + ] + }, + "image": { + "title": "String", + "description": "The image avatar for the user. This is a URL.", + "type": "string", + "format": "uri" + }, + "last_name": { + "description": "The user's last name.", + "type": "string" + }, + "name": { + "description": "The name of the user. This is auto populated at first from the authentication provider (if there was a name). It can be updated by the user by updating their `first_name` and `last_name` fields.", + "type": "string" + }, + "phone": { + "title": "String", + "description": "The user's phone number.", + "default": "", + "type": "string", + "format": "phone" + }, + "role": { + "description": "The user's role in the org.", + "allOf": [ + { + "$ref": "#/components/schemas/OrgRole" + } + ] + }, + "updated_at": { "title": "DateTime", - "description": "When the user created their first token.", + "description": "The date and time the user was last updated.", "type": "string", "format": "date-time" } - } + }, + "required": [ + "created_at", + "id", + "image", + "role", + "updated_at" + ] + }, + "OrgMemberResultsPage": { + "description": "A single page of results", + "type": "object", + "properties": { + "items": { + "description": "list of items on this page of results", + "type": "array", + "items": { + "$ref": "#/components/schemas/OrgMember" + } + }, + "next_page": { + "nullable": true, + "description": "token used to fetch the next page of results (if any)", + "type": "string" + } + }, + "required": [ + "items" + ] + }, + "OrgRole": { + "description": "The roles for users in an organization.", + "oneOf": [ + { + "description": "Admins can do anything in the org.", + "type": "string", + "enum": [ + "admin" + ] + }, + { + "description": "Members of an org can not modify an org, but they belong in the org.", + "type": "string", + "enum": [ + "member" + ] + } + ] }, "OutputFile": { - "description": "Output file contents.", + "description": "Output file contents.\n\n
JSON schema\n\n```json { \"description\": \"Output file contents.\", \"type\": \"object\", \"properties\": { \"contents\": { \"description\": \"The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON.\", \"type\": \"string\" }, \"name\": { \"description\": \"The name of the file.\", \"default\": \"\", \"type\": \"string\" } } } ```
", "type": "object", "properties": { "contents": { @@ -18782,6 +20913,23 @@ "user_id" ] }, + "UpdateMemberToOrgBody": { + "description": "Data for updating a member of an org.", + "type": "object", + "properties": { + "role": { + "description": "The organization role to give the user.", + "allOf": [ + { + "$ref": "#/components/schemas/OrgRole" + } + ] + } + }, + "required": [ + "role" + ] + }, "UpdateUser": { "description": "The user-modifiable parts of a User.", "type": "object", @@ -18905,6 +21053,100 @@ "updated_at" ] }, + "UserOrgInfo": { + "description": "A user's information about an org, including their role.", + "type": "object", + "properties": { + "allow_users_in_domain_to_auto_join": { + "nullable": true, + "description": "If we should allow all future users who are created with email addresses from this domain to join the org.", + "type": "boolean" + }, + "billing_email": { + "description": "The billing email address of the org.", + "type": "string", + "format": "email" + }, + "billing_email_verified": { + "nullable": true, + "title": "DateTime", + "description": "The date and time the billing email address was verified.", + "type": "string", + "format": "date-time" + }, + "block": { + "nullable": true, + "description": "If the org should be blocked and the reason why.", + "allOf": [ + { + "$ref": "#/components/schemas/BlockReason" + } + ] + }, + "created_at": { + "title": "DateTime", + "description": "The date and time the org was created.", + "type": "string", + "format": "date-time" + }, + "domain": { + "nullable": true, + "description": "The org's domain.", + "type": "string" + }, + "id": { + "description": "The unique identifier for the org.", + "allOf": [ + { + "$ref": "#/components/schemas/Uuid" + } + ] + }, + "image": { + "nullable": true, + "title": "String", + "description": "The image for the org. This is a URL.", + "type": "string", + "format": "uri" + }, + "name": { + "description": "The name of the org.", + "type": "string" + }, + "phone": { + "title": "String", + "description": "The org's phone number.", + "default": "", + "type": "string", + "format": "phone" + }, + "role": { + "description": "The user's role in the org.", + "allOf": [ + { + "$ref": "#/components/schemas/OrgRole" + } + ] + }, + "stripe_id": { + "nullable": true, + "description": "The org's stripe id.", + "type": "string" + }, + "updated_at": { + "title": "DateTime", + "description": "The date and time the org was last updated.", + "type": "string", + "format": "date-time" + } + }, + "required": [ + "created_at", + "id", + "role", + "updated_at" + ] + }, "UserResultsPage": { "description": "A single page of results", "type": "object", @@ -19165,6 +21407,18 @@ } ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } }, "tags": [ @@ -19172,105 +21426,112 @@ "name": "ai", "description": "AI uses machine learning to generate CAD models.", "externalDocs": { - "url": "https://docs.kittycad.io/api/ai" + "url": "https://zoo.dev/docs/api/ai" } }, { "name": "api-calls", "description": "API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing.", "externalDocs": { - "url": "https://docs.kittycad.io/api/api-calls" + "url": "https://zoo.dev/docs/api/api-calls" } }, { "name": "api-tokens", "description": "API tokens allow users to call the API outside of their session token that is used as a cookie in the user interface. Users can create, delete, and list their API tokens. But, of course, you need an API token to do this, so first be sure to generate one in the account UI.", "externalDocs": { - "url": "https://docs.kittycad.io/api/api-tokens" + "url": "https://zoo.dev/docs/api/api-tokens" } }, { "name": "apps", "description": "Endpoints for third party app grant flows.", "externalDocs": { - "url": "https://docs.kittycad.io/api/apps" + "url": "https://zoo.dev/docs/api/apps" } }, { "name": "beta", "description": "Beta API endpoints. We will not charge for these endpoints while they are in beta.", "externalDocs": { - "url": "https://docs.kittycad.io/api/beta" + "url": "https://zoo.dev/docs/api/beta" } }, { "name": "constant", "description": "Constants. These are helpful as helpers.", "externalDocs": { - "url": "https://docs.kittycad.io/api/constant" + "url": "https://zoo.dev/docs/api/constant" } }, { "name": "executor", "description": "Endpoints that allow for code execution or creation of code execution environments.", "externalDocs": { - "url": "https://docs.kittycad.io/api/executor" + "url": "https://zoo.dev/docs/api/executor" } }, { "name": "file", "description": "CAD file operations. Create, get, and list CAD file conversions. More endpoints will be added here in the future as we build out transforms, etc on CAD models.", "externalDocs": { - "url": "https://docs.kittycad.io/api/file" + "url": "https://zoo.dev/docs/api/file" } }, { "name": "hidden", "description": "Hidden API endpoints that should not show up in the docs.", "externalDocs": { - "url": "https://docs.kittycad.io/api/hidden" + "url": "https://zoo.dev/docs/api/hidden" } }, { "name": "meta", "description": "Meta information about the API.", "externalDocs": { - "url": "https://docs.kittycad.io/api/meta" + "url": "https://zoo.dev/docs/api/meta" } }, { "name": "modeling", - "description": "Modeling API for updating your 3D files using the KittyCAD engine.", + "description": "Modeling API for updating your 3D files using the Zoo engine.", "externalDocs": { - "url": "https://docs.kittycad.io/api/modeling" + "url": "https://zoo.dev/docs/api/modeling" } }, { "name": "oauth2", "description": "Endpoints that implement OAuth 2.0 grant flows.", "externalDocs": { - "url": "https://docs.kittycad.io/api/oauth2" + "url": "https://zoo.dev/docs/api/oauth2" + } + }, + { + "name": "orgs", + "description": "An organization is a group of users of the Zoo API. Here, we can add users to an org and perform operations on orgs.", + "externalDocs": { + "url": "https://zoo.dev/docs/api/orgs" } }, { "name": "payments", "description": "Operations around payments and billing.", "externalDocs": { - "url": "https://docs.kittycad.io/api/payments" + "url": "https://zoo.dev/docs/api/payments" } }, { "name": "unit", "description": "Unit conversion operations.", "externalDocs": { - "url": "https://docs.kittycad.io/api/file" + "url": "https://zoo.dev/docs/api/file" } }, { "name": "users", - "description": "A user is someone who uses the KittyCAD API. Here, we can create, delete, and list users. We can also get information about a user. Operations will only be authorized if the user is requesting information about themselves.", + "description": "A user is someone who uses the Zoo API. Here, we can create, delete, and list users. We can also get information about a user. Operations will only be authorized if the user is requesting information about themselves.", "externalDocs": { - "url": "https://docs.kittycad.io/api/users" + "url": "https://zoo.dev/docs/api/users" } } ] diff --git a/types.go b/types.go index 496fb54..6ac65bb 100755 --- a/types.go +++ b/types.go @@ -67,6 +67,8 @@ type APICallWithPrice struct { Method Method `json:"method" yaml:"method" schema:"method,required"` // Minutes: The number of minutes the API call was billed for. Minutes int `json:"minutes" yaml:"minutes" schema:"minutes"` + // OrgID: The organization ID of the API call if it is billable through an organization. + OrgID UUID `json:"org_id" yaml:"org_id" schema:"org_id"` // Origin: The origin of the API call. Origin string `json:"origin" yaml:"origin" schema:"origin"` // Price: The price of the API call. @@ -118,6 +120,8 @@ type APIToken struct { ID UUID `json:"id" yaml:"id" schema:"id,required"` // IsValid: If the token is valid. We never delete API tokens, but we can mark them as invalid. We save them for ever to preserve the history of the API token. IsValid bool `json:"is_valid" yaml:"is_valid" schema:"is_valid,required"` + // Label: An optional label for the API token. + Label string `json:"label" yaml:"label" schema:"label"` // Token: The API token itself. Token UUID `json:"token" yaml:"token" schema:"token,required"` // UpdatedAt: The date and time the API token was last updated. @@ -146,6 +150,30 @@ const ( AccountProviderGithub AccountProvider = "github" ) +// AddOrgMember: Data for adding a member to an org. +type AddOrgMember struct { + // Email: The email address of the user to add to the org. + Email string `json:"email" yaml:"email" schema:"email,required"` + // Role: The organization role to give the user. + Role OrgRole `json:"role" yaml:"role" schema:"role,required"` +} + +// AddressDetails: Address details. +type AddressDetails struct { + // City: The city component. + City string `json:"city" yaml:"city" schema:"city"` + // Country: The country component. This is a two-letter ISO country code. + Country string `json:"country" yaml:"country" schema:"country,required"` + // State: The state component. + State string `json:"state" yaml:"state" schema:"state"` + // Street1: The first street component. + Street1 string `json:"street1" yaml:"street1" schema:"street1"` + // Street2: The second street component. + Street2 string `json:"street2" yaml:"street2" schema:"street2"` + // Zip: The zip component. + Zip string `json:"zip" yaml:"zip" schema:"zip"` +} + // AiFeedback: Human feedback on an AI response. type AiFeedback string @@ -604,7 +632,7 @@ type AxisDirectionPair struct { // BillingInfo: The billing information for payments. type BillingInfo struct { // Address: The address of the customer. - Address NewAddress `json:"address" yaml:"address" schema:"address"` + Address AddressDetails `json:"address" yaml:"address" schema:"address"` // Name: The name of the customer. Name string `json:"name" yaml:"name" schema:"name"` // Phone: The phone for the customer. @@ -709,6 +737,9 @@ type Cluster struct { } // CodeLanguage: The language code is written in. +//
JSON schema +// +// ```json { "description": "The language code is written in.", "oneOf": [ { "description": "The `go` programming language.", "type": "string", "enum": [ "go" ] }, { "description": "The `python` programming language.", "type": "string", "enum": [ "python" ] }, { "description": "The `node` programming language.", "type": "string", "enum": [ "node" ] } ] } ```
type CodeLanguage string const ( @@ -721,6 +752,9 @@ const ( ) // CodeOutput: Output of the code being executed. +//
JSON schema +// +// ```json { "description": "Output of the code being executed.", "type": "object", "properties": { "output_files": { "description": "The contents of the files requested if they were passed.", "type": "array", "items": { "$ref": "#/components/schemas/OutputFile" } }, "stderr": { "description": "The stderr of the code.", "default": "", "type": "string" }, "stdout": { "description": "The stdout of the code.", "default": "", "type": "string" } } } ```
type CodeOutput struct { // OutputFiles: The contents of the files requested if they were passed. OutputFiles []OutputFile `json:"output_files" yaml:"output_files" schema:"output_files"` @@ -905,7 +939,7 @@ const ( // Customer: The resource representing a payment "Customer". type Customer struct { // Address: The customer's address. - Address NewAddress `json:"address" yaml:"address" schema:"address"` + Address AddressDetails `json:"address" yaml:"address" schema:"address"` // Balance: Current balance, if any, being stored on the customer in the payments service. // // If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized. @@ -930,25 +964,25 @@ type Customer struct { Phone string `json:"phone" yaml:"phone" schema:"phone"` } -// CustomerBalance: A balance for a user. -// This holds information about the financial balance for the user. +// CustomerBalance: A balance for a customer. +// This holds information about the financial balance for the customer. type CustomerBalance struct { // CreatedAt: The date and time the balance was created. CreatedAt Time `json:"created_at" yaml:"created_at" schema:"created_at,required"` // ID: The unique identifier for the balance. ID UUID `json:"id" yaml:"id" schema:"id,required"` - // MonthlyCreditsRemaining: The monthy credits remaining in the balance. This gets re-upped every month, but if the credits are not used for a month they do not carry over to the next month. It is a stable amount granted to the user per month. + // MapID: The mapping id of the user or org. + MapID UUID `json:"map_id" yaml:"map_id" schema:"map_id,required"` + // MonthlyCreditsRemaining: The monthy credits remaining in the balance. This gets re-upped every month, but if the credits are not used for a month they do not carry over to the next month. It is a stable amount granted to the customer per month. MonthlyCreditsRemaining float64 `json:"monthly_credits_remaining" yaml:"monthly_credits_remaining" schema:"monthly_credits_remaining,required"` - // PrePayCashRemaining: The amount of pre-pay cash remaining in the balance. This number goes down as the user uses their pre-paid credits. The reason we track this amount is if a user ever wants to withdraw their pre-pay cash, we can use this amount to determine how much to give them. Say a user has $100 in pre-paid cash, their bill is worth, $50 after subtracting any other credits (like monthly etc.) Their bill is $50, their pre-pay cash remaining will be subtracted by 50 to pay the bill and their `pre_pay_credits_remaining` will be subtracted by 50 to pay the bill. This way if they want to withdraw money after, they can only withdraw $50 since that is the amount of cash they have remaining. + // PrePayCashRemaining: The amount of pre-pay cash remaining in the balance. This number goes down as the customer uses their pre-paid credits. The reason we track this amount is if a customer ever wants to withdraw their pre-pay cash, we can use this amount to determine how much to give them. Say a customer has $100 in pre-paid cash, their bill is worth, $50 after subtracting any other credits (like monthly etc.) Their bill is $50, their pre-pay cash remaining will be subtracted by 50 to pay the bill and their `pre_pay_credits_remaining` will be subtracted by 50 to pay the bill. This way if they want to withdraw money after, they can only withdraw $50 since that is the amount of cash they have remaining. PrePayCashRemaining float64 `json:"pre_pay_cash_remaining" yaml:"pre_pay_cash_remaining" schema:"pre_pay_cash_remaining,required"` - // PrePayCreditsRemaining: The amount of credits remaining in the balance. This is typically the amount of cash * some multiplier they get for pre-paying their account. This number lowers every time a bill is paid with the balance. This number increases every time a user adds funds to their balance. This may be through a subscription or a one off payment. + // PrePayCreditsRemaining: The amount of credits remaining in the balance. This is typically the amount of cash * some multiplier they get for pre-paying their account. This number lowers every time a bill is paid with the balance. This number increases every time a customer adds funds to their balance. This may be through a subscription or a one off payment. PrePayCreditsRemaining float64 `json:"pre_pay_credits_remaining" yaml:"pre_pay_credits_remaining" schema:"pre_pay_credits_remaining,required"` - // TotalDue: This includes any outstanding, draft, or open invoices and any pending invoice items. This does not include any credits the user has on their account. + // TotalDue: This includes any outstanding, draft, or open invoices and any pending invoice items. This does not include any credits the customer has on their account. TotalDue float64 `json:"total_due" yaml:"total_due" schema:"total_due,required"` // UpdatedAt: The date and time the balance was last updated. UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` - // UserID: The user ID the balance belongs to. - UserID UUID `json:"user_id" yaml:"user_id" schema:"user_id,required"` } // Data is the type definition for a Data. @@ -2611,24 +2645,6 @@ type MouseClick struct { EntitiesSelected []UUID `json:"entities_selected" yaml:"entities_selected" schema:"entities_selected,required"` } -// NewAddress: The struct that is used to create a new record. This is automatically generated and has all the same fields as the main struct only it is missing the `id`. -type NewAddress struct { - // City: The city component. - City string `json:"city" yaml:"city" schema:"city"` - // Country: The country component. This is a two-letter ISO country code. - Country string `json:"country" yaml:"country" schema:"country,required"` - // State: The state component. - State string `json:"state" yaml:"state" schema:"state"` - // Street1: The first street component. - Street1 string `json:"street1" yaml:"street1" schema:"street1"` - // Street2: The second street component. - Street2 string `json:"street2" yaml:"street2" schema:"street2"` - // UserID: The user ID that this address belongs to. - UserID UUID `json:"user_id" yaml:"user_id" schema:"user_id,required"` - // Zip: The zip component. - Zip string `json:"zip" yaml:"zip" schema:"zip"` -} - // Oauth2ClientInfo: Information about an OAuth 2.0 client. type Oauth2ClientInfo struct { // CsrfToken: Value used for [CSRF](https://tools.ietf.org/html/rfc6749#section-10.12) protection via the `state` parameter. @@ -2847,7 +2863,104 @@ type Onboarding struct { FirstTokenDate Time `json:"first_token_date" yaml:"first_token_date" schema:"first_token_date"` } +// Org: An organization. +type Org struct { + // AllowUsersInDomainToAutoJoin: If we should allow all future users who are created with email addresses from this domain to join the org. + AllowUsersInDomainToAutoJoin bool `json:"allow_users_in_domain_to_auto_join" yaml:"allow_users_in_domain_to_auto_join" schema:"allow_users_in_domain_to_auto_join"` + // BillingEmail: The billing email address of the org. + BillingEmail string `json:"billing_email" yaml:"billing_email" schema:"billing_email"` + // BillingEmailVerified: The date and time the billing email address was verified. + BillingEmailVerified Time `json:"billing_email_verified" yaml:"billing_email_verified" schema:"billing_email_verified"` + // Block: If the org should be blocked and the reason why. + Block BlockReason `json:"block" yaml:"block" schema:"block"` + // CreatedAt: The date and time the org was created. + CreatedAt Time `json:"created_at" yaml:"created_at" schema:"created_at,required"` + // Domain: The org's domain. + Domain string `json:"domain" yaml:"domain" schema:"domain"` + // ID: The unique identifier for the org. + ID UUID `json:"id" yaml:"id" schema:"id,required"` + // Image: The image for the org. This is a URL. + Image URL `json:"image" yaml:"image" schema:"image"` + // Name: The name of the org. + Name string `json:"name" yaml:"name" schema:"name"` + // Phone: The org's phone number. + Phone string `json:"phone" yaml:"phone" schema:"phone"` + // StripeID: The org's stripe id. + StripeID string `json:"stripe_id" yaml:"stripe_id" schema:"stripe_id"` + // UpdatedAt: The date and time the org was last updated. + UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` +} + +// OrgDetails: The user-modifiable parts of an organization. +type OrgDetails struct { + // AllowUsersInDomainToAutoJoin: If we should allow all future users who are created with email addresses from this domain to join the org. + AllowUsersInDomainToAutoJoin bool `json:"allow_users_in_domain_to_auto_join" yaml:"allow_users_in_domain_to_auto_join" schema:"allow_users_in_domain_to_auto_join"` + // BillingEmail: The billing email address of the org. + BillingEmail string `json:"billing_email" yaml:"billing_email" schema:"billing_email"` + // Domain: The org's domain. + Domain string `json:"domain" yaml:"domain" schema:"domain"` + // Image: The image for the org. This is a URL. + Image URL `json:"image" yaml:"image" schema:"image"` + // Name: The name of the org. + Name string `json:"name" yaml:"name" schema:"name"` + // Phone: The org's phone number. + Phone string `json:"phone" yaml:"phone" schema:"phone"` +} + +// OrgMember: A member of an organization. +type OrgMember struct { + // Company: The user's company. + Company string `json:"company" yaml:"company" schema:"company"` + // CreatedAt: The date and time the user was created. + CreatedAt Time `json:"created_at" yaml:"created_at" schema:"created_at,required"` + // Discord: The user's Discord handle. + Discord string `json:"discord" yaml:"discord" schema:"discord"` + // Email: The email address of the user. + Email string `json:"email" yaml:"email" schema:"email"` + // EmailVerified: The date and time the email address was verified. + EmailVerified Time `json:"email_verified" yaml:"email_verified" schema:"email_verified"` + // FirstName: The user's first name. + FirstName string `json:"first_name" yaml:"first_name" schema:"first_name"` + // Github: The user's GitHub handle. + Github string `json:"github" yaml:"github" schema:"github"` + // ID: The unique identifier for the user. + ID UUID `json:"id" yaml:"id" schema:"id,required"` + // Image: The image avatar for the user. This is a URL. + Image URL `json:"image" yaml:"image" schema:"image,required"` + // LastName: The user's last name. + LastName string `json:"last_name" yaml:"last_name" schema:"last_name"` + // Name: The name of the user. This is auto populated at first from the authentication provider (if there was a name). It can be updated by the user by updating their `first_name` and `last_name` fields. + Name string `json:"name" yaml:"name" schema:"name"` + // Phone: The user's phone number. + Phone string `json:"phone" yaml:"phone" schema:"phone"` + // Role: The user's role in the org. + Role OrgRole `json:"role" yaml:"role" schema:"role,required"` + // UpdatedAt: The date and time the user was last updated. + UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` +} + +// OrgMemberResultsPage: A single page of results +type OrgMemberResultsPage struct { + // Items: list of items on this page of results + Items []OrgMember `json:"items" yaml:"items" schema:"items,required"` + // NextPage: token used to fetch the next page of results (if any) + NextPage string `json:"next_page" yaml:"next_page" schema:"next_page"` +} + +// OrgRole: The roles for users in an organization. +type OrgRole string + +const ( + // OrgRoleAdmin: Admins can do anything in the org. + OrgRoleAdmin OrgRole = "admin" + // OrgRoleMember: Members of an org can not modify an org, but they belong in the org. + OrgRoleMember OrgRole = "member" +) + // OutputFile: Output file contents. +//
JSON schema +// +// ```json { "description": "Output file contents.", "type": "object", "properties": { "contents": { "description": "The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON.", "type": "string" }, "name": { "description": "The name of the file.", "default": "", "type": "string" } } } ```
type OutputFile struct { // Contents: The contents of the file. This is base64 encoded so we can ensure it is UTF-8 for JSON. Contents string `json:"contents" yaml:"contents" schema:"contents"` @@ -4069,6 +4182,12 @@ type UnitVolumeConversion struct { UserID UUID `json:"user_id" yaml:"user_id" schema:"user_id,required"` } +// UpdateMemberToOrgBody: Data for updating a member of an org. +type UpdateMemberToOrgBody struct { + // Role: The organization role to give the user. + Role OrgRole `json:"role" yaml:"role" schema:"role,required"` +} + // UpdateUser: The user-modifiable parts of a User. type UpdateUser struct { // Company: The user's company. @@ -4117,6 +4236,36 @@ type User struct { UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` } +// UserOrgInfo: A user's information about an org, including their role. +type UserOrgInfo struct { + // AllowUsersInDomainToAutoJoin: If we should allow all future users who are created with email addresses from this domain to join the org. + AllowUsersInDomainToAutoJoin bool `json:"allow_users_in_domain_to_auto_join" yaml:"allow_users_in_domain_to_auto_join" schema:"allow_users_in_domain_to_auto_join"` + // BillingEmail: The billing email address of the org. + BillingEmail string `json:"billing_email" yaml:"billing_email" schema:"billing_email"` + // BillingEmailVerified: The date and time the billing email address was verified. + BillingEmailVerified Time `json:"billing_email_verified" yaml:"billing_email_verified" schema:"billing_email_verified"` + // Block: If the org should be blocked and the reason why. + Block BlockReason `json:"block" yaml:"block" schema:"block"` + // CreatedAt: The date and time the org was created. + CreatedAt Time `json:"created_at" yaml:"created_at" schema:"created_at,required"` + // Domain: The org's domain. + Domain string `json:"domain" yaml:"domain" schema:"domain"` + // ID: The unique identifier for the org. + ID UUID `json:"id" yaml:"id" schema:"id,required"` + // Image: The image for the org. This is a URL. + Image URL `json:"image" yaml:"image" schema:"image"` + // Name: The name of the org. + Name string `json:"name" yaml:"name" schema:"name"` + // Phone: The org's phone number. + Phone string `json:"phone" yaml:"phone" schema:"phone"` + // Role: The user's role in the org. + Role OrgRole `json:"role" yaml:"role" schema:"role,required"` + // StripeID: The org's stripe id. + StripeID string `json:"stripe_id" yaml:"stripe_id" schema:"stripe_id"` + // UpdatedAt: The date and time the org was last updated. + UpdatedAt Time `json:"updated_at" yaml:"updated_at" schema:"updated_at,required"` +} + // UserResultsPage: A single page of results type UserResultsPage struct { // Items: list of items on this page of results