MCPcopy Create free account
hub / github.com/appwrite/sdk-for-react-native / createExecution

Method createExecution

src/services/functions.ts:107–170  ·  view source on GitHub ↗
(
        paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string,
        ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?]    
    )

Source from the content-addressed store, hash-verified

105 */
106 createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>;
107 createExecution(
108 paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string,
109 ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?]
110 ): Promise<Models.Execution> {
111 let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
112
113 if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
114 params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string };
115 } else {
116 params = {
117 functionId: paramsOrFirst as string,
118 body: rest[0] as string,
119 async: rest[1] as boolean,
120 xpath: rest[2] as string,
121 method: rest[3] as ExecutionMethod,
122 headers: rest[4] as object,
123 scheduledAt: rest[5] as string
124 };
125 }
126
127 const functionId = params.functionId;
128 const body = params.body;
129 const async = params.async;
130 const xpath = params.xpath;
131 const method = params.method;
132 const headers = params.headers;
133 const scheduledAt = params.scheduledAt;
134
135 if (typeof functionId === 'undefined') {
136 throw new AppwriteException('Missing required parameter: "functionId"');
137 }
138
139 const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
140 const payload: Payload = {};
141
142 if (typeof body !== 'undefined') {
143 payload['body'] = body;
144 }
145
146 if (typeof async !== 'undefined') {
147 payload['async'] = async;
148 }
149
150 if (typeof xpath !== 'undefined') {
151 payload['path'] = xpath;
152 }
153
154 if (typeof method !== 'undefined') {
155 payload['method'] = method;
156 }
157
158 if (typeof headers !== 'undefined') {
159 payload['headers'] = headers;
160 }
161
162 if (typeof scheduledAt !== 'undefined') {
163 payload['scheduledAt'] = scheduledAt;
164 }

Callers

nothing calls this directly

Calls 1

callMethod · 0.80

Tested by

no test coverage detected