GoodMemGoodMem

Users

Methods on this page are called as client.users.<method>(...) on a Goodmem instance.

Classai.pairsys.goodmem.client.api.UsersAPI (extends internal UsersAPIBase).

import ai.pairsys.goodmem.client.Goodmem;

try (Goodmem client = Goodmem.builder()
        .baseUrl("http://localhost:8080")
        .apiKey("gm_...")
        .build()) {
    // client.users.<method>(...)
}

Async variants

Every method listed below also exists on ai.pairsys.goodmem.client.api.AsyncUsersAPI (accessed via asyncClient.users on an AsyncGoodmem) with the same parameter list, wrapped in CompletableFuture<T>. Paginated list methods return CompletableFuture<AsyncPage<T>>. See the async client guide for composition patterns.

import ai.pairsys.goodmem.client.AsyncGoodmem;

try (AsyncGoodmem asyncClient = AsyncGoodmem.builder()
        .baseUrl("http://localhost:8080")
        .apiKey("gm_...")
        .build()) {
    asyncClient.users.<method>(...)  // returns CompletableFuture<T>
}

Method Summary

Method Detail

create(CreateUserRequest)

UserResponse create(CreateUserRequest request)

Javadoccreate(CreateUserRequest)

Creates one dormant human user after requiring instance-wide CREATE_USER authority. Creation does not issue a credential or create a role, grant, or authentication mapping.

HTTPPOST /v1/users

Parameters

  • request (CreateUserRequest) — full request payload. The linked Javadoc lists every field and its Builder setter.

ReturnsUserResponse

Throws

Example

UserResponse userResponse = client.users.create(CreateUserRequest.builder()
            // …set required fields…
            .build());

REST equivalent

curl -X POST 'http://localhost:8080/v1/users' \
  -H "x-api-key: gm_..." \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "username": "alex",
    "displayName": "Alex Example",
    "labels": {
      "team": "search"
    }
  }'

createEnrollment(String, CreateUserEnrollmentRequest)

CreateUserEnrollmentResponse createEnrollment(String userId, CreateUserEnrollmentRequest request)

JavadoccreateEnrollment(String, CreateUserEnrollmentRequest)

Creates a short-lived, one-time enrollment credential for an existing dormant human. Requires MANAGE_USER_ENROLLMENT with ANY or EXACT authority on the target user. The raw credential is returned only once. rotateExisting atomically revokes and replaces a live enrollment; an expired enrollment is replaced automatically.

HTTPPOST /v1/users/&#123;userId&#125;/enrollments

Parameters

ReturnsCreateUserEnrollmentResponse

Throws

Example

CreateUserEnrollmentResponse createUserEnrollmentResponse = client.users.createEnrollment(CreateUserEnrollmentRequest.builder()
            // …set required fields…
            .build());

REST equivalent

curl -X POST 'http://localhost:8080/v1/users/{userId}/enrollments' \
  -H "x-api-key: gm_..." \
  -H "Content-Type: application/json" \
  -d '{ /* CreateUserEnrollmentRequest fields, see Javadoc */ }'

delete(String)

void delete(String id)

Javadocdelete(String)

Permanently soft-deletes the user and invalidates credentials acting for that subject. The GoodMem instance owner cannot be deleted; transfer ownership first. Repeating an authorized delete succeeds without rewriting audit data.

HTTPDELETE /v1/users/&#123;id&#125;

Parameters

  • id (String) — User UUID

Returns — None (HTTP 204).

Throws

Example

client.users.delete("...");

REST equivalent

curl -X DELETE 'http://localhost:8080/v1/users/{id}' \
  -H "x-api-key: gm_..."

get(UsersGetOptions)

UserResponse get(UsersGetOptions opts)

Javadocget(UsersGetOptions)

Retrieves a user by ID or email address. Exactly one of id and email must be provided.

HTTPGET /v1/users/&#123;id&#125;

Parameters

  • opts (UsersGetOptions) — options bag. Set exactly one of its fields (the compact constructor enforces "exactly one"). Mirrors Python's kwargs form and the AWS / GCP / Azure / OpenAI options-bag norm. The linked Javadoc lists every field.

ReturnsUserResponse

Throws

Example

UserResponse userResponse = client.users.get(UsersGetOptions.builder().build());

REST equivalent

curl -X GET 'http://localhost:8080/v1/users/{id}' \
  -H "x-api-key: gm_..."

getByUsername(String, Map<String, Object>)

UserResponse getByUsername(String username, Map<String, Object> query)

JavadocgetByUsername(String, Map<String, Object>)

Returns a user selected by exact username after applying READ_USER authority. includeDeleted permits an authorized caller to inspect a permanent tombstone; it does not grant additional authority. Missing and unauthorized matches both return 404 so this guessable identifier cannot reveal whether a user exists.

HTTPGET /v1/users/username/&#123;username&#125;

Parameters

  • username (String) — Exact username
  • query (Map<String, Object>) — query-string parameters; use Map.of() when none.

ReturnsUserResponse

Throws

Example

UserResponse userResponse = client.users.getByUsername("...", java.util.Map.of());

REST equivalent

curl -X GET 'http://localhost:8080/v1/users/username/{username}' \
  -H "x-api-key: gm_..."

