{"id":31813655,"url":"https://github.com/haskell-miso/servant-miso-client","last_synced_at":"2025-10-11T08:20:27.578Z","repository":{"id":312779982,"uuid":"1048709961","full_name":"haskell-miso/servant-miso-client","owner":"haskell-miso","description":"🍜 A servant-client interpretation for miso","archived":false,"fork":false,"pushed_at":"2025-09-01T23:45:36.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-02T01:06:35.177Z","etag":null,"topics":["haskell","miso","servant","servant-client"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haskell-miso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"open_collective":"miso","github":["dmjio"]}},"created_at":"2025-09-01T22:46:02.000Z","updated_at":"2025-09-01T23:45:38.000Z","dependencies_parsed_at":"2025-09-02T01:06:38.479Z","dependency_job_id":"9dc39df0-be57-40ea-b2cc-dad9bdeaeace","html_url":"https://github.com/haskell-miso/servant-miso-client","commit_stats":null,"previous_names":["haskell-miso/servant-miso-client"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/haskell-miso/servant-miso-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-miso%2Fservant-miso-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-miso%2Fservant-miso-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-miso%2Fservant-miso-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-miso%2Fservant-miso-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haskell-miso","download_url":"https://codeload.github.com/haskell-miso/servant-miso-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-miso%2Fservant-miso-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006769,"owners_count":26084148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","miso","servant","servant-client"],"created_at":"2025-10-11T08:20:25.365Z","updated_at":"2025-10-11T08:20:27.571Z","avatar_url":"https://github.com/haskell-miso.png","language":"Haskell","funding_links":["https://opencollective.com/miso","https://github.com/sponsors/dmjio"],"categories":[],"sub_categories":[],"readme":"🍜 servant-miso-client\n===================================\n\nThis is a [servant-client](https://github.com/haskell-servant/servant) binding to [miso](https://github.com/dmjio/miso).\n\n\n```haskell\n-----------------------------------------------------------------------------\n{-# LANGUAGE OverloadedStrings #-}\n{-# LANGUAGE TypeApplications  #-}\n{-# LANGUAGE RecordWildCards   #-}\n{-# LANGUAGE TypeOperators     #-}\n{-# LANGUAGE DataKinds         #-}\n{-# LANGUAGE LambdaCase        #-}\n-----------------------------------------------------------------------------\nmodule Main where\n-----------------------------------------------------------------------------\nimport Miso\nimport Miso.Html.Element as H\nimport Miso.Html.Event as H\n-----------------------------------------------------------------------------\nimport Data.Aeson\nimport Data.Proxy\nimport Servant.Miso.Client\nimport Servant.API\n-----------------------------------------------------------------------------\nmain :: IO ()\nmain = run $ startComponent myComponent\n  { initialAction = Just Start\n  }\n-----------------------------------------------------------------------------\ntype MyComponent = App () Action\n-----------------------------------------------------------------------------\nmyComponent :: MyComponent\nmyComponent = component () update_ $ \\() -\u003e\n  H.div_ []\n  [ button_ [ onClick Download ] [ \"download\" ]\n  ] where\n      update_ = \\case\n        Download -\u003e do\n          io_ (consoleLog \"clicked\")\n          downloadGithub Downloaded DownloadError\n        DownloadError Response {..} -\u003e io_ $ do\n          consoleError $ ms (show errorMessage)\n        Downloaded Response {..} -\u003e io_ $ do\n          consoleLog $ ms $ show body\n        Start -\u003e io_ $ do\n          consoleLog \"starting...\"\n-----------------------------------------------------------------------------\ndata Action\n  = Downloaded (Response Value)\n  | DownloadError (Response MisoString)\n  | Download\n  | Start\n-----------------------------------------------------------------------------\ntype API = UploadFile :\u003c|\u003e DownloadFile\n-----------------------------------------------------------------------------\ntype UploadFile\n  = \"api\" :\u003e \"upload\" :\u003e \"file1\" :\u003e ReqBody '[OctetStream] File :\u003e PostNoContent\n-----------------------------------------------------------------------------\ntype DownloadFile\n  = \"api\" :\u003e \"download\" :\u003e \"file1\" :\u003e QueryParam \"foo\" MisoString :\u003e Get '[OctetStream] File\n-----------------------------------------------------------------------------\nuploadFile\n  :: File\n  -- ^ File to upload\n  -\u003e (Response () -\u003e Action)\n  -- ^ Successful callback (expecting no response)\n  -\u003e (Response MisoString -\u003e Action)\n  -- ^ Errorful callback, with error message as param\n  -\u003e Transition () Action\n-----------------------------------------------------------------------------\ndownloadFile\n  :: Maybe MisoString\n  -\u003e (Response File -\u003e Action)\n  -- ^ Received file\n  -\u003e (Response MisoString -\u003e Action)\n  -- ^ Error message\n  -\u003e Transition () Action\n-----------------------------------------------------------------------------\nuploadFile :\u003c|\u003e downloadFile = toClient mempty (Proxy @MyComponent) (Proxy @API)\n-----------------------------------------------------------------------------\ntype GitHubAPI = Get '[JSON] Value\n-----------------------------------------------------------------------------\ndownloadGithub :: (Response Value -\u003e Action) -\u003e (Response MisoString -\u003e Action) -\u003e Effect ROOT () Action\ndownloadGithub = toClient \"https://api.github.com\" (Proxy @MyComponent) (Proxy @GitHubAPI)\n-----------------------------------------------------------------------------\n```\n\n### Build\n\n```bash\ncabal build\n```\n\n### Dev\n\n```bash\ncabal build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell-miso%2Fservant-miso-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaskell-miso%2Fservant-miso-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell-miso%2Fservant-miso-client/lists"}