WebService::TogetherWeRemember::v0::API

Perl interface for TogetherWeRemember API v0

Description

Together We Remember is a platform where you can create, share, and preserve meaningful memories.

This document outlines the v0 version of the Together We Remember API.

The API is free to use, but you must first create a user account and know your password to authenticate and access the endpoints.

Together We Remember

Synopsis

use WebService::TogetherWeRemember;

my $twr = WebService::TogetherWeRemember->new();

my $api = $twr->login($email, $password);

my $timeline = $api->timeline_create({
    name => "My First Timeline",
    description => $markdown_text,
    image => '/path/to/image.png',
    related_links => [
        { label => "lnation", url => "https//lnation.org" }
    ],
    passphrase => "123",
    is_public => 1,
    is_published => 0,
    is_open => 0,
});

my $memory = $api->memory_create($timeline->{timeline}->{id}, {
    title => "My First Memory",
    content => $markdown_text,
    date => time,
    related_links => [
        { label => "lnation", url => "https//lnation.org" }
    ],
});

$api->memory_asset($timeline->{timeline}->{id}, $memory->{memory}->{id}, '/path/to/asset.mp4', 5 * 1024 * 1024);

$api->logout();

Attributes

ua

LWP::UserAgent instance used for HTTP requests.

host

Base URL for the API.

Authentication

login

my $response = $api->login($email, $password);

This method sends a login request to the TogetherWeRemember API with the provided email and password. It returns the HTTP response.

Parameters:

  • URL: POST /api/login
  • email (string) - The user's email address.
  • password (string) - The user's password.

This method sends a form data POST request to /api/login with the above parameters.

logout

my $response = $api->logout();

This method sends a logout request to the TogetherWeRemember API. It returns the HTTP response.

Parameters:

  • URL: GET /api/logout
  • This method does not require any parameters.

This method sends a GET request to /api/logout.

Users

user_get

my $response = $api->user_get($user_id);

This method retrieves user information from the TogetherWeRemember API.

Parameters:

  • URL: GET /api/user/get or GET /api/user/get/:userid
  • userid (string) - The user's id.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • user (hash) - users data if successful.

user_update

my $response = $api->user_update({
    name => 'My Name',
    bio => $markdown_bio,
    profile_image => '/path/to/image.png'
});

This method updates user information in the TogetherWeRemember API.

Parameters:

  • URL: POST /api/user/update
  • profile_image (string or array) - The user's profile image. If a string is provided, it will be converted to an array.
  • name (string) - The user's name.
  • bio (string) - The user's biography.

Returns:

  • ok (boolean) - Indicates if the request was successful.

This method sends a form data POST request to /api/user/update with the provided user data.

Timelines

timelines_published

my $response = $api->timelines_published($user_id, { page => 1, q => 'search text' });

This method retrieves published timelines from the TogetherWeRemember API.

Parameters:

  • URL: GET /api/timeline/published or GET /api/timeline/published/:userid
  • userid (string, optional) - The user's id. If provided, only timelines for this user will be returned.
  • page (integer, optional) - The page number for pagination.
  • q (string, optional) - Search query to filter timelines.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • timelines (array) - List of timelines if successful.

This method sends a GET request to /api/timeline/published with the provided parameters.

timelines_mine

my $response = $api->timelines_mine({ page => 0, limit => 10 });

This method retrieves the user's own timelines from the TogetherWeRemember API.

Parameters:

  • URL: GET /api/timelines/mine
  • page (integer, optional) - The page number for pagination. Default is 0.
  • limit (integer, optional) - The number of timelines to return per page. Default is 12.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • timelines (array) - List of timelines if successful.

This method sends a GET request to /api/timelines/mine with the provided parameters.

timelines_collab

my $response = $api->timelines_collab({ page => 0, limit => 10 });

This method retrieves timelines where the user is a collaborator from the TogetherWeRemember API.

Parameters:

  • URL: GET /api/timelines/collab
  • page (integer, optional) - The page number for pagination. Default is 0.
  • limit (integer, optional) - The number of timelines to return per page. Default is 12.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • timelines (array) - List of timelines if successful.

This method sends a GET request to /api/timelines/collab with the provided parameters.

timelines_liked

my $response = $api->timelines_liked({ page => 0, limit => 10 });

This method retrieves timelines that the user has liked from the TogetherWeRemember API.

Parameters:

  • URL: GET /api/timelines/liked
  • page (integer, optional) - The page number for pagination. Default is 0.
  • limit (integer, optional) - The number of timelines to return per page. Default is 12.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • timelines (array) - List of timelines if successful.