getEnrollment(String, String)

UserEnrollmentResponse getEnrollment(String userId, String enrollmentId)

JavadocgetEnrollment(String, String)

Returns non-secret metadata for one current or historical enrollment. The target user is resolved before the enrollment, and MANAGE_USER_ENROLLMENT with ANY or EXACT authority on that user is required. Raw enrollment tokens are never returned.

HTTPGET /v1/users/&#123;userId&#125;/enrollments/&#123;enrollmentId&#125;

Parameters

(no parameters)

ReturnsUserEnrollmentResponse

Throws

Example

UserEnrollmentResponse userEnrollmentResponse = client.users.getEnrollment();

REST equivalent

curl -X GET 'http://localhost:8080/v1/users/{userId}/enrollments/{enrollmentId}' \
  -H "x-api-key: gm_..."

list(Map<String, Object>)

Page<UserResponse> list(Map<String, Object> query)

Javadoclist(Map<String, Object>)

Requires LIST_USER on the GoodMem instance and READ_USER on each returned row. Authorization, label filtering, lifecycle filtering, and keyset pagination run in PostgreSQL. includeDeleted expands the lifecycle view but grants no access. includeEnrollmentSummary requests non-secret bootstrap posture only on active rows where MANAGE_USER_ENROLLMENT is independently authorized. LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production).

HTTPGET /v1/users

Parameters

  • query (Map<String, Object>) — query-string parameters; use Map.of() when none.

ReturnsPage<UserResponse>

Throws

Example

Page<UserResponse> page = client.users.list(java.util.Map.of());

REST equivalent

curl -X GET 'http://localhost:8080/v1/users' \
  -H "x-api-key: gm_..."

listEnrollments(String, Map<String, Object>)

Page<UserEnrollmentResponse> listEnrollments(String userId, Map<String, Object> query)

JavadoclistEnrollments(String, Map<String, Object>)

Returns one newest-first page containing pending, expired, consumed, and revoked enrollment metadata. MANAGE_USER_ENROLLMENT with ANY or EXACT authority on the target user is required. The page never contains raw credentials.

HTTPGET /v1/users/&#123;userId&#125;/enrollments

Parameters

  • query (Map<String, Object>) — query-string parameters; use Map.of() when none.

ReturnsPage<UserEnrollmentResponse>

Throws

Example

Page<UserEnrollmentResponse> page = client.users.listEnrollments(java.util.Map.of());

REST equivalent

curl -X GET 'http://localhost:8080/v1/users/{userId}/enrollments' \
  -H "x-api-key: gm_..."

me()

UserResponse me()

Javadocme()

Returns the human-user profile associated with the authenticated principal. Service principals do not have a human-user profile.

HTTPGET /v1/users/me

Parameters

(no parameters)

ReturnsUserResponse

Throws

Example

UserResponse userResponse = client.users.me();

REST equivalent

curl -X GET 'http://localhost:8080/v1/users/me' \
  -H "x-api-key: gm_..."

revokeEnrollment(String, String)

void revokeEnrollment(String userId, String enrollmentId)

JavadocrevokeEnrollment(String, String)

Permanently revokes one outstanding enrollment after requiring MANAGE_USER_ENROLLMENT on its target user. Repeating an authorized revocation succeeds without replacing its original audit provenance. Consumed enrollments cannot be revoked.

HTTPDELETE /v1/users/&#123;userId&#125;/enrollments/&#123;enrollmentId&#125;

Parameters

(no parameters)

Returns — None (HTTP 204).

Throws

Example

client.users.revokeEnrollment();

REST equivalent

curl -X DELETE 'http://localhost:8080/v1/users/{userId}/enrollments/{enrollmentId}' \
  -H "x-api-key: gm_..."

update(String, UpdateUserRequest)

UserResponse update(String id, UpdateUserRequest request)

Javadocupdate(String, UpdateUserRequest)

Updates only fields present in the request. Empty username or displayName values clear those optional fields. Updating a deleted user fails with 412.

HTTPPUT /v1/users/&#123;id&#125;

Parameters

  • id (String) — User UUID
  • request (UpdateUserRequest) — full request payload. The linked Javadoc lists every field and its Builder setter.

ReturnsUserResponse

Throws

Example

UserResponse userResponse = client.users.update("...", UpdateUserRequest.builder()
            // …set required fields…
            .build());

REST equivalent

curl -X PUT 'http://localhost:8080/v1/users/{id}' \
  -H "x-api-key: gm_..." \
  -H "Content-Type: application/json" \
  -d '{
    "request": {
      "displayName": "Alexandra Example"
    }
  }'

Errors

Every method on this page may throw the standard HTTP-error class hierarchy rooted at GoodmemException:

BadRequestException (400), AuthenticationException (401), PermissionDeniedException (403), NotFoundException (404), ConflictException (409), UnprocessableEntityException (422), RateLimitException (429), InternalServerException (5xx), or the generic ApiException for any other 4xx/5xx. All are unchecked (RuntimeException). See Errors.

All error classes live in ai.pairsys.goodmem.client.errors and are unchecked (RuntimeException). Async siblings complete the returned CompletableFuture exceptionally with the same types, wrapped in CompletionException at await time. See Errors on the index for the full table.