Skip to content

Latest commit

 

History

History
171 lines (119 loc) · 8.02 KB

File metadata and controls

171 lines (119 loc) · 8.02 KB

OrganizationDomains

(organizationDomains())

Overview

Available Operations

  • create - Create a new organization domain.
  • list - Get a list of all domains of an organization.
  • delete - Remove a domain from an organization.

create

Creates a new organization domain. By default the domain is verified, but can be optionally set to unverified.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateOrganizationDomainRequestBody;
import com.clerk.backend_api.models.operations.CreateOrganizationDomainResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        CreateOrganizationDomainResponse res = sdk.organizationDomains().create()
                .organizationId("<id>")
                .requestBody(CreateOrganizationDomainRequestBody.builder()
                    .build())
                .call();

        if (res.organizationDomain().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
organizationId String ✔️ The ID of the organization where the new domain will be created.
requestBody CreateOrganizationDomainRequestBody ✔️ N/A

Response

CreateOrganizationDomainResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 403, 404, 422 application/json
models/errors/SDKError 4XX, 5XX */*

list

Get a list of all domains of an organization.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.ListOrganizationDomainsRequest;
import com.clerk.backend_api.models.operations.ListOrganizationDomainsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        ListOrganizationDomainsRequest req = ListOrganizationDomainsRequest.builder()
                .organizationId("<id>")
                .build();

        ListOrganizationDomainsResponse res = sdk.organizationDomains().list()
                .request(req)
                .call();

        if (res.organizationDomains().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request ListOrganizationDomainsRequest ✔️ The request object to use for the request.

Response

ListOrganizationDomainsResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 401, 422 application/json
models/errors/SDKError 4XX, 5XX */*

delete

Removes the given domain from the organization.

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteOrganizationDomainResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ClerkErrors, Exception {

        Clerk sdk = Clerk.builder()
                .bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
            .build();

        DeleteOrganizationDomainResponse res = sdk.organizationDomains().delete()
                .organizationId("<id>")
                .domainId("<id>")
                .call();

        if (res.deletedObject().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
organizationId String ✔️ The ID of the organization the domain belongs to
domainId String ✔️ The ID of the domain

Response

DeleteOrganizationDomainResponse

Errors

Error Type Status Code Content Type
models/errors/ClerkErrors 400, 401, 404 application/json
models/errors/SDKError 4XX, 5XX */*