diff --git a/Nakama/Source/NakamaBlueprints/NakamaBlueprints.Build.cs b/Nakama/Source/NakamaBlueprints/NakamaBlueprints.Build.cs index 35a146ab..01ce700c 100644 --- a/Nakama/Source/NakamaBlueprints/NakamaBlueprints.Build.cs +++ b/Nakama/Source/NakamaBlueprints/NakamaBlueprints.Build.cs @@ -1,4 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ using UnrealBuildTool; diff --git a/Nakama/Source/NakamaBlueprints/Private/NakamaBlueprints.cpp b/Nakama/Source/NakamaBlueprints/Private/NakamaBlueprints.cpp index a248c9ee..30fc75bc 100644 --- a/Nakama/Source/NakamaBlueprints/Private/NakamaBlueprints.cpp +++ b/Nakama/Source/NakamaBlueprints/Private/NakamaBlueprints.cpp @@ -1,6 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - - +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaBlueprints.h" #include "Modules/ModuleManager.h" diff --git a/Nakama/Source/NakamaBlueprints/Private/NakamaClientRequests.cpp b/Nakama/Source/NakamaBlueprints/Private/NakamaClientRequests.cpp index d6e33fa1..f8948014 100644 --- a/Nakama/Source/NakamaBlueprints/Private/NakamaClientRequests.cpp +++ b/Nakama/Source/NakamaBlueprints/Private/NakamaClientRequests.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaClientRequests.h" #include "NakamaStorageObject.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaBlueprints/Private/NakamaLibrary.cpp b/Nakama/Source/NakamaBlueprints/Private/NakamaLibrary.cpp index d22dc33d..2782651b 100644 --- a/Nakama/Source/NakamaBlueprints/Private/NakamaLibrary.cpp +++ b/Nakama/Source/NakamaBlueprints/Private/NakamaLibrary.cpp @@ -1,5 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. - +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaLibrary.h" diff --git a/Nakama/Source/NakamaBlueprints/Private/NakamaRealtimeClientRequests.cpp b/Nakama/Source/NakamaBlueprints/Private/NakamaRealtimeClientRequests.cpp index 6948d10e..9d952541 100644 --- a/Nakama/Source/NakamaBlueprints/Private/NakamaRealtimeClientRequests.cpp +++ b/Nakama/Source/NakamaBlueprints/Private/NakamaRealtimeClientRequests.cpp @@ -1,5 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. - +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaRealtimeClientRequests.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaBlueprints/Public/NakamaBlueprints.h b/Nakama/Source/NakamaBlueprints/Public/NakamaBlueprints.h index 268d0931..db69caea 100644 --- a/Nakama/Source/NakamaBlueprints/Public/NakamaBlueprints.h +++ b/Nakama/Source/NakamaBlueprints/Public/NakamaBlueprints.h @@ -1,4 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaBlueprints/Public/NakamaClientRequests.h b/Nakama/Source/NakamaBlueprints/Public/NakamaClientRequests.h index 2dde75d9..aa3871e7 100644 --- a/Nakama/Source/NakamaBlueprints/Public/NakamaClientRequests.h +++ b/Nakama/Source/NakamaBlueprints/Public/NakamaClientRequests.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaBlueprints/Public/NakamaLibrary.h b/Nakama/Source/NakamaBlueprints/Public/NakamaLibrary.h index fbd766e7..01b4da4d 100644 --- a/Nakama/Source/NakamaBlueprints/Public/NakamaLibrary.h +++ b/Nakama/Source/NakamaBlueprints/Public/NakamaLibrary.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaBlueprints/Public/NakamaRealtimeClientRequests.h b/Nakama/Source/NakamaBlueprints/Public/NakamaRealtimeClientRequests.h index eed610bf..8484b3f5 100644 --- a/Nakama/Source/NakamaBlueprints/Public/NakamaRealtimeClientRequests.h +++ b/Nakama/Source/NakamaBlueprints/Public/NakamaRealtimeClientRequests.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaTests/NakamaTests.Build.cs b/Nakama/Source/NakamaTests/NakamaTests.Build.cs index 4f2c88a1..c996f867 100644 --- a/Nakama/Source/NakamaTests/NakamaTests.Build.cs +++ b/Nakama/Source/NakamaTests/NakamaTests.Build.cs @@ -1,4 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ using UnrealBuildTool; diff --git a/Nakama/Source/NakamaTests/Private/NakamaTests.cpp b/Nakama/Source/NakamaTests/Private/NakamaTests.cpp index d3665352..555cabc8 100644 --- a/Nakama/Source/NakamaTests/Private/NakamaTests.cpp +++ b/Nakama/Source/NakamaTests/Private/NakamaTests.cpp @@ -1,6 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - - +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaTests.h" #include "Modules/ModuleManager.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_AuthoritativeMatch.cpp b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_AuthoritativeMatch.cpp index 823b8684..33bcb730 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_AuthoritativeMatch.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_AuthoritativeMatch.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "Tests/Realtime/Test_AuthoritativeMatch.h" #include "NakamaLoggingMacros.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Chat.cpp b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Chat.cpp index e07c97e3..185817ec 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Chat.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Chat.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTestBase.h" #include "Misc/AutomationTest.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_FollowUsers.cpp b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_FollowUsers.cpp index bb7ce15a..750c6ee8 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_FollowUsers.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_FollowUsers.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "Tests/Realtime/Test_FollowUsers.h" #include "NakamaTestBase.h" #include "Misc/AutomationTest.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Match.cpp b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Match.cpp index 75761d6f..ef6b7bb3 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Match.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Match.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "Tests/Realtime/Test_Match.h" #include "NakamaTestBase.h" #include "Misc/AutomationTest.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Notifications.cpp b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Notifications.cpp index b496f60a..8d073139 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Notifications.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Notifications.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTestBase.h" // Send Notification to self from RPC and receive it diff --git a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Parties.cpp b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Parties.cpp index ca557054..7c328106 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Parties.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Parties.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "Tests/Realtime/Test_Parties.h" // Create Party and Join Party Test Case diff --git a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_RPC.cpp b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_RPC.cpp index 84c1ff2d..adfad2da 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_RPC.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_RPC.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTestBase.h" IMPLEMENT_CUSTOM_SIMPLE_AUTOMATION_TEST(RPCWithHttpKey, FNakamaTestBase, "Nakama.Base.Realtime.RPC.RPCWithHttpKey", NAKAMA_MODULE_TEST_MASK) diff --git a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Tournament.cpp b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Tournament.cpp index 07a55d80..bc0f59b3 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Tournament.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Realtime/Test_Tournament.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "Tests/Realtime/Test_Tournament.h" IMPLEMENT_CUSTOM_SIMPLE_AUTOMATION_TEST(Tournament, FNakamaTournamentTestBase, "Nakama.Base.Realtime.Tournament", NAKAMA_MODULE_TEST_MASK) diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_Authentication.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_Authentication.cpp index ae93e8bb..24092a62 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_Authentication.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_Authentication.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTestBase.h" #include "NakamaUtils.h" #include "Misc/AutomationTest.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_Errors.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_Errors.cpp index afa5ece7..e4cdd1ee 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_Errors.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_Errors.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTestBase.h" // Error Not Found diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_Friends.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_Friends.cpp index eb9caaad..2d936420 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_Friends.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_Friends.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "Tests/Test_Friends.h" #include "NakamaLogger.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_GetAccount.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_GetAccount.cpp index 50bbc568..bf07af00 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_GetAccount.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_GetAccount.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTestBase.h" #include "Misc/AutomationTest.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_GetUsers.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_GetUsers.cpp index 37ea6a0f..ec4ba4f9 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_GetUsers.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_GetUsers.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTestBase.h" #include "Misc/AutomationTest.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_Groups.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_Groups.cpp index 0606c157..75d7e08c 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_Groups.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_Groups.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "Tests/Test_Groups.h" #include "Misc/AutomationTest.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_Internals.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_Internals.cpp index 62f601a6..32d37aec 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_Internals.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_Internals.cpp @@ -1,4 +1,20 @@ -#include "GenericPlatform/GenericPlatformHttp.h" +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GenericPlatform/GenericPlatformHttp.h" #include "Misc/AutomationTest.h" IMPLEMENT_SIMPLE_AUTOMATION_TEST(Test_Internals, "Nakama.Base.Internals.UriEncode", diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_ListMatches.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_ListMatches.cpp index 491242e0..cfe98770 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_ListMatches.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_ListMatches.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTestBase.h" #include "Misc/AutomationTest.h" #include "Tests/AutomationCommon.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_RestoreSession.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_RestoreSession.cpp index 7c2ee7f4..12ff7b72 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_RestoreSession.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_RestoreSession.cpp @@ -1,3 +1,18 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaTestBase.h" diff --git a/Nakama/Source/NakamaTests/Private/Tests/Test_Storage.cpp b/Nakama/Source/NakamaTests/Private/Tests/Test_Storage.cpp index ff8145b0..8d96ad12 100644 --- a/Nakama/Source/NakamaTests/Private/Tests/Test_Storage.cpp +++ b/Nakama/Source/NakamaTests/Private/Tests/Test_Storage.cpp @@ -1,3 +1,18 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "Tests/Test_Storage.h" diff --git a/Nakama/Source/NakamaTests/Public/NakamaTestBase.h b/Nakama/Source/NakamaTests/Public/NakamaTestBase.h index ad5e5138..c22883ed 100644 --- a/Nakama/Source/NakamaTests/Public/NakamaTestBase.h +++ b/Nakama/Source/NakamaTests/Public/NakamaTestBase.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaTests/Public/NakamaTests.h b/Nakama/Source/NakamaTests/Public/NakamaTests.h index 59172ba4..630ede68 100644 --- a/Nakama/Source/NakamaTests/Public/NakamaTests.h +++ b/Nakama/Source/NakamaTests/Public/NakamaTests.h @@ -1,4 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_AuthoritativeMatch.h b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_AuthoritativeMatch.h index bf018548..47860015 100644 --- a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_AuthoritativeMatch.h +++ b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_AuthoritativeMatch.h @@ -1,4 +1,20 @@ -#pragma once +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once #include "CoreMinimal.h" #include "NakamaTestBase.h" diff --git a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_FollowUsers.h b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_FollowUsers.h index 2b49ae51..dbc730b1 100644 --- a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_FollowUsers.h +++ b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_FollowUsers.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Match.h b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Match.h index dfcafb77..2419dd68 100644 --- a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Match.h +++ b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Match.h @@ -1,4 +1,20 @@ -#pragma once +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once #include "CoreMinimal.h" #include "NakamaTestBase.h" diff --git a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Parties.h b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Parties.h index fe39f49e..d7d00a84 100644 --- a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Parties.h +++ b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Parties.h @@ -1,4 +1,20 @@ -#pragma once +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once #include "CoreMinimal.h" #include "NakamaTestBase.h" diff --git a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Tournament.h b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Tournament.h index ff379526..190c73a3 100644 --- a/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Tournament.h +++ b/Nakama/Source/NakamaTests/Public/Tests/Realtime/Test_Tournament.h @@ -1,4 +1,20 @@ -#pragma once +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once #include "CoreMinimal.h" #include "NakamaTestBase.h" diff --git a/Nakama/Source/NakamaTests/Public/Tests/Test_Friends.h b/Nakama/Source/NakamaTests/Public/Tests/Test_Friends.h index 91044a4b..6eb52787 100644 --- a/Nakama/Source/NakamaTests/Public/Tests/Test_Friends.h +++ b/Nakama/Source/NakamaTests/Public/Tests/Test_Friends.h @@ -1,4 +1,20 @@ -#pragma once +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once #include "CoreMinimal.h" #include "NakamaTestBase.h" diff --git a/Nakama/Source/NakamaTests/Public/Tests/Test_Groups.h b/Nakama/Source/NakamaTests/Public/Tests/Test_Groups.h index 5f660479..4159aa86 100644 --- a/Nakama/Source/NakamaTests/Public/Tests/Test_Groups.h +++ b/Nakama/Source/NakamaTests/Public/Tests/Test_Groups.h @@ -1,4 +1,20 @@ -#pragma once +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once #include "CoreMinimal.h" #include "NakamaTestBase.h" diff --git a/Nakama/Source/NakamaTests/Public/Tests/Test_Storage.h b/Nakama/Source/NakamaTests/Public/Tests/Test_Storage.h index b608fec6..fdb50d36 100644 --- a/Nakama/Source/NakamaTests/Public/Tests/Test_Storage.h +++ b/Nakama/Source/NakamaTests/Public/Tests/Test_Storage.h @@ -1,4 +1,20 @@ -#pragma once +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once #include "CoreMinimal.h" #include "NakamaTestBase.h" diff --git a/Nakama/Source/NakamaUnreal/NakamaUnreal.Build.cs b/Nakama/Source/NakamaUnreal/NakamaUnreal.Build.cs index 9ff66dfd..46b969a9 100644 --- a/Nakama/Source/NakamaUnreal/NakamaUnreal.Build.cs +++ b/Nakama/Source/NakamaUnreal/NakamaUnreal.Build.cs @@ -1,4 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ using UnrealBuildTool; using System.IO; diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaAccount.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaAccount.cpp index 948781b2..81267ff2 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaAccount.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaAccount.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaAccount.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaAccountDevice.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaAccountDevice.cpp index 7836450e..d868c65c 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaAccountDevice.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaAccountDevice.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaAccountDevice.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaChannelTypes.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaChannelTypes.cpp index edfe76af..20066f66 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaChannelTypes.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaChannelTypes.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaChannelTypes.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaChat.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaChat.cpp index a3c01813..bc626145 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaChat.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaChat.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaChat.h" FNakamaChannel::FNakamaChannel() diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaClient.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaClient.cpp index 44d0ec1c..30d48cdc 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaClient.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaClient.cpp @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaClient.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaError.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaError.cpp index b1a27163..0740c175 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaError.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaError.cpp @@ -1,4 +1,20 @@ -#include "NakamaError.h" +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "NakamaError.h" #include "NakamaUtils.h" ENakamaErrorCode FNakamaError::ConvertNakamaErrorCode(int32 CodeValue) diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaFriend.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaFriend.cpp index 75f86e11..371eee56 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaFriend.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaFriend.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaFriend.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaGroup.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaGroup.cpp index 0e15eca1..9bea8ba7 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaGroup.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaGroup.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaGroup.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaLeaderboard.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaLeaderboard.cpp index 1e1ae2df..7e763208 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaLeaderboard.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaLeaderboard.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaLeaderboard.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaLogger.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaLogger.cpp index 0d26710d..a0fd2c2e 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaLogger.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaLogger.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaLogger.h" DEFINE_LOG_CATEGORY(LogNakamaUnreal); diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaMatch.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaMatch.cpp index df298bba..fb2bb1be 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaMatch.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaMatch.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaMatch.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaMatchTypes.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaMatchTypes.cpp index 66ef69f6..49f83f1f 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaMatchTypes.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaMatchTypes.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaMatchTypes.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaNotification.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaNotification.cpp index 7f9a004b..bbda5657 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaNotification.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaNotification.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaNotification.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaParty.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaParty.cpp index c9e65028..cac69ee6 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaParty.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaParty.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaParty.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaPresence.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaPresence.cpp index 4cf1be92..8b71b21d 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaPresence.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaPresence.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaPresence.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaRPC.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaRPC.cpp index d1d2075f..cb2ec348 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaRPC.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaRPC.cpp @@ -1,4 +1,20 @@ -#include "NakamaRPC.h" +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "NakamaRPC.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaRealtimeClient.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaRealtimeClient.cpp index ce44909f..11e6f27d 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaRealtimeClient.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaRealtimeClient.cpp @@ -1,5 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. - +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaRealtimeClient.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaRealtimeRequestContext.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaRealtimeRequestContext.cpp index 7441e14a..f363ba62 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaRealtimeRequestContext.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaRealtimeRequestContext.cpp @@ -1,5 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. - +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaRealtimeRequestContext.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaRtError.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaRtError.cpp index ea96d5a0..032741db 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaRtError.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaRtError.cpp @@ -1,4 +1,20 @@ -#include "NakamaRtError.h" +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "NakamaRtError.h" #include "NakamaUtils.h" FNakamaRtError::FNakamaRtError(const FString& JsonString) diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaSession.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaSession.cpp index 86edd416..9338dc07 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaSession.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaSession.cpp @@ -1,5 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. - +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "NakamaSession.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaStatus.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaStatus.cpp index 6272c3e1..62804755 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaStatus.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaStatus.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaStatus.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaStorageObject.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaStorageObject.cpp index b452260a..fcee237f 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaStorageObject.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaStorageObject.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaStorageObject.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaStreams.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaStreams.cpp index f39e66fe..d233c135 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaStreams.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaStreams.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaStreams.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaTournament.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaTournament.cpp index 26c9d57f..e0ba36b8 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaTournament.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaTournament.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaTournament.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaUnreal.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaUnreal.cpp index 7920adb9..a4aa967d 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaUnreal.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaUnreal.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaUnreal.h" #include "Modules/ModuleManager.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaUser.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaUser.cpp index 6871d7e5..36b48835 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaUser.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaUser.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaUser.h" #include "NakamaUtils.h" diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaUserSession.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaUserSession.cpp index bb5e0742..86a52701 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaUserSession.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaUserSession.cpp @@ -1,4 +1,20 @@ -#include "NakamaUserSession.h" +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "NakamaUserSession.h" FNakamaUserSession::FNakamaUserSession(): IsCreated(false), CreateTime(FDateTime::MinValue()), ExpireTime(FDateTime::MinValue()), IsExpired(false), IsRefreshExpired(false) { diff --git a/Nakama/Source/NakamaUnreal/Private/NakamaUtils.cpp b/Nakama/Source/NakamaUnreal/Private/NakamaUtils.cpp index 78b6a065..2e391f4b 100644 --- a/Nakama/Source/NakamaUnreal/Private/NakamaUtils.cpp +++ b/Nakama/Source/NakamaUnreal/Private/NakamaUtils.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "NakamaUtils.h" #include "NakamaUser.h" #include "NakamaLogger.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaAccount.h b/Nakama/Source/NakamaUnreal/Public/NakamaAccount.h index 97021a21..c58fb556 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaAccount.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaAccount.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaAccountDevice.h b/Nakama/Source/NakamaUnreal/Public/NakamaAccountDevice.h index 054b8963..b700d693 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaAccountDevice.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaAccountDevice.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaChannelTypes.h b/Nakama/Source/NakamaUnreal/Public/NakamaChannelTypes.h index 571ccbed..c7d8b739 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaChannelTypes.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaChannelTypes.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaChat.h b/Nakama/Source/NakamaUnreal/Public/NakamaChat.h index 6d283bb4..8bb29538 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaChat.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaChat.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaClient.h b/Nakama/Source/NakamaUnreal/Public/NakamaClient.h index 1c37a755..219dd97a 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaClient.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaClient.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaError.h b/Nakama/Source/NakamaUnreal/Public/NakamaError.h index 883513a6..c1a57f26 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaError.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaError.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaFriend.h b/Nakama/Source/NakamaUnreal/Public/NakamaFriend.h index cdd606bb..130037b9 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaFriend.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaFriend.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaGroup.h b/Nakama/Source/NakamaUnreal/Public/NakamaGroup.h index 97eb9330..dbbff412 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaGroup.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaGroup.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaLeaderboard.h b/Nakama/Source/NakamaUnreal/Public/NakamaLeaderboard.h index e3f8ed64..1230619d 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaLeaderboard.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaLeaderboard.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaLogger.h b/Nakama/Source/NakamaUnreal/Public/NakamaLogger.h index f16f23a9..237418f7 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaLogger.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaLogger.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaLoggingMacros.h b/Nakama/Source/NakamaUnreal/Public/NakamaLoggingMacros.h index bbba9cca..a2c68991 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaLoggingMacros.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaLoggingMacros.h @@ -1,4 +1,20 @@ -#pragma once +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once // Toggle logging on/off by defining NAKAMA_LOGS_ENABLED #define NAKAMA_LOGS_ENABLED diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaMatch.h b/Nakama/Source/NakamaUnreal/Public/NakamaMatch.h index 731cd707..c3428651 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaMatch.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaMatch.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaMatchTypes.h b/Nakama/Source/NakamaUnreal/Public/NakamaMatchTypes.h index fc548ad8..e4260bf1 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaMatchTypes.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaMatchTypes.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaNotification.h b/Nakama/Source/NakamaUnreal/Public/NakamaNotification.h index 4da1eeca..d7df2ed2 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaNotification.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaNotification.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaParty.h b/Nakama/Source/NakamaUnreal/Public/NakamaParty.h index 191d6f40..4cb70909 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaParty.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaParty.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaPresence.h b/Nakama/Source/NakamaUnreal/Public/NakamaPresence.h index b911d3b1..7ec0cc3f 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaPresence.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaPresence.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaRPC.h b/Nakama/Source/NakamaUnreal/Public/NakamaRPC.h index 23c56a0b..2200ffb1 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaRPC.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaRPC.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaRealtimeClient.h b/Nakama/Source/NakamaUnreal/Public/NakamaRealtimeClient.h index 67bdf7d3..eb57f83b 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaRealtimeClient.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaRealtimeClient.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaRealtimeRequestContext.h b/Nakama/Source/NakamaUnreal/Public/NakamaRealtimeRequestContext.h index 21050f9d..9ca0fc1f 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaRealtimeRequestContext.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaRealtimeRequestContext.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaRtError.h b/Nakama/Source/NakamaUnreal/Public/NakamaRtError.h index 92821470..1e8d3391 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaRtError.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaRtError.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaSession.h b/Nakama/Source/NakamaUnreal/Public/NakamaSession.h index c1e861f0..3eb4a451 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaSession.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaSession.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaStatus.h b/Nakama/Source/NakamaUnreal/Public/NakamaStatus.h index b4a6fc4f..bfcde0d7 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaStatus.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaStatus.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaStorageObject.h b/Nakama/Source/NakamaUnreal/Public/NakamaStorageObject.h index 8bd15079..0c62d7be 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaStorageObject.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaStorageObject.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaStorageTypes.h b/Nakama/Source/NakamaUnreal/Public/NakamaStorageTypes.h index c0f127f9..25176c92 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaStorageTypes.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaStorageTypes.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaStreams.h b/Nakama/Source/NakamaUnreal/Public/NakamaStreams.h index 24523037..a853bbbe 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaStreams.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaStreams.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaTournament.h b/Nakama/Source/NakamaUnreal/Public/NakamaTournament.h index 5e1df2c0..81eb87f1 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaTournament.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaTournament.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaUnreal.h b/Nakama/Source/NakamaUnreal/Public/NakamaUnreal.h index 78f6715d..2ec15a0b 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaUnreal.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaUnreal.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "Modules/ModuleInterface.h" diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaUser.h b/Nakama/Source/NakamaUnreal/Public/NakamaUser.h index 1872ad0b..116cc13b 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaUser.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaUser.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaUserSession.h b/Nakama/Source/NakamaUnreal/Public/NakamaUserSession.h index 4b18a9f6..5e76d269 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaUserSession.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaUserSession.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Nakama/Source/NakamaUnreal/Public/NakamaUtils.h b/Nakama/Source/NakamaUnreal/Public/NakamaUtils.h index 75b0753a..7aaf5106 100644 --- a/Nakama/Source/NakamaUnreal/Public/NakamaUtils.h +++ b/Nakama/Source/NakamaUnreal/Public/NakamaUtils.h @@ -1,4 +1,18 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once diff --git a/Satori/Source/SatoriBlueprints/Private/SatoriBlueprint.cpp b/Satori/Source/SatoriBlueprints/Private/SatoriBlueprint.cpp index b2d1fba8..e4584963 100644 --- a/Satori/Source/SatoriBlueprints/Private/SatoriBlueprint.cpp +++ b/Satori/Source/SatoriBlueprints/Private/SatoriBlueprint.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriBlueprints.h" #include "Modules/ModuleManager.h" diff --git a/Satori/Source/SatoriBlueprints/Private/SatoriClientRequests.cpp b/Satori/Source/SatoriBlueprints/Private/SatoriClientRequests.cpp index e780c2af..acad505e 100644 --- a/Satori/Source/SatoriBlueprints/Private/SatoriClientRequests.cpp +++ b/Satori/Source/SatoriBlueprints/Private/SatoriClientRequests.cpp @@ -1,34 +1,50 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriClientRequests.h" -#include "NakamaUtils.h" +#include "SatoriUtils.h" -USatoriClientAuthenticateCustom* USatoriClientAuthenticateCustom::AuthenticateCustom( - USatoriClient* Client, - const FString& UserID, - const FString& Username, - bool CreateAccount, - const TMap& Vars) +USatoriClientAuthenticate* USatoriClientAuthenticate::Authenticate( + USatoriClient* Client, + const FString& ID, + const TMap& DefaultProperties, + const TMap& CustomProperties, + const bool bNoSession) { - USatoriClientAuthenticateCustom* Node = NewObject(); + USatoriClientAuthenticate* Node = NewObject(); Node->SatoriClient = Client; - Node->UserID = UserID; - Node->Username = Username; - Node->bCreateAccount = CreateAccount; - Node->Vars = Vars; + Node->ID = ID; + Node->DefaultProperties = DefaultProperties; + Node->CustomProperties = CustomProperties; + Node->bNoSession = bNoSession; return Node; } -void USatoriClientAuthenticateCustom::Activate() +void USatoriClientAuthenticate::Activate() { if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; } - auto successCallback = [this](UNakamaSession* session) + auto successCallback = [this](USatoriSession* session) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -40,7 +56,7 @@ void USatoriClientAuthenticateCustom::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -52,10 +68,10 @@ void USatoriClientAuthenticateCustom::Activate() SetReadyToDestroy(); }; - SatoriClient->AuthenticateCustom(UserID, Username, bCreateAccount, Vars, successCallback, errorCallback); + SatoriClient->Authenticate(ID, DefaultProperties, CustomProperties, bNoSession, successCallback, errorCallback); } -USatoriClientAuthenticateRefresh* USatoriClientAuthenticateRefresh::AuthenticateRefresh(USatoriClient* Client, UNakamaSession* Session) +USatoriClientAuthenticateRefresh* USatoriClientAuthenticateRefresh::AuthenticateRefresh(USatoriClient* Client, USatoriSession* Session) { USatoriClientAuthenticateRefresh* Node = NewObject(); Node->SatoriClient = Client; @@ -69,7 +85,7 @@ void USatoriClientAuthenticateRefresh::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -77,7 +93,7 @@ void USatoriClientAuthenticateRefresh::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -85,13 +101,13 @@ void USatoriClientAuthenticateRefresh::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; } - auto successCallback = [this](UNakamaSession* session) + auto successCallback = [this](USatoriSession* session) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -103,7 +119,7 @@ void USatoriClientAuthenticateRefresh::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -118,7 +134,7 @@ void USatoriClientAuthenticateRefresh::Activate() SatoriClient->AuthenticateRefresh(UserSession, successCallback, errorCallback); } -USatoriClientAuthenticateLogout* USatoriClientAuthenticateLogout::AuthenticateLogout(USatoriClient* Client, UNakamaSession* Session) +USatoriClientAuthenticateLogout* USatoriClientAuthenticateLogout::AuthenticateLogout(USatoriClient* Client, USatoriSession* Session) { USatoriClientAuthenticateLogout* Node = NewObject(); Node->SatoriClient = Client; @@ -132,7 +148,7 @@ void USatoriClientAuthenticateLogout::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -140,7 +156,7 @@ void USatoriClientAuthenticateLogout::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -148,7 +164,7 @@ void USatoriClientAuthenticateLogout::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -166,7 +182,7 @@ void USatoriClientAuthenticateLogout::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -183,7 +199,7 @@ void USatoriClientAuthenticateLogout::Activate() USatoriClientIdentify* USatoriClientIdentify::Identify( USatoriClient* Client, - UNakamaSession* Session, + USatoriSession* Session, const FString& ID, const TMap& DefaultProperties, const TMap& CustomProperties) @@ -203,7 +219,7 @@ void USatoriClientIdentify::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -211,7 +227,7 @@ void USatoriClientIdentify::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -219,13 +235,13 @@ void USatoriClientIdentify::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; } - auto successCallback = [this](UNakamaSession* session) + auto successCallback = [this](USatoriSession* session) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -237,7 +253,7 @@ void USatoriClientIdentify::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -252,7 +268,7 @@ void USatoriClientIdentify::Activate() SatoriClient->Identify(UserSession, ID, DefaultProperties, CustomProperties, successCallback, errorCallback); } -USatoriClientListIdentityProperties* USatoriClientListIdentityProperties::ListIdentityProperties(USatoriClient* Client, UNakamaSession* Session) +USatoriClientListIdentityProperties* USatoriClientListIdentityProperties::ListIdentityProperties(USatoriClient* Client, USatoriSession* Session) { USatoriClientListIdentityProperties* Node = NewObject(); Node->SatoriClient = Client; @@ -266,7 +282,7 @@ void USatoriClientListIdentityProperties::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -274,7 +290,7 @@ void USatoriClientListIdentityProperties::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -282,7 +298,7 @@ void USatoriClientListIdentityProperties::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -300,7 +316,7 @@ void USatoriClientListIdentityProperties::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -317,7 +333,7 @@ void USatoriClientListIdentityProperties::Activate() USatoriClientUpdateProperties* USatoriClientUpdateProperties::UpdateProperties( USatoriClient* Client, - UNakamaSession* Session, + USatoriSession* Session, const TMap& DefaultProperties, const TMap& CustomProperties, const bool bRecompute) @@ -337,7 +353,7 @@ void USatoriClientUpdateProperties::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -345,7 +361,7 @@ void USatoriClientUpdateProperties::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -353,7 +369,7 @@ void USatoriClientUpdateProperties::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -371,7 +387,7 @@ void USatoriClientUpdateProperties::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -386,7 +402,7 @@ void USatoriClientUpdateProperties::Activate() SatoriClient->UpdateProperties(UserSession, DefaultProperties, CustomProperties, bRecompute, successCallback, errorCallback); } -USatoriClientDeleteIdentity* USatoriClientDeleteIdentity::DeleteIdentity(USatoriClient* Client, UNakamaSession* Session) +USatoriClientDeleteIdentity* USatoriClientDeleteIdentity::DeleteIdentity(USatoriClient* Client, USatoriSession* Session) { USatoriClientDeleteIdentity* Node = NewObject(); Node->SatoriClient = Client; @@ -400,7 +416,7 @@ void USatoriClientDeleteIdentity::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -408,7 +424,7 @@ void USatoriClientDeleteIdentity::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -416,7 +432,7 @@ void USatoriClientDeleteIdentity::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -434,7 +450,7 @@ void USatoriClientDeleteIdentity::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -449,7 +465,7 @@ void USatoriClientDeleteIdentity::Activate() SatoriClient->DeleteIdentity(UserSession, successCallback, errorCallback); } -USatoriClientPostEvent* USatoriClientPostEvent::PostEvent(USatoriClient* Client, UNakamaSession* Session, const TArray& Events) +USatoriClientPostEvent* USatoriClientPostEvent::PostEvent(USatoriClient* Client, USatoriSession* Session, const TArray& Events) { USatoriClientPostEvent* Node = NewObject(); Node->SatoriClient = Client; @@ -464,7 +480,7 @@ void USatoriClientPostEvent::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -472,7 +488,7 @@ void USatoriClientPostEvent::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -480,7 +496,7 @@ void USatoriClientPostEvent::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -498,7 +514,7 @@ void USatoriClientPostEvent::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -513,7 +529,7 @@ void USatoriClientPostEvent::Activate() SatoriClient->PostEvent(UserSession, Events, successCallback, errorCallback); } -USatoriClientGetExperiments* USatoriClientGetExperiments::GetExperiments(USatoriClient* Client, UNakamaSession* Session, const TArray& Names) +USatoriClientGetExperiments* USatoriClientGetExperiments::GetExperiments(USatoriClient* Client, USatoriSession* Session, const TArray& Names) { USatoriClientGetExperiments* Node = NewObject(); Node->SatoriClient = Client; @@ -528,7 +544,7 @@ void USatoriClientGetExperiments::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -536,7 +552,7 @@ void USatoriClientGetExperiments::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -544,7 +560,7 @@ void USatoriClientGetExperiments::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -562,7 +578,7 @@ void USatoriClientGetExperiments::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -577,7 +593,7 @@ void USatoriClientGetExperiments::Activate() SatoriClient->GetExperiments(UserSession, Names, successCallback, errorCallback); } -USatoriClientGetFlags* USatoriClientGetFlags::GetFlags(USatoriClient* Client, UNakamaSession* Session, const TArray& Names) +USatoriClientGetFlags* USatoriClientGetFlags::GetFlags(USatoriClient* Client, USatoriSession* Session, const TArray& Names) { USatoriClientGetFlags* Node = NewObject(); Node->SatoriClient = Client; @@ -592,7 +608,7 @@ void USatoriClientGetFlags::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -600,7 +616,7 @@ void USatoriClientGetFlags::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -608,7 +624,7 @@ void USatoriClientGetFlags::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -626,7 +642,7 @@ void USatoriClientGetFlags::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -641,7 +657,7 @@ void USatoriClientGetFlags::Activate() SatoriClient->GetFlags(UserSession, Names, successCallback, errorCallback); } -USatoriClientGetFlagOverrides* USatoriClientGetFlagOverrides::GetFlagOverrides(USatoriClient* Client, UNakamaSession* Session, const TArray& Names) +USatoriClientGetFlagOverrides* USatoriClientGetFlagOverrides::GetFlagOverrides(USatoriClient* Client, USatoriSession* Session, const TArray& Names) { USatoriClientGetFlagOverrides* Node = NewObject(); Node->SatoriClient = Client; @@ -656,7 +672,7 @@ void USatoriClientGetFlagOverrides::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -664,7 +680,7 @@ void USatoriClientGetFlagOverrides::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -672,7 +688,7 @@ void USatoriClientGetFlagOverrides::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -690,7 +706,7 @@ void USatoriClientGetFlagOverrides::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -705,7 +721,7 @@ void USatoriClientGetFlagOverrides::Activate() SatoriClient->GetFlagOverrides(UserSession, Names, successCallback, errorCallback); } -USatoriClientGetLiveEvents* USatoriClientGetLiveEvents::GetLiveEvents(USatoriClient* Client, UNakamaSession* Session, const TArray& LiveEventNames) +USatoriClientGetLiveEvents* USatoriClientGetLiveEvents::GetLiveEvents(USatoriClient* Client, USatoriSession* Session, const TArray& LiveEventNames) { USatoriClientGetLiveEvents* Node = NewObject(); Node->SatoriClient = Client; @@ -720,7 +736,7 @@ void USatoriClientGetLiveEvents::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -728,7 +744,7 @@ void USatoriClientGetLiveEvents::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -736,7 +752,7 @@ void USatoriClientGetLiveEvents::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -754,7 +770,7 @@ void USatoriClientGetLiveEvents::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -771,7 +787,7 @@ void USatoriClientGetLiveEvents::Activate() USatoriClientGetMessages* USatoriClientGetMessages::GetMessages( USatoriClient* Client, - UNakamaSession* Session, + USatoriSession* Session, int32 Limit, bool Forward, const FString& Cursor) @@ -791,7 +807,7 @@ void USatoriClientGetMessages::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -799,7 +815,7 @@ void USatoriClientGetMessages::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -807,7 +823,7 @@ void USatoriClientGetMessages::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast({}, Error); SetReadyToDestroy(); return; @@ -825,7 +841,7 @@ void USatoriClientGetMessages::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -842,7 +858,7 @@ void USatoriClientGetMessages::Activate() USatoriClientUpdateMessage* USatoriClientUpdateMessage::UpdateMessage( USatoriClient* Client, - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, const FDateTime ReadTime, const FDateTime ConsumeTime) @@ -862,7 +878,7 @@ void USatoriClientUpdateMessage::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -870,7 +886,7 @@ void USatoriClientUpdateMessage::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -878,7 +894,7 @@ void USatoriClientUpdateMessage::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -896,7 +912,7 @@ void USatoriClientUpdateMessage::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { @@ -911,7 +927,7 @@ void USatoriClientUpdateMessage::Activate() SatoriClient->UpdateMessage(UserSession, MessageId, ReadTime, ConsumeTime, successCallback, errorCallback); } -USatoriClientDeleteMessage* USatoriClientDeleteMessage::DeleteMessage(USatoriClient* Client, UNakamaSession* Session, const FString& MessageId) +USatoriClientDeleteMessage* USatoriClientDeleteMessage::DeleteMessage(USatoriClient* Client, USatoriSession* Session, const FString& MessageId) { USatoriClientDeleteMessage* Node = NewObject(); Node->SatoriClient = Client; @@ -926,7 +942,7 @@ void USatoriClientDeleteMessage::Activate() // Check validity of client and session if (!SatoriClient && !UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClientAndSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClientAndSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -934,7 +950,7 @@ void USatoriClientDeleteMessage::Activate() if (!SatoriClient) { - const FNakamaError Error = FNakamaUtils::HandleInvalidClient(); + const FSatoriError Error = FSatoriUtils::HandleInvalidClient(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -942,7 +958,7 @@ void USatoriClientDeleteMessage::Activate() if (!UserSession) { - const FNakamaError Error = FNakamaUtils::HandleInvalidSession(); + const FSatoriError Error = FSatoriUtils::HandleInvalidSession(); OnError.Broadcast(Error); SetReadyToDestroy(); return; @@ -960,7 +976,7 @@ void USatoriClientDeleteMessage::Activate() SetReadyToDestroy(); }; - auto errorCallback = [this](const FNakamaError& error) + auto errorCallback = [this](const FSatoriError& error) { if (!USatoriClient::IsClientActive(SatoriClient)) { diff --git a/Satori/Source/SatoriBlueprints/Public/SatoriBlueprints.h b/Satori/Source/SatoriBlueprints/Public/SatoriBlueprints.h index b91e8605..9ff6aed9 100644 --- a/Satori/Source/SatoriBlueprints/Public/SatoriBlueprints.h +++ b/Satori/Source/SatoriBlueprints/Public/SatoriBlueprints.h @@ -1,7 +1,21 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once -//#include "SatoriUnreal.h" -//#include "nonstd/optional.hpp" #include "CoreMinimal.h" #include "Modules/ModuleManager.h" diff --git a/Satori/Source/SatoriBlueprints/Public/SatoriClientRequests.h b/Satori/Source/SatoriBlueprints/Public/SatoriClientRequests.h index 9f9f0e40..4f9552eb 100644 --- a/Satori/Source/SatoriBlueprints/Public/SatoriClientRequests.h +++ b/Satori/Source/SatoriBlueprints/Public/SatoriClientRequests.h @@ -1,31 +1,45 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once #include "CoreMinimal.h" #include "SatoriClient.h" #include "Kismet/BlueprintAsyncActionBase.h" -#include "NakamaError.h" +#include "SatoriError.h" #include "SatoriClientRequests.generated.h" // Delegates -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriAuthenticateCustom, UNakamaSession*, Session, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriAuthenticateRefresh, UNakamaSession*, Session, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriAuthenticateLogout, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriIdentify, UNakamaSession*, Session, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriListIdentityProperties, FSatoriProperties, Properties, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriUpdateProperties, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriDeleteIdentity, FNakamaError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriAuthenticate, USatoriSession*, Session, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriAuthenticateRefresh, USatoriSession*, Session, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriAuthenticateLogout, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriIdentify, USatoriSession*, Session, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriListIdentityProperties, FSatoriProperties, Properties, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriUpdateProperties, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriDeleteIdentity, FSatoriError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriPostEvent, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetExperiments, FSatoriExperimentList, Experiments, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetFlags, FSatoriFlagList, Flags, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetFlagOverrides, FSatoriFlagOverrideList, FlagOverrides, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetLiveEvents, FSatoriLiveEventList, LiveEvents, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetMessages, FSatoriMessageList, Messages, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriUpdateMessage, FNakamaError, Error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriDeleteMessage, FNakamaError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriPostEvent, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetExperiments, FSatoriExperimentList, Experiments, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetFlags, FSatoriFlagList, Flags, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetFlagOverrides, FSatoriFlagOverrideList, FlagOverrides, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetLiveEvents, FSatoriLiveEventList, LiveEvents, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSatoriGetMessages, FSatoriMessageList, Messages, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriUpdateMessage, FSatoriError, Error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriDeleteMessage, FSatoriError, Error); @@ -37,7 +51,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriDeleteMessage, FNakamaError */ UCLASS() -class SATORIBLUEPRINTS_API USatoriClientAuthenticateCustom : public UBlueprintAsyncActionBase +class SATORIBLUEPRINTS_API USatoriClientAuthenticate : public UBlueprintAsyncActionBase { GENERATED_BODY() @@ -47,36 +61,36 @@ class SATORIBLUEPRINTS_API USatoriClientAuthenticateCustom : public UBlueprintAs TObjectPtr SatoriClient; UPROPERTY(BlueprintAssignable) - FOnSatoriAuthenticateCustom OnSuccess; + FOnSatoriAuthenticate OnSuccess; UPROPERTY(BlueprintAssignable) - FOnSatoriAuthenticateCustom OnError; + FOnSatoriAuthenticate OnError; /** - * Authenticate a user with a custom id. - * @param Client The Client to use. - * @param UserID A custom identifier usually obtained from an external authentication service. - * @param Username A username used to create the user. - * @param CreateAccount True if the user should be created when authenticated. - * @param Vars Extra information that will be bundled in the session token. + * Authenticate to get a satori session. + * @param ID Must be between eight and 128 characters (inclusive). Must be an alphanumeric string with only underscores and hyphens allowed. + * @param DefaultProperties Optional default properties to update with this call. If not set, properties are left as they are on the server. + * @param CustomProperties Optional custom properties to update with this call. If not set, properties are left as they are on the server. + * @param bNoSession Modifies the request to only create/update an identity without creating a new session. If set to 'true' the response won't include a token and a refresh token. + * @param Success Delegate called upon successful authentication, providing the user session. + * @param Error Delegate called on authentication failure with error details. */ - UFUNCTION(BlueprintCallable, Category = "Satori|Authentication", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "Vars")) - static USatoriClientAuthenticateCustom* AuthenticateCustom( + UFUNCTION(BlueprintCallable, Category = "Satori|Authentication", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "DefaultProperties,CustomProperties")) + static USatoriClientAuthenticate* Authenticate( USatoriClient *Client, - const FString& UserID, - const FString& Username, - bool CreateAccount, - const TMap& Vars); + const FString& ID, + const TMap& DefaultProperties, + const TMap& CustomProperties, + const bool bNoSession); virtual void Activate() override; private: - FString UserID; - FString Username; - bool bCreateAccount; - TMap Vars; - + FString ID; + TMap DefaultProperties; + TMap CustomProperties; + bool bNoSession; }; @@ -95,7 +109,7 @@ class SATORIBLUEPRINTS_API USatoriClientAuthenticateRefresh : public UBlueprintA TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriAuthenticateRefresh OnSuccess; @@ -110,7 +124,7 @@ class SATORIBLUEPRINTS_API USatoriClientAuthenticateRefresh : public UBlueprintA * @param Client The Client to use. */ UFUNCTION(BlueprintCallable, Category = "Satori|Authentication", meta = (BlueprintInternalUseOnly = "true")) - static USatoriClientAuthenticateRefresh* AuthenticateRefresh(USatoriClient* Client, UNakamaSession* Session); + static USatoriClientAuthenticateRefresh* AuthenticateRefresh(USatoriClient* Client, USatoriSession* Session); virtual void Activate() override; }; @@ -131,7 +145,7 @@ class SATORIBLUEPRINTS_API USatoriClientAuthenticateLogout : public UBlueprintAs TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriAuthenticateLogout OnSuccess; @@ -146,7 +160,7 @@ class SATORIBLUEPRINTS_API USatoriClientAuthenticateLogout : public UBlueprintAs * @param Client The Client to use. */ UFUNCTION(BlueprintCallable, Category = "Satori|Authentication", meta = (BlueprintInternalUseOnly = "true")) - static USatoriClientAuthenticateLogout* AuthenticateLogout(USatoriClient* Client, UNakamaSession* Session); + static USatoriClientAuthenticateLogout* AuthenticateLogout(USatoriClient* Client, USatoriSession* Session); virtual void Activate() override; }; @@ -167,7 +181,7 @@ class SATORIBLUEPRINTS_API USatoriClientIdentify : public UBlueprintAsyncActionB TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriIdentify OnSuccess; @@ -182,10 +196,10 @@ class SATORIBLUEPRINTS_API USatoriClientIdentify : public UBlueprintAsyncActionB * @param Session The session of the user. * @param Client The Client to use. */ - UFUNCTION(BlueprintCallable, Category = "Satori|Identity", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "DefaultProperties,CustomProperties")) + UFUNCTION(BlueprintCallable, Category = "Satori|Authentication", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "DefaultProperties,CustomProperties")) static USatoriClientIdentify* Identify( USatoriClient* Client, - UNakamaSession* Session, + USatoriSession* Session, const FString& ID, const TMap& DefaultProperties, const TMap& CustomProperties); @@ -214,7 +228,7 @@ class SATORIBLUEPRINTS_API USatoriClientListIdentityProperties : public UBluepri TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriListIdentityProperties OnSuccess; @@ -228,8 +242,8 @@ class SATORIBLUEPRINTS_API USatoriClientListIdentityProperties : public UBluepri * @param Session The session of the user. * @param Client The Client to use. */ - UFUNCTION(BlueprintCallable, Category = "Satori|Identity", meta = (BlueprintInternalUseOnly = "true")) - static USatoriClientListIdentityProperties* ListIdentityProperties(USatoriClient* Client, UNakamaSession* Session); + UFUNCTION(BlueprintCallable, Category = "Satori|Authentication", meta = (BlueprintInternalUseOnly = "true")) + static USatoriClientListIdentityProperties* ListIdentityProperties(USatoriClient* Client, USatoriSession* Session); virtual void Activate() override; }; @@ -250,7 +264,7 @@ class SATORIBLUEPRINTS_API USatoriClientUpdateProperties : public UBlueprintAsyn TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriUpdateProperties OnSuccess; @@ -265,10 +279,10 @@ class SATORIBLUEPRINTS_API USatoriClientUpdateProperties : public UBlueprintAsyn * @param Session The session of the user. * @param Client The Client to use. */ - UFUNCTION(BlueprintCallable, Category = "Satori|Identity", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "DefaultProperties,CustomProperties")) + UFUNCTION(BlueprintCallable, Category = "Satori|Authentication", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "DefaultProperties,CustomProperties")) static USatoriClientUpdateProperties* UpdateProperties( USatoriClient* Client, - UNakamaSession* Session, + USatoriSession* Session, const TMap& DefaultProperties, const TMap& CustomProperties, const bool bRecompute); @@ -297,7 +311,7 @@ class SATORIBLUEPRINTS_API USatoriClientDeleteIdentity : public UBlueprintAsyncA TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriDeleteIdentity OnSuccess; @@ -311,8 +325,8 @@ class SATORIBLUEPRINTS_API USatoriClientDeleteIdentity : public UBlueprintAsyncA * @param Session The session of the user. * @param Client The Client to use. */ - UFUNCTION(BlueprintCallable, Category = "Satori|Identity", meta = (BlueprintInternalUseOnly = "true")) - static USatoriClientDeleteIdentity* DeleteIdentity(USatoriClient* Client, UNakamaSession* Session); + UFUNCTION(BlueprintCallable, Category = "Satori|Authentication", meta = (BlueprintInternalUseOnly = "true")) + static USatoriClientDeleteIdentity* DeleteIdentity(USatoriClient* Client, USatoriSession* Session); virtual void Activate() override; }; @@ -337,7 +351,7 @@ class SATORIBLUEPRINTS_API USatoriClientPostEvent : public UBlueprintAsyncAction TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriPostEvent OnSuccess; @@ -353,7 +367,7 @@ class SATORIBLUEPRINTS_API USatoriClientPostEvent : public UBlueprintAsyncAction * @param Client The Client to use. */ UFUNCTION(BlueprintCallable, Category = "Satori|Events", meta = (BlueprintInternalUseOnly = "true")) - static USatoriClientPostEvent* PostEvent(USatoriClient* Client, UNakamaSession* Session, const TArray& Events); + static USatoriClientPostEvent* PostEvent(USatoriClient* Client, USatoriSession* Session, const TArray& Events); virtual void Activate() override; @@ -377,7 +391,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetExperiments : public UBlueprintAsyncA TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriGetExperiments OnSuccess; @@ -393,7 +407,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetExperiments : public UBlueprintAsyncA * @param Client The Client to use. */ UFUNCTION(BlueprintCallable, Category = "Satori|Experiments", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "Names")) - static USatoriClientGetExperiments* GetExperiments(USatoriClient* Client, UNakamaSession* Session, const TArray& Names); + static USatoriClientGetExperiments* GetExperiments(USatoriClient* Client, USatoriSession* Session, const TArray& Names); virtual void Activate() override; @@ -417,7 +431,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetFlags : public UBlueprintAsyncActionB TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriGetFlags OnSuccess; @@ -433,7 +447,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetFlags : public UBlueprintAsyncActionB * @param Client The Client to use. */ UFUNCTION(BlueprintCallable, Category = "Satori|Flags", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "Names")) - static USatoriClientGetFlags* GetFlags(USatoriClient* Client, UNakamaSession* Session, const TArray& Names); + static USatoriClientGetFlags* GetFlags(USatoriClient* Client, USatoriSession* Session, const TArray& Names); virtual void Activate() override; @@ -457,7 +471,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetFlagOverrides : public UBlueprintAsyn TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriGetFlagOverrides OnSuccess; @@ -473,7 +487,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetFlagOverrides : public UBlueprintAsyn * @param Client The Client to use. */ UFUNCTION(BlueprintCallable, Category = "Satori|Flags", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "Names")) - static USatoriClientGetFlagOverrides* GetFlagOverrides(USatoriClient* Client, UNakamaSession* Session, const TArray& Names); + static USatoriClientGetFlagOverrides* GetFlagOverrides(USatoriClient* Client, USatoriSession* Session, const TArray& Names); virtual void Activate() override; @@ -497,7 +511,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetLiveEvents : public UBlueprintAsyncAc TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriGetLiveEvents OnSuccess; @@ -513,7 +527,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetLiveEvents : public UBlueprintAsyncAc * @param Client The Client to use. */ UFUNCTION(BlueprintCallable, Category = "Satori|LiveEvents", meta = (BlueprintInternalUseOnly = "true", AutoCreateRefTerm = "LiveEventNames")) - static USatoriClientGetLiveEvents* GetLiveEvents(USatoriClient* Client, UNakamaSession* Session, const TArray& LiveEventNames); + static USatoriClientGetLiveEvents* GetLiveEvents(USatoriClient* Client, USatoriSession* Session, const TArray& LiveEventNames); virtual void Activate() override; @@ -537,7 +551,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetMessages : public UBlueprintAsyncActi TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriGetMessages OnSuccess; @@ -555,7 +569,7 @@ class SATORIBLUEPRINTS_API USatoriClientGetMessages : public UBlueprintAsyncActi UFUNCTION(BlueprintCallable, Category = "Satori|Messages", meta = (BlueprintInternalUseOnly = "true")) static USatoriClientGetMessages* GetMessages( USatoriClient* Client, - UNakamaSession* Session, + USatoriSession* Session, int32 Limit, bool Forward, const FString& Cursor); @@ -584,7 +598,7 @@ class SATORIBLUEPRINTS_API USatoriClientUpdateMessage : public UBlueprintAsyncAc TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriUpdateMessage OnSuccess; @@ -602,7 +616,7 @@ class SATORIBLUEPRINTS_API USatoriClientUpdateMessage : public UBlueprintAsyncAc UFUNCTION(BlueprintCallable, Category = "Satori|Messages", meta = (BlueprintInternalUseOnly = "true")) static USatoriClientUpdateMessage* UpdateMessage( USatoriClient* Client, - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, const FDateTime ReadTime, const FDateTime ConsumeTime); @@ -631,7 +645,7 @@ class SATORIBLUEPRINTS_API USatoriClientDeleteMessage : public UBlueprintAsyncAc TObjectPtr SatoriClient; UPROPERTY() - TObjectPtr UserSession; + TObjectPtr UserSession; UPROPERTY(BlueprintAssignable) FOnSatoriDeleteMessage OnSuccess; @@ -647,7 +661,7 @@ class SATORIBLUEPRINTS_API USatoriClientDeleteMessage : public UBlueprintAsyncAc * @param Client The Client to use. */ UFUNCTION(BlueprintCallable, Category = "Satori|Messages", meta = (BlueprintInternalUseOnly = "true")) - static USatoriClientDeleteMessage* DeleteMessage(USatoriClient* Client, UNakamaSession* Session, const FString& MessageId); + static USatoriClientDeleteMessage* DeleteMessage(USatoriClient* Client, USatoriSession* Session, const FString& MessageId); virtual void Activate() override; diff --git a/Satori/Source/SatoriBlueprints/SatoriBlueprints.Build.cs b/Satori/Source/SatoriBlueprints/SatoriBlueprints.Build.cs index c736949e..81f22b97 100644 --- a/Satori/Source/SatoriBlueprints/SatoriBlueprints.Build.cs +++ b/Satori/Source/SatoriBlueprints/SatoriBlueprints.Build.cs @@ -1,4 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ using UnrealBuildTool; @@ -41,8 +55,7 @@ public SatoriBlueprints(ReadOnlyTargetRules Target) : base(Target) "SlateCore", "Engine", "JsonUtilities", - "Json", - "NakamaUnreal", + "Json" // ... private dependencies that you statically link with here ... } diff --git a/Satori/Source/SatoriUnreal/Private/SatoriClient.cpp b/Satori/Source/SatoriUnreal/Private/SatoriClient.cpp index 9d89350d..e504b915 100644 --- a/Satori/Source/SatoriUnreal/Private/SatoriClient.cpp +++ b/Satori/Source/SatoriUnreal/Private/SatoriClient.cpp @@ -1,7 +1,21 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "SatoriClient.h" -#include "NakamaUtils.h" +#include "SatoriUtils.h" #include "GenericPlatform/GenericPlatformHttp.h" #include "Interfaces/IHttpResponse.h" @@ -93,22 +107,22 @@ USatoriClient* USatoriClient::CreateDefaultClient( if (EnableDebug) { - UNakamaLogger::EnableLogging(true); - UNakamaLogger::SetLogLevel(ENakamaLogLevel::Debug); + USatoriLogger::EnableLogging(true); + USatoriLogger::SetLogLevel(ESatoriLogLevel::Debug); } return NewClient; } -void USatoriClient::AuthenticateCustom( - const FString& UserID, - const FString& Username, - bool CreateAccount, - const TMap& Vars, +void USatoriClient::Authenticate( + const FString& ID, + const TMap& DefaultProperties, + const TMap& CustomProperties, + const bool bNoSession, FOnSatoriAuthUpdate Success, FOnSatoriError Error) { - auto successCallback = [this, Success](UNakamaSession* session) + auto successCallback = [this, Success](USatoriSession* session) { if (!IsClientActive(this)) return; @@ -116,7 +130,7 @@ void USatoriClient::AuthenticateCustom( Success.Broadcast(session); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) return; @@ -127,44 +141,63 @@ void USatoriClient::AuthenticateCustom( // A custom identifier must contain alphanumeric // characters with dashesand be between 6 and 128 bytes. - AuthenticateCustom(UserID, Username, CreateAccount, Vars, successCallback, errorCallback); + Authenticate(ID, DefaultProperties, CustomProperties, bNoSession, successCallback, errorCallback); } -void USatoriClient::AuthenticateCustom( - const FString& CustomId, - const FString& Username, - bool bCreate, - const TMap& Vars, - TFunction SuccessCallback, - TFunction ErrorCallback) +void USatoriClient::Authenticate( + const FString& ID, + const TMap& DefaultProperties, + const TMap& CustomProperties, + const bool bNoSession, + TFunction SuccessCallback, + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/authenticate"); - // Setup the query parameters - TMultiMap QueryParams; - QueryParams.Add(TEXT("create"), FNakamaUtils::BoolToString(bCreate)); - QueryParams.Add(TEXT("username"), FGenericPlatformHttp::UrlEncode(Username)); - // Setup the request content const TSharedPtr ContentJson = MakeShared(); - ContentJson->SetStringField(TEXT("id"), CustomId); - FNakamaUtils::AddVarsToJson(ContentJson, Vars); + + ContentJson->SetStringField(TEXT("id"), ID); + if (bNoSession) + { + ContentJson->SetBoolField(TEXT("no_session"), bNoSession); + } + + if(!DefaultProperties.IsEmpty()) + { + TSharedPtr DefaultPropertiesJson = MakeShared(); + for (const TPair& Pair : DefaultProperties) + { + DefaultPropertiesJson->SetStringField(Pair.Key, Pair.Value); + } + ContentJson->SetObjectField(TEXT("default"), DefaultPropertiesJson); + } + + if (!CustomProperties.IsEmpty()) + { + TSharedPtr CustomPropertiesJson = MakeShared(); + for (const TPair& Pair : CustomProperties) + { + CustomPropertiesJson->SetStringField(Pair.Key, Pair.Value); + } + ContentJson->SetObjectField(TEXT("custom"), CustomPropertiesJson); + } // Serialize the request content FString Content; - if (!FNakamaUtils::SerializeJsonObject(ContentJson, Content)) + if (!FSatoriUtils::SerializeJsonObject(ContentJson, Content)) { // Handle JSON serialization failure - FNakamaUtils::HandleJsonSerializationFailure(ErrorCallback); + FSatoriUtils::HandleJsonSerializationFailure(ErrorCallback); return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, Content, ENakamaRequestMethod::POST, QueryParams, ""); + const auto HttpRequest = MakeRequest(Endpoint, Content, ESatoriRequestMethod::POST, TMultiMap(), ""); // Set the basic authorization header - FNakamaUtils::SetBasicAuthorizationHeader(HttpRequest, ServerKey); + FSatoriUtils::SetBasicAuthorizationHeader(HttpRequest, ServerKey); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -190,12 +223,12 @@ void USatoriClient::AuthenticateCustom( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) { - UNakamaSession* ResultSession = NewObject(); + USatoriSession* ResultSession = NewObject(); ResultSession->SetupSession(ResponseBody); SuccessCallback(ResultSession); } @@ -205,7 +238,7 @@ void USatoriClient::AuthenticateCustom( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -215,7 +248,7 @@ void USatoriClient::AuthenticateCustom( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -230,11 +263,11 @@ void USatoriClient::AuthenticateCustom( } void USatoriClient::AuthenticateRefresh( - UNakamaSession* Session, + USatoriSession* Session, FOnSatoriAuthUpdate Success, FOnSatoriError Error) { - auto successCallback = [this, Success](UNakamaSession* UserSession) + auto successCallback = [this, Success](USatoriSession* UserSession) { if (!IsClientActive(this)) { @@ -244,7 +277,7 @@ void USatoriClient::AuthenticateRefresh( Success.Broadcast(UserSession); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -258,15 +291,15 @@ void USatoriClient::AuthenticateRefresh( } void USatoriClient::AuthenticateRefresh( - UNakamaSession* Session, - TFunction SuccessCallback, - TFunction ErrorCallback) + USatoriSession* Session, + TFunction SuccessCallback, + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/authenticate/refresh"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } @@ -277,18 +310,18 @@ void USatoriClient::AuthenticateRefresh( // Serialize the request content FString Content; - if (!FNakamaUtils::SerializeJsonObject(ContentJson, Content)) + if (!FSatoriUtils::SerializeJsonObject(ContentJson, Content)) { // Handle JSON serialization failure - FNakamaUtils::HandleJsonSerializationFailure(ErrorCallback); + FSatoriUtils::HandleJsonSerializationFailure(ErrorCallback); return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, Content, ENakamaRequestMethod::POST, TMultiMap(), ""); + const auto HttpRequest = MakeRequest(Endpoint, Content, ESatoriRequestMethod::POST, TMultiMap(), ""); // Set the basic authorization header - FNakamaUtils::SetBasicAuthorizationHeader(HttpRequest, ServerKey); + FSatoriUtils::SetBasicAuthorizationHeader(HttpRequest, ServerKey); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -314,12 +347,12 @@ void USatoriClient::AuthenticateRefresh( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) { - UNakamaSession* ResultSession = NewObject(); + USatoriSession* ResultSession = NewObject(); ResultSession->SetupSession(ResponseBody); SuccessCallback(ResultSession); } @@ -329,7 +362,7 @@ void USatoriClient::AuthenticateRefresh( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -339,7 +372,7 @@ void USatoriClient::AuthenticateRefresh( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -347,14 +380,14 @@ void USatoriClient::AuthenticateRefresh( // Remove the HttpRequest from ActiveRequests ActiveRequests.Remove(Request); } - }); + }); // Process the request HttpRequest->ProcessRequest(); } void USatoriClient::AuthenticateLogout( - UNakamaSession* Session, + USatoriSession* Session, FOnAuthLogoutSent Success, FOnSatoriError Error) { @@ -368,7 +401,7 @@ void USatoriClient::AuthenticateLogout( Success.Broadcast(); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -382,15 +415,15 @@ void USatoriClient::AuthenticateLogout( } void USatoriClient::AuthenticateLogout( - UNakamaSession* Session, + USatoriSession* Session, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/authenticate/logout"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } @@ -402,15 +435,15 @@ void USatoriClient::AuthenticateLogout( // Serialize the request content FString Content; - if (!FNakamaUtils::SerializeJsonObject(ContentJson, Content)) + if (!FSatoriUtils::SerializeJsonObject(ContentJson, Content)) { // Handle JSON serialization failure - FNakamaUtils::HandleJsonSerializationFailure(ErrorCallback); + FSatoriUtils::HandleJsonSerializationFailure(ErrorCallback); return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, Content, ENakamaRequestMethod::POST, TMultiMap(), Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, Content, ESatoriRequestMethod::POST, TMultiMap(), Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -436,7 +469,7 @@ void USatoriClient::AuthenticateLogout( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -449,7 +482,7 @@ void USatoriClient::AuthenticateLogout( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -459,7 +492,7 @@ void USatoriClient::AuthenticateLogout( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -474,14 +507,14 @@ void USatoriClient::AuthenticateLogout( } void USatoriClient::Identify( - UNakamaSession* Session, + USatoriSession* Session, const FString& ID, const TMap& defaultProperties, const TMap& customProperties, FOnSatoriAuthUpdate Success, FOnSatoriError Error) { - auto successCallback = [this, Success](UNakamaSession* UserSession) + auto successCallback = [this, Success](USatoriSession* UserSession) { if (!IsClientActive(this)) { @@ -491,7 +524,7 @@ void USatoriClient::Identify( Success.Broadcast(UserSession); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -505,12 +538,12 @@ void USatoriClient::Identify( } void USatoriClient::Identify( - UNakamaSession* Session, + USatoriSession* Session, const FString& ID, const TMap& DefaultProperties, const TMap& CustomProperties, - TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction SuccessCallback, + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/identify"); @@ -520,31 +553,37 @@ void USatoriClient::Identify( ContentJson->SetStringField(TEXT("id"), ID); - TSharedPtr DefaultPropertiesJson = MakeShared(); - for (const TPair& Pair : DefaultProperties) + if(!DefaultProperties.IsEmpty()) { - DefaultPropertiesJson->SetStringField(Pair.Key, Pair.Value); + TSharedPtr DefaultPropertiesJson = MakeShared(); + for (const TPair& Pair : DefaultProperties) + { + DefaultPropertiesJson->SetStringField(Pair.Key, Pair.Value); + } + ContentJson->SetObjectField(TEXT("default"), DefaultPropertiesJson); } - ContentJson->SetObjectField(TEXT("default"), DefaultPropertiesJson); - TSharedPtr CustomPropertiesJson = MakeShared(); - for (const TPair& Pair : DefaultProperties) + if (!CustomProperties.IsEmpty()) { - CustomPropertiesJson->SetStringField(Pair.Key, Pair.Value); + TSharedPtr CustomPropertiesJson = MakeShared(); + for (const TPair& Pair : CustomProperties) + { + CustomPropertiesJson->SetStringField(Pair.Key, Pair.Value); + } + ContentJson->SetObjectField(TEXT("custom"), CustomPropertiesJson); } - ContentJson->SetObjectField(TEXT("custom"), CustomPropertiesJson); // Serialize the request content FString Content; - if (!FNakamaUtils::SerializeJsonObject(ContentJson, Content)) + if (!FSatoriUtils::SerializeJsonObject(ContentJson, Content)) { // Handle JSON serialization failure - FNakamaUtils::HandleJsonSerializationFailure(ErrorCallback); + FSatoriUtils::HandleJsonSerializationFailure(ErrorCallback); return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, Content, ENakamaRequestMethod::PUT, TMultiMap(), Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, Content, ESatoriRequestMethod::PUT, TMultiMap(), Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -570,12 +609,12 @@ void USatoriClient::Identify( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) { - UNakamaSession* ResultSession = NewObject(); + USatoriSession* ResultSession = NewObject(); ResultSession->SetupSession(ResponseBody); SuccessCallback(ResultSession); } @@ -585,7 +624,7 @@ void USatoriClient::Identify( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -595,7 +634,7 @@ void USatoriClient::Identify( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -610,7 +649,7 @@ void USatoriClient::Identify( } void USatoriClient::ListIdentityProperties( - UNakamaSession* Session, + USatoriSession* Session, FOnGetProperties Success, FOnSatoriError Error) { @@ -624,7 +663,7 @@ void USatoriClient::ListIdentityProperties( Success.Broadcast(Properties); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -638,21 +677,21 @@ void USatoriClient::ListIdentityProperties( } void USatoriClient::ListIdentityProperties( - UNakamaSession* Session, + USatoriSession* Session, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/properties"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ENakamaRequestMethod::GET, TMultiMap(), Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ESatoriRequestMethod::GET, TMultiMap(), Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -678,7 +717,7 @@ void USatoriClient::ListIdentityProperties( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -692,7 +731,7 @@ void USatoriClient::ListIdentityProperties( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -702,7 +741,7 @@ void USatoriClient::ListIdentityProperties( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -717,7 +756,7 @@ void USatoriClient::ListIdentityProperties( } void USatoriClient::UpdateProperties( - UNakamaSession* Session, + USatoriSession* Session, const TMap& DefaultProperties, const TMap& CustomProperties, const bool bRecompute, @@ -734,7 +773,7 @@ void USatoriClient::UpdateProperties( Success.Broadcast(); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -748,12 +787,12 @@ void USatoriClient::UpdateProperties( } void USatoriClient::UpdateProperties( - UNakamaSession* Session, + USatoriSession* Session, const TMap& DefaultProperties, const TMap& CustomProperties, const bool bRecompute, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/properties"); @@ -761,33 +800,39 @@ void USatoriClient::UpdateProperties( // Setup the request content const TSharedPtr ContentJson = MakeShared(); - TSharedPtr DefaultPropertiesJson = MakeShared(); - for (const TPair& Pair : DefaultProperties) + if (!DefaultProperties.IsEmpty()) { - DefaultPropertiesJson->SetStringField(Pair.Key, Pair.Value); + TSharedPtr DefaultPropertiesJson = MakeShared(); + for (const TPair& Pair : DefaultProperties) + { + DefaultPropertiesJson->SetStringField(Pair.Key, Pair.Value); + } + ContentJson->SetObjectField(TEXT("default"), DefaultPropertiesJson); } - ContentJson->SetObjectField(TEXT("default"), DefaultPropertiesJson); - TSharedPtr CustomPropertiesJson = MakeShared(); - for (const TPair& Pair : DefaultProperties) + if (!CustomProperties.IsEmpty()) { - CustomPropertiesJson->SetStringField(Pair.Key, Pair.Value); + TSharedPtr CustomPropertiesJson = MakeShared(); + for (const TPair& Pair : CustomProperties) + { + CustomPropertiesJson->SetStringField(Pair.Key, Pair.Value); + } + ContentJson->SetObjectField(TEXT("custom"), CustomPropertiesJson); } - ContentJson->SetObjectField(TEXT("custom"), CustomPropertiesJson); ContentJson->SetBoolField(TEXT("recompute"), bRecompute); // Serialize the request content FString Content; - if (!FNakamaUtils::SerializeJsonObject(ContentJson, Content)) + if (!FSatoriUtils::SerializeJsonObject(ContentJson, Content)) { // Handle JSON serialization failure - FNakamaUtils::HandleJsonSerializationFailure(ErrorCallback); + FSatoriUtils::HandleJsonSerializationFailure(ErrorCallback); return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, Content, ENakamaRequestMethod::PUT, TMultiMap(), Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, Content, ESatoriRequestMethod::PUT, TMultiMap(), Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -813,7 +858,7 @@ void USatoriClient::UpdateProperties( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -826,7 +871,7 @@ void USatoriClient::UpdateProperties( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -836,7 +881,7 @@ void USatoriClient::UpdateProperties( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -851,7 +896,7 @@ void USatoriClient::UpdateProperties( } void USatoriClient::DeleteIdentity( - UNakamaSession* Session, + USatoriSession* Session, FOnDeleteIdentitySent Success, FOnSatoriError Error) { @@ -865,7 +910,7 @@ void USatoriClient::DeleteIdentity( Success.Broadcast(); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -879,21 +924,21 @@ void USatoriClient::DeleteIdentity( } void USatoriClient::DeleteIdentity( - UNakamaSession* Session, + USatoriSession* Session, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/identity"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ENakamaRequestMethod::DEL, TMultiMap(), Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ESatoriRequestMethod::DEL, TMultiMap(), Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -919,7 +964,7 @@ void USatoriClient::DeleteIdentity( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -932,7 +977,7 @@ void USatoriClient::DeleteIdentity( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -942,7 +987,7 @@ void USatoriClient::DeleteIdentity( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -957,7 +1002,7 @@ void USatoriClient::DeleteIdentity( } void USatoriClient::PostEvent( - UNakamaSession* Session, + USatoriSession* Session, const TArray& events, FOnPostEventSent Success, FOnSatoriError Error) @@ -972,7 +1017,7 @@ void USatoriClient::PostEvent( Success.Broadcast(); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -986,16 +1031,16 @@ void USatoriClient::PostEvent( } void USatoriClient::PostEvent( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Events, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/event"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } @@ -1013,7 +1058,7 @@ void USatoriClient::PostEvent( { EventJson->SetStringField(TEXT("id"), Event.ID); } - FNakamaUtils::AddVarsToJson(EventJson, Event.Metadata, TEXT("metadata")); + FSatoriUtils::AddVarsToJson(EventJson, Event.Metadata, TEXT("metadata")); if (!Event.Value.IsEmpty()) { EventJson->SetStringField(TEXT("value"), Event.Value); @@ -1026,15 +1071,15 @@ void USatoriClient::PostEvent( // Serialize the request content FString Content; - if (!FNakamaUtils::SerializeJsonObject(ContentJson, Content)) + if (!FSatoriUtils::SerializeJsonObject(ContentJson, Content)) { // Handle JSON serialization failure - FNakamaUtils::HandleJsonSerializationFailure(ErrorCallback); + FSatoriUtils::HandleJsonSerializationFailure(ErrorCallback); return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, Content, ENakamaRequestMethod::POST, TMultiMap(), Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, Content, ESatoriRequestMethod::POST, TMultiMap(), Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -1060,7 +1105,7 @@ void USatoriClient::PostEvent( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -1073,7 +1118,7 @@ void USatoriClient::PostEvent( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -1083,7 +1128,7 @@ void USatoriClient::PostEvent( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -1098,7 +1143,7 @@ void USatoriClient::PostEvent( } void USatoriClient::GetExperiments( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, FOnGetExperiments Success, FOnSatoriError Error) @@ -1113,7 +1158,7 @@ void USatoriClient::GetExperiments( Success.Broadcast(Experiments); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -1127,16 +1172,16 @@ void USatoriClient::GetExperiments( } void USatoriClient::GetExperiments( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/experiment"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } @@ -1149,7 +1194,7 @@ void USatoriClient::GetExperiments( } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ENakamaRequestMethod::GET, QueryParams, Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ESatoriRequestMethod::GET, QueryParams, Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -1175,7 +1220,7 @@ void USatoriClient::GetExperiments( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -1189,7 +1234,7 @@ void USatoriClient::GetExperiments( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -1199,7 +1244,7 @@ void USatoriClient::GetExperiments( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -1214,7 +1259,7 @@ void USatoriClient::GetExperiments( } void USatoriClient::GetFlags( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, FOnGetFlags Success, FOnSatoriError Error) @@ -1229,7 +1274,7 @@ void USatoriClient::GetFlags( Success.Broadcast(Flags); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -1243,16 +1288,16 @@ void USatoriClient::GetFlags( } void USatoriClient::GetFlags( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/flag"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } @@ -1265,7 +1310,7 @@ void USatoriClient::GetFlags( } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ENakamaRequestMethod::GET, QueryParams, Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ESatoriRequestMethod::GET, QueryParams, Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -1290,7 +1335,7 @@ void USatoriClient::GetFlags( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -1304,7 +1349,7 @@ void USatoriClient::GetFlags( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -1314,7 +1359,7 @@ void USatoriClient::GetFlags( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -1329,7 +1374,7 @@ void USatoriClient::GetFlags( } void USatoriClient::GetFlagOverrides( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, FOnGetFlagOverrides Success, FOnSatoriError Error) @@ -1344,7 +1389,7 @@ void USatoriClient::GetFlagOverrides( Success.Broadcast(Flags); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -1358,16 +1403,16 @@ void USatoriClient::GetFlagOverrides( } void USatoriClient::GetFlagOverrides( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/flag/override"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } @@ -1380,7 +1425,7 @@ void USatoriClient::GetFlagOverrides( } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ENakamaRequestMethod::GET, QueryParams, Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ESatoriRequestMethod::GET, QueryParams, Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -1405,7 +1450,7 @@ void USatoriClient::GetFlagOverrides( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -1419,7 +1464,7 @@ void USatoriClient::GetFlagOverrides( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -1429,7 +1474,7 @@ void USatoriClient::GetFlagOverrides( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -1444,7 +1489,7 @@ void USatoriClient::GetFlagOverrides( } void USatoriClient::GetLiveEvents( - UNakamaSession* Session, + USatoriSession* Session, const TArray& LiveEventNames, FOnGetLiveEvents Success, FOnSatoriError Error) @@ -1459,7 +1504,7 @@ void USatoriClient::GetLiveEvents( Success.Broadcast(LiveEvents); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -1473,16 +1518,16 @@ void USatoriClient::GetLiveEvents( } void USatoriClient::GetLiveEvents( - UNakamaSession* Session, + USatoriSession* Session, const TArray& LiveEventNames, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/live-event"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } @@ -1495,7 +1540,7 @@ void USatoriClient::GetLiveEvents( } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ENakamaRequestMethod::GET, QueryParams, Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ESatoriRequestMethod::GET, QueryParams, Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -1521,7 +1566,7 @@ void USatoriClient::GetLiveEvents( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -1535,7 +1580,7 @@ void USatoriClient::GetLiveEvents( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -1545,7 +1590,7 @@ void USatoriClient::GetLiveEvents( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -1560,7 +1605,7 @@ void USatoriClient::GetLiveEvents( } void USatoriClient::GetMessages( - UNakamaSession* Session, + USatoriSession* Session, int32 Limit, bool Forward, const FString& Cursor, @@ -1577,7 +1622,7 @@ void USatoriClient::GetMessages( Success.Broadcast(Messages); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -1591,18 +1636,18 @@ void USatoriClient::GetMessages( } void USatoriClient::GetMessages( - UNakamaSession* Session, + USatoriSession* Session, int32 Limit, bool Forward, const FString& Cursor, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/message"); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } @@ -1610,11 +1655,11 @@ void USatoriClient::GetMessages( // Setup the query parameters TMultiMap QueryParams; QueryParams.Add(TEXT("limit"), FString::FromInt(Limit)); - QueryParams.Add(TEXT("forward"), FNakamaUtils::BoolToString(Forward)); + QueryParams.Add(TEXT("forward"), FSatoriUtils::BoolToString(Forward)); if (!Cursor.IsEmpty()) { QueryParams.Add(TEXT("cursor"), FGenericPlatformHttp::UrlEncode(Cursor)); } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ENakamaRequestMethod::GET, QueryParams, Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ESatoriRequestMethod::GET, QueryParams, Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -1640,7 +1685,7 @@ void USatoriClient::GetMessages( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -1654,7 +1699,7 @@ void USatoriClient::GetMessages( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -1664,7 +1709,7 @@ void USatoriClient::GetMessages( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -1679,7 +1724,7 @@ void USatoriClient::GetMessages( } void USatoriClient::UpdateMessage( - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, const FDateTime ReadTime, const FDateTime ConsumeTime, @@ -1696,7 +1741,7 @@ void USatoriClient::UpdateMessage( Success.Broadcast(); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -1710,12 +1755,12 @@ void USatoriClient::UpdateMessage( } void USatoriClient::UpdateMessage( - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, const FDateTime ReadTime, const FDateTime ConsumeTime, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/message/") + FGenericPlatformHttp::UrlEncode(MessageId); @@ -1728,15 +1773,15 @@ void USatoriClient::UpdateMessage( // Serialize the request content FString Content; - if (!FNakamaUtils::SerializeJsonObject(ContentJson, Content)) + if (!FSatoriUtils::SerializeJsonObject(ContentJson, Content)) { // Handle JSON serialization failure - FNakamaUtils::HandleJsonSerializationFailure(ErrorCallback); + FSatoriUtils::HandleJsonSerializationFailure(ErrorCallback); return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, Content, ENakamaRequestMethod::PUT, TMultiMap(), Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, Content, ESatoriRequestMethod::PUT, TMultiMap(), Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -1762,7 +1807,7 @@ void USatoriClient::UpdateMessage( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -1775,7 +1820,7 @@ void USatoriClient::UpdateMessage( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -1785,7 +1830,7 @@ void USatoriClient::UpdateMessage( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -1800,7 +1845,7 @@ void USatoriClient::UpdateMessage( } void USatoriClient::DeleteMessage( - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, FOnDeleteMessageSent Success, FOnSatoriError Error) @@ -1815,7 +1860,7 @@ void USatoriClient::DeleteMessage( Success.Broadcast(); }; - auto errorCallback = [this, Error](const FNakamaError& error) + auto errorCallback = [this, Error](const FSatoriError& error) { if (!IsClientActive(this)) { @@ -1829,22 +1874,22 @@ void USatoriClient::DeleteMessage( } void USatoriClient::DeleteMessage( - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, TFunction SuccessCallback, - TFunction ErrorCallback) + TFunction ErrorCallback) { // Setup the endpoint const FString Endpoint = TEXT("/v1/message/") + FGenericPlatformHttp::UrlEncode(MessageId); // Verify the session - if (!FNakamaUtils::IsSessionValid(Session, ErrorCallback)) + if (!FSatoriUtils::IsSessionValid(Session, ErrorCallback)) { return; } // Make the request - const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ENakamaRequestMethod::DEL, TMultiMap(), Session->GetAuthToken()); + const auto HttpRequest = MakeRequest(Endpoint, TEXT(""), ESatoriRequestMethod::DEL, TMultiMap(), Session->GetAuthToken()); // Lock the ActiveRequests mutex to protect concurrent access FScopeLock Lock(&ActiveRequestsMutex); @@ -1870,7 +1915,7 @@ void USatoriClient::DeleteMessage( const FString ResponseBody = Response->GetContentAsString(); // Check if Request was successful - if (FNakamaUtils::IsResponseSuccessful(Response->GetResponseCode())) + if (FSatoriUtils::IsResponseSuccessful(Response->GetResponseCode())) { // Check for Success Callback if (SuccessCallback) @@ -1883,7 +1928,7 @@ void USatoriClient::DeleteMessage( // Check for Error Callback if (ErrorCallback) { - const FNakamaError Error(ResponseBody); + const FSatoriError Error(ResponseBody); ErrorCallback(Error); } } @@ -1893,7 +1938,7 @@ void USatoriClient::DeleteMessage( // Handle Invalid Response if (ErrorCallback) { - const FNakamaError RequestError = FNakamaUtils::CreateRequestFailureError(); + const FSatoriError RequestError = FSatoriUtils::CreateRequestFailureError(); ErrorCallback(RequestError); } } @@ -1923,7 +1968,7 @@ FString USatoriClient::ConstructURL(const FString& Endpoint) TSharedRef USatoriClient::MakeRequest( const FString& Endpoint, const FString& Content, - ENakamaRequestMethod RequestMethod, + ESatoriRequestMethod RequestMethod, const TMultiMap& QueryParams, const FString& SessionToken) { @@ -1931,12 +1976,12 @@ TSharedRef USatoriClient::MakeRequest( FString ModifiedEndpoint = Endpoint; if (QueryParams.Num() > 0) { - FString QueryString = FNakamaUtils::BuildQueryString(QueryParams); + FString QueryString = FSatoriUtils::BuildQueryString(QueryParams); ModifiedEndpoint += "?" + QueryString; } // Construct the URL FString URL = ConstructURL(ModifiedEndpoint); - return FNakamaUtils::MakeRequest(URL, Content, RequestMethod, SessionToken, Timeout); + return FSatoriUtils::MakeRequest(URL, Content, RequestMethod, SessionToken, Timeout); } diff --git a/Satori/Source/SatoriUnreal/Private/SatoriError.cpp b/Satori/Source/SatoriUnreal/Private/SatoriError.cpp new file mode 100644 index 00000000..b539462e --- /dev/null +++ b/Satori/Source/SatoriUnreal/Private/SatoriError.cpp @@ -0,0 +1,94 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SatoriError.h" +#include "SatoriUtils.h" + +ESatoriErrorCode FSatoriError::ConvertSatoriErrorCode(int32 CodeValue) +{ + switch (CodeValue) + { + case 0: + return ESatoriErrorCode::Ok; + case 1: + return ESatoriErrorCode::Cancelled; + case 2: + return ESatoriErrorCode::Unknown; + case 3: + return ESatoriErrorCode::InvalidArgument; + case 4: + return ESatoriErrorCode::DeadlineExceeded; + case 5: + return ESatoriErrorCode::NotFound; + case 6: + return ESatoriErrorCode::AlreadyExists; + case 7: + return ESatoriErrorCode::PermissionDenied; + case 8: + return ESatoriErrorCode::ResourceExhausted; + case 9: + return ESatoriErrorCode::FailedPrecondition; + case 10: + return ESatoriErrorCode::Aborted; + case 11: + return ESatoriErrorCode::OutOfRange; + case 12: + return ESatoriErrorCode::Unimplemented; + case 13: + return ESatoriErrorCode::Internal; + case 14: + return ESatoriErrorCode::Unavailable; + case 15: + return ESatoriErrorCode::DataLoss; + case 16: + return ESatoriErrorCode::Unauthenticated; + default: + return ESatoriErrorCode::Unknown; + } +} + +FSatoriError::FSatoriError(const FString& JsonString) +{ + TSharedPtr JsonObject; + const TSharedRef> JsonReader = TJsonReaderFactory<>::Create(JsonString); + if (FJsonSerializer::Deserialize(JsonReader, JsonObject)) + { + if (JsonObject->HasField(TEXT("message"))) + { + Message = JsonObject->GetStringField(TEXT("message")); + } + else + { + Message = TEXT("Invalid or missing 'message' field"); + } + + int32 CodeValue; + if (JsonObject->TryGetNumberField(TEXT("code"), CodeValue)) + { + //Code = static_cast(CodeValue); + Code = ConvertSatoriErrorCode(CodeValue); + } + else + { + Code = ESatoriErrorCode::Unknown; + } + } + else + { + Message = TEXT("Failed to parse JSON"); + Code = ESatoriErrorCode::Unknown; + } +} diff --git a/Satori/Source/SatoriUnreal/Private/SatoriEvent.cpp b/Satori/Source/SatoriUnreal/Private/SatoriEvent.cpp index a39e5a8a..1836a5cb 100644 --- a/Satori/Source/SatoriUnreal/Private/SatoriEvent.cpp +++ b/Satori/Source/SatoriUnreal/Private/SatoriEvent.cpp @@ -1,8 +1,24 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriEvent.h" -#include "NakamaUtils.h" +#include "SatoriUtils.h" -FSatoriEvent::FSatoriEvent(const FString& JsonString) : FSatoriEvent(FNakamaUtils::DeserializeJsonObject(JsonString)) { +FSatoriEvent::FSatoriEvent(const FString& JsonString) : FSatoriEvent(FSatoriUtils::DeserializeJsonObject(JsonString)) { } FSatoriEvent::FSatoriEvent(const TSharedPtr JsonObject) diff --git a/Satori/Source/SatoriUnreal/Private/SatoriExperiment.cpp b/Satori/Source/SatoriUnreal/Private/SatoriExperiment.cpp index 26950196..576627f4 100644 --- a/Satori/Source/SatoriUnreal/Private/SatoriExperiment.cpp +++ b/Satori/Source/SatoriUnreal/Private/SatoriExperiment.cpp @@ -1,7 +1,23 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriExperiment.h" -#include "NakamaUtils.h" +#include "SatoriUtils.h" -FSatoriExperiment::FSatoriExperiment(const FString& JsonString) : FSatoriExperiment(FNakamaUtils::DeserializeJsonObject(JsonString)) { +FSatoriExperiment::FSatoriExperiment(const FString& JsonString) : FSatoriExperiment(FSatoriUtils::DeserializeJsonObject(JsonString)) { } FSatoriExperiment::FSatoriExperiment(const TSharedPtr JsonObject) diff --git a/Satori/Source/SatoriUnreal/Private/SatoriFlag.cpp b/Satori/Source/SatoriUnreal/Private/SatoriFlag.cpp index f21710ba..1d7aa190 100644 --- a/Satori/Source/SatoriUnreal/Private/SatoriFlag.cpp +++ b/Satori/Source/SatoriUnreal/Private/SatoriFlag.cpp @@ -1,7 +1,23 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriFlag.h" -#include "NakamaUtils.h" +#include "SatoriUtils.h" -FSatoriFlagValueChangeReason::FSatoriFlagValueChangeReason(const FString& JsonString) : FSatoriFlagValueChangeReason(FNakamaUtils::DeserializeJsonObject(JsonString)) +FSatoriFlagValueChangeReason::FSatoriFlagValueChangeReason(const FString& JsonString) : FSatoriFlagValueChangeReason(FSatoriUtils::DeserializeJsonObject(JsonString)) { } @@ -25,7 +41,7 @@ FSatoriFlagValueChangeReason::FSatoriFlagValueChangeReason() { } -FSatoriFlag::FSatoriFlag(const FString& JsonString) : FSatoriFlag(FNakamaUtils::DeserializeJsonObject(JsonString)) +FSatoriFlag::FSatoriFlag(const FString& JsonString) : FSatoriFlag(FSatoriUtils::DeserializeJsonObject(JsonString)) { } @@ -75,7 +91,7 @@ FSatoriFlagList::FSatoriFlagList() { } -FSatoriFlagOverrideValue::FSatoriFlagOverrideValue(const FString& JsonString) : FSatoriFlagOverrideValue(FNakamaUtils::DeserializeJsonObject(JsonString)) +FSatoriFlagOverrideValue::FSatoriFlagOverrideValue(const FString& JsonString) : FSatoriFlagOverrideValue(FSatoriUtils::DeserializeJsonObject(JsonString)) { } @@ -100,7 +116,7 @@ FSatoriFlagOverrideValue::FSatoriFlagOverrideValue() { } -FSatoriFlagOverride::FSatoriFlagOverride(const FString& JsonString) : FSatoriFlagOverride(FNakamaUtils::DeserializeJsonObject(JsonString)) +FSatoriFlagOverride::FSatoriFlagOverride(const FString& JsonString) : FSatoriFlagOverride(FSatoriUtils::DeserializeJsonObject(JsonString)) { } @@ -132,6 +148,7 @@ FSatoriFlagOverride::FSatoriFlagOverride() { } + FSatoriFlagOverrideList::FSatoriFlagOverrideList(const FString& JsonString) { TSharedPtr JsonObject; diff --git a/Satori/Source/SatoriUnreal/Private/SatoriLiveEvent.cpp b/Satori/Source/SatoriUnreal/Private/SatoriLiveEvent.cpp index 94c8ae30..fd09bfdd 100644 --- a/Satori/Source/SatoriUnreal/Private/SatoriLiveEvent.cpp +++ b/Satori/Source/SatoriUnreal/Private/SatoriLiveEvent.cpp @@ -1,7 +1,23 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriLiveEvent.h" -#include "NakamaUtils.h" +#include "SatoriUtils.h" -FSatoriLiveEvent::FSatoriLiveEvent(const FString& JsonString) : FSatoriLiveEvent(FNakamaUtils::DeserializeJsonObject(JsonString)) { +FSatoriLiveEvent::FSatoriLiveEvent(const FString& JsonString) : FSatoriLiveEvent(FSatoriUtils::DeserializeJsonObject(JsonString)) { } FSatoriLiveEvent::FSatoriLiveEvent(const TSharedPtr JsonObject) diff --git a/Satori/Source/SatoriUnreal/Private/SatoriLogger.cpp b/Satori/Source/SatoriUnreal/Private/SatoriLogger.cpp new file mode 100644 index 00000000..71825fdd --- /dev/null +++ b/Satori/Source/SatoriUnreal/Private/SatoriLogger.cpp @@ -0,0 +1,138 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SatoriLogger.h" + +DEFINE_LOG_CATEGORY(LogSatoriUnreal); + +ESatoriLogLevel USatoriLogger::CurrentLogLevel = ESatoriLogLevel::Info; +bool USatoriLogger::bLoggingEnabled = false; + +USatoriLogger::USatoriLogger() +{ + +} + +void USatoriLogger::SetLogLevel(ESatoriLogLevel InLogLevel) +{ + CurrentLogLevel = InLogLevel; +} + +bool USatoriLogger::IsLoggable(ESatoriLogLevel InLogLevel) +{ + // Logging Disabled check + if (!bLoggingEnabled) + return false; + + // Debug + if(CurrentLogLevel == ESatoriLogLevel::Debug) + { + if(InLogLevel == ESatoriLogLevel::Debug) + return true; + + if(InLogLevel == ESatoriLogLevel::Info) + return true; + + if(InLogLevel == ESatoriLogLevel::Warn) + return true; + + if(InLogLevel == ESatoriLogLevel::Error) + return true; + + if(InLogLevel == ESatoriLogLevel::Fatal) + return true; + } + + // Info + if(CurrentLogLevel == ESatoriLogLevel::Info) + { + if(InLogLevel == ESatoriLogLevel::Info) + return true; + + if(InLogLevel == ESatoriLogLevel::Warn) + return true; + + if(InLogLevel == ESatoriLogLevel::Error) + return true; + + if(InLogLevel == ESatoriLogLevel::Fatal) + return true; + } + + // Warn + if(CurrentLogLevel == ESatoriLogLevel::Warn) + { + if(InLogLevel == ESatoriLogLevel::Warn) + return true; + + if(InLogLevel == ESatoriLogLevel::Error) + return true; + + if(InLogLevel == ESatoriLogLevel::Fatal) + return true; + } + + // Error + if(CurrentLogLevel == ESatoriLogLevel::Error) + { + if(InLogLevel == ESatoriLogLevel::Error) + return true; + + if(InLogLevel == ESatoriLogLevel::Fatal) + return true; + } + + // Fatal + if(CurrentLogLevel == ESatoriLogLevel::Fatal) + { + if(InLogLevel == ESatoriLogLevel::Fatal) + return true; + } + + return false; +} + +void USatoriLogger::Log(ESatoriLogLevel InLogLevel, const FString& Message) +{ + if (IsLoggable(InLogLevel)) + { + switch (InLogLevel) + { + case ESatoriLogLevel::Debug: + UE_LOG(LogSatoriUnreal, Display, TEXT("%s"), *Message); + break; + case ESatoriLogLevel::Info: + UE_LOG(LogSatoriUnreal, Display, TEXT("%s"), *Message); + break; + case ESatoriLogLevel::Warn: + UE_LOG(LogSatoriUnreal, Warning, TEXT("%s"), *Message); + break; + case ESatoriLogLevel::Error: + UE_LOG(LogSatoriUnreal, Error, TEXT("%s"), *Message); + break; + case ESatoriLogLevel::Fatal: + UE_LOG(LogSatoriUnreal, Fatal, TEXT("%s"), *Message); + break; + default: + break; + } + } +} + +void USatoriLogger::EnableLogging(bool bEnable) +{ + bLoggingEnabled = bEnable; +} diff --git a/Satori/Source/SatoriUnreal/Private/SatoriMessage.cpp b/Satori/Source/SatoriUnreal/Private/SatoriMessage.cpp index f503db73..abfae2f7 100644 --- a/Satori/Source/SatoriUnreal/Private/SatoriMessage.cpp +++ b/Satori/Source/SatoriUnreal/Private/SatoriMessage.cpp @@ -1,7 +1,23 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriMessage.h" -#include "NakamaUtils.h" +#include "SatoriUtils.h" -FSatoriMessage::FSatoriMessage(const FString& JsonString) : FSatoriMessage(FNakamaUtils::DeserializeJsonObject(JsonString)) { +FSatoriMessage::FSatoriMessage(const FString& JsonString) : FSatoriMessage(FSatoriUtils::DeserializeJsonObject(JsonString)) { } FSatoriMessage::FSatoriMessage(const TSharedPtr JsonObject) diff --git a/Satori/Source/SatoriUnreal/Private/SatoriProperties.cpp b/Satori/Source/SatoriUnreal/Private/SatoriProperties.cpp index 676e05a9..e743d98e 100644 --- a/Satori/Source/SatoriUnreal/Private/SatoriProperties.cpp +++ b/Satori/Source/SatoriUnreal/Private/SatoriProperties.cpp @@ -1,7 +1,23 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriProperties.h" -#include "NakamaUtils.h" +#include "SatoriUtils.h" -FSatoriProperties::FSatoriProperties(const FString& JsonString) : FSatoriProperties(FNakamaUtils::DeserializeJsonObject(JsonString)) { +FSatoriProperties::FSatoriProperties(const FString& JsonString) : FSatoriProperties(FSatoriUtils::DeserializeJsonObject(JsonString)) { } FSatoriProperties::FSatoriProperties(const TSharedPtr JsonObject) diff --git a/Satori/Source/SatoriUnreal/Private/SatoriSession.cpp b/Satori/Source/SatoriUnreal/Private/SatoriSession.cpp new file mode 100644 index 00000000..21a1389e --- /dev/null +++ b/Satori/Source/SatoriUnreal/Private/SatoriSession.cpp @@ -0,0 +1,74 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SatoriSession.h" + +#include "SatoriUtils.h" + + +void USatoriSession::SetupSession(const FString& AuthResponse) +{ + TSharedPtr JsonObject = MakeShareable(new FJsonObject()); + const TSharedRef> JsonReader = TJsonReaderFactory<>::Create(AuthResponse); + + if (FJsonSerializer::Deserialize(JsonReader, JsonObject)) + { + FString Token = JsonObject->GetStringField(TEXT("token")); + FString RefreshToken = JsonObject->GetStringField(TEXT("refresh_token")); + + SessionData.AuthToken = Token; + _AuthToken = Token; + SessionData.RefreshToken = RefreshToken; + _RefreshToken = RefreshToken; + + const TSharedPtr* PropertiesJson = nullptr; + if (JsonObject->TryGetObjectField(TEXT("properties"), PropertiesJson)) + { + FSatoriProperties Properties = FSatoriProperties(*PropertiesJson); + SessionData.Properties = Properties; + _Properties = Properties; + } + } + else + { + SATORI_LOG_ERROR(TEXT("Failed to deserialize Satori Session JSON object")); + } +} + +const FString USatoriSession::GetAuthToken() const +{ + return _AuthToken; +} + +const FString USatoriSession::GetRefreshToken() const +{ + return _RefreshToken; +} + +const FSatoriProperties USatoriSession::GetProperties() const +{ + return _Properties; +} + +USatoriSession* USatoriSession::RestoreSession(FString Token, FString RefreshToken) +{ + USatoriSession* ResultSession = NewObject(); + ResultSession->SessionData.AuthToken = Token; + ResultSession->_AuthToken = Token; + ResultSession->SessionData.RefreshToken = RefreshToken; + ResultSession->_RefreshToken = RefreshToken; + return ResultSession; +} diff --git a/Satori/Source/SatoriUnreal/Private/SatoriUnreal.cpp b/Satori/Source/SatoriUnreal/Private/SatoriUnreal.cpp index e044cb60..59abb1dd 100644 --- a/Satori/Source/SatoriUnreal/Private/SatoriUnreal.cpp +++ b/Satori/Source/SatoriUnreal/Private/SatoriUnreal.cpp @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "SatoriUnreal.h" #include "Modules/ModuleManager.h" diff --git a/Satori/Source/SatoriUnreal/Private/SatoriUserSession.cpp b/Satori/Source/SatoriUnreal/Private/SatoriUserSession.cpp new file mode 100644 index 00000000..20336ce7 --- /dev/null +++ b/Satori/Source/SatoriUnreal/Private/SatoriUserSession.cpp @@ -0,0 +1,22 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SatoriUserSession.h" + +FSatoriUserSession::FSatoriUserSession() +{ + +} \ No newline at end of file diff --git a/Satori/Source/SatoriUnreal/Private/SatoriUtils.cpp b/Satori/Source/SatoriUnreal/Private/SatoriUtils.cpp new file mode 100644 index 00000000..4f0e7af1 --- /dev/null +++ b/Satori/Source/SatoriUnreal/Private/SatoriUtils.cpp @@ -0,0 +1,145 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "SatoriUtils.h" +#include "SatoriLogger.h" +#include "Interfaces/IHttpResponse.h" + +DEFINE_LOG_CATEGORY_STATIC(LogSatoriUtils, Log, Log); + + void FSatoriUtils::ProcessRequestComplete(FHttpRequestPtr Request, const FHttpResponsePtr& Response, bool bSuccess, const TFunction& SuccessCallback, const TFunction& ErrorCallback) + { + if (bSuccess && Response.IsValid()) + { + const int32 ResponseCode = Response->GetResponseCode(); + const FString ResponseBody = Response->GetContentAsString(); + + if (ResponseCode == 200) + { + SATORI_LOG_DEBUG(FString::Printf(TEXT("Request Successful: %s"), *ResponseBody)); + if (SuccessCallback) + { + SuccessCallback(ResponseBody); + } + } + else + { + SATORI_LOG_WARN(FString::Printf(TEXT("Response (Code: %d) - Contents: %s"), ResponseCode, *ResponseBody)); + const FSatoriError Error(ResponseBody); + if (ErrorCallback) + { + ErrorCallback(Error); + } + } + } + else + { + // Handle request failure + SATORI_LOG_ERROR(TEXT("Failed to process request.")); + + if (Request.IsValid()) + { + SATORI_LOG_DEBUG(FString::Printf(TEXT("Request URL: %s"), *(Request->GetURL()))); + } + + FSatoriError Error; + Error.Code = ESatoriErrorCode::Unknown; + Error.Message = TEXT("Failed to proccess request. Request failed."); + + if (ErrorCallback) + { + ErrorCallback(Error); + } + } + } + + void FSatoriUtils::HandleJsonSerializationFailure(TFunction ErrorCallback) + { + SATORI_LOG_ERROR(TEXT("Failed to generate request content.")); + FSatoriError Error; + Error.Code = ESatoriErrorCode::Unknown; + Error.Message = TEXT("Failed to generate request content."); + ErrorCallback(Error); + } + + bool FSatoriUtils::IsSessionValid(const USatoriSession* Session, TFunction ErrorCallback) + { + if (!Session || Session->SessionData.AuthToken.IsEmpty()) + { + SATORI_LOG_ERROR("Invalid session or session data."); + + FSatoriError Error; + Error.Message = "Invalid session or session data."; + ErrorCallback(Error); + return false; + } + + return true; + } + + bool FSatoriUtils::IsResponseSuccessful(int32 ResponseCode) + { + return ResponseCode == 200; + } + + FSatoriError FSatoriUtils::CreateRequestFailureError() + { + SATORI_LOG_ERROR(TEXT("Failed to proccess request. Request failed.")); + FSatoriError Error; + Error.Code = ESatoriErrorCode::Unknown; + Error.Message = TEXT("Failed to proccess request. Request failed."); + return Error; + } + + TSharedRef FSatoriUtils::MakeRequest(const FString& URL, const FString& Content, ESatoriRequestMethod RequestMethod, const FString& SessionToken, float Timeout) + { + FHttpModule* HttpModule = &FHttpModule::Get(); + + // Create the HttpRequest +#if ENGINE_MAJOR_VERSION <= 4 && ENGINE_MINOR_VERSION <= 25 + TSharedRef Request = HttpModule->CreateRequest(); +#else + TSharedRef HttpRequest = HttpModule->CreateRequest(); +#endif + + HttpRequest->SetURL(URL); + HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json")); + HttpRequest->SetTimeout(Timeout); // Exposed to end user + + FString VerbString = ESatoriRequesMethodToFString(RequestMethod); + if (!VerbString.IsEmpty()) + { + HttpRequest->SetVerb(VerbString); + } + + // Set the content if it is not empty + if (!Content.IsEmpty()) + { + HttpRequest->SetContentAsString(Content); + } + + // Add authorization header if session token is provided + if (!SessionToken.IsEmpty()) + { + FString AuthorizationHeader = FString::Printf(TEXT("Bearer %s"), *SessionToken); + HttpRequest->SetHeader(TEXT("Authorization"), AuthorizationHeader); + } + + //SATORI_LOG_INFO(TEXT("...")); + //SATORI_LOG_INFO(FString::Printf(TEXT("Making Request to %s"), *Endpoint)); + SATORI_LOG_INFO(FString::Printf(TEXT("Making %s request to %s with content: %s"), *VerbString, *URL, *Content)); + return HttpRequest; + } diff --git a/Satori/Source/SatoriUnreal/Public/SatoriClient.h b/Satori/Source/SatoriUnreal/Public/SatoriClient.h index d5d3c2d6..c16e8527 100644 --- a/Satori/Source/SatoriUnreal/Public/SatoriClient.h +++ b/Satori/Source/SatoriUnreal/Public/SatoriClient.h @@ -1,12 +1,26 @@ -// Fill out your copyright notice in the Description page of Project Settings. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #pragma once #include "CoreMinimal.h" #include "Interfaces/IHttpRequest.h" #include "HttpModule.h" -#include "NakamaError.h" -#include "NakamaSession.h" +#include "SatoriError.h" +#include "SatoriSession.h" #include "SatoriEvent.h" #include "SatoriExperiment.h" #include "SatoriLiveEvent.h" @@ -16,13 +30,13 @@ namespace Satori {} using namespace Satori; -enum class ENakamaRequestMethod:uint8; +enum class ESatoriRequestMethod:uint8; // Delegates -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriAuthUpdate, UNakamaSession*, LoginData); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriAuthUpdate, USatoriSession*, LoginData); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnAuthLogoutSent); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnDeleteIdentitySent); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriError, const FNakamaError&, ErrorData); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSatoriError, const FSatoriError&, ErrorData); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnPostEventSent); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnGetExperiments, const FSatoriExperimentList&, Experiments); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnGetFlags, const FSatoriFlagList&, Flags); @@ -34,6 +48,15 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnGetMessages, const FSatoriMessage DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnUpdateMessageSent); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnDeleteMessageSent); +UENUM(BlueprintType) +enum class ESatoriRequestMethod : uint8 +{ + GET, + POST, + DEL, + PUT, +}; + /** * */ @@ -121,64 +144,64 @@ class SATORIUNREAL_API USatoriClient : public UObject // --- Authentication --- // /** - * Authenticate a user with a custom id. + * Authenticate to get a satori session. * - * @param UserID A custom identifier usually obtained from an external authentication service. - * @param Username A username used to create the user. - * @param CreateAccount True if the user should be created when authenticated. - * @param Vars Extra information that will be bundled in the session token. + * @param ID Must be between eight and 128 characters (inclusive). Must be an alphanumeric string with only underscores and hyphens allowed. + * @param DefaultProperties Optional default properties to update with this call. If not set, properties are left as they are on the server. + * @param CustomProperties Optional custom properties to update with this call. If not set, properties are left as they are on the server. + * @param bNoSession Modifies the request to only create/update an identity without creating a new session. If set to 'true' the response won't include a token and a refresh token. * @param Success Delegate called upon successful authentication, providing the user session. * @param Error Delegate called on authentication failure with error details. */ UFUNCTION(Category = "Satori|Authentication") - void AuthenticateCustom( - const FString& UserID, - const FString& Username, - bool CreateAccount, - const TMap& Vars, + void Authenticate( + const FString& ID, + const TMap& DefaultProperties, + const TMap& CustomProperties, + const bool bNoSession, FOnSatoriAuthUpdate Success, FOnSatoriError Error ); - void AuthenticateCustom( - const FString& UserID, - const FString& Username, - bool bCreate, - const TMap& Vars, - TFunction SuccessCallback, - TFunction ErrorCallback + void Authenticate( + const FString& ID, + const TMap& DefaultProperties, + const TMap& CustomProperties, + const bool bNoSession, + TFunction SuccessCallback, + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|Authentication") void AuthenticateRefresh( - UNakamaSession* Session, + USatoriSession* Session, FOnSatoriAuthUpdate Success, FOnSatoriError Error ); void AuthenticateRefresh( - UNakamaSession* Session, - TFunction SuccessCallback, - TFunction ErrorCallback + USatoriSession* Session, + TFunction SuccessCallback, + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|Authentication") void AuthenticateLogout( - UNakamaSession* Session, + USatoriSession* Session, FOnAuthLogoutSent Success, FOnSatoriError Error ); void AuthenticateLogout( - UNakamaSession* Session, + USatoriSession* Session, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); - UFUNCTION(Category = "Satori|Identity") + UFUNCTION(Category = "Satori|Authentication") void Identify( - UNakamaSession* Session, + USatoriSession* Session, const FString& ID, const TMap& defaultProperties, const TMap& customProperties, @@ -187,30 +210,30 @@ class SATORIUNREAL_API USatoriClient : public UObject ); void Identify( - UNakamaSession* Session, + USatoriSession* Session, const FString& ID, const TMap& DefaultProperties, const TMap& CustomProperties, - TFunction SuccessCallback, - TFunction ErrorCallback + TFunction SuccessCallback, + TFunction ErrorCallback ); - UFUNCTION(Category = "Satori|Identity") + UFUNCTION(Category = "Satori|Authentication") void ListIdentityProperties( - UNakamaSession* Session, + USatoriSession* Session, FOnGetProperties Success, FOnSatoriError Error ); void ListIdentityProperties( - UNakamaSession* Session, + USatoriSession* Session, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); - UFUNCTION(Category = "Satori|Identity") + UFUNCTION(Category = "Satori|Authentication") void UpdateProperties( - UNakamaSession* Session, + USatoriSession* Session, const TMap& DefaultProperties, const TMap& CustomProperties, const bool bRecompute, @@ -219,25 +242,25 @@ class SATORIUNREAL_API USatoriClient : public UObject ); void UpdateProperties( - UNakamaSession* Session, + USatoriSession* Session, const TMap& DefaultProperties, const TMap& CustomProperties, const bool bRecompute, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); - UFUNCTION(Category = "Satori|Identity") + UFUNCTION(Category = "Satori|Authentication") void DeleteIdentity( - UNakamaSession* Session, + USatoriSession* Session, FOnDeleteIdentitySent Success, FOnSatoriError Error ); void DeleteIdentity( - UNakamaSession* Session, + USatoriSession* Session, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); @@ -245,82 +268,82 @@ class SATORIUNREAL_API USatoriClient : public UObject UFUNCTION(Category = "Satori|Events") void PostEvent( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Events, FOnPostEventSent Success, FOnSatoriError Error ); void PostEvent( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Events, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|Experiments") void GetExperiments( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, FOnGetExperiments Success, FOnSatoriError Error ); void GetExperiments( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|Flags") void GetFlags( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, FOnGetFlags Success, FOnSatoriError Error ); void GetFlags( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|Flags") void GetFlagOverrides( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, FOnGetFlagOverrides Success, FOnSatoriError Error ); void GetFlagOverrides( - UNakamaSession* Session, + USatoriSession* Session, const TArray& Names, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|LiveEvents") void GetLiveEvents( - UNakamaSession* Session, + USatoriSession* Session, const TArray& LiveEventNames, FOnGetLiveEvents Success, FOnSatoriError Error ); void GetLiveEvents( - UNakamaSession* Session, + USatoriSession* Session, const TArray& LiveEventNames, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|Messages") void GetMessages( - UNakamaSession* Session, + USatoriSession* Session, int32 Limit, bool Forward, const FString& Cursor, @@ -329,17 +352,17 @@ class SATORIUNREAL_API USatoriClient : public UObject ); void GetMessages( - UNakamaSession* Session, + USatoriSession* Session, int32 Limit, bool Forward, const FString& Cursor, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|Messages") void UpdateMessage( - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, const FDateTime ReadTime, const FDateTime ConsumeTime, @@ -348,27 +371,27 @@ class SATORIUNREAL_API USatoriClient : public UObject ); void UpdateMessage( - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, const FDateTime ReadTime, const FDateTime ConsumeTime, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); UFUNCTION(Category = "Satori|Messages") void DeleteMessage( - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, FOnDeleteMessageSent Success, FOnSatoriError Error ); void DeleteMessage( - UNakamaSession* Session, + USatoriSession* Session, const FString& MessageId, TFunction SuccessCallback, - TFunction ErrorCallback + TFunction ErrorCallback ); // --- Utilities --- // @@ -381,7 +404,7 @@ class SATORIUNREAL_API USatoriClient : public UObject TSharedRef MakeRequest( const FString& Endpoint, const FString& Content, - ENakamaRequestMethod RequestMethod, + ESatoriRequestMethod RequestMethod, const TMultiMap& QueryParams, const FString& SessionToken ); diff --git a/Satori/Source/SatoriUnreal/Public/SatoriError.h b/Satori/Source/SatoriUnreal/Public/SatoriError.h new file mode 100644 index 00000000..dd9d9059 --- /dev/null +++ b/Satori/Source/SatoriUnreal/Public/SatoriError.h @@ -0,0 +1,62 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "CoreMinimal.h" +#include "SatoriError.generated.h" + +// Error Data +UENUM(BlueprintType) +enum class ESatoriErrorCode : uint8 +{ + Ok = 0 UMETA(DisplayName = "Ok"), + Cancelled = 1 UMETA(DisplayName = "Cancelled"), + Unknown = 2 UMETA(DisplayName = "Unknown"), + InvalidArgument = 3 UMETA(DisplayName = "Invalid Argument"), + DeadlineExceeded = 4 UMETA(DisplayName = "Deadline Exceeded"), + NotFound = 5 UMETA(DisplayName = "Not Found"), + AlreadyExists = 6 UMETA(DisplayName = "Already Exists"), + PermissionDenied = 7 UMETA(DisplayName = "Permission Denied"), + ResourceExhausted = 8 UMETA(DisplayName = "Resource Exhausted"), + FailedPrecondition = 9 UMETA(DisplayName = "Failed Precondition"), + Aborted = 10 UMETA(DisplayName = "Aborted"), + OutOfRange = 11 UMETA(DisplayName = "Out Of Range"), + Unimplemented = 12 UMETA(DisplayName = "Unimplemented"), + Internal = 13 UMETA(DisplayName = "Internal"), + Unavailable = 14 UMETA(DisplayName = "Unavailable"), + DataLoss = 15 UMETA(DisplayName = "Data Loss"), + Unauthenticated = 16 UMETA(DisplayName = "Unauthenticated") +}; + +USTRUCT(BlueprintType) +struct SATORIUNREAL_API FSatoriError +{ + GENERATED_BODY() + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori Error") + FString Message; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori Error") + ESatoriErrorCode Code; + + FSatoriError(const FString& JsonString); + FSatoriError(): Code(ESatoriErrorCode::Unknown) { } + + ESatoriErrorCode ConvertSatoriErrorCode(int32 CodeValue); + + +}; \ No newline at end of file diff --git a/Satori/Source/SatoriUnreal/Public/SatoriEvent.h b/Satori/Source/SatoriUnreal/Public/SatoriEvent.h index d2d2b42d..4d84df9e 100644 --- a/Satori/Source/SatoriUnreal/Public/SatoriEvent.h +++ b/Satori/Source/SatoriUnreal/Public/SatoriEvent.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Satori/Source/SatoriUnreal/Public/SatoriExperiment.h b/Satori/Source/SatoriUnreal/Public/SatoriExperiment.h index e8f3e18f..7b0a1e28 100644 --- a/Satori/Source/SatoriUnreal/Public/SatoriExperiment.h +++ b/Satori/Source/SatoriUnreal/Public/SatoriExperiment.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Satori/Source/SatoriUnreal/Public/SatoriFlag.h b/Satori/Source/SatoriUnreal/Public/SatoriFlag.h index 377a90a9..9b42ef04 100644 --- a/Satori/Source/SatoriUnreal/Public/SatoriFlag.h +++ b/Satori/Source/SatoriUnreal/Public/SatoriFlag.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Satori/Source/SatoriUnreal/Public/SatoriLiveEvent.h b/Satori/Source/SatoriUnreal/Public/SatoriLiveEvent.h index fe936536..7c7657ec 100644 --- a/Satori/Source/SatoriUnreal/Public/SatoriLiveEvent.h +++ b/Satori/Source/SatoriUnreal/Public/SatoriLiveEvent.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Satori/Source/SatoriUnreal/Public/SatoriLogger.h b/Satori/Source/SatoriUnreal/Public/SatoriLogger.h new file mode 100644 index 00000000..53c5f3c4 --- /dev/null +++ b/Satori/Source/SatoriUnreal/Public/SatoriLogger.h @@ -0,0 +1,60 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "CoreMinimal.h" +#include "UObject/NoExportTypes.h" +#include "SatoriLogger.generated.h" + +//DECLARE_LOG_CATEGORY_EXTERN(LogSatori, Log, All); +DECLARE_LOG_CATEGORY_EXTERN(LogSatoriUnreal, Log, All); + +UENUM(BlueprintType, Category = "Satori") +enum class ESatoriLogLevel : uint8 +{ + Debug, + Info, + Warn, + Error, + Fatal +}; + +/** + * + */ +UCLASS() +class SATORIUNREAL_API USatoriLogger : public UObject +{ + GENERATED_BODY() + +public: + USatoriLogger(); + + UFUNCTION(BlueprintCallable, Category = "Satori") + static void SetLogLevel(ESatoriLogLevel InLogLevel); + + UFUNCTION(BlueprintCallable, Category = "Satori") + static void Log(ESatoriLogLevel InLogLevel, const FString& Message); + + UFUNCTION(BlueprintCallable, Category = "Satori") + static void EnableLogging(bool bEnable); + +private: + static ESatoriLogLevel CurrentLogLevel; + static bool bLoggingEnabled; + static bool IsLoggable(ESatoriLogLevel InLogLevel); +}; diff --git a/Satori/Source/SatoriUnreal/Public/SatoriLoggingMacros.h b/Satori/Source/SatoriUnreal/Public/SatoriLoggingMacros.h new file mode 100644 index 00000000..57df9f78 --- /dev/null +++ b/Satori/Source/SatoriUnreal/Public/SatoriLoggingMacros.h @@ -0,0 +1,48 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +// Toggle logging on/off by defining SATORI_LOGS_ENABLED +#define SATORI_LOGS_ENABLED + +#ifdef SATORI_LOGS_ENABLED + + #define SATORI_LOG_DEBUG(Message) \ + USatoriLogger::Log(ESatoriLogLevel::Debug, Message) + + #define SATORI_LOG_INFO(Message) \ + USatoriLogger::Log(ESatoriLogLevel::Info, Message) + + #define SATORI_LOG_WARN(Message) \ + USatoriLogger::Log(ESatoriLogLevel::Warn, Message) + + #define SATORI_LOG_ERROR(Message) \ + USatoriLogger::Log(ESatoriLogLevel::Error, Message) + + #define SATORI_LOG_FATAL(Message) \ + USatoriLogger::Log(ESatoriLogLevel::Fatal, Message) + +#else + + // Define empty macros if logging is disabled + #define SATORI_LOG_DEBUG(Message) + #define SATORI_LOG_INFO(Message) + #define SATORI_LOG_WARN(Message) + #define SATORI_LOG_ERROR(Message) + #define SATORI_LOG_FATAL(Message) + +#endif // SATORI_LOGS_ENABLED \ No newline at end of file diff --git a/Satori/Source/SatoriUnreal/Public/SatoriMessage.h b/Satori/Source/SatoriUnreal/Public/SatoriMessage.h index 601f5dfb..6bf7d64e 100644 --- a/Satori/Source/SatoriUnreal/Public/SatoriMessage.h +++ b/Satori/Source/SatoriUnreal/Public/SatoriMessage.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" diff --git a/Satori/Source/SatoriUnreal/Public/SatoriProperties.h b/Satori/Source/SatoriUnreal/Public/SatoriProperties.h index 8cdb866e..acfacc87 100644 --- a/Satori/Source/SatoriUnreal/Public/SatoriProperties.h +++ b/Satori/Source/SatoriUnreal/Public/SatoriProperties.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "CoreMinimal.h" @@ -10,13 +26,13 @@ struct SATORIUNREAL_API FSatoriProperties { GENERATED_BODY() // Event default properties. - UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Properties") + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Authentication") TMap DefaultProperties; // Event computed properties. - UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Properties") + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Authentication") TMap ComputedProperties; // Event custom properties. - UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Properties") + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Authentication") TMap CustomProperties; FSatoriProperties(const FString& JsonString); diff --git a/Satori/Source/SatoriUnreal/Public/SatoriSession.h b/Satori/Source/SatoriUnreal/Public/SatoriSession.h new file mode 100644 index 00000000..45f96874 --- /dev/null +++ b/Satori/Source/SatoriUnreal/Public/SatoriSession.h @@ -0,0 +1,73 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "CoreMinimal.h" +#include "SatoriUserSession.h" +#include "SatoriSession.generated.h" + +/** + * + */ +UCLASS(Blueprintable, BlueprintType) +class SATORIUNREAL_API USatoriSession : public UObject +{ + GENERATED_BODY() + +public: + + // Blueprint/C++ Exposed Struct with Data + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Authentication") + FSatoriUserSession SessionData; + + USatoriSession() { } + + void SetupSession(const FString& AuthResponse); + + /** + * @return The authentication token used to construct this session. + */ + UFUNCTION(BlueprintPure, Category = "Satori|Authentication") + const FString GetAuthToken() const; + + /** + * @return The refresh token used to construct this session. + */ + UFUNCTION(BlueprintPure, Category = "Satori|Authentication") + const FString GetRefreshToken() const; + + /** + * @return The refresh properties used to construct this session. + */ + UFUNCTION(BlueprintPure, Category = "Satori|Authentication") + const FSatoriProperties GetProperties() const; + + /** + * Restore User Session + * + * @param Token Authentication Token from Session + * @param RefreshToken RefreshToken retrieved from Session + */ + UFUNCTION(BlueprintCallable, Category = "Satori|Authentication") + static USatoriSession* RestoreSession(FString Token, FString RefreshToken); + +private: + + FString _AuthToken; + FString _RefreshToken; + FSatoriProperties _Properties; +}; diff --git a/Satori/Source/SatoriUnreal/Public/SatoriUnreal.h b/Satori/Source/SatoriUnreal/Public/SatoriUnreal.h index 4cb55981..cc30865f 100644 --- a/Satori/Source/SatoriUnreal/Public/SatoriUnreal.h +++ b/Satori/Source/SatoriUnreal/Public/SatoriUnreal.h @@ -1,3 +1,19 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once #include "Modules/ModuleInterface.h" diff --git a/Satori/Source/SatoriUnreal/Public/SatoriUserSession.h b/Satori/Source/SatoriUnreal/Public/SatoriUserSession.h new file mode 100644 index 00000000..4e8b79b9 --- /dev/null +++ b/Satori/Source/SatoriUnreal/Public/SatoriUserSession.h @@ -0,0 +1,41 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "CoreMinimal.h" +#include "SatoriProperties.h" +#include "SatoriUserSession.generated.h" + +USTRUCT(BlueprintType) +struct SATORIUNREAL_API FSatoriUserSession +{ + GENERATED_BODY() + + // The authentication token used to construct this session. + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Authentication") + FString AuthToken; + + // The refresh token used to construct this session. + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Authentication") + FString RefreshToken; + + // Properties of this satori session. + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Satori|Authentication") + FSatoriProperties Properties; + + FSatoriUserSession(); // Default Constructor +}; \ No newline at end of file diff --git a/Satori/Source/SatoriUnreal/Public/SatoriUtils.h b/Satori/Source/SatoriUnreal/Public/SatoriUtils.h new file mode 100644 index 00000000..8207a35a --- /dev/null +++ b/Satori/Source/SatoriUnreal/Public/SatoriUtils.h @@ -0,0 +1,254 @@ +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "CoreMinimal.h" + +#include "SatoriClient.h" +#include "Templates/SharedPointer.h" +#include "SatoriLogger.h" +#include "SatoriLoggingMacros.h" + +class SATORIUNREAL_API FSatoriUtils +{ +public: + // Handle Request Methods for REST API + static FString ESatoriRequesMethodToFString(ESatoriRequestMethod Verb) + { + switch (Verb) + { + case ESatoriRequestMethod::GET: + return TEXT("GET"); + case ESatoriRequestMethod::POST: + return TEXT("POST"); + case ESatoriRequestMethod::PUT: + return TEXT("PUT"); + case ESatoriRequestMethod::DEL: + return TEXT("DELETE"); + default: + // Handle unrecognized verb if needed + break; + } + + // Return an empty string for unrecognized verbs + return FString(); + } + + // Bool to String Helper + static FString BoolToString(bool Value) + { + return Value ? TEXT("true") : TEXT("false"); + } + + // Build Query String + static FString BuildQueryString(const TMultiMap& QueryParams) + { + FString QueryString; + + for (const auto& Param : QueryParams) + { + if (!QueryString.IsEmpty()) + { + QueryString += "&"; + } + + // Only specific inputs needs to be encoded + //FString EncodedKey = FGenericPlatformHttp::UrlEncode(Param.Key); + //FString EncodedValue = FGenericPlatformHttp::UrlEncode(Param.Value); + + QueryString += Param.Key + "=" + Param.Value; + } + + return QueryString; + } + + // Extra client checks for lambdas in requests + static bool IsClientActive(const USatoriClient *Client) + { + return IsValid(Client) && Client->bIsActive == true; + } + + // Json helpers + static FString EncodeJson(TSharedPtr JsonObject) + { + FString OutputString; + const TSharedRef> Writer = TJsonWriterFactory<>::Create(&OutputString); + FJsonSerializer::Serialize(JsonObject.ToSharedRef(), Writer); + return OutputString; + } + + static bool SerializeJsonObject(const TSharedPtr& JsonObject, FString& OutSerializedJson) + { + if (!JsonObject.IsValid()) + { + return false; + } + + const TSharedRef> JsonWriter = TJsonWriterFactory<>::Create(&OutSerializedJson); + if (!FJsonSerializer::Serialize(JsonObject.ToSharedRef(), JsonWriter)) + { + JsonWriter->Close(); + return false; + } + + JsonWriter->Close(); + + return true; + } + + static TSharedPtr DeserializeJsonObject(const FString& JsonString) { + TSharedPtr JsonObject; + const TSharedRef> JsonReader = TJsonReaderFactory<>::Create(JsonString); + if (!FJsonSerializer::Deserialize(JsonReader, JsonObject)) + { + JsonObject = nullptr; + } + return JsonObject; + } + + static void AddVarsToJson(const TSharedPtr& JsonObject, const TMap& Vars, const FString varsFieldName = TEXT("vars"), const bool addAlways = false) { + + if (addAlways || Vars.Num() > 0) + { + const TSharedPtr VarsJson = MakeShared(); + for (const auto& Var : Vars) + { + if (!Var.Key.IsEmpty() && !Var.Value.IsEmpty()) + { + VarsJson->SetStringField(Var.Key, Var.Value); + } + else + { + SATORI_LOG_WARN(TEXT("AddVarsToJson: Empty key or value detected.")); + } + } + JsonObject->SetObjectField(varsFieldName, VarsJson); + } + } + + // Enum as integer string + template + static FString GetEnumValueAsIntString(TEnum EnumValue) + { + const int32 IntValue = static_cast(EnumValue); + return FString::FromInt(IntValue); + } + + // Error handling + static FSatoriError HandleInvalidClient() + { + FSatoriError Error; + Error.Message = FString(TEXT("Client Missing")); + Error.Code = ESatoriErrorCode::InvalidArgument; + + SATORI_LOG_ERROR(Error.Message); + + return Error; + } + + static FSatoriError HandleInvalidSession() + { + FSatoriError Error; + Error.Message = FString(TEXT("Session Missing")); + Error.Code = ESatoriErrorCode::InvalidArgument; + + SATORI_LOG_ERROR(Error.Message); + + return Error; + } + + static FSatoriError HandleInvalidClientAndSession() + { + FSatoriError Error; + Error.Message = FString(TEXT("Client and Session Missing")); + Error.Code = ESatoriErrorCode::InvalidArgument; + + SATORI_LOG_ERROR(Error.Message); + + return Error; + } + + // Base64 Encode/Decode + static FString Base64Encode(const FString& Source) + { + TArray ByteArray; + FTCHARToUTF8 StringSrc = FTCHARToUTF8(Source.GetCharArray().GetData()); + ByteArray.Append((uint8*)StringSrc.Get(), StringSrc.Length()); + + return FBase64::Encode(ByteArray); + } + + static bool Base64Decode(const FString& Source, FString& Dest) + { + TArray ByteArray; + bool Success = FBase64::Decode(Source, ByteArray); + + FUTF8ToTCHAR StringSrc = FUTF8ToTCHAR((const ANSICHAR*)ByteArray.GetData(), ByteArray.Num()); + Dest.AppendChars(StringSrc.Get(), StringSrc.Length()); + + return Success; + } + + // Working with Optionals (mainly from Blueprints) + + template + static TOptional CreateOptional(const T& value, const T& defaultValue) + { + return value != defaultValue ? TOptional(value) : TOptional(); + } + + // Conversion + + static TMap ConvertFloatMapToDouble(const TMap& FloatMap) + { + TMap DoubleMap; + for (const auto& Pair : FloatMap) + { + DoubleMap.Add(Pair.Key, static_cast(Pair.Value)); + } + return DoubleMap; + } + + // Common functions used by multiple clients + static void ProcessRequestComplete(FHttpRequestPtr Request, const FHttpResponsePtr& Response, bool bSuccess, const TFunction& SuccessCallback, const TFunction& ErrorCallback); + + static void HandleJsonSerializationFailure(TFunction ErrorCallback); + static bool IsSessionValid(const USatoriSession* Session, TFunction ErrorCallback); + static bool IsResponseSuccessful(int32 ResponseCode); + static FSatoriError CreateRequestFailureError(); + + // Make HTTP request + static TSharedRef MakeRequest( + const FString& URL, + const FString& Content, + ESatoriRequestMethod RequestMethod, + const FString& SessionToken, + float Timeout + ); + + static void SetBasicAuthorizationHeader(TSharedRef HttpRequest, const FString& ServerKey) + { + FString AuthToken = FString::Printf(TEXT("%s:"), *ServerKey); + FTCHARToUTF8 Utf8Token = FTCHARToUTF8(*AuthToken); + FString EncodedAuthToken = FBase64::Encode((const uint8*)Utf8Token.Get(), Utf8Token.Length()); + FString AuthorizationHeader = FString::Printf(TEXT("Basic %s"), *EncodedAuthToken); + + //SATORI_LOG_DEBUG(FString::Printf( TEXT("Authorization Header: %s"), *AuthorizationHeader )); + + HttpRequest->SetHeader(TEXT("Authorization"), AuthorizationHeader); + } +}; diff --git a/Satori/Source/SatoriUnreal/SatoriUnreal.Build.cs b/Satori/Source/SatoriUnreal/SatoriUnreal.Build.cs index 7db977d0..39ea7591 100644 --- a/Satori/Source/SatoriUnreal/SatoriUnreal.Build.cs +++ b/Satori/Source/SatoriUnreal/SatoriUnreal.Build.cs @@ -1,4 +1,18 @@ -// Copyright Epic Games, Inc. All Rights Reserved. +/* +* Copyright 2025 The Nakama Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ using UnrealBuildTool; using System.IO; @@ -27,7 +41,7 @@ public SatoriUnreal(ReadOnlyTargetRules Target) : base(Target) PublicDependencyModuleNames.AddRange( new string[] { - "Core", "HTTP", "WebSockets", "JsonUtilities", "NakamaUnreal" + "Core", "HTTP", "WebSockets", "JsonUtilities" // ... add other public dependencies that you statically link with here ... } ); @@ -43,8 +57,7 @@ public SatoriUnreal(ReadOnlyTargetRules Target) : base(Target) "Engine", "JsonUtilities", "Json", - "HTTP", - "NakamaUnreal" + "HTTP" // ... add private dependencies that you statically link with here ... } );