feat : smart tree component (#2865)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
Nivedin
2023-01-31 17:15:03 +05:30
committed by GitHub
parent b95e2b365a
commit 2910164d5a
39 changed files with 4483 additions and 4142 deletions

View File

@@ -0,0 +1,34 @@
import axios from "axios"
import * as TE from "fp-ts/TaskEither"
/**
* Create an gist on GitHub with the collection JSON
* @param collectionJSON - JSON string of the collection
* @param accessToken - GitHub access token
* @returns Either of the response of the GitHub Gist API or the error
*/
export const createCollectionGists = (
collectionJSON: string,
accessToken: string
) => {
return TE.tryCatch(
async () =>
axios.post(
"https://api.github.com/gists",
{
files: {
"hoppscotch-collections.json": {
content: collectionJSON,
},
},
},
{
headers: {
Authorization: `token ${accessToken}`,
Accept: "application/vnd.github.v3+json",
},
}
),
(reason) => reason
)
}