Skip to content

Commit 7ace63f

Browse files
committed
Move cannon's internal API type to wire-api
1 parent 99527b9 commit 7ace63f

File tree

51 files changed

+136
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+136
-120
lines changed

libs/gundeck-types/gundeck-types.cabal

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cabal-version: 1.12
44
--
55
-- see: https://github.com/sol/hpack
66
--
7-
-- hash: 5ecbff5b5248085ccaf245621fb9388ff13a1cdace8dff356ea98ccd1cb72a03
7+
-- hash: 738b7369cd6cbbf07382a5645aa9c475292f016888ee76c40569aa56d24d9cae
88

99
name: gundeck-types
1010
version: 1.45.0
@@ -20,10 +20,8 @@ build-type: Simple
2020
library
2121
exposed-modules:
2222
Gundeck.Types
23-
Gundeck.Types.BulkPush
2423
Gundeck.Types.Common
2524
Gundeck.Types.Event
26-
Gundeck.Types.Notification
2725
Gundeck.Types.Presence
2826
Gundeck.Types.Push
2927
Gundeck.Types.Push.V2

libs/gundeck-types/src/Gundeck/Types.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ module Gundeck.Types
2121
where
2222

2323
import Gundeck.Types.Event as G
24-
import Gundeck.Types.Notification as G
2524
import Gundeck.Types.Presence as G
2625
import Gundeck.Types.Push as G

libs/tasty-cannon/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ dependencies:
1616
- bytestring
1717
- bytestring-conversion
1818
- data-timeout
19-
- gundeck-types
2019
- exceptions
2120
- http-client >=0.5
2221
- http-types
@@ -25,5 +24,6 @@ dependencies:
2524
- tasty-hunit >=0.9
2625
- types-common >=0.16
2726
- websockets >=0.8
27+
- wire-api
2828
library:
2929
source-dirs: src