This method sends a GET request to /api/timelines/liked with the provided parameters.

timeline_passphrase

my $response = $api->timeline_passphrase($timeline_id, $passphrase);

This method authenticates you to access a timeline that has a passphrase attached to it. You will not need to use the passphrase for your own timelines only for collaborative.

Parameters:

  • URL: POST /api/timeline/passphrase
  • timeline_id (string, required) - The ID of the timeline to access.
  • passphrase (string, required) - The passphrase for the timeline.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • timeline (hash) - The timeline data if successful.

This method sends a form data POST request to /api/timeline/passphrase with the provided timeline ID and passphrase.

timeline_get

my $response = $api->timeline_get($timeline_id);

This method retrieves a specific timeline from the TogetherWeRemember API.

Parameters:

  • URL: GET /api/timeline/get/:timelineid
  • timelineid (string, required) - The ID of the timeline to retrieve.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • timeline (hash) - The timeline data if successful.

This method sends a GET request to /api/timeline/get/:timelineid with the provided timeline ID.

timeline_create

my $response = $api->timeline_create({
    name => 'My Timeline',
    description => 'A description of my timeline',
    image => '/path/to/image.png',
    related_links => [
        { url => 'https://lnation.org', label => 'LNATION' },
        { url => 'https://example.com', label => 'Example' }
    ],
    passphrase => '123',
    is_public => 1,
    is_published => 0,
    is_open => 0,
});

This method creates a new timeline in the TogetherWeRemember API.

Parameters:

  • URL: POST /api/timeline/create
  • name (string, required) - The name of the timeline.
  • description (string, optional) - A description of the timeline.
  • image (string, optional) - The path to the timeline image.
  • related_links (array, optional) - An array of related links, each containing a url and a label.
  • passphrase (string, optional) - A passphrase for the timeline.
  • is_public (boolean, optional) - Whether the timeline is public. Default is 1 (true).
  • is_published (boolean, optional) - Whether the timeline is published. Default is 0 (false).
  • is_open (boolean, optional) - Whether the timeline is open for collaboration. Default is 0 (false).

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • timeline (hash) - The created timeline data if successful.

This method sends a form data POST request to /api/timeline/create with the provided timeline data.

timeline_update

my $response = $api->timeline_update({
    id => '12345',
    name => 'Updated Timeline Name',
    description => 'Updated description of the timeline',
    image => '/path/to/new_image.png',
    related_links => [
        { url => 'https://lnation.org', label => 'LNATION' },
        { url => 'https://example.com', label => 'Example' }
    ],
    passphrase => 'newpassphrase',
    is_public => 1,
    is_published => 1,
    is_open => 1,
});

This method updates an existing timeline in the TogetherWeRemember API.

Parameters:

  • URL: POST /api/timeline/update
  • id (string, required) - The ID of the timeline to update.
  • name (string, required) - The new name of the timeline.
  • description (string, optional) - The new description of the timeline.
  • image (string, optional) - The path to the new timeline image.
  • related_links (array, optional) - An array of related links, each containing a url and a label.
  • passphrase (string, optional) - A new passphrase for the timeline.
  • is_public (boolean, optional) - Whether the timeline is public. Default is 1 (true).
  • is_published (boolean, optional) - Whether the timeline is published. Default is 1 (true).
  • is_open (boolean, optional) - Whether the timeline is open for collaboration. Default is 1 (true).

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • timeline (hash) - The updated timeline data if successful.

This method sends a form data POST request to /api/timeline/update with the provided timeline data.

timeline_delete

my $response = $api->timeline_delete($timeline_id);

This method deletes a timeline from the TogetherWeRemember API.

Parameters:

  • URL: POST /api/timeline/delete/:timelineid
  • timelineid (string, required) - The ID of the timeline to delete.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • message (string) - A message indicating the result of the deletion.

This method sends a POST request to /api/timeline/delete/:timelineid with the provided timeline ID.

Memories

memory_list

my $response = $api->memory_list($timeline_id, { 
    page => 0,
    limit => 10,
    orderby => 'event_date',
    orderdir => 'desc',
    from => 1751026816, # Unix timestamp
    to => 1751026920,   # Unix timestamp
    q => 'search text'
});

This method retrieves a list of memories (timeline items) for a given timeline from the TogetherWeRemember API.

