unison-share-api-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Server.CodebaseServer

Synopsis

Documentation

data HTML Source #

Constructors

HTML 

Instances

Instances details
Accept HTML Source # 
Instance details

Defined in Unison.Server.CodebaseServer

MimeRender HTML RawHtml Source # 
Instance details

Defined in Unison.Server.CodebaseServer

newtype RawHtml Source #

Constructors

RawHtml 

Fields

Instances

Instances details
MimeRender HTML RawHtml Source # 
Instance details

Defined in Unison.Server.CodebaseServer

type OpenApiJSON = "openapi.json" :> Get '[JSON] OpenApi Source #

type UnisonLocalAPI = ("projects" :> ProjectsAPI) :<|> ("ucm" :> UCMAPI) Source #

type StaticAPI = "static" :> Raw Source #

type Authed api = Capture "token" Text :> api Source #

data BaseUrl Source #

Constructors

BaseUrl 

Instances

Instances details
Show BaseUrl Source # 
Instance details

Defined in Unison.Server.CodebaseServer

data URISegment Source #

Constructors

EscapeMe Text 
DontEscape Text 

Instances

Instances details
Show URISegment Source # 
Instance details

Defined in Unison.Server.CodebaseServer

urlFor :: Service -> BaseUrl -> Text Source #

Create a Service URL, either for the UI or the API

Examples:

>>> urlFor Api (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 })
"http://localhost:1234/asdf/api"

Loose code with definition but no perspective >>> import qualified Unison.Syntax.Name as Name >>> let service = LooseCodeUI (Path.absoluteEmpty) (Just (TermReference (NameOnly (Name.unsafeFromText "base.data.List.map")))) >>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 }) >>> urlFor service baseUrl "http://localhost:1234/asdf/ui/non-project-code/latest/terms/base/data/List/map"

Loose code with definition and perspective >>> import qualified Unison.Syntax.Name as Name >>> let service = LooseCodeUI (Path.Absolute (Path.fromText "base.data")) (Just (TermReference (NameOnly (Name.unsafeFromText "List.map")))) >>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 }) >>> urlFor service baseUrl "http://localhost:1234/asdf/ui/non-project-code/latest/namespaces/base/data/;/terms/List/map"

Project with definition but no perspective >>> import qualified Unison.Syntax.Name as Name >>> import Unison.Core.Project (ProjectName (..), ProjectBranchName (..), ProjectAndBranch (..)) >>> let service = ProjectBranchUI (ProjectAndBranch (UnsafeProjectName "base") (UnsafeProjectBranchName "main")) (Path.empty) (Just (TermReference (NameOnly (Name.unsafeFromText "List.map")))) >>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 }) >>> urlFor service baseUrl "http://localhost:1234/asdf/ui/projects/base/main/latest/terms/List/map"

Project with definition but no perspective, contributor branch >>> import qualified Unison.Syntax.Name as Name >>> import Unison.Core.Project (ProjectName (..), ProjectBranchName (..), ProjectAndBranch (..)) >>> let service = ProjectBranchUI (ProjectAndBranch (UnsafeProjectName "unison/base") (UnsafeProjectBranchName "runarorama/contribution")) (Path.empty) (Just (TermReference (NameOnly (Name.unsafeFromText "List.map")))) >>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 }) >>> urlFor service baseUrl "http://localhost:1234/asdf/ui/projects/@unison/base/@runarorama/contribution/latest/terms/List/map"

Project with definition and perspective >>> import qualified Unison.Syntax.Name as Name >>> import Unison.Core.Project (ProjectName (..), ProjectBranchName (..), ProjectAndBranch (..)) >>> let service = ProjectBranchUI (ProjectAndBranch (UnsafeProjectName "unison/base") (UnsafeProjectBranchName "runarorama/contribution")) (Path.fromList ["data"]) (Just (TermReference (NameOnly (Name.unsafeFromText "List.map")))) >>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 }) >>> urlFor service baseUrl "http://localhost:1234/asdf/ui/projects/@unison/base/@runarorama/contribution/latest/namespaces/data/;/terms/List/map"

genToken :: IO ByteString Source #

The Token is used to help prevent multiple users on a machine gain access to each others codebases.

Generate a cryptographically secure random token. https://neilmadden.blog/2018/08/30/moving-away-from-uuids/

E.g. >>> genToken "uxf85C7Y0B6om47"

data Waiter a Source #

Constructors

Waiter 

Fields

hoistWithAuth :: forall api. HasServer api '[] => Proxy api -> ByteString -> ServerT api Handler -> ServerT (Authed api) Handler Source #

Orphan instances

ToSample Char Source # 
Instance details

Methods

toSamples :: Proxy Char -> [(Text, Char)] #

ToParam (QueryParam' mods "newBranchRef" a :: Type) Source # 
Instance details

Methods

toParam :: Proxy (QueryParam' mods "newBranchRef" a) -> DocQueryParam #

ToParam (QueryParam' mods "newTerm" a :: Type) Source # 
Instance details

Methods

toParam :: Proxy (QueryParam' mods "newTerm" a) -> DocQueryParam #

ToParam (QueryParam' mods "newType" a :: Type) Source # 
Instance details

Methods

toParam :: Proxy (QueryParam' mods "newType" a) -> DocQueryParam #

ToParam (QueryParam' mods "oldBranchRef" a :: Type) Source # 
Instance details

Methods

toParam :: Proxy (QueryParam' mods "oldBranchRef" a) -> DocQueryParam #

ToParam (QueryParam' mods "oldTerm" a :: Type) Source # 
Instance details

Methods

toParam :: Proxy (QueryParam' mods "oldTerm" a) -> DocQueryParam #

ToParam (QueryParam' mods "oldType" a :: Type) Source # 
Instance details

Methods

toParam :: Proxy (QueryParam' mods "oldType" a) -> DocQueryParam #