Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
11d7268
Added projects CRUD functions
gtchax Aug 6, 2025
db99b27
Added examples for all project related SDK methods
gtchax Aug 6, 2025
54ac5ba
Added methods to manage team CRUD functionality
gtchax Aug 6, 2025
98fa9b2
Added examples for the use of team SDK methods
gtchax Aug 6, 2025
48eb929
Added checks for required fields in team methods
gtchax Aug 6, 2025
40b7cc2
updated updateTeam method error check
gtchax Aug 6, 2025
82f50be
Added team members methods
gtchax Aug 6, 2025
0fef4c0
Added examples for the use of team member methods
gtchax Aug 6, 2025
c9d8137
Added api-key to headers to allow for auth via API keys
gtchax Aug 7, 2025
f1e4ed9
fix: Basic data generation test to pass
gtchax Aug 7, 2025
e2cccf6
fix: correctly logging example project API call results
gtchax Aug 7, 2025
088f359
fix: correctly logging example team members API call results
gtchax Aug 7, 2025
a4ee6cc
Added fetch all teams test
gtchax Aug 7, 2025
77f8518
Added create team test
gtchax Aug 7, 2025
3d2c82d
Added update team test
gtchax Aug 7, 2025
02555ec
Added delete team test
gtchax Aug 7, 2025
24f0a7c
Added full CRUD test suite for projects
gtchax Aug 7, 2025
6498e1c
Added fetch all user templates SDK method and example usage
gtchax Aug 7, 2025
7062ef7
Added fetch templates test
gtchax Aug 7, 2025
9d95b5c
Added fetch template by ID method
gtchax Aug 8, 2025
f83fef2
Added comments to projects examples
gtchax Aug 8, 2025
1600c0c
added comments to teams example
gtchax Aug 8, 2025
7bf1d59
Added fetch template by ID example
gtchax Aug 8, 2025
3b481ff
Added delete template by Id method and example usage
gtchax Aug 8, 2025
33b632e
fixed template examples hanging promise
gtchax Aug 8, 2025
d146e98
Added create template method and updated types file
gtchax Aug 8, 2025
0f9c585
Added test for create template method
gtchax Aug 8, 2025
b773d02
Added update template method
gtchax Aug 8, 2025
9f2bc97
Added template update method and example usage
gtchax Aug 8, 2025
2f4c79d
Added create connection method and necessary types
gtchax Aug 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions examples/connections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { DataMaker } from "../src/index";
import { CreateConnectionRequest } from "../src/template";

const datamaker = new DataMaker({});

// ----------------------
// Create a new connection
// ----------------------
const createConnection = async () => {
const newConnectionData = {
name: "Analytics DB",
type: "postgresql", // Database type "db2" | "postgresql" | "mysql" | "mssql" | "mongodb" | "oracle";
connectionString: "postgresql://user:pass@host:5432/dbname",
createdBy: "cme1bbe8m000er5dp2y6f1lla",
projectId: "cme2sniao0012r5a83wl4rasm",
teamId: "cme1bbe8k000cr5dp62cd5lab",
readOnly: true, // Optional: restrict connection to read-only queries
endpointFolderId: null, // Optional: no folder assigned for now
} satisfies CreateConnectionRequest;

const project = await datamaker.createConnection(newConnectionData);

console.log("Created Connection:", project);
};

createConnection();
85 changes: 85 additions & 0 deletions examples/projects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { DataMaker } from "../src/index";

const datamaker = new DataMaker({});

// ----------------------
// Fetch all projects
// ----------------------
const fetchProjects = async () => {

const projects = await datamaker.getProjects();

console.log("All Projects:", projects);
};

fetchProjects();

// ----------------------
// Create a new project
// ----------------------
const createNewProject = async () => {

// Define the new project data with teamID
const newProject = {
name: "AI Templates Project",
teamId: "team_123456",
description: "Project for testing SDK integration",
avatar: "https://example.com/avatar.png",
};

const project = await datamaker.createProject(newProject);

console.log("Created Project:", project);
};


createNewProject();

// ----------------------
// Fetch a single project by ID
// ----------------------
const fetchProjectById = async () => {

const projectId = "project_abc123";
const project = await datamaker.getProjectById(projectId);

console.log("Project by ID:", project);
};

fetchProjectById();

// ----------------------
// Update an existing project
// ----------------------
const updateExistingProject = async () => {

const projectId = "project_abc123";

// Define the fields to update
const updates = {
name: "Updated Project Name",
teamId: "team_123456",
avatar: "https://example.com/new-avatar.png",
description: "Updated description via SDK",
};

const updated = await datamaker.updateProject(projectId, updates);

console.log("Updated Project:", updated);
};


updateExistingProject();

// ----------------------
// Delete a project
// ----------------------
const removeProject = async () => {

const projectId = "project_abc123";
const result = await datamaker.deleteProject(projectId);

console.log("Delete Result:", result);
};

removeProject();
50 changes: 50 additions & 0 deletions examples/teamMembers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { DataMaker } from "../src/index";

const datamaker = new DataMaker({});

const getAllTeamMembers = async () => {
const teamMembers = await datamaker.getTeamMembers();
console.log("Team Members:", teamMembers);
};

