Shortcode.ts (hoppscotch-2.2.1) | : | Shortcode.ts (hoppscotch-3.0.0) | ||
---|---|---|---|---|
import { HoppRESTRequest } from "@hoppscotch/data" | import { HoppRESTRequest } from "@hoppscotch/data" | |||
import { runMutation } from "../GQLClient" | import { runMutation } from "../GQLClient" | |||
import { | import { | |||
CreateShortcodeDocument, | CreateShortcodeDocument, | |||
CreateShortcodeMutation, | CreateShortcodeMutation, | |||
CreateShortcodeMutationVariables, | CreateShortcodeMutationVariables, | |||
DeleteShortcodeDocument, | ||||
DeleteShortcodeMutation, | ||||
DeleteShortcodeMutationVariables, | ||||
} from "../graphql" | } from "../graphql" | |||
type DeleteShortcodeErrors = "shortcode/not_found" | ||||
export const createShortcode = (request: HoppRESTRequest) => | export const createShortcode = (request: HoppRESTRequest) => | |||
runMutation<CreateShortcodeMutation, CreateShortcodeMutationVariables, "">( | runMutation<CreateShortcodeMutation, CreateShortcodeMutationVariables, "">( | |||
CreateShortcodeDocument, | CreateShortcodeDocument, | |||
{ | { | |||
request: JSON.stringify(request), | request: JSON.stringify(request), | |||
} | } | |||
) | ) | |||
export const deleteShortcode = (code: string) => | ||||
runMutation< | ||||
DeleteShortcodeMutation, | ||||
DeleteShortcodeMutationVariables, | ||||
DeleteShortcodeErrors | ||||
>(DeleteShortcodeDocument, { | ||||
code, | ||||
}) | ||||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 5 lines changed or added |