Skip to content

Latest commit

 

History

History
261 lines (179 loc) · 9.41 KB

README.md

File metadata and controls

261 lines (179 loc) · 9.41 KB

JwtTemplates

(jwtTemplates())

Overview

Available Operations

  • list - List all templates
  • create - Create a JWT template
  • get - Retrieve a template
  • update - Update a JWT template
  • delete - Delete a Template

list

List all templates

Example Usage

package hello.world;

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

        ListJWTTemplatesResponse res = sdk.jwtTemplates().list()
                .call();

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

Response

ListJWTTemplatesResponse

Errors

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

create

Create a new JWT template

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

        CreateJWTTemplateRequestBody req = CreateJWTTemplateRequestBody.builder()
                .build();

        CreateJWTTemplateResponse res = sdk.jwtTemplates().create()
                .request(req)
                .call();

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

Parameters

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

Response

CreateJWTTemplateResponse

Errors

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

get

Retrieve the details of a given JWT template

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

        GetJWTTemplateResponse res = sdk.jwtTemplates().get()
                .templateId("<id>")
                .call();

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

Parameters

Parameter Type Required Description
templateId String ✔️ JWT Template ID

Response

GetJWTTemplateResponse

Errors

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

update

Updates an existing JWT template

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

        UpdateJWTTemplateResponse res = sdk.jwtTemplates().update()
                .templateId("<id>")
                .requestBody(UpdateJWTTemplateRequestBody.builder()
                    .build())
                .call();

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

Parameters

Parameter Type Required Description
templateId String ✔️ The ID of the JWT template to update
requestBody Optional<UpdateJWTTemplateRequestBody> N/A

Response

UpdateJWTTemplateResponse

Errors

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

delete

Delete a Template

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

        DeleteJWTTemplateResponse res = sdk.jwtTemplates().delete()
                .templateId("<id>")
                .call();

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

Parameters

Parameter Type Required Description
templateId String ✔️ JWT Template ID

Response

DeleteJWTTemplateResponse

Errors

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