Skip to content

Files

Latest commit

 

History

History
218 lines (150 loc) · 9.61 KB

README.md

File metadata and controls

218 lines (150 loc) · 9.61 KB

RedirectUrls

(redirectUrls())

Overview

Available Operations

  • list - List all redirect URLs
  • create - Create a redirect URL
  • get - Retrieve a redirect URL
  • delete - Delete a redirect URL

list

Lists all whitelisted redirect_urls for the instance

Example Usage

package hello.world;

import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.operations.ListRedirectURLsResponse;
import java.lang.Exception;

public class Application {

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

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

        ListRedirectURLsResponse res = sdk.redirectUrls().list()
                .paginated(false)
                .limit(10L)
                .offset(0L)
                .call();

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

Parameters

Parameter Type Required Description
paginated Optional<Boolean> Whether to paginate the results.
If true, the results will be paginated.
If false, the results will not be paginated.
limit Optional<Long> Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
offset Optional<Long> Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.

Response

ListRedirectURLsResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

create

Create a redirect URL

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.CreateRedirectURLRequestBody;
import com.clerk.backend_api.models.operations.CreateRedirectURLResponse;
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();

        CreateRedirectURLRequestBody req = CreateRedirectURLRequestBody.builder()
                .url("https://probable-heating.com/")
                .build();

        CreateRedirectURLResponse res = sdk.redirectUrls().create()
                .request(req)
                .call();

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

Parameters

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

Response

CreateRedirectURLResponse

Errors

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

get

Retrieve the details of the redirect URL with the given ID

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.GetRedirectURLResponse;
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();

        GetRedirectURLResponse res = sdk.redirectUrls().get()
                .id("<id>")
                .call();

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

Parameters

Parameter Type Required Description
id String ✔️ The ID of the redirect URL

Response

GetRedirectURLResponse

Errors

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

delete

Remove the selected redirect URL from the whitelist of the instance

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.DeleteRedirectURLResponse;
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();

        DeleteRedirectURLResponse res = sdk.redirectUrls().delete()
                .id("<id>")
                .call();

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

Parameters

Parameter Type Required Description
id String ✔️ The ID of the redirect URL

Response

DeleteRedirectURLResponse

Errors

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