xref: /aosp_15_r20/external/googleapis/google/firebase/fcm/connection/v1alpha1/connection_api.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2019 Google LLC.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15
16syntax = "proto3";
17
18package google.firebase.fcm.connection.v1alpha1;
19
20import "google/api/annotations.proto";
21import "google/protobuf/timestamp.proto";
22
23option go_package = "google.golang.org/genproto/googleapis/firebase/fcm/connection/v1alpha1;connection";
24option java_multiple_files = true;
25option java_package = "com.google.firebase.fcm.connection.v1alpha1";
26
27// FCM's service to create client connections to send/receive messages.
28service ConnectionApi {
29  // Creates a streaming connection with FCM to send messages and their
30  // respective ACKs.
31  //
32  // The client credentials need to be passed in the [gRPC
33  // Metadata](https://grpc.io/docs/guides/concepts.html#metadata). The Format
34  // of the header is:
35  //   Key: "authorization"
36  //   Value: "Checkin [client_id:secret]"
37  //
38  //
39  // The project's API key also needs to be sent to authorize the project.
40  // That can be set in the X-Goog-Api-Key Metadata header.
41  rpc Connect(stream UpstreamRequest) returns (stream DownstreamResponse) {
42  }
43}
44
45// Request sent to FCM from the connected client.
46message UpstreamRequest {
47  // The type of request the client is making to FCM.
48  oneof request_type {
49    // Message acknowledgement.
50    Ack ack = 1;
51  }
52}
53
54// Response sent to the connected client from FCM.
55message DownstreamResponse {
56  // The type of response FCM is sending to the client.
57  oneof response_type {
58    // Message sent to FCM via the [Send
59    // API](https://firebase.google.com/docs/cloud-messaging/send-message)
60    // targeting this client.
61    Message message = 1;
62  }
63}
64
65// Acknowledgement to indicate a client successfully received an FCM message.
66//
67// If a message is not acked, FCM will continously resend the message until
68// it expires. Duplicate delivery in this case is working as intended.
69message Ack {
70  // Id of message being acknowledged
71  string message_id = 1;
72}
73
74// Message created through the [Send
75// API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource-message).
76message Message {
77  // The identifier of the message. Used to ack the message.
78  string message_id = 1;
79
80  // Time the message was received in FCM.
81  google.protobuf.Timestamp create_time = 2;
82
83  // Expiry time of the message. Currently it is always 4 weeks.
84  google.protobuf.Timestamp expire_time = 3;
85
86  // The arbitrary payload set in the [Send
87  // API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource-message).
88  map<string, string> data = 4;
89}
90