getAllTeamMembers();

const createTeamMember = async () => {
const newMember = await datamaker.createTeamMember({
userId: "user_123",
teamId: "team_456",
role: "MEMBER",
});
console.log("Created Team Member:", newMember);
};

createTeamMember();

const updateTeamMember = async () => {
const updated = await datamaker.updateTeamMember("teamMember_789", {
userId: "user_123",
teamId: "team_456",
role: "OWNER",
});
console.log("Updated Team Member:", updated);
};

updateTeamMember();

const deleteTeamMember = async () => {
const result = await datamaker.deleteTeamMember("teamMember_789");
console.log("Deleted Team Member:", result);
};

deleteTeamMember();

const inviteTeamMember = async () => {
const invitation = await datamaker.inviteTeamMember({
email: "new.member@example.com",
teamId: "team_456",
role: "MEMBER", // Optional, defaults to MEMBER
});
console.log("Invitation Sent:", invitation);
};

inviteTeamMember();
60 changes: 60 additions & 0 deletions examples/teams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { DataMaker } from "../src/index";

const datamaker = new DataMaker({});

// ----------------------
// Fetch all teams
// ----------------------
const getAllTeams = async () => {
const teams = await datamaker.getTeams();
console.log("Teams:", teams);
};

getAllTeams();


// ----------------------
// Create a new team
// ----------------------
const createTeam = async () => {
const team = await datamaker.createTeam({
name: "Automators AI Team",
avatar: "https://example.com/avatar.png",
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
});

console.log("Created Team:", team);
};

createTeam();

// ----------------------
// Update existing team
// ----------------------
const updateTeam = async () => {
const teamId = "team_12345";

const updated = await datamaker.updateTeam(teamId, {
name: "Updated Automators Team",
avatar: "https://example.com/new-avatar.png",
updatedAt: new Date().toISOString(),
});

console.log("Updated Team:", updated);
};

updateTeam();

// ----------------------
// Delete a team
// ----------------------
const deleteTeam = async () => {
const teamId = "team_12345";

const deletedTeam = await datamaker.deleteTeam(teamId);

console.log("Deleted Team:", deletedTeam);
};

deleteTeam();
148 changes: 148 additions & 0 deletions examples/templates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import { DataMaker } from "../src/index";
import { CreateTemplateRequest } from "../src/template";

const datamaker = new DataMaker({});

// ----------------------
// Fetch all templates
// ----------------------
const fetchTemplates = async () => {
const templates = await datamaker.getTemplates();
console.log("All Templates:", templates);
};

fetchTemplates();

// ----------------------
// Fetch existing template by ID
// ----------------------
const fetchTemplateById = async () => {
const templateID = "template_12345";
const template = await datamaker.getTemplateById(templateID);

console.log("Template by ID:", template);
};

fetchTemplateById()

// ----------------------
// Create a new template
// ----------------------
const createTemplate = async () => {

const templateData = {
name: "New Template 1234",
projectId: "cme1bb331000br5dpl7pelvul",
teamId: "cme1akhyp0000r5dplpyugis7",
fields: [
{
name: "username",
active: true,
type: "Words",
options: { count: 2 },
},
{
name: "userId",
active: true,
type: "UUID",
options: { primaryKey: true },
},
{
name: "age",
active: true,
type: "Number",
options: { min: 18, max: 99 },
},
{
name: "signupDate",
active: true,
type: "Date",
options: { format: "YYYY-MM-DD" },
},
{
name: "isActive",
active: true,
type: "Boolean",
options: { truthy: true },
},
{
name: "bio",
active: true,
type: "Lorem",
options: { lineCount: 3 },
},
{
name: "location",
active: true,
type: "Address",
options: { useFullAddress: true },
},
{
name: "profilePicture",
active: true,
type: "Avatar",
},
{
name: "productCategory",
type: "Mapped",
active: true,
options: {
field: "department",
map: { Electronics: "Tech", Shoes: "Fashion" },
},
},
],
} satisfies CreateTemplateRequest;

const template = await datamaker.createTemplate(templateData);

console.log("Created Template", template);
};

createTemplate()

// ----------------------
// Update existing template
// ----------------------
const updateTemplate = async () => {
const uniqueName = `Updated template ${Date.now()}`;
const templateId = "cme2snibd0018r5a862o8rlpp";

const updateData = {
name: uniqueName,
projectId: "cme1bb331000br5dpl7pelvul",
teamId: "cme1akhyp0000r5dplpyugis7",
fields: [
{
name: "username",
active: true,
type: "Words",
options: { count: 2 },
},
{
name: "signupDate",
active: true,
type: "Date",
options: { format: "YYYY-MM-DD" },
},
],
} satisfies CreateTemplateRequest;

const template = await datamaker.updateTemplate(templateId, updateData);

console.log("Update Template", template);
};

updateTemplate();

// ----------------------
// Delete existing template by ID
// ----------------------
const deleteTemplateById = async () => {
const templateID = "template_12345";
const template = await datamaker.deleteTemplate(templateID);

console.log("Template by ID:", template);
};

deleteTemplateById()
Loading
Loading