UNPKG

5.72 kBTypeScriptView Raw
1import { ISPQueryable, _SPQueryable } from "../spqueryable.js";
2export declare class _SiteScripts extends _SPQueryable {
3 constructor(base: string | ISPQueryable, methodName?: string);
4 run<T>(props: any): Promise<T>;
5 /**
6 * Gets a list of information on all existing site scripts.
7 */
8 getSiteScripts(): Promise<ISiteScriptInfo[]>;
9 /**
10 * Creates a new site script.
11 *
12 * @param title The display name of the site script.
13 * @param content JSON value that describes the script. For more information, see JSON reference.
14 */
15 createSiteScript(title: string, description: string, content: any): Promise<ISiteScriptInfo>;
16 /**
17 * Gets information about a specific site script. It also returns the JSON of the script.
18 *
19 * @param id The ID of the site script to get information about.
20 */
21 getSiteScriptMetadata(id: string): Promise<ISiteScriptInfo>;
22 /**
23 * Deletes a site script.
24 *
25 * @param id The ID of the site script to delete.
26 */
27 deleteSiteScript(id: string): Promise<void>;
28 /**
29 * Updates a site script with new values. In the REST call, all parameters are optional except the site script Id.
30 *
31 * @param siteScriptUpdateInfo Object that contains the information to update a site script.
32 * Make sure you stringify the content object or pass it in the second 'content' parameter
33 * @param content (Optional) A new JSON script defining the script actions. For more information, see Site design JSON schema.
34 */
35 updateSiteScript(updateInfo: ISiteScriptUpdateInfo, content?: any): Promise<ISiteScriptInfo>;
36 /**
37 * Gets the site script syntax (JSON) for a specific list
38 * @param listUrl The absolute url of the list to retrieve site script
39 */
40 getSiteScriptFromList(listUrl: string): Promise<string>;
41 /**
42 * Gets the site script syntax (JSON) for a specific web
43 * @param webUrl The absolute url of the web to retrieve site script
44 * @param extractInfo configuration object to specify what to extract
45 */
46 getSiteScriptFromWeb(webUrl: string, info: ISiteScriptSerializationInfo): Promise<ISiteScriptSerializationResult>;
47 /**
48 * Executes the indicated site design action on the indicated web.
49 *
50 * @param webUrl The absolute url of the web to retrieve site script
51 * @param extractInfo configuration object to specify what to extract
52 */
53 executeSiteScriptAction(actionDefinition: string): Promise<ISiteScriptActionResult>;
54}
55export interface ISiteScripts extends _SiteScripts {
56}
57export declare const SiteScripts: (baseUrl: string | ISPQueryable, methodName?: string) => ISiteScripts;
58/**
59 * Result from creating or retrieving a site script
60 *
61 */
62export interface ISiteScriptInfo {
63 /**
64 * The ID of the site script to apply
65 */
66 Id: string;
67 /**
68 * The display name of the site script
69 */
70 Title: string;
71 /**
72 * The description for the site script
73 */
74 Description: string;
75 /**
76 * The JSON data/definition for the site script
77 */
78 Content: string;
79 /**
80 * The version number of the site script
81 */
82 Version: string;
83}
84/**
85 * Data for updating a site script
86 *
87 */
88export interface ISiteScriptUpdateInfo {
89 /**
90 * The ID of the site script to update
91 */
92 Id: string;
93 /**
94 * (Optional) The new display name for the updated site script
95 */
96 Title?: string;
97 /**
98 * (Optional) The new description for the updated site script
99 */
100 Description?: string;
101 /**
102 * (Optional) The new JSON data/definition for the updated site script
103 */
104 Content?: string;
105 /**
106 * (Optional) The new version for the updated site script
107 */
108 Version?: string;
109}
110export interface ISiteScriptSerializationInfo {
111 /**
112 * (Optional) Include branding
113 */
114 IncludeBranding?: boolean;
115 /**
116 * (Optional) Lists to include e.g. ["Lists/MyList"]
117 */
118 IncludedLists?: string[];
119 /**
120 * (Optional) Include links to exported items
121 */
122 IncludeLinksToExportedItems?: boolean;
123 /**
124 * (Optional) Include regional settings
125 */
126 IncludeRegionalSettings?: boolean;
127 /**
128 * (Optional) Include site external sharing capability
129 */
130 IncludeSiteExternalSharingCapability?: boolean;
131 /**
132 * (Optional) Include theme
133 */
134 IncludeTheme?: boolean;
135}
136export interface ISiteScriptSerializationResult {
137 /**
138 * The site script in JSON format
139 */
140 JSON: string;
141 /**
142 * A collection of warnings
143 */
144 Warnings: string[];
145}
146export interface ISiteScriptActionResult {
147 /**
148 * The title of the action.
149 */
150 Title: string;
151 /**
152 * Text associated with the outcome of the action. If this is present, it is usually an error message.
153 */
154 OutcomeText: string;
155 /**
156 * Indicates the outcome of the action.
157 */
158 Outcome: SiteScriptActionOutcome;
159 /**
160 * Indicates the target of the action.
161 */
162 Target: string;
163}
164export declare enum SiteScriptActionOutcome {
165 /**
166 * The stage was deemed to have completed successfully.
167 */
168 Success = 0,
169 /**
170 * The stage was deemed to have failed to complete successfully (non-blocking, rest of recipe
171 * execution should still be able to proceed).
172 */
173 Failure = 1,
174 /**
175 * No action was taken for this stage / this stage was skipped.
176 */
177 NoOp = 2,
178 /**
179 * There was an exception but the operation succeeded. This is analagous to the operation completing
180 * in a "yellow" state.
181 */
182 SucceededWithException = 3
183}
184//# sourceMappingURL=types.d.ts.map
\No newline at end of file