My App

API Reference

Complete API reference for the Unchange SDK

Unchange

The main SDK class that provides access to all API endpoints.

Constructor

new Unchange(options: UnchangeOptions)

Parameters

  • options.apiKey (string, required): Your API key for authentication
  • options.projectId (string, required): Your project ID
  • options.baseUrl (string, optional): Custom base URL. Defaults to https://dev.untraceable.dev

Example

const client = new Unchange({
  apiKey: 'your-api-key',
  projectId: 'your-project-id',
});

Changelogs

Access changelog-related methods via client.changelogs.

list()

Retrieve all changelogs for your project.

changelogs.list(): Promise<Changelog[]>

Returns

Promise that resolves to an array of Changelog objects.

Example

const allChangelogs = await client.changelogs.list();

Response

[
  {
    _id: "changelog-1",
    _creationTime: 1704067200000,
    title: "Version 2.0 Released",
    content: "We're excited to announce...",
    projectId: "project-123"
  }
]

getLatest()

Get the most recent changelog for your project.

changelogs.getLatest(): Promise<Changelog[]>

Returns

Promise that resolves to an array containing the latest Changelog object.

Example

const latest = await client.changelogs.getLatest();

getLatestForUser(userId)

Get the latest changelog for a specific user, including their seen status.

changelogs.getLatestForUser(userId: string): Promise<ChangelogWithSeenStatus>

Parameters

  • userId (string, required): The user's unique identifier

Returns

Promise that resolves to a ChangelogWithSeenStatus object.

Example

const latestForUser = await client.changelogs.getLatestForUser('user-123');
console.log(latestForUser.seen); // true or false

Response

{
  _id: "changelog-1",
  _creationTime: 1704067200000,
  title: "Version 2.0 Released",
  content: "We're excited to announce...",
  projectId: "project-123",
  seen: false
}

acknowledge(changelogId, userId)

Mark a changelog as seen/acknowledged by a specific user.

changelogs.acknowledge(changelogId: string, userId: string): Promise<void>

Parameters

  • changelogId (string, required): The changelog's unique identifier
  • userId (string, required): The user's unique identifier

Returns

Promise that resolves when the acknowledgment is successful.

Example

await client.changelogs.acknowledge('changelog-1', 'user-123');

Users

Access user-related methods via client.users.

create(userId)

Create a new user in the system.

users.create(userId: string): Promise<CreateUserResponse>

Parameters

  • userId (string, required): The user's unique identifier

Returns

Promise that resolves to a CreateUserResponse object.

Example

const response = await client.users.create('user-123');
console.log(response.message);

Response

{
  message: "User created successfully"
}

delete(userId)

Delete a user from the system.

users.delete(userId: string): Promise<void>

Parameters

  • userId (string, required): The user's unique identifier

Returns

Promise that resolves when the deletion is successful.

Example

await client.users.delete('user-123');

Error Handling

All methods throw errors if the API request fails. Wrap your calls in try-catch blocks:

try {
  const changelogs = await client.changelogs.list();
} catch (error) {
  console.error('Failed to fetch changelogs:', error.message);
}

On this page