(tokensV1())
Create a new organization token.
package hello.world;
import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.CreateOrgTokenResponse;
import dev.hathora.cloud_sdk.models.shared.CreateOrgToken;
import dev.hathora.cloud_sdk.models.shared.Security;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ApiError, Exception {
HathoraCloud sdk = HathoraCloud.builder()
.security(Security.builder()
.hathoraDevToken("<YOUR_BEARER_TOKEN_HERE>")
.build())
.appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
.orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
.build();
CreateOrgTokenResponse res = sdk.tokensV1().createOrgToken()
.createOrgToken(CreateOrgToken.builder()
.name("ci-token")
.build())
.orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
.call();
if (res.createdOrgToken().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
createOrgToken |
CreateOrgToken |
✔️ |
N/A |
|
orgId |
String |
✔️ |
N/A |
org-6f706e83-0ec1-437a-9a46-7d4281eb2f39 |
CreateOrgTokenResponse
Error Type |
Status Code |
Content Type |
models/errors/ApiError |
401, 404, 422, 429 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |
List all organization tokens for a given org.
package hello.world;
import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.GetOrgTokensResponse;
import dev.hathora.cloud_sdk.models.shared.Security;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ApiError, Exception {
HathoraCloud sdk = HathoraCloud.builder()
.security(Security.builder()
.hathoraDevToken("<YOUR_BEARER_TOKEN_HERE>")
.build())
.appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
.orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
.build();
GetOrgTokensResponse res = sdk.tokensV1().getOrgTokens()
.orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
.call();
if (res.listOrgTokens().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
orgId |
String |
✔️ |
N/A |
org-6f706e83-0ec1-437a-9a46-7d4281eb2f39 |
GetOrgTokensResponse
Error Type |
Status Code |
Content Type |
models/errors/ApiError |
401, 404, 429 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |
Revoke an organization token.
package hello.world;
import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.RevokeOrgTokenResponse;
import dev.hathora.cloud_sdk.models.shared.Security;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ApiError, Exception {
HathoraCloud sdk = HathoraCloud.builder()
.security(Security.builder()
.hathoraDevToken("<YOUR_BEARER_TOKEN_HERE>")
.build())
.appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
.orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
.build();
RevokeOrgTokenResponse res = sdk.tokensV1().revokeOrgToken()
.orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
.orgTokenId("org-token-af469a92-5b45-4565-b3c4-b79878de67d2")
.call();
if (res.boolean_().isPresent()) {
// handle response
}
}
}
Parameter |
Type |
Required |
Description |
Example |
orgId |
String |
✔️ |
N/A |
org-6f706e83-0ec1-437a-9a46-7d4281eb2f39 |
orgTokenId |
String |
✔️ |
N/A |
org-token-af469a92-5b45-4565-b3c4-b79878de67d2 |
RevokeOrgTokenResponse
Error Type |
Status Code |
Content Type |
models/errors/ApiError |
401, 404, 429 |
application/json |
models/errors/SDKError |
4XX, 5XX |
*/* |