MCPcopy Index your code
hub / github.com/simstudioai/sim / deleteSubscription

Function deleteSubscription

apps/sim/lib/webhooks/providers/linq.ts:231–265  ·  view source on GitHub ↗
(ctx: DeleteSubscriptionContext)

Source from the content-addressed store, hash-verified

229 },
230
231 async deleteSubscription(ctx: DeleteSubscriptionContext): Promise<void> {
232 const { webhook, requestId } = ctx
233 try {
234 const config = getProviderConfig(webhook)
235 const apiKey = config.triggerApiKey as string | undefined
236 const externalId = config.externalId as string | undefined
237
238 if (!apiKey || !externalId) {
239 logger.warn(
240 `[${requestId}] Missing apiKey or externalId for Linq webhook deletion ${webhook.id}, skipping cleanup`
241 )
242 if (ctx.strict) throw new Error('Missing Linq webhook deletion credentials')
243 return
244 }
245
246 const response = await fetch(`${LINQ_API_BASE}/webhook-subscriptions/${externalId}`, {
247 method: 'DELETE',
248 headers: linqHeaders(apiKey),
249 })
250
251 if (!response.ok && response.status !== 404) {
252 logger.warn(
253 `[${requestId}] Failed to delete Linq webhook subscription (non-fatal): ${response.status}`
254 )
255 if (ctx.strict) {
256 throw new Error(`Failed to delete Linq webhook subscription: ${response.status}`)
257 }
258 } else {
259 logger.info(`[${requestId}] Successfully deleted Linq webhook subscription ${externalId}`)
260 }
261 } catch (error) {
262 logger.warn(`[${requestId}] Error deleting Linq webhook subscription (non-fatal)`, error)
263 if (ctx.strict) throw error
264 }
265 },
266}

Callers

nothing calls this directly

Calls 4

getProviderConfigFunction · 0.90
linqHeadersFunction · 0.90
infoMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected