gabster-sharek
v1.0.1
Published
Client library for Gabster Sharek API — create shareable text links with one function call.
Maintainers
Readme
gabster-sharek
Client library for Gabster Sharek API. Create shareable text links with a single function call.
npm install gabster-sharekFunction
createShareLink(params)
Creates a text post on Sharek and returns the shareable link. The API response is normalized to a unified shape.
import { createShareLink } from "gabster-sharek";
const result = await createShareLink({
text: "Hello, world!",
title: "My first share",
});
if (result.status === 201 || result.status === 200) {
console.log(result.data); // "https://sharek.gabster.ai/s_abc123xyz"
} else {
console.log(result.message ?? result.errors);
}Types
CreateShareLinkParams
interface CreateShareLinkParams {
text: string; // required — content to share
title?: string; // optional
password?: string; // optional — makes the post private
}CreateShareLinkResponse
Unified shape for all responses:
interface CreateShareLinkResponse {
status: number;
data: string | null; // shareable link on success
message?: string;
errors?: Array<{ message: string; serial?: string }>;
}Examples
Basic (public post)
const result = await createShareLink({
text: "Check out this snippet.",
});
// result.data → "https://sharek.gabster.ai/s_xyz789abc"With title
const result = await createShareLink({
text: "Sensitive data here.",
title: "Private note",
});Private post (password-protected)
const result = await createShareLink({
text: "Only for you.",
title: "Secret",
password: "my-secret",
});
// Viewers need the password to unlock the content on Sharek.Handle errors
const result = await createShareLink({ text: "" });
if (result.status >= 400) {
console.error(result.message ?? result.errors);
}Dev Dependencies
| Package | Version | | ------------ | -------- | | @types/node | ^20.19.33 | | rimraf | ^5.0.5 | | typescript | ^5.5.3 |
Version History
| Version | Published | Notes | | ------- | --------- | ------------ | | 1.0.0 | — | Initial release |
