-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2115 from bluesky-social/signup-queue-notify
Signup queue notifications
- Loading branch information
Showing
14 changed files
with
1,278 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: v1 | ||
plugins: | ||
- plugin: es | ||
opt: | ||
- target=ts | ||
- import_extension=.ts | ||
out: src/proto | ||
- plugin: connect-es | ||
opt: | ||
- target=ts | ||
- import_extension=.ts | ||
out: src/proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
syntax = "proto3"; | ||
|
||
package courier; | ||
option go_package = "./;courier"; | ||
|
||
import "google/protobuf/struct.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
// | ||
// Messages | ||
// | ||
|
||
// Ping | ||
message PingRequest {} | ||
message PingResponse {} | ||
|
||
// Notifications | ||
|
||
enum AppPlatform { | ||
APP_PLATFORM_UNSPECIFIED = 0; | ||
APP_PLATFORM_IOS = 1; | ||
APP_PLATFORM_ANDROID = 2; | ||
APP_PLATFORM_WEB = 3; | ||
} | ||
|
||
message Notification { | ||
string id = 1; | ||
string recipient_did = 2; | ||
string title = 3; | ||
string message = 4; | ||
string collapse_key = 5; | ||
bool always_deliver = 6; | ||
google.protobuf.Timestamp timestamp = 7; | ||
google.protobuf.Struct additional = 8; | ||
} | ||
|
||
message PushNotificationsRequest { | ||
repeated Notification notifications = 1; | ||
} | ||
|
||
message PushNotificationsResponse {} | ||
|
||
message RegisterDeviceTokenRequest { | ||
string did = 1; | ||
string token = 2; | ||
string app_id = 3; | ||
AppPlatform platform = 4; | ||
} | ||
|
||
message RegisterDeviceTokenResponse {} | ||
|
||
service Service { | ||
rpc Ping(PingRequest) returns (PingResponse); | ||
rpc PushNotifications(PushNotificationsRequest) returns (PushNotificationsResponse); | ||
rpc RegisterDeviceToken(RegisterDeviceTokenRequest) returns (RegisterDeviceTokenResponse); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Service } from './proto/courier_connect' | ||
import { | ||
Code, | ||
ConnectError, | ||
PromiseClient, | ||
createPromiseClient, | ||
Interceptor, | ||
} from '@connectrpc/connect' | ||
import { | ||
createConnectTransport, | ||
ConnectTransportOptions, | ||
} from '@connectrpc/connect-node' | ||
|
||
export type CourierClient = PromiseClient<typeof Service> | ||
|
||
export const createCourierClient = ( | ||
opts: ConnectTransportOptions, | ||
): CourierClient => { | ||
const transport = createConnectTransport(opts) | ||
return createPromiseClient(Service, transport) | ||
} | ||
|
||
export { Code } | ||
|
||
export const isCourierError = ( | ||
err: unknown, | ||
code?: Code, | ||
): err is ConnectError => { | ||
if (err instanceof ConnectError) { | ||
return !code || err.code === code | ||
} | ||
return false | ||
} | ||
|
||
export const authWithApiKey = | ||
(apiKey: string): Interceptor => | ||
(next) => | ||
(req) => { | ||
req.header.set('authorization', `Bearer ${apiKey}`) | ||
return next(req) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.