Loading CHANGELOG.md +9 −0 Original line number Diff line number Diff line Loading @@ -4,8 +4,17 @@ All notable changes to this project are documented below. The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org). ## [Unreleased] ### Added - Support for Apple Sign In authentication, linking, and unlinking. - Wallet operations now return the updated and previous state of the wallet. ### Changed - Sanitize metric names and properties fields. - Wallet operations now use int64 values for all numeric operations. - Update to nakama-common 1.6.0 release. ### Fixed - Prevent bad presence list input to dispatcher message broadcasts from causing unexpected errors. ## [2.12.0] - 2020-05-25 ### Added Loading apigrpc/apigrpc.pb.go +251 −134 File changed.Preview size limit exceeded, changes collapsed. Show changes apigrpc/apigrpc.pb.gw.go +249 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,55 @@ func local_request_Nakama_AddGroupUsers_0(ctx context.Context, marshaler runtime } var ( filter_Nakama_AuthenticateApple_0 = &utilities.DoubleArray{Encoding: map[string]int{"account": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Nakama_AuthenticateApple_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AuthenticateAppleRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Account); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Nakama_AuthenticateApple_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.AuthenticateApple(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Nakama_AuthenticateApple_0(ctx context.Context, marshaler runtime.Marshaler, server NakamaServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AuthenticateAppleRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Account); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Nakama_AuthenticateApple_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.AuthenticateApple(ctx, &protoReq) return msg, metadata, err } var ( filter_Nakama_AuthenticateCustom_0 = &utilities.DoubleArray{Encoding: map[string]int{"account": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) Loading Loading @@ -1251,6 +1300,40 @@ func local_request_Nakama_LeaveGroup_0(ctx context.Context, marshaler runtime.Ma } func request_Nakama_LinkApple_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountApple var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.LinkApple(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Nakama_LinkApple_0(ctx context.Context, marshaler runtime.Marshaler, server NakamaServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountApple var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.LinkApple(ctx, &protoReq) return msg, metadata, err } func request_Nakama_LinkCustom_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountCustom var metadata runtime.ServerMetadata Loading Loading @@ -2647,6 +2730,40 @@ func local_request_Nakama_RpcFunc_1(ctx context.Context, marshaler runtime.Marsh } func request_Nakama_UnlinkApple_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountApple var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.UnlinkApple(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Nakama_UnlinkApple_0(ctx context.Context, marshaler runtime.Marshaler, server NakamaServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountApple var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.UnlinkApple(ctx, &protoReq) return msg, metadata, err } func request_Nakama_UnlinkCustom_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountCustom var metadata runtime.ServerMetadata Loading Loading @@ -3242,6 +3359,26 @@ func RegisterNakamaHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) mux.Handle("POST", pattern_Nakama_AuthenticateApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Nakama_AuthenticateApple_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } forward_Nakama_AuthenticateApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_AuthenticateCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -3742,6 +3879,26 @@ func RegisterNakamaHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) mux.Handle("POST", pattern_Nakama_LinkApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Nakama_LinkApple_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } forward_Nakama_LinkApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_LinkCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -4262,6 +4419,26 @@ func RegisterNakamaHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) mux.Handle("POST", pattern_Nakama_UnlinkApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Nakama_UnlinkApple_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } forward_Nakama_UnlinkApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_UnlinkCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -4603,6 +4780,26 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) mux.Handle("POST", pattern_Nakama_AuthenticateApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() 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_AuthenticateApple_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_AuthenticateApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_AuthenticateCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -5103,6 +5300,26 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) mux.Handle("POST", pattern_Nakama_LinkApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() 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_LinkApple_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_LinkApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_LinkCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -5623,6 +5840,26 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) mux.Handle("POST", pattern_Nakama_UnlinkApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() 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_UnlinkApple_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_UnlinkApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_UnlinkCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -5891,6 +6128,8 @@ var ( pattern_Nakama_AddGroupUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v2", "group", "group_id", "add"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_AuthenticateApple_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "authenticate", "apple"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_AuthenticateCustom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "authenticate", "custom"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_AuthenticateDevice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "authenticate", "device"}, "", runtime.AssumeColonVerbOpt(true))) Loading Loading @@ -5941,6 +6180,8 @@ var ( pattern_Nakama_LeaveGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v2", "group", "group_id", "leave"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_LinkApple_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "link", "apple"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_LinkCustom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "link", "custom"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_LinkDevice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "link", "device"}, "", runtime.AssumeColonVerbOpt(true))) Loading Loading @@ -5993,6 +6234,8 @@ var ( pattern_Nakama_RpcFunc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v2", "rpc", "id"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_UnlinkApple_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "unlink", "apple"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_UnlinkCustom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "unlink", "custom"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_UnlinkDevice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "unlink", "device"}, "", runtime.AssumeColonVerbOpt(true))) Loading Loading @@ -6025,6 +6268,8 @@ var ( forward_Nakama_AddGroupUsers_0 = runtime.ForwardResponseMessage forward_Nakama_AuthenticateApple_0 = runtime.ForwardResponseMessage forward_Nakama_AuthenticateCustom_0 = runtime.ForwardResponseMessage forward_Nakama_AuthenticateDevice_0 = runtime.ForwardResponseMessage Loading Loading @@ -6075,6 +6320,8 @@ var ( forward_Nakama_LeaveGroup_0 = runtime.ForwardResponseMessage forward_Nakama_LinkApple_0 = runtime.ForwardResponseMessage forward_Nakama_LinkCustom_0 = runtime.ForwardResponseMessage forward_Nakama_LinkDevice_0 = runtime.ForwardResponseMessage Loading Loading @@ -6127,6 +6374,8 @@ var ( forward_Nakama_RpcFunc_1 = runtime.ForwardResponseMessage forward_Nakama_UnlinkApple_0 = runtime.ForwardResponseMessage forward_Nakama_UnlinkCustom_0 = runtime.ForwardResponseMessage forward_Nakama_UnlinkDevice_0 = runtime.ForwardResponseMessage Loading apigrpc/apigrpc.proto +32 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,22 @@ service Nakama { option (google.api.http).post = "/v2/group/{group_id}/add"; } // Authenticate a user with an Apple ID against the server. rpc AuthenticateApple (api.AuthenticateAppleRequest) returns (api.Session) { option (google.api.http) = { post: "/v2/account/authenticate/apple", body: "account" }; option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { security: { security_requirement: { key: "BasicAuth"; value: {}; } } }; } // Authenticate a user with a custom id against the server. rpc AuthenticateCustom (api.AuthenticateCustomRequest) returns (api.Session) { option (google.api.http) = { Loading Loading @@ -325,6 +341,14 @@ service Nakama { option (google.api.http).post = "/v2/group/{group_id}/leave"; } // Add an Apple ID to the social profiles on the current user's account. rpc LinkApple (api.AccountApple) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v2/account/link/apple", body: "*" }; } // Add a custom ID to the social profiles on the current user's account. rpc LinkCustom (api.AccountCustom) returns (google.protobuf.Empty) { option (google.api.http) = { Loading Loading @@ -496,6 +520,14 @@ service Nakama { }; } // Remove the Apple ID from the social profiles on the current user's account. rpc UnlinkApple (api.AccountApple) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v2/account/unlink/apple", body: "*" }; } // Remove the custom ID from the social profiles on the current user's account. rpc UnlinkCustom (api.AccountCustom) returns (google.protobuf.Empty) { option (google.api.http) = { Loading apigrpc/apigrpc.swagger.json +114 −1 Original line number Diff line number Diff line Loading @@ -79,6 +79,39 @@ ] } }, "/v2/account/authenticate/apple": { "post": { "summary": "Authenticate a user with an Apple ID against the server.", "operationId": "AuthenticateApple", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/apiSession" } } }, "parameters": [ { "name": "body", "description": "The Apple account details.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/apiAccountApple" } } ], "tags": [ "Nakama" ], "security": [ { "BasicAuth": [] } ] } }, "/v2/account/authenticate/custom": { "post": { "summary": "Authenticate a user with a custom id against the server.", Loading Loading @@ -471,6 +504,33 @@ ] } }, "/v2/account/link/apple": { "post": { "summary": "Add an Apple ID to the social profiles on the current user's account.", "operationId": "LinkApple", "responses": { "200": { "description": "A successful response.", "schema": { "properties": {} } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/apiAccountApple" } } ], "tags": [ "Nakama" ] } }, "/v2/account/link/custom": { "post": { "summary": "Add a custom ID to the social profiles on the current user's account.", Loading Loading @@ -697,6 +757,33 @@ ] } }, "/v2/account/unlink/apple": { "post": { "summary": "Remove the Apple ID from the social profiles on the current user's account.", "operationId": "UnlinkApple", "responses": { "200": { "description": "A successful response.", "schema": { "properties": {} } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/apiAccountApple" } } ], "tags": [ "Nakama" ] } }, "/v2/account/unlink/custom": { "post": { "summary": "Remove the custom ID from the social profiles on the current user's account.", Loading Loading @@ -2550,6 +2637,23 @@ }, "description": "A user with additional account details. Always the current user." }, "apiAccountApple": { "type": "object", "properties": { "token": { "type": "string", "description": "The ID token received from Apple to validate." }, "vars": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Extra information that will be bundled in the session token." } }, "description": "Send a Apple Sign In token to the server. Used with authenticate/link/unlink." }, "apiAccountCustom": { "type": "object", "properties": { Loading Loading @@ -2895,6 +2999,11 @@ "type": "integer", "format": "int32", "description": "The friend status." }, "update_time": { "type": "string", "format": "date-time", "description": "Time of the latest relationship update." } }, "description": "A friend of a user." Loading Loading @@ -3631,7 +3740,11 @@ }, "facebook_instant_game_id": { "type": "string", "description": "The Facebook Instant Game id in the user's account." "description": "The Facebook Instant Game ID in the user's account." }, "apple_id": { "type": "string", "description": "The Apple Sign In ID in the user's account." } }, "description": "A user in the server." Loading Loading
CHANGELOG.md +9 −0 Original line number Diff line number Diff line Loading @@ -4,8 +4,17 @@ All notable changes to this project are documented below. The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org). ## [Unreleased] ### Added - Support for Apple Sign In authentication, linking, and unlinking. - Wallet operations now return the updated and previous state of the wallet. ### Changed - Sanitize metric names and properties fields. - Wallet operations now use int64 values for all numeric operations. - Update to nakama-common 1.6.0 release. ### Fixed - Prevent bad presence list input to dispatcher message broadcasts from causing unexpected errors. ## [2.12.0] - 2020-05-25 ### Added Loading
apigrpc/apigrpc.pb.go +251 −134 File changed.Preview size limit exceeded, changes collapsed. Show changes
apigrpc/apigrpc.pb.gw.go +249 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,55 @@ func local_request_Nakama_AddGroupUsers_0(ctx context.Context, marshaler runtime } var ( filter_Nakama_AuthenticateApple_0 = &utilities.DoubleArray{Encoding: map[string]int{"account": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Nakama_AuthenticateApple_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AuthenticateAppleRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Account); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Nakama_AuthenticateApple_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.AuthenticateApple(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Nakama_AuthenticateApple_0(ctx context.Context, marshaler runtime.Marshaler, server NakamaServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AuthenticateAppleRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Account); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Nakama_AuthenticateApple_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.AuthenticateApple(ctx, &protoReq) return msg, metadata, err } var ( filter_Nakama_AuthenticateCustom_0 = &utilities.DoubleArray{Encoding: map[string]int{"account": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) Loading Loading @@ -1251,6 +1300,40 @@ func local_request_Nakama_LeaveGroup_0(ctx context.Context, marshaler runtime.Ma } func request_Nakama_LinkApple_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountApple var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.LinkApple(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Nakama_LinkApple_0(ctx context.Context, marshaler runtime.Marshaler, server NakamaServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountApple var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.LinkApple(ctx, &protoReq) return msg, metadata, err } func request_Nakama_LinkCustom_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountCustom var metadata runtime.ServerMetadata Loading Loading @@ -2647,6 +2730,40 @@ func local_request_Nakama_RpcFunc_1(ctx context.Context, marshaler runtime.Marsh } func request_Nakama_UnlinkApple_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountApple var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.UnlinkApple(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Nakama_UnlinkApple_0(ctx context.Context, marshaler runtime.Marshaler, server NakamaServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountApple var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) if berr != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.UnlinkApple(ctx, &protoReq) return msg, metadata, err } func request_Nakama_UnlinkCustom_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq api.AccountCustom var metadata runtime.ServerMetadata Loading Loading @@ -3242,6 +3359,26 @@ func RegisterNakamaHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) mux.Handle("POST", pattern_Nakama_AuthenticateApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Nakama_AuthenticateApple_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } forward_Nakama_AuthenticateApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_AuthenticateCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -3742,6 +3879,26 @@ func RegisterNakamaHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) mux.Handle("POST", pattern_Nakama_LinkApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Nakama_LinkApple_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } forward_Nakama_LinkApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_LinkCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -4262,6 +4419,26 @@ func RegisterNakamaHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) mux.Handle("POST", pattern_Nakama_UnlinkApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } resp, md, err := local_request_Nakama_UnlinkApple_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } forward_Nakama_UnlinkApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_UnlinkCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -4603,6 +4780,26 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) mux.Handle("POST", pattern_Nakama_AuthenticateApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() 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_AuthenticateApple_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_AuthenticateApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_AuthenticateCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -5103,6 +5300,26 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) mux.Handle("POST", pattern_Nakama_LinkApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() 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_LinkApple_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_LinkApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_LinkCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -5623,6 +5840,26 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) mux.Handle("POST", pattern_Nakama_UnlinkApple_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() 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_UnlinkApple_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_UnlinkApple_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("POST", pattern_Nakama_UnlinkCustom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() Loading Loading @@ -5891,6 +6128,8 @@ var ( pattern_Nakama_AddGroupUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v2", "group", "group_id", "add"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_AuthenticateApple_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "authenticate", "apple"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_AuthenticateCustom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "authenticate", "custom"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_AuthenticateDevice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "authenticate", "device"}, "", runtime.AssumeColonVerbOpt(true))) Loading Loading @@ -5941,6 +6180,8 @@ var ( pattern_Nakama_LeaveGroup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v2", "group", "group_id", "leave"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_LinkApple_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "link", "apple"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_LinkCustom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "link", "custom"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_LinkDevice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "link", "device"}, "", runtime.AssumeColonVerbOpt(true))) Loading Loading @@ -5993,6 +6234,8 @@ var ( pattern_Nakama_RpcFunc_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v2", "rpc", "id"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_UnlinkApple_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "unlink", "apple"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_UnlinkCustom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "unlink", "custom"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Nakama_UnlinkDevice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "account", "unlink", "device"}, "", runtime.AssumeColonVerbOpt(true))) Loading Loading @@ -6025,6 +6268,8 @@ var ( forward_Nakama_AddGroupUsers_0 = runtime.ForwardResponseMessage forward_Nakama_AuthenticateApple_0 = runtime.ForwardResponseMessage forward_Nakama_AuthenticateCustom_0 = runtime.ForwardResponseMessage forward_Nakama_AuthenticateDevice_0 = runtime.ForwardResponseMessage Loading Loading @@ -6075,6 +6320,8 @@ var ( forward_Nakama_LeaveGroup_0 = runtime.ForwardResponseMessage forward_Nakama_LinkApple_0 = runtime.ForwardResponseMessage forward_Nakama_LinkCustom_0 = runtime.ForwardResponseMessage forward_Nakama_LinkDevice_0 = runtime.ForwardResponseMessage Loading Loading @@ -6127,6 +6374,8 @@ var ( forward_Nakama_RpcFunc_1 = runtime.ForwardResponseMessage forward_Nakama_UnlinkApple_0 = runtime.ForwardResponseMessage forward_Nakama_UnlinkCustom_0 = runtime.ForwardResponseMessage forward_Nakama_UnlinkDevice_0 = runtime.ForwardResponseMessage Loading
apigrpc/apigrpc.proto +32 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,22 @@ service Nakama { option (google.api.http).post = "/v2/group/{group_id}/add"; } // Authenticate a user with an Apple ID against the server. rpc AuthenticateApple (api.AuthenticateAppleRequest) returns (api.Session) { option (google.api.http) = { post: "/v2/account/authenticate/apple", body: "account" }; option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { security: { security_requirement: { key: "BasicAuth"; value: {}; } } }; } // Authenticate a user with a custom id against the server. rpc AuthenticateCustom (api.AuthenticateCustomRequest) returns (api.Session) { option (google.api.http) = { Loading Loading @@ -325,6 +341,14 @@ service Nakama { option (google.api.http).post = "/v2/group/{group_id}/leave"; } // Add an Apple ID to the social profiles on the current user's account. rpc LinkApple (api.AccountApple) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v2/account/link/apple", body: "*" }; } // Add a custom ID to the social profiles on the current user's account. rpc LinkCustom (api.AccountCustom) returns (google.protobuf.Empty) { option (google.api.http) = { Loading Loading @@ -496,6 +520,14 @@ service Nakama { }; } // Remove the Apple ID from the social profiles on the current user's account. rpc UnlinkApple (api.AccountApple) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v2/account/unlink/apple", body: "*" }; } // Remove the custom ID from the social profiles on the current user's account. rpc UnlinkCustom (api.AccountCustom) returns (google.protobuf.Empty) { option (google.api.http) = { Loading
apigrpc/apigrpc.swagger.json +114 −1 Original line number Diff line number Diff line Loading @@ -79,6 +79,39 @@ ] } }, "/v2/account/authenticate/apple": { "post": { "summary": "Authenticate a user with an Apple ID against the server.", "operationId": "AuthenticateApple", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/apiSession" } } }, "parameters": [ { "name": "body", "description": "The Apple account details.", "in": "body", "required": true, "schema": { "$ref": "#/definitions/apiAccountApple" } } ], "tags": [ "Nakama" ], "security": [ { "BasicAuth": [] } ] } }, "/v2/account/authenticate/custom": { "post": { "summary": "Authenticate a user with a custom id against the server.", Loading Loading @@ -471,6 +504,33 @@ ] } }, "/v2/account/link/apple": { "post": { "summary": "Add an Apple ID to the social profiles on the current user's account.", "operationId": "LinkApple", "responses": { "200": { "description": "A successful response.", "schema": { "properties": {} } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/apiAccountApple" } } ], "tags": [ "Nakama" ] } }, "/v2/account/link/custom": { "post": { "summary": "Add a custom ID to the social profiles on the current user's account.", Loading Loading @@ -697,6 +757,33 @@ ] } }, "/v2/account/unlink/apple": { "post": { "summary": "Remove the Apple ID from the social profiles on the current user's account.", "operationId": "UnlinkApple", "responses": { "200": { "description": "A successful response.", "schema": { "properties": {} } } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/apiAccountApple" } } ], "tags": [ "Nakama" ] } }, "/v2/account/unlink/custom": { "post": { "summary": "Remove the custom ID from the social profiles on the current user's account.", Loading Loading @@ -2550,6 +2637,23 @@ }, "description": "A user with additional account details. Always the current user." }, "apiAccountApple": { "type": "object", "properties": { "token": { "type": "string", "description": "The ID token received from Apple to validate." }, "vars": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Extra information that will be bundled in the session token." } }, "description": "Send a Apple Sign In token to the server. Used with authenticate/link/unlink." }, "apiAccountCustom": { "type": "object", "properties": { Loading Loading @@ -2895,6 +2999,11 @@ "type": "integer", "format": "int32", "description": "The friend status." }, "update_time": { "type": "string", "format": "date-time", "description": "Time of the latest relationship update." } }, "description": "A friend of a user." Loading Loading @@ -3631,7 +3740,11 @@ }, "facebook_instant_game_id": { "type": "string", "description": "The Facebook Instant Game id in the user's account." "description": "The Facebook Instant Game ID in the user's account." }, "apple_id": { "type": "string", "description": "The Apple Sign In ID in the user's account." } }, "description": "A user in the server." Loading