Skip to content

Commit

Permalink
fix: update preference set types
Browse files Browse the repository at this point in the history
  • Loading branch information
connorlindsey committed Nov 13, 2024
1 parent 88d5dbb commit 66186d8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/resources/preferences/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export interface SetPreferencesProperties {

export interface PreferenceSet {
id: string;
categories: WorkflowPreferences;
workflows: WorkflowPreferences;
channel_types: ChannelTypePreferences;
categories: WorkflowPreferences | null;
workflows: WorkflowPreferences | null;
channel_types: ChannelTypePreferences | null;
}

export interface PreferenceOptions {
Expand Down
60 changes: 60 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Knock } from "../src/knock";
import { ListSchedulesProps } from "../src/resources/workflows/interfaces";

// npx ts-node index.ts
async function main() {
try {
// dev "sk_test_9pTKnHlI2IvUszbb4-fK20enCeQcAjMRk2USZMpa6yU"
// local sk_test_XQPmyTEvFKJFO1H4i2sz24gAA3cCEV-kZUMt_6U6p_U
const knock = new Knock(
"sk_test_9pTKnHlI2IvUszbb4-fK20enCeQcAjMRk2USZMpa6yU",
{
// host: "http://localhost:4001",
host: "https://api.knock-dev.app",
},
);

const params: ListSchedulesProps = {
recipients: ["007", { collection: "object_collection", id: "object_id" }],
after: undefined,
before: undefined,
page_size: undefined,
};
const res = await knock.get("/v1/users/007/schedules", {
...params,
});

console.log(res);
// const users = await knock.users.list()
// console.log(users)

// await knock.users.identify("es", {
// locale: "es-MX"
// })

// await knock.objects.setChannelData(
// "$tenants",
// "tenant-123",
// "506ccea0-8350-4549-bf6c-0ef70268bfd3",
// {
// tokens: ["apns-user-push-token"],
// },
// );

// await knock.users.setChannelData("tenant-123", "506ccea0-8350-4549-bf6c-0ef70268bfd3", {
// tokens: ["apns-user-push-token"],
// })

// await knock.users.setChannelData("1234", "506ccea0-8350-4549-bf6c-0ef70268bfd3", {
// tokens: ["apns-user-push-token"],
// })

// await knock.workflows.trigger("send-windows", {
// recipients: ["[email protected]"]
// })
} catch (error) {
console.error(error);
}
}

main();

0 comments on commit 66186d8

Please sign in to comment.