|
1 | 1 | module Fission.Web.API.App.Update.Streaming.Types where
|
2 | 2 |
|
| 3 | +import qualified Network.IPFS.CID.Types as IPFS |
3 | 4 | import Servant.API
|
4 |
| -import Servant.Types.SourceT |
5 |
| - |
6 |
| -import qualified Network.IPFS.CID.Types as IPFS |
7 | 5 |
|
| 6 | +import Fission.BytesReceived.Types |
8 | 7 | import Fission.URL.Types
|
9 |
| - |
10 |
| -import Fission.Prelude |
11 |
| - |
12 |
| -import qualified Fission.Web.API.Auth.Types as Auth |
13 |
| -import Fission.Web.API.Prelude |
14 |
| - |
15 |
| - |
16 |
| - |
17 |
| - |
18 |
| - |
19 |
| -import Data.Swagger hiding (URL, url) |
20 |
| -import Servant.Types.SourceT as S |
21 |
| -import Streamly.Prelude |
| 8 | +import qualified Fission.Web.API.Auth.Types as Auth |
22 | 9 |
|
23 | 10 | type StreamingUpdate
|
24 |
| - = Summary "" -- FIXME |
25 |
| - :> Description "" -- FIXME |
| 11 | + = Summary "Set app content & stream upload progress" |
| 12 | + :> Description "Update the content (CID) of an app & stream the progress" |
26 | 13 | --
|
27 |
| - :> Capture "App URL" URL |
28 |
| - :> Capture "New CID" IPFS.CID |
| 14 | + :> Capture "App URL" URL |
| 15 | + :> Capture "New CID" IPFS.CID |
29 | 16 | --
|
30 | 17 | :> Auth.HigherOrder
|
31 | 18 | :> Stream 'PATCH 200 NewlineFraming JSON (SourceIO BytesReceived)
|
32 |
| - |
33 |
| - |
34 |
| -newtype BytesReceived = BytesReceived { byteCount :: Natural } -- FIXME is it bytes? |
35 |
| - deriving (Show, Eq) |
36 |
| - |
37 |
| -instance ToJSON BytesReceived where |
38 |
| - toJSON BytesReceived {..} = object [ "bytes" .= byteCount ] |
39 |
| - |
40 |
| --- ToSchema Fission.Web.API.App.Update.Streaming.Types.BytesReceived |
41 |
| - |
42 |
| -instance ToSchema BytesReceived where -- VERY MUCH FIXME |
43 |
| - declareNamedSchema _ = do |
44 |
| - urls' <- declareSchemaRef $ Proxy @[URL] |
45 |
| - insertedAt' <- declareSchemaRef $ Proxy @UTCTime |
46 |
| - modifiedAt' <- declareSchemaRef $ Proxy @UTCTime |
47 |
| - |
48 |
| - mempty |
49 |
| - |> type_ ?~ SwaggerObject |
50 |
| - |> properties .~ |
51 |
| - [ ("urls", urls') |
52 |
| - , ("insertedAt", insertedAt') |
53 |
| - , ("modifiedAt", modifiedAt') |
54 |
| - ] |
55 |
| - |> required .~ ["username", "email"] |
56 |
| - |> description ?~ "Properties for a registered application" |
57 |
| - |> example ?~ toJSON (BytesReceived 42) |
58 |
| - |> NamedSchema (Just "App Index Payload") |
59 |
| - |> pure |
0 commit comments