(organizations())
REST APIs for managing Organizations (speakeasy L1 Tenancy construct)
- create - Create an organization
- createFreeTrial - Create a free trial for an organization
- get - Get organization
- getAll - Get organizations for a user
- getUsage - Get billing usage summary for a particular organization
Creates an organization
package hello.world;
import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.errors.Error;
import dev.speakeasyapi.javaclientsdk.models.operations.CreateOrganizationResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.AccountType;
import dev.speakeasyapi.javaclientsdk.models.shared.Organization;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;
import java.time.OffsetDateTime;
public class Application {
public static void main(String[] args) throws Error, Exception {
RyanTest sdk = RyanTest.builder()
.security(Security.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.build())
.build();
Organization req = Organization.builder()
.accountType(AccountType.SCALE_UP)
.createdAt(OffsetDateTime.parse("2023-12-01T17:06:07.804Z"))
.id("<id>")
.name("<value>")
.slug("<value>")
.ssoActivated(true)
.telemetryDisabled(true)
.updatedAt(OffsetDateTime.parse("2022-05-28T06:20:22.766Z"))
.build();
CreateOrganizationResponse res = sdk.organizations().create()
.request(req)
.call();
if (res.organization().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
request |
Organization | ✔️ | The request object to use for the request. |
Error Type | Status Code | Content Type |
---|---|---|
models/errors/Error | 4XX | application/json |
models/errors/SDKError | 5XX | */* |
Creates a free trial for an organization
package hello.world;
import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.errors.Error;
import dev.speakeasyapi.javaclientsdk.models.operations.CreateFreeTrialResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
RyanTest sdk = RyanTest.builder()
.security(Security.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.build())
.build();
CreateFreeTrialResponse res = sdk.organizations().createFreeTrial()
.call();
// handle response
}
}
Error Type | Status Code | Content Type |
---|---|---|
models/errors/Error | 4XX | application/json |
models/errors/SDKError | 5XX | */* |
Get information about a particular organization.
package hello.world;
import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.errors.Error;
import dev.speakeasyapi.javaclientsdk.models.operations.GetOrganizationRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetOrganizationResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
RyanTest sdk = RyanTest.builder()
.security(Security.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.build())
.build();
GetOrganizationRequest req = GetOrganizationRequest.builder()
.organizationID("<value>")
.build();
GetOrganizationResponse res = sdk.organizations().get()
.request(req)
.call();
if (res.organization().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
request |
GetOrganizationRequest | ✔️ | The request object to use for the request. |
Error Type | Status Code | Content Type |
---|---|---|
models/errors/Error | 4XX | application/json |
models/errors/SDKError | 5XX | */* |
Returns a list of organizations a user has access too
package hello.world;
import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.errors.Error;
import dev.speakeasyapi.javaclientsdk.models.operations.GetOrganizationsResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
RyanTest sdk = RyanTest.builder()
.security(Security.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.build())
.build();
GetOrganizationsResponse res = sdk.organizations().getAll()
.call();
if (res.organizations().isPresent()) {
// handle response
}
}
}
Error Type | Status Code | Content Type |
---|---|---|
models/errors/Error | 4XX | application/json |
models/errors/SDKError | 5XX | */* |
Returns a billing usage summary by target languages for a particular organization
package hello.world;
import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.errors.Error;
import dev.speakeasyapi.javaclientsdk.models.operations.GetOrganizationUsageResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
RyanTest sdk = RyanTest.builder()
.security(Security.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.build())
.build();
GetOrganizationUsageResponse res = sdk.organizations().getUsage()
.call();
if (res.organizationUsageResponse().isPresent()) {
// handle response
}
}
}
Error Type | Status Code | Content Type |
---|---|---|
models/errors/Error | 4XX | application/json |
models/errors/SDKError | 5XX | */* |