Loading api/api.pb.go +386 −219 File changed.Preview size limit exceeded, changes collapsed. Show changes api/api.pb.gw.go +50 −0 Original line number Diff line number Diff line Loading @@ -470,6 +470,23 @@ func request_Nakama_ListFriends_0(ctx context.Context, marshaler runtime.Marshal } var ( filter_Nakama_ListMatches_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_Nakama_ListMatches_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListMatchesRequest var metadata runtime.ServerMetadata if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Nakama_ListMatches_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.ListMatches(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } var ( filter_Nakama_ListNotifications_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) Loading Loading @@ -1557,6 +1574,35 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) mux.Handle("GET", pattern_Nakama_ListMatches_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { select { case <-done: case <-closed: cancel() } }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Nakama_ListMatches_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } forward_Nakama_ListMatches_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Nakama_ListNotifications_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -2046,6 +2092,8 @@ var ( pattern_Nakama_ListFriends_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "friend"}, "")) pattern_Nakama_ListMatches_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "match"}, "")) pattern_Nakama_ListNotifications_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "notification"}, "")) pattern_Nakama_ListStorageObjects_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v2", "storage", "collection"}, "")) Loading Loading @@ -2128,6 +2176,8 @@ var ( forward_Nakama_ListFriends_0 = runtime.ForwardResponseMessage forward_Nakama_ListMatches_0 = runtime.ForwardResponseMessage forward_Nakama_ListNotifications_0 = runtime.ForwardResponseMessage forward_Nakama_ListStorageObjects_0 = runtime.ForwardResponseMessage Loading api/api.proto +36 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,11 @@ service Nakama { option (google.api.http).get = "/v2/friend"; } // Fetch list of running matches. rpc ListMatches (ListMatchesRequest) returns (MatchList) { option (google.api.http).get = "/v2/match"; } // Fetch list of notifications. rpc ListNotifications (ListNotificationsRequest) returns (NotificationList) { option (google.api.http).get = "/v2/notification"; Loading Loading @@ -685,6 +690,19 @@ message LinkFacebookRequest { google.protobuf.BoolValue import = 4; } message ListMatchesRequest { // Limit the number of returned matches. google.protobuf.Int32Value limit = 1; // Authoritative or relayed matches. google.protobuf.BoolValue authoritative = 2; // Label filter. google.protobuf.StringValue label = 3; // Minimum user count. google.protobuf.Int32Value min_size = 4; // Maximum user count. google.protobuf.Int32Value max_size = 5; } // Get a list of unexpired notifications. message ListNotificationsRequest { // The number of notifications to get. Between 1 and 100. Loading @@ -705,6 +723,24 @@ message ListStorageObjectsRequest { string cursor = 4; // value from StorageObjectList.cursor. } // Represents a realtime match. message Match { // The ID of the match, can be used to join. string match_id = 1; // True if it's an server-managed authoritative match, false otherwise. bool authoritative = 2; // Match label, if any. google.protobuf.StringValue label = 3; // Current number of users in the match. int32 size = 4; } // A list of realtime matches. message MatchList { // A number of matches corresponding to a list operation. repeated Match matches = 1; } // A notification in the server. message Notification { // ID of the Notification. Loading api/api.swagger.json +95 −0 Original line number Diff line number Diff line Loading @@ -763,6 +763,64 @@ ] } }, "/v2/match": { "get": { "summary": "Fetch list of running matches.", "operationId": "ListMatches", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/apiMatchList" } } }, "parameters": [ { "name": "limit", "description": "Limit the number of returned matches.", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "authoritative", "description": "Authoritative or relayed matches.", "in": "query", "required": false, "type": "boolean", "format": "boolean" }, { "name": "label", "description": "Label filter.", "in": "query", "required": false, "type": "string" }, { "name": "min_size", "description": "Minimum user count.", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "max_size", "description": "Maximum user count.", "in": "query", "required": false, "type": "integer", "format": "int32" } ], "tags": [ "Nakama" ] } }, "/v2/notification": { "get": { "summary": "Fetch list of notifications.", Loading Loading @@ -1379,6 +1437,43 @@ }, "description": "A collection of zero or more groups." }, "apiMatch": { "type": "object", "properties": { "match_id": { "type": "string", "description": "The ID of the match, can be used to join." }, "authoritative": { "type": "boolean", "format": "boolean", "description": "True if it's an server-managed authoritative match, false otherwise." }, "label": { "type": "string", "description": "Match label, if any." }, "size": { "type": "integer", "format": "int32", "description": "Current number of users in the match." } }, "description": "Represents a realtime match." }, "apiMatchList": { "type": "object", "properties": { "matches": { "type": "array", "items": { "$ref": "#/definitions/apiMatch" }, "description": "A number of matches corresponding to a list operation." } }, "description": "A list of realtime matches." }, "apiNotification": { "type": "object", "properties": { Loading data/modules/clientrpc.lua +6 −0 Original line number Diff line number Diff line Loading @@ -63,3 +63,9 @@ local function send_stream_data(context, payload) nk.stream_send(stream, tostring(payload)) end nk.register_rpc(send_stream_data, "clientrpc.send_stream_data") local function create_authoritative_match(_context, _payload) local match_id = nk.match_create("match", {}) return nk.json_encode({ match_id = match_id }) end nk.register_rpc(create_authoritative_match, "clientrpc.create_authoritative_match") Loading
api/api.pb.gw.go +50 −0 Original line number Diff line number Diff line Loading @@ -470,6 +470,23 @@ func request_Nakama_ListFriends_0(ctx context.Context, marshaler runtime.Marshal } var ( filter_Nakama_ListMatches_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_Nakama_ListMatches_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListMatchesRequest var metadata runtime.ServerMetadata if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Nakama_ListMatches_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.ListMatches(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } var ( filter_Nakama_ListNotifications_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) Loading Loading @@ -1557,6 +1574,35 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) mux.Handle("GET", pattern_Nakama_ListMatches_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() if cn, ok := w.(http.CloseNotifier); ok { go func(done <-chan struct{}, closed <-chan bool) { select { case <-done: case <-closed: cancel() } }(ctx.Done(), cn.CloseNotify()) } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := request_Nakama_ListMatches_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } forward_Nakama_ListMatches_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Nakama_ListNotifications_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -2046,6 +2092,8 @@ var ( pattern_Nakama_ListFriends_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "friend"}, "")) pattern_Nakama_ListMatches_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "match"}, "")) pattern_Nakama_ListNotifications_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "notification"}, "")) pattern_Nakama_ListStorageObjects_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v2", "storage", "collection"}, "")) Loading Loading @@ -2128,6 +2176,8 @@ var ( forward_Nakama_ListFriends_0 = runtime.ForwardResponseMessage forward_Nakama_ListMatches_0 = runtime.ForwardResponseMessage forward_Nakama_ListNotifications_0 = runtime.ForwardResponseMessage forward_Nakama_ListStorageObjects_0 = runtime.ForwardResponseMessage Loading
api/api.proto +36 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,11 @@ service Nakama { option (google.api.http).get = "/v2/friend"; } // Fetch list of running matches. rpc ListMatches (ListMatchesRequest) returns (MatchList) { option (google.api.http).get = "/v2/match"; } // Fetch list of notifications. rpc ListNotifications (ListNotificationsRequest) returns (NotificationList) { option (google.api.http).get = "/v2/notification"; Loading Loading @@ -685,6 +690,19 @@ message LinkFacebookRequest { google.protobuf.BoolValue import = 4; } message ListMatchesRequest { // Limit the number of returned matches. google.protobuf.Int32Value limit = 1; // Authoritative or relayed matches. google.protobuf.BoolValue authoritative = 2; // Label filter. google.protobuf.StringValue label = 3; // Minimum user count. google.protobuf.Int32Value min_size = 4; // Maximum user count. google.protobuf.Int32Value max_size = 5; } // Get a list of unexpired notifications. message ListNotificationsRequest { // The number of notifications to get. Between 1 and 100. Loading @@ -705,6 +723,24 @@ message ListStorageObjectsRequest { string cursor = 4; // value from StorageObjectList.cursor. } // Represents a realtime match. message Match { // The ID of the match, can be used to join. string match_id = 1; // True if it's an server-managed authoritative match, false otherwise. bool authoritative = 2; // Match label, if any. google.protobuf.StringValue label = 3; // Current number of users in the match. int32 size = 4; } // A list of realtime matches. message MatchList { // A number of matches corresponding to a list operation. repeated Match matches = 1; } // A notification in the server. message Notification { // ID of the Notification. Loading
api/api.swagger.json +95 −0 Original line number Diff line number Diff line Loading @@ -763,6 +763,64 @@ ] } }, "/v2/match": { "get": { "summary": "Fetch list of running matches.", "operationId": "ListMatches", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/apiMatchList" } } }, "parameters": [ { "name": "limit", "description": "Limit the number of returned matches.", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "authoritative", "description": "Authoritative or relayed matches.", "in": "query", "required": false, "type": "boolean", "format": "boolean" }, { "name": "label", "description": "Label filter.", "in": "query", "required": false, "type": "string" }, { "name": "min_size", "description": "Minimum user count.", "in": "query", "required": false, "type": "integer", "format": "int32" }, { "name": "max_size", "description": "Maximum user count.", "in": "query", "required": false, "type": "integer", "format": "int32" } ], "tags": [ "Nakama" ] } }, "/v2/notification": { "get": { "summary": "Fetch list of notifications.", Loading Loading @@ -1379,6 +1437,43 @@ }, "description": "A collection of zero or more groups." }, "apiMatch": { "type": "object", "properties": { "match_id": { "type": "string", "description": "The ID of the match, can be used to join." }, "authoritative": { "type": "boolean", "format": "boolean", "description": "True if it's an server-managed authoritative match, false otherwise." }, "label": { "type": "string", "description": "Match label, if any." }, "size": { "type": "integer", "format": "int32", "description": "Current number of users in the match." } }, "description": "Represents a realtime match." }, "apiMatchList": { "type": "object", "properties": { "matches": { "type": "array", "items": { "$ref": "#/definitions/apiMatch" }, "description": "A number of matches corresponding to a list operation." } }, "description": "A list of realtime matches." }, "apiNotification": { "type": "object", "properties": { Loading
data/modules/clientrpc.lua +6 −0 Original line number Diff line number Diff line Loading @@ -63,3 +63,9 @@ local function send_stream_data(context, payload) nk.stream_send(stream, tostring(payload)) end nk.register_rpc(send_stream_data, "clientrpc.send_stream_data") local function create_authoritative_match(_context, _payload) local match_id = nk.match_create("match", {}) return nk.json_encode({ match_id = match_id }) end nk.register_rpc(create_authoritative_match, "clientrpc.create_authoritative_match")