using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace QuestShare.Services.API { internal class SessionStart_Client { public static void HandleDispatch(Objects.OwnedSession session) { var api = (ApiService)Plugin.GetService(); var request = new SessionStart.Request { Version = Constants.Version, Token = ConfigurationManager.Instance.Token, Session = session }; _ = api.Invoke(nameof(SessionStart), request); } public static void HandleResponse(SessionStart.Response response) { if (response.Success) { Log.Information("Session started successfully"); ConfigurationManager.Instance.OwnedSession = response.Session; ConfigurationManager.Save(); HostService.UpdateParty(); } else { Log.Error($"Failed to start session: {response.Error}"); UiService.LastErrorMessage = $"Failed to start session: {response.Error}"; _ = ((ApiService)Plugin.GetService()).Disconnect(); } } } }