const baseUrl = 'https://node.damn.fun';
const apiKey = 'your api key';
const client = new ApiClient({ baseUrl, apiKey });
3.1 Upload assets(png, jpg, mp3, etc.)
The game assets, such as images, audio files, etc., need to be uploaded through the upload API first. After obtaining the storageId, it can be used for other APIs.
The first parameter is the file, which currently supports local file path strings, Buffer, and ReadStream.
The second parameter is the file name. You can customize the file name, and it can be anything, but make sure to include the correct file extension.
Create game music. Game music is an abstract resource, and the actual material files need to be uploaded via the upload interface.
client.createMusic({
audioStorageId: 'storage id from upload',
coverStorageId: 'storage id from upload',
description: 'string',
status: 'string',
title: 'string',
visibility: 'string',
});
Get the list of all chat messages within a conversation.
client.gameData.getMessageList('conversation id like c:0');
About pagination
Some query APIs support pagination. Pagination queries have a unified parameter and return value structure. When querying, you need to pass numItems (the number of items per page) and cursor (the current cursor, which should be set to null for the first query).The response will include a data list and a new cursor.