libs/tasty-cannon/src/Test/Tasty/Cannon.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ import Data.ByteString.Conversion
8383
import Data.Id
8484
import Data.List1
8585
import Data.Timeout (Timeout, TimeoutUnit (..), (#))
86-
import Gundeck.Types
8786
import Imports
8887
import Network.HTTP.Client
8988
import qualified Network.HTTP.Client as Http
9089
import Network.HTTP.Types.Status
9190
import qualified Network.WebSockets as WS
9291
import System.Random (randomIO)
9392
import Test.Tasty.HUnit
93+
import Wire.API.Internal.Notification
9494

9595
type Cannon = Http.Request -> Http.Request
9696

libs/tasty-cannon/tasty-cannon.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cabal-version: 1.12
44
--
55
-- see: https://github.com/sol/hpack
66
--
7-
-- hash: 33f3a557e5296946dc5929fd741dfa0bb68e83484e1760cd425204e7defec8af
7+
-- hash: be26c1ad508de205143282797883e24b2b8ba5dad64b576df52e8c2665bb3c32
88

99
name: tasty-cannon
1010
version: 0.4.0
@@ -73,12 +73,12 @@ library
7373
, bytestring-conversion
7474
, data-timeout
7575
, exceptions
76-
, gundeck-types
7776
, http-client >=0.5
7877
, http-types
7978
, imports
8079
, random
8180
, tasty-hunit >=0.9
8281
, types-common >=0.16
8382
, websockets >=0.8
83+
, wire-api
8484
default-language: Haskell2010

libs/gundeck-types/src/Gundeck/Types/BulkPush.hs renamed to libs/wire-api/src/Wire/API/Internal/BulkPush.hs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
{-# LANGUAGE DeriveGeneric #-}
2-
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3-
{-# LANGUAGE OverloadedStrings #-}
41
{-# LANGUAGE TemplateHaskell #-}
52

63
-- This file is part of the Wire Server implementation.
@@ -20,17 +17,13 @@
2017
-- You should have received a copy of the GNU Affero General Public License along
2118
-- with this program. If not, see <https://www.gnu.org/licenses/>.
2219

23-
-- | This module defines the types used by the Cannon API. It is contained in package gundeck-types
24-
-- for the pragmatic reason that it allows us to re-use types from the gundeck API. (This move can
25-
-- be justified by picturing Cannon as a local service that makes only sense in the context of a
26-
-- Gundeck.)
27-
module Gundeck.Types.BulkPush where
20+
module Wire.API.Internal.BulkPush where
2821

2922
import Data.Aeson
3023
import Data.Aeson.TH (deriveJSON)
3124
import Data.Id
32-
import Gundeck.Types.Notification
3325
import Imports
26+
import Wire.API.Internal.Notification
3427

3528
data PushTarget = PushTarget
3629
{ ptUserId :: !UserId,

libs/gundeck-types/src/Gundeck/Types/Notification.hs renamed to libs/wire-api/src/Wire/API/Internal/Notification.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# LANGUAGE OverloadedStrings #-}
21
{-# LANGUAGE TemplateHaskell #-}
32

43
-- This file is part of the Wire Server implementation.
@@ -18,7 +17,7 @@
1817
-- You should have received a copy of the GNU Affero General Public License along
1918
-- with this program. If not, see <https://www.gnu.org/licenses/>.
2019

21-
module Gundeck.Types.Notification
20+
module Wire.API.Internal.Notification
2221
( -- * Notification
2322
Notification (..),
2423
NotificationId,
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
module Wire.API.Routes.Internal.Cannon where
2+
3+
import Data.Id
4+
import Imports
5+
import Servant
6+
import Wire.API.Error
7+
import Wire.API.Error.Cannon
8+
import Wire.API.Internal.BulkPush
9+
import Wire.API.RawJson
10+
import Wire.API.Routes.MultiVerb
11+
import Wire.API.Routes.Named
12+
13+
type API =
14+
"i"
15+
:> ( Named
16+
"get-status"
17+
( "status"
18+
:> MultiVerb
19+
'GET
20+
'[PlainText]
21+
'[RespondEmpty 200 "Service is alive."]
22+
()
23+
)
24+
:<|> Named
25+
"push-notification"
26+
( "push"
27+
:> Capture "user" UserId
28+
:> Capture "conn" ConnId
29+
:> ReqBody '[JSON] RawJson
30+
:> MultiVerb
31+
'POST
32+
'[JSON]
33+
'[ ErrorResponse 'ClientGone,
34+
RespondEmpty 200 "Successfully pushed."
35+
]
36+
(Maybe ())
37+
)
38+
:<|> Named
39+
"bulk-push-notifications"
40+
( "bulkpush"
41+
:> ReqBody '[JSON] BulkPushRequest
42+
:> Post '[JSON] BulkPushResponse
43+
)
44+
:<|> Named
45+
"check-presence"
46+
( "presences"
47+
:> Capture "uid" UserId
48+
:> Capture "conn" ConnId
49+
:> MultiVerb
50+
'HEAD
51+
'[JSON]
52+
'[ ErrorResponse 'PresenceNotRegistered,
53+
RespondEmpty 200 "Presence checked successfully."
54+
]
55+
(Maybe ())
56+
)
57+
)

libs/wire-api/wire-api.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ library
4141
Wire.API.Event.Conversation
4242
Wire.API.Event.FeatureConfig
4343
Wire.API.Event.Team
44+
Wire.API.Internal.BulkPush
45+
Wire.API.Internal.Notification
4446
Wire.API.Message
4547
Wire.API.Message.Proto
4648
Wire.API.MLS.CipherSuite
@@ -69,6 +71,7 @@ library
6971
Wire.API.Routes.Internal.Brig
7072
Wire.API.Routes.Internal.Brig.Connection
7173
Wire.API.Routes.Internal.Brig.EJPD
74+
Wire.API.Routes.Internal.Cannon
7275
Wire.API.Routes.Internal.Cargohold
7376
Wire.API.Routes.Internal.Galley.TeamFeatureNoConfigMulti
7477
Wire.API.Routes.Internal.LegalHold

services/brig/test/integration/API/Provider.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ import Galley.Types
7070
import Galley.Types.Bot (ServiceRef, newServiceRef, serviceRefId, serviceRefProvider)
7171
import Galley.Types.Conversations.Roles (roleNameWireAdmin)
7272
import qualified Galley.Types.Teams as Team
73-
import Gundeck.Types.Notification
7473
import Imports hiding (threadDelay)
7574
import Network.HTTP.Types.Status (status200, status201, status400)
7675
import Network.Wai (Application, responseLBS, strictRequestBody)
@@ -89,6 +88,7 @@ import Util
8988
import Web.Cookie (SetCookie (..), parseSetCookie)
9089
import Wire.API.Asset hiding (Asset)
9190
import Wire.API.Event.Conversation
91+
import Wire.API.Internal.Notification
9292
import qualified Wire.API.Team.Feature as Public
9393

9494
tests :: Domain -> Config -> Manager -> DB.ClientState -> Brig -> Cannon -> Galley -> IO TestTree

0 commit comments

Comments
 (0)