Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data PrincipalTag
- type family PrincipalId (tag :: PrincipalTag) = (id :: Type) | id -> tag where ...
- type family ApplyPrincipalPath (tag :: PrincipalTag) api
- type AssetLocationHeader r = '[DescHeader "Location" "Asset location" (AssetLocation r)]
- type AssetRedirect = WithHeaders (AssetLocationHeader Absolute) (AssetLocation Absolute) (RespondEmpty 302 "Asset found")
- type AssetStreaming = RespondStreaming 200 "Asset returned directly with content type `application/octet-stream`" OctetStream
- type GetAsset = MultiVerb 'GET '[JSON] '[ErrorResponse 'AssetNotFound, AssetRedirect] (Maybe (AssetLocation Absolute))
- type CargoholdAPI = (Summary "Renew an asset token" :> (Until 'V2 :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (ZLocalUser :> ("assets" :> ("v3" :> (Capture "key" AssetKey :> ("token" :> Post '[JSON] NewAssetToken))))))))) :<|> ((Summary "Delete an asset token" :> (Until 'V2 :> (Description "**Note**: deleting the token makes the asset public." :> (ZLocalUser :> ("assets" :> ("v3" :> (Capture "key" AssetKey :> ("token" :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset token deleted"] ())))))))) :<|> (BaseAPIv3 'UserPrincipalTag :<|> (BaseAPIv3 'BotPrincipalTag :<|> (BaseAPIv3 'ProviderPrincipalTag :<|> (QualifiedAPI :<|> (LegacyAPI :<|> MainAPI))))))
- type BaseAPIv3 (tag :: PrincipalTag) = (Summary "Upload an asset" :> (CanThrow 'AssetTooLarge :> (CanThrow 'InvalidLength :> (tag :> (AssetBody :> MultiVerb 'POST '[JSON] '[WithHeaders (AssetLocationHeader Relative) (Asset, AssetLocation Relative) (Respond 201 "Asset posted" Asset)] (Asset, AssetLocation Relative)))))) :<|> ((Summary "Download an asset" :> (tag :> (Capture "key" AssetKey :> (Header "Asset-Token" AssetToken :> (QueryParam "asset_token" AssetToken :> (ZHostOpt :> GetAsset)))))) :<|> (Summary "Delete an asset" :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (tag :> (Capture "key" AssetKey :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset deleted"] ()))))))
- type QualifiedAPI = (Summary "Download an asset" :> (Until 'V2 :> (Description "**Note**: local assets result in a redirect, while remote assets are streamed directly." :> (ZLocalUser :> ("assets" :> ("v4" :> (QualifiedCapture "key" AssetKey :> (Header "Asset-Token" AssetToken :> (QueryParam "asset_token" AssetToken :> (ZHostOpt :> MultiVerb 'GET '() '[ErrorResponse 'AssetNotFound, AssetRedirect, AssetStreaming] (Maybe LocalOrRemoteAsset))))))))))) :<|> (Summary "Delete an asset" :> (Until 'V2 :> (Description "**Note**: only local assets can be deleted." :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (ZLocalUser :> ("assets" :> ("v4" :> (QualifiedCapture "key" AssetKey :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset deleted"] ())))))))))
- type LegacyAPI = (ZLocalUser :> (Until 'V2 :> ("assets" :> (QueryParam' [Required, Strict] "conv_id" ConvId :> (Capture "id" AssetId :> GetAsset))))) :<|> ((ZLocalUser :> (Until 'V2 :> ("conversations" :> (Capture "cnv" ConvId :> ("assets" :> (Capture "id" AssetId :> GetAsset)))))) :<|> (ZLocalUser :> (Until 'V2 :> ("conversations" :> (Capture "cnv" ConvId :> ("otr" :> ("assets" :> (Capture "id" AssetId :> GetAsset))))))))
- type MainAPI = (Summary "Renew an asset token" :> (From 'V2 :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (ZLocalUser :> ("assets" :> (Capture "key" AssetKey :> ("token" :> Post '[JSON] NewAssetToken)))))))) :<|> ((Summary "Delete an asset token" :> (From 'V2 :> (Description "**Note**: deleting the token makes the asset public." :> (ZLocalUser :> ("assets" :> (Capture "key" AssetKey :> ("token" :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset token deleted"] ()))))))) :<|> ((Summary "Upload an asset" :> (From 'V2 :> (CanThrow 'AssetTooLarge :> (CanThrow 'InvalidLength :> (ZLocalUser :> ("assets" :> (AssetBody :> MultiVerb 'POST '[JSON] '[WithHeaders (AssetLocationHeader Relative) (Asset, AssetLocation Relative) (Respond 201 "Asset posted" Asset)] (Asset, AssetLocation Relative)))))))) :<|> ((Summary "Download an asset" :> (From 'V2 :> (Description "**Note**: local assets result in a redirect, while remote assets are streamed directly." :> (CanThrow 'NoMatchingAssetEndpoint :> (ZLocalUser :> ("assets" :> (QualifiedCapture "key" AssetKey :> (Header "Asset-Token" AssetToken :> (QueryParam "asset_token" AssetToken :> (ZHostOpt :> MultiVerb 'GET '() '[ErrorResponse 'AssetNotFound, AssetRedirect, AssetStreaming] (Maybe LocalOrRemoteAsset))))))))))) :<|> (Summary "Delete an asset" :> (From 'V2 :> (Description "**Note**: only local assets can be deleted." :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (ZLocalUser :> ("assets" :> (QualifiedCapture "key" AssetKey :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset deleted"] ())))))))))))
- data CargoholdAPITag
Documentation
data PrincipalTag Source #
Instances
Show PrincipalTag Source # | |
Defined in Wire.API.Routes.Public.Cargohold showsPrec :: Int -> PrincipalTag -> ShowS # show :: PrincipalTag -> String # showList :: [PrincipalTag] -> ShowS # | |
Eq PrincipalTag Source # | |
Defined in Wire.API.Routes.Public.Cargohold (==) :: PrincipalTag -> PrincipalTag -> Bool # (/=) :: PrincipalTag -> PrincipalTag -> Bool # | |
RoutesToPaths (ApplyPrincipalPath tag api) => RoutesToPaths (tag :> api :: Type) Source # | |
Defined in Wire.API.Routes.Public.Cargohold | |
HasServer (ApplyPrincipalPath tag api) ctx => HasServer (tag :> api :: Type) ctx Source # | |
Defined in Wire.API.Routes.Public.Cargohold | |
type SpecialiseToVersion v (tag :> api) Source # | |
Defined in Wire.API.Routes.Public.Cargohold | |
type ServerT (tag :> api :: Type) m Source # | |
Defined in Wire.API.Routes.Public.Cargohold |
type family PrincipalId (tag :: PrincipalTag) = (id :: Type) | id -> tag where ... Source #
type family ApplyPrincipalPath (tag :: PrincipalTag) api Source #
Instances
type ApplyPrincipalPath 'BotPrincipalTag api Source # | |
Defined in Wire.API.Routes.Public.Cargohold | |
type ApplyPrincipalPath 'ProviderPrincipalTag api Source # | |
Defined in Wire.API.Routes.Public.Cargohold | |
type ApplyPrincipalPath 'UserPrincipalTag api Source # | |
Defined in Wire.API.Routes.Public.Cargohold type ApplyPrincipalPath 'UserPrincipalTag api = ZLocalUser :> (Until 'V2 :> ("assets" :> ("v3" :> api))) |
type AssetLocationHeader r = '[DescHeader "Location" "Asset location" (AssetLocation r)] Source #
type AssetRedirect = WithHeaders (AssetLocationHeader Absolute) (AssetLocation Absolute) (RespondEmpty 302 "Asset found") Source #
type AssetStreaming = RespondStreaming 200 "Asset returned directly with content type `application/octet-stream`" OctetStream Source #
type GetAsset = MultiVerb 'GET '[JSON] '[ErrorResponse 'AssetNotFound, AssetRedirect] (Maybe (AssetLocation Absolute)) Source #
type CargoholdAPI = (Summary "Renew an asset token" :> (Until 'V2 :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (ZLocalUser :> ("assets" :> ("v3" :> (Capture "key" AssetKey :> ("token" :> Post '[JSON] NewAssetToken))))))))) :<|> ((Summary "Delete an asset token" :> (Until 'V2 :> (Description "**Note**: deleting the token makes the asset public." :> (ZLocalUser :> ("assets" :> ("v3" :> (Capture "key" AssetKey :> ("token" :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset token deleted"] ())))))))) :<|> (BaseAPIv3 'UserPrincipalTag :<|> (BaseAPIv3 'BotPrincipalTag :<|> (BaseAPIv3 'ProviderPrincipalTag :<|> (QualifiedAPI :<|> (LegacyAPI :<|> MainAPI)))))) Source #
type BaseAPIv3 (tag :: PrincipalTag) = (Summary "Upload an asset" :> (CanThrow 'AssetTooLarge :> (CanThrow 'InvalidLength :> (tag :> (AssetBody :> MultiVerb 'POST '[JSON] '[WithHeaders (AssetLocationHeader Relative) (Asset, AssetLocation Relative) (Respond 201 "Asset posted" Asset)] (Asset, AssetLocation Relative)))))) :<|> ((Summary "Download an asset" :> (tag :> (Capture "key" AssetKey :> (Header "Asset-Token" AssetToken :> (QueryParam "asset_token" AssetToken :> (ZHostOpt :> GetAsset)))))) :<|> (Summary "Delete an asset" :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (tag :> (Capture "key" AssetKey :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset deleted"] ())))))) Source #
Asset API for a given principal (userbotprovider).
This was introduced before API versioning, and the user endpoints contain a v3 suffix, which is removed starting from API V2.
type QualifiedAPI = (Summary "Download an asset" :> (Until 'V2 :> (Description "**Note**: local assets result in a redirect, while remote assets are streamed directly." :> (ZLocalUser :> ("assets" :> ("v4" :> (QualifiedCapture "key" AssetKey :> (Header "Asset-Token" AssetToken :> (QueryParam "asset_token" AssetToken :> (ZHostOpt :> MultiVerb 'GET '() '[ErrorResponse 'AssetNotFound, AssetRedirect, AssetStreaming] (Maybe LocalOrRemoteAsset))))))))))) :<|> (Summary "Delete an asset" :> (Until 'V2 :> (Description "**Note**: only local assets can be deleted." :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (ZLocalUser :> ("assets" :> ("v4" :> (QualifiedCapture "key" AssetKey :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset deleted"] ()))))))))) Source #
Qualified asset API. Only download and delete endpoints are supported, as upload has stayed unqualified. These endpoints also predate API versioning, and contain a v4 suffix.
type LegacyAPI = (ZLocalUser :> (Until 'V2 :> ("assets" :> (QueryParam' [Required, Strict] "conv_id" ConvId :> (Capture "id" AssetId :> GetAsset))))) :<|> ((ZLocalUser :> (Until 'V2 :> ("conversations" :> (Capture "cnv" ConvId :> ("assets" :> (Capture "id" AssetId :> GetAsset)))))) :<|> (ZLocalUser :> (Until 'V2 :> ("conversations" :> (Capture "cnv" ConvId :> ("otr" :> ("assets" :> (Capture "id" AssetId :> GetAsset)))))))) Source #
type MainAPI = (Summary "Renew an asset token" :> (From 'V2 :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (ZLocalUser :> ("assets" :> (Capture "key" AssetKey :> ("token" :> Post '[JSON] NewAssetToken)))))))) :<|> ((Summary "Delete an asset token" :> (From 'V2 :> (Description "**Note**: deleting the token makes the asset public." :> (ZLocalUser :> ("assets" :> (Capture "key" AssetKey :> ("token" :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset token deleted"] ()))))))) :<|> ((Summary "Upload an asset" :> (From 'V2 :> (CanThrow 'AssetTooLarge :> (CanThrow 'InvalidLength :> (ZLocalUser :> ("assets" :> (AssetBody :> MultiVerb 'POST '[JSON] '[WithHeaders (AssetLocationHeader Relative) (Asset, AssetLocation Relative) (Respond 201 "Asset posted" Asset)] (Asset, AssetLocation Relative)))))))) :<|> ((Summary "Download an asset" :> (From 'V2 :> (Description "**Note**: local assets result in a redirect, while remote assets are streamed directly." :> (CanThrow 'NoMatchingAssetEndpoint :> (ZLocalUser :> ("assets" :> (QualifiedCapture "key" AssetKey :> (Header "Asset-Token" AssetToken :> (QueryParam "asset_token" AssetToken :> (ZHostOpt :> MultiVerb 'GET '() '[ErrorResponse 'AssetNotFound, AssetRedirect, AssetStreaming] (Maybe LocalOrRemoteAsset))))))))))) :<|> (Summary "Delete an asset" :> (From 'V2 :> (Description "**Note**: only local assets can be deleted." :> (CanThrow 'AssetNotFound :> (CanThrow 'Unauthorised :> (ZLocalUser :> ("assets" :> (QualifiedCapture "key" AssetKey :> MultiVerb 'DELETE '[JSON] '[RespondEmpty 200 "Asset deleted"] ()))))))))))) Source #
With API versioning, the previous ad-hoc v3/v4 versioning is abandoned, and asset endpoints are versioned normally as part of the public API, without any explicit prefix.
data CargoholdAPITag Source #
Instances
ServiceAPI CargoholdAPITag v Source # | |
Defined in Wire.API.Routes.Public.Cargohold | |
type ServiceAPIRoutes CargoholdAPITag Source # | |
Defined in Wire.API.Routes.Public.Cargohold | |
type SpecialisedAPIRoutes v CargoholdAPITag Source # | |