refactor: move collection data structures and utility functions to hopp/data

This commit is contained in:
Andrew Bastin
2022-01-20 23:55:23 +05:30
parent 6b0494ddba
commit 5043606701
17 changed files with 156 additions and 124 deletions

View File

@@ -3,13 +3,14 @@ import * as TE from "fp-ts/TaskEither"
import * as TO from "fp-ts/TaskOption"
import * as O from "fp-ts/Option"
import axios from "axios"
import { HoppRESTRequest } from "@hoppscotch/data"
import { HoppRESTRequest, HoppCollection } from "@hoppscotch/data"
import { step } from "../steps"
import { defineImporter, IMPORTER_INVALID_FILE_FORMAT } from "."
import { Collection } from "~/newstore/collections"
// TODO: Add validation to output
const fetchGist = (url: string): TO.TaskOption<Collection<HoppRESTRequest>> =>
const fetchGist = (
url: string
): TO.TaskOption<HoppCollection<HoppRESTRequest>> =>
pipe(
TO.tryCatch(() =>
axios.get(`https://api.github.com/gists/${url.split("/").pop()}`, {