GoodMemGoodMem
ReferenceSdkV2.NET

User Enrollments

One-time human-user enrollment completion.

Namespace: Goodmem.Client.Api · Class: UserEnrollmentsApi

Reach this surface as client.UserEnrollments on a GoodmemClient. Every network method is asynchronous — it returns a Task<T> (or an IAsyncEnumerable<T> for pagination and streaming) and accepts a CancellationToken; the Async suffix marks the standard .NET Task-based async pattern.

Methods

MethodSummary
CompleteAsyncComplete human-user enrollment.

CompleteAsync

Exchanges a one-time enrollment credential for the human's initial self-owned API key. This endpoint does not use ordinary API-key authentication. Omit both optional key fields for server generation; a fresh response discloses the raw key exactly once and cannot be safely retried after an ambiguous outcome. Supply and retain both fields for client mode, where only an exact tuple retry is safe and raw material is never echoed. Status precedence is request-shape errors (400), then the same generic authentication failure for every nonblank unusable enrollment (401); key conflicts or concurrent lifecycle winners return 409, rate limits return 429, and unexpected failures return 500.

Declaration

public Task<CompleteUserEnrollmentResponse> CompleteAsync(CompleteUserEnrollmentRequest request, CancellationToken ct = default)

HTTPPOST /v1/user-enrollments:complete

Parameters

TypeNameDescription
CompleteUserEnrollmentRequestrequestThe request payload; the linked model lists every field and its JSON wire name.
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<CompleteUserEnrollmentResponse> — an awaitable that resolves to CompleteUserEnrollmentResponse.

Exceptions

TypeCondition
ArgumentNullExceptionrequest is null.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var completedEnrollment = await client.UserEnrollments.CompleteAsync(
    new CompleteUserEnrollmentRequest { EnrollmentToken = "gme_..." }
);
// Server-generated raw API keys are disclosed only on fresh completion.
Console.WriteLine(completedEnrollment.RawApiKey);


Data Models

Types in the Goodmem.Client.Models namespace. Each row lists the C# property, its type, the JSON wire name, and a description.

CompleteUserEnrollmentRequest

Exchanges one enrollment credential for the target human's initial API key. Omit both apiKeyId and rawApiKey for server-generated key material, or supply both for exact-retry-safe client-generated completion; supplying only one is invalid.

PropertyTypeJSON (wire)Description
EnrollmentTokenstringenrollmentTokenRequired one-time enrollment credential. Never log or persist it.
ApiKeyIdstringapiKeyIdOptional client-generated API-key UUID retained for exact retries. Must be supplied together with rawApiKey, or both fields must be omitted. (optional)
RawApiKeystringrawApiKeyOptional canonical client-generated API key. Must be supplied together with apiKeyId, never logged, and retained for exact retries; omit both fields for server generation. (optional)

CompleteUserEnrollmentResponse

Initial API-key metadata, exact-retry classification, and one-time raw key material only for a fresh server-generated completion. Client-supplied keys are never echoed.

PropertyTypeJSON (wire)Description
ApiKeyApiKeyResponseapiKeyOUTPUT_ONLY; metadata for the newly published initial API key.
AlreadyCompletedboolalreadyCompletedOUTPUT_ONLY; true when the exact completion tuple already committed.
RawApiKeystringrawApiKeyOUTPUT_ONLY; one-time raw API key returned only by a fresh server-generated completion. Omitted for client-supplied completion and every replay. (optional)