Parameters:

  • URL: GET /api/timeline/item/list
  • timelineid (string, required) - The ID of the timeline.
  • page (integer, optional) - The page number for pagination. Default is 0.
  • limit (integer, optional) - The number of items per page. Default is 12.
  • orderby (string, optional) - Field to order by (e.g., 'event_date').
  • orderdir (string, optional) - Order direction ('asc' or 'desc').
  • from (integer, optional) - Start of date range (Unix timestamp).
  • to (integer, optional) - End of date range (Unix timestamp).
  • q (string, optional) - Search query to filter memories.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • memories (array) - List of memory items if successful.

This method sends a GET request to /api/timeline/item/list with the provided parameters.

memory_get

my $response = $api->memory_get($timeline_id, $memory_id);

This method retrieves a specific memory (timeline item) from the TogetherWeRemember API.

Parameters:

  • URL: GET /api/timeline/item/get
  • timelineid (string, required) - The ID of the timeline.
  • memoryid (string, required) - The ID of the memory to retrieve.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • memory (hash) - The memory data if successful.

This method sends a GET request to /api/timeline/item/get with the provided timeline ID and memory ID.

memory_create

my $response = $api->memory_create($timeline_id, {
    title => 'My Memory Title',
    content => 'A description of my memory',
    date => epoch,
    related_links => [
        { url => 'https://lnation.org', label => 'LNATION' },
        { url => 'https://example.com', label => 'Example' }
    ],
});

This method creates a new memory (timeline item) in the TogetherWeRemember API.

Parameters:

  • URL: POST /api/timeline/item/save
  • timeline_id (string, required) - The ID of the timeline to add the memory to.
  • title (string, required) - The title of the memory.
  • content (string, optional) - The content or description of the memory.
  • date (integer, optional) - The event date as a Unix timestamp.
  • related_links (array, optional) - An array of related links, each containing a url and a label.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • memory (hash) - The created memory data if successful.

This method sends a form data POST request to /api/timeline/item/save with the provided memory data.

memory_update

my $response = $api->memory_update($timeline_id, $memory_id, {
    title => 'Updated Memory Title',
    content => 'Updated description of my memory',
    date => epoch,
    existing_image_ids => [ 10, 15 ],
    related_links => [
        { url => 'https://lnation.org', label => 'LNATION' },
        { url => 'https://example.com', label => 'Example' }
    ],
});

This method updates an existing memory (timeline item) in the TogetherWeRemember API.

Parameters:

  • URL: POST /api/timeline/item/save
  • timeline_id (string, required) - The ID of the timeline containing the memory.
  • memory_id (string, required) - The ID of the memory to update.
  • title (string, required) - The new title of the memory.
  • content (string, optional) - The new content or description of the memory.
  • date (integer, optional) - The new event date as a Unix timestamp.
  • existing_image_ids (array, optional) - Array of image IDs to retain.
  • related_links (array, optional) - An array of related links, each containing a url and a label.

Returns:

  • ok (boolean) - Indicates if the request was successful.
  • memory (hash) - The updated memory data if successful.

This method sends a form data POST request to /api/timeline/item/save with the provided memory data.

memory_asset

my $response = $api->memory_asset($timeline_id, $memory_id, '/path/to/asset.mp4', 5 * 1024 * 1024);

This method uploads an asset (file) to a specific memory in the TogetherWeRemember API.

Parameters:

  • URL: POST /api/timeline/item/asset
  • timeline_id (string, required) - The ID of the timeline containing the memory.
  • memory_id (string, required) - The ID of the memory to which the asset will be uploaded.
  • file (string, required) - The path to the file to upload.
  • chunk_size (integer, optional) - The size of each chunk to upload. Default is 5MB.

Returns:

  • ok (boolean) - Indicates if the request was successful for each chunk.
  • results (array) - An array of responses for each uploaded chunk.

This method uploads the specified file in chunks (default 5MB each) to /api/timeline/item/asset for the given timeline and memory. Each chunk is sent as a separate POST request with multipart form data.

memory_delete

my $response = $api->memory_delete($timeline_id, $memory_id);

This method deletes a specific memory (timeline item) from the TogetherWeRemember API.

Parameters:

  • URL: POST /api/timeline/item/delete
  • timeline_id (string, required) - The ID of the timeline containing the memory.
  • memory_id (string, required) - The ID of the memory to delete.

Returns:

  • ok (boolean) - Indicates if the request was successful.

This method sends a POST request to /api/timeline/item/delete with the provided timeline ID and memory ID.