|
1 |
| -import mondaySdk from '../types'; |
| 1 | +import mondaySdk from "../types"; |
2 | 2 | const monday = mondaySdk();
|
3 | 3 |
|
4 |
| -monday.api('test'); // $ExpectType Promise<{ data: object; }> |
| 4 | +monday.api("test"); |
5 | 5 |
|
6 |
| -monday.setApiVersion('2023-10'); // $ExpectType void |
7 |
| -mondaySdk({ apiVersion: '2023-10' }); |
8 |
| -monday.api('test', { apiVersion: '2023-07' }); // $ExpectType Promise<{ data: object; }> |
| 6 | +monday.setApiVersion("2023-10"); |
| 7 | +mondaySdk({ apiVersion: "2023-10" }); |
| 8 | +monday.api("test", { apiVersion: "2023-07" }); |
9 | 9 |
|
10 |
| -monday.setToken('test'); // $ExpectType void |
| 10 | +monday.setToken("test"); |
11 | 11 |
|
12 |
| -monday.get('context'); // $ExpectType Promise<any> |
13 |
| -monday.get('settings'); // $ExpectType Promise<any> |
14 |
| -monday.get('itemIds'); // $ExpectType Promise<any> |
15 |
| -monday.get('sessionToken'); // $ExpectType Promise<any> |
| 12 | +monday.get("context", { appFeatureType: "AppFeatureBoardView" }).then(res => { |
| 13 | + const { data }: { data: { app: { id: number }; theme: string; boardId: number; viewMode: string } } = res; |
| 14 | +}); |
| 15 | + |
| 16 | +monday.get<{ text: string; level: number }>("settings").then(res => { |
| 17 | + const { data }: { data: { text: string; level: number } } = res; |
| 18 | +}); |
| 19 | + |
| 20 | +monday.get("itemIds").then(res => { |
| 21 | + const { data }: { data: number[] } = res; |
| 22 | +}); |
| 23 | + |
| 24 | +monday.get("sessionToken").then(res => { |
| 25 | + const { data }: { data: string } = res; |
| 26 | +}); |
| 27 | + |
| 28 | +monday.set("settings", { text: "this is a test", number: 23 }); |
16 | 29 |
|
17 |
| -monday.set('settings', {'text' : 'this is a test', 'number' : 23}); // $ExpectType Promise<any> |
| 30 | +monday.listen( |
| 31 | + "context", |
| 32 | + res => { |
| 33 | + const { data }: { data: { app: { id: number }; theme: string; itemId: number } } = res; |
| 34 | + }, |
| 35 | + { appFeatureType: "AppFeatureItemView" } |
| 36 | +); |
18 | 37 |
|
19 |
| -monday.listen('context', res => res); // $ExpectType void |
| 38 | +monday.execute("openItemCard", { itemId: 123 }); |
| 39 | +monday.execute("confirm", { message: "Hello" }); |
| 40 | +monday.execute("notice", { message: "Hello" }); |
20 | 41 |
|
21 |
| -monday.execute('openItemCard', { itemId: 123 }); // $ExpectType Promise<any> |
22 |
| -monday.execute('confirm', { message: 'Hello' }); // $ExpectType Promise<{ data: { confirm: boolean; }; }> |
23 |
| -monday.execute('notice', { message: 'Hello' }); // $ExpectType Promise<any> |
24 |
| -// $ExpectType Promise<any> |
25 |
| -monday.execute('openFilesDialog', { |
26 |
| - boardId: 12345, |
27 |
| - itemId: 23456, |
28 |
| - columnId: 'files', |
29 |
| - assetId: 34567, |
| 42 | +monday.execute("openFilesDialog", { |
| 43 | + boardId: 12345, |
| 44 | + itemId: 23456, |
| 45 | + columnId: "files", |
| 46 | + assetId: 34567 |
30 | 47 | });
|
31 |
| -// $ExpectType Promise<any> |
32 |
| -monday.execute('triggerFilesUpload', { |
33 |
| - boardId: 12345, |
34 |
| - itemId: 23456, |
35 |
| - columnId: 'files', |
| 48 | + |
| 49 | +monday.execute("triggerFilesUpload", { |
| 50 | + boardId: 12345, |
| 51 | + itemId: 23456, |
| 52 | + columnId: "files" |
36 | 53 | });
|
37 |
| -monday.execute('openAppFeatureModal', { urlPath: '/path', urlParams: {}, width: '100px', height: '100px' }); // $ExpectType Promise<{ data: any; }> |
38 |
| -monday.execute('closeAppFeatureModal'); // $ExpectType Promise<{ data: any; }> |
39 |
| -monday.execute('valueCreatedForUser'); // $ExpectType Promise<any}> |
40 |
| -// $ExpectType Promise<any> |
41 |
| -monday.execute('addDocBlock', { |
42 |
| - type : 'normal text', |
43 |
| - content : {'deltaFormat' : [{'insert' : 'test'}]} |
| 54 | +monday.execute("openAppFeatureModal", { urlPath: "/path", urlParams: {}, width: "100px", height: "100px" }); |
| 55 | +monday.execute("closeAppFeatureModal"); |
| 56 | +monday.execute("valueCreatedForUser"); |
| 57 | + |
| 58 | +monday.execute("addDocBlock", { |
| 59 | + type: "normal text", |
| 60 | + content: { deltaFormat: [{ insert: "test" }] } |
44 | 61 | });
|
45 |
| -// $ExpectType Promise<any> |
46 |
| -monday.execute('updateDocBlock', { |
47 |
| - id : '1234-1234-23434dsf', |
48 |
| - content : {'deltaFormat' : [{'insert' : 'test'}]} |
| 62 | + |
| 63 | +monday.execute("updateDocBlock", { |
| 64 | + id: "1234-1234-23434dsf", |
| 65 | + content: { deltaFormat: [{ insert: "test" }] } |
49 | 66 | });
|
50 |
| -// $ExpectType Promise<any> |
51 |
| -monday.execute('addMultiBlocks', { |
52 |
| - afterBlockId : '1234-1234-23434dsf', |
53 |
| - blocks: [ |
54 |
| - { |
55 |
| - type: 'normal text', |
56 |
| - content: { deltaFormat : [{ 'insert' : 'test' }] } |
57 |
| - } |
58 |
| - ] |
| 67 | + |
| 68 | +monday.execute("addMultiBlocks", { |
| 69 | + afterBlockId: "1234-1234-23434dsf", |
| 70 | + blocks: [ |
| 71 | + { |
| 72 | + type: "normal text", |
| 73 | + content: { deltaFormat: [{ insert: "test" }] } |
| 74 | + } |
| 75 | + ] |
59 | 76 | });
|
60 |
| -monday.execute('closeDocModal'); // $ExpectType Promise<any> |
| 77 | +monday.execute("closeDocModal"); |
61 | 78 |
|
62 |
| -monday.oauth({ clientId: 'clientId' }); |
| 79 | +monday.oauth({ clientId: "clientId" }); |
63 | 80 |
|
64 |
| -monday.storage.instance.getItem('test'); // $ExpectType Promise<GetResponse> |
65 |
| -monday.storage.instance.setItem('test', '123'); // $ExpectType Promise<SetResponse> |
66 |
| -monday.storage.instance.deleteItem('test'); // $ExpectType Promise<DeleteResponse> |
| 81 | +monday.storage.instance.getItem("test").then(res => { |
| 82 | + const { data }: { data: { error?: string; success: boolean }; errorMessage?: string } = res; |
| 83 | +}); |
| 84 | + |
| 85 | +monday.storage.instance.setItem("test", "123").then(res => { |
| 86 | + const { data }: { data: { error?: string; success: boolean }; errorMessage?: string } = res; |
| 87 | +}); |
| 88 | + |
| 89 | +monday.storage.instance.deleteItem("test").then(res => { |
| 90 | + const { data }: { data: { error?: string; success: boolean }; errorMessage?: string } = res; |
| 91 | +}); |
| 92 | + |
| 93 | +monday.storage.getItem("test").then(res => { |
| 94 | + const { data }: { data: { error?: string; success: boolean }; errorMessage?: string } = res; |
| 95 | +}); |
| 96 | + |
| 97 | +monday.storage.setItem("test", "123").then(res => { |
| 98 | + const { data }: { data: { error?: string; success: boolean }; errorMessage?: string } = res; |
| 99 | +}); |
| 100 | + |
| 101 | +monday.storage.deleteItem("test").then(res => { |
| 102 | + const { data }: { data: { error?: string; success: boolean }; errorMessage?: string } = res; |
| 103 | +}); |
67 | 104 |
|
68 |
| -const mondayServer = mondaySdk({ token: '123', apiVersion: '2023-10' }); |
| 105 | +const mondayServer = mondaySdk({ token: "123", apiVersion: "2023-10" }); |
69 | 106 |
|
70 |
| -mondayServer.setToken('123'); // $ExpectType void |
71 |
| -mondayServer.setApiVersion('2023-10'); // $ExpectType void |
72 |
| -mondayServer.api('test'); // $ExpectType Promise<any> |
73 |
| -mondayServer.api('test', { token: 'test' }); // $ExpectType Promise<any> |
74 |
| -mondayServer.api('test', { variables: { variable1: 'test' } }); // $ExpectType Promise<any> |
75 |
| -mondayServer.api('test', { token: 'test', variables: { variable1: 'test' } }); // $ExpectType Promise<any> |
76 |
| -mondayServer.api('test', { token: 'test', apiVersion: '2023-07' }); // $ExpectType Promise<any> |
77 |
| -mondayServer.oauthToken('test', 'test', 'test'); // $ExpectType Promise<any> |
| 107 | +mondayServer.setToken("123"); |
| 108 | +mondayServer.setApiVersion("2023-10"); |
| 109 | +mondayServer.api("test"); |
| 110 | +mondayServer.api("test", { token: "test" }); |
| 111 | +mondayServer.api("test", { variables: { variable1: "test" } }); |
| 112 | +mondayServer.api("test", { token: "test", variables: { variable1: "test" } }); |
| 113 | +mondayServer.api("test", { token: "test", apiVersion: "2023-07" }); |
| 114 | +mondayServer.oauthToken("test", "test", "test"); |
0 commit comments