├── .Builder ├── .idea │ └── .idea.SupabaseUnityBuilder │ │ └── .idea │ │ ├── .name │ │ ├── encodings.xml │ │ ├── indexLayout.xml │ │ ├── projectSettingsUpdater.xml │ │ └── workspace.xml ├── SupabaseUnityBuilder.sln └── SupabaseUnityBuilder │ ├── .idea │ └── .idea.SupabaseUnityBuilder │ │ └── .idea │ │ └── workspace.xml │ ├── Program.cs │ ├── SupabaseUnityBuilder.csproj │ └── Utils.cs ├── .UnityDlls ├── Functions.meta ├── Functions │ ├── Functions.dll │ ├── Functions.dll.meta │ ├── package.json │ └── package.json.meta ├── Gotrue.meta ├── Gotrue │ ├── Gotrue.dll │ ├── Gotrue.dll.meta │ ├── package.json │ └── package.json.meta ├── MimeMapping.meta ├── MimeMapping │ ├── MimeMapping.dll │ ├── MimeMapping.dll.meta │ ├── package.json │ └── package.json.meta ├── Newtonsoft.Json.meta ├── Newtonsoft.Json │ ├── Newtonsoft.Json.dll │ ├── Newtonsoft.Json.dll.meta │ ├── package.json │ └── package.json.meta ├── Postgrest.meta ├── Postgrest │ ├── Postgrest.dll │ ├── Postgrest.dll.meta │ ├── package.json │ └── package.json.meta ├── Realtime.meta ├── Realtime │ ├── Realtime.dll │ ├── Realtime.dll.meta │ ├── package.json │ └── package.json.meta ├── Storage.meta ├── Storage │ ├── Storage.dll │ ├── Storage.dll.meta │ ├── package.json │ └── package.json.meta ├── Supabase.meta ├── Supabase │ ├── Supabase.dll │ ├── Supabase.dll.meta │ ├── package.json │ └── package.json.meta ├── System.Reactive.meta ├── System.Reactive │ ├── System.Reactive.dll │ ├── System.Reactive.dll.meta │ ├── package.json │ └── package.json.meta ├── System.Runtime.CompilerServices.Unsafe.meta ├── System.Runtime.CompilerServices.Unsafe │ ├── System.Runtime.CompilerServices.Unsafe.dll │ ├── System.Runtime.CompilerServices.Unsafe.dll.meta │ ├── package.json │ └── package.json.meta ├── System.Runtime.InteropServices.WindowsRuntime.meta ├── System.Runtime.InteropServices.WindowsRuntime │ ├── System.Runtime.InteropServices.WindowsRuntime.dll │ ├── System.Runtime.InteropServices.WindowsRuntime.dll.meta │ ├── package.json │ └── package.json.meta ├── System.Threading.Channels.meta ├── System.Threading.Channels │ ├── System.Threading.Channels.dll │ ├── System.Threading.Channels.dll.meta │ ├── package.json │ └── package.json.meta ├── System.Threading.Tasks.Extensions.meta ├── System.Threading.Tasks.Extensions │ ├── System.Threading.Tasks.Extensions.dll │ ├── System.Threading.Tasks.Extensions.dll.meta │ ├── package.json │ └── package.json.meta ├── Websocket.Client.meta └── Websocket.Client │ ├── Websocket.Client.dll │ ├── Websocket.Client.dll.meta │ ├── package.json │ └── package.json.meta ├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── README.md ├── README.md.meta ├── Unity.meta ├── Unity ├── Supabase.asmdef ├── Supabase.asmdef.meta ├── package.json ├── package.json.meta ├── supabase-cloned.meta └── supabase-cloned │ ├── supabase-csharp.meta │ └── supabase-csharp │ ├── Supabase.meta │ ├── Supabase │ ├── Client.cs │ ├── Client.cs.meta │ ├── Extensions.meta │ ├── Extensions │ │ ├── DictionaryExtension.cs │ │ └── DictionaryExtension.cs.meta │ ├── StatelessClient.cs │ ├── StatelessClient.cs.meta │ ├── SupabaseFunctions.cs │ ├── SupabaseFunctions.cs.meta │ ├── SupabaseModel.cs │ ├── SupabaseModel.cs.meta │ ├── SupabaseTable.cs │ ├── SupabaseTable.cs.meta │ ├── Util.cs │ ├── Util.cs.meta │ ├── bin.meta │ ├── bin │ │ ├── Debug.meta │ │ └── Debug │ │ │ └── netstandard2.0.meta │ ├── obj.meta │ └── obj │ │ ├── Debug.meta │ │ └── Debug │ │ ├── netstandard2.0.meta │ │ └── netstandard2.0 │ │ ├── Supabase.AssemblyInfo.cs │ │ └── Supabase.AssemblyInfo.cs.meta │ ├── modules.meta │ └── modules │ ├── functions-csharp.meta │ ├── functions-csharp │ ├── Functions.meta │ ├── Functions │ │ ├── Client.cs │ │ ├── Client.cs.meta │ │ ├── Responses.meta │ │ ├── Responses │ │ │ ├── BaseResponse.cs │ │ │ ├── BaseResponse.cs.meta │ │ │ ├── ErrorResponse.cs │ │ │ └── ErrorResponse.cs.meta │ │ ├── Util.cs │ │ └── Util.cs.meta │ ├── supabase.meta │ └── supabase │ │ ├── functions.meta │ │ └── functions │ │ └── hello.meta │ ├── gotrue-csharp.meta │ ├── gotrue-csharp │ ├── Gotrue.meta │ └── Gotrue │ │ ├── Api.cs │ │ ├── Api.cs.meta │ │ ├── Attributes.meta │ │ ├── Attributes │ │ ├── MapToAttribute.cs │ │ └── MapToAttribute.cs.meta │ │ ├── Client.cs │ │ ├── Client.cs.meta │ │ ├── Constants.cs │ │ ├── Constants.cs.meta │ │ ├── ExceptionHandler.cs │ │ ├── ExceptionHandler.cs.meta │ │ ├── Helpers.cs │ │ ├── Helpers.cs.meta │ │ ├── Responses.meta │ │ ├── Responses │ │ ├── BaseResponse.cs │ │ ├── BaseResponse.cs.meta │ │ ├── ErrorResponse.cs │ │ └── ErrorResponse.cs.meta │ │ ├── Session.cs │ │ ├── Session.cs.meta │ │ ├── StatelessClient.cs │ │ ├── StatelessClient.cs.meta │ │ ├── User.cs │ │ ├── User.cs.meta │ │ ├── Util.cs │ │ └── Util.cs.meta │ ├── postgrest-csharp.meta │ ├── postgrest-csharp │ ├── Postgrest.meta │ └── Postgrest │ │ ├── Attributes.meta │ │ ├── Attributes │ │ ├── ColumnAttribute.cs │ │ ├── ColumnAttribute.cs.meta │ │ ├── MapToAttribute.cs │ │ ├── MapToAttribute.cs.meta │ │ ├── PrimaryKeyAttribute.cs │ │ ├── PrimaryKeyAttribute.cs.meta │ │ ├── TableAttribute.cs │ │ └── TableAttribute.cs.meta │ │ ├── Client.cs │ │ ├── Client.cs.meta │ │ ├── ClientOptions.cs │ │ ├── ClientOptions.cs.meta │ │ ├── Constants.cs │ │ ├── Constants.cs.meta │ │ ├── Converters.meta │ │ ├── Converters │ │ ├── DateTimeConverter.cs │ │ ├── DateTimeConverter.cs.meta │ │ ├── IntConverter.cs │ │ ├── IntConverter.cs.meta │ │ ├── RangeConverter.cs │ │ └── RangeConverter.cs.meta │ │ ├── Extensions.meta │ │ ├── Extensions │ │ ├── DictionaryExtensions.cs │ │ ├── DictionaryExtensions.cs.meta │ │ ├── EnumExtensions.cs │ │ ├── EnumExtensions.cs.meta │ │ ├── RangeExtensions.cs │ │ └── RangeExtensions.cs.meta │ │ ├── Helpers.cs │ │ ├── Helpers.cs.meta │ │ ├── IntRange.cs │ │ ├── IntRange.cs.meta │ │ ├── Models.meta │ │ ├── Models │ │ ├── BaseModel.cs │ │ └── BaseModel.cs.meta │ │ ├── PostgrestContractResolver.cs │ │ ├── PostgrestContractResolver.cs.meta │ │ ├── QueryFilter.cs │ │ ├── QueryFilter.cs.meta │ │ ├── QueryOptions.cs │ │ ├── QueryOptions.cs.meta │ │ ├── QueryOrderer.cs │ │ ├── QueryOrderer.cs.meta │ │ ├── Responses.meta │ │ ├── Responses │ │ ├── BaseResponse.cs │ │ ├── BaseResponse.cs.meta │ │ ├── ErrorResponse.cs │ │ ├── ErrorResponse.cs.meta │ │ ├── ModeledResponse.cs │ │ └── ModeledResponse.cs.meta │ │ ├── StatelessClient.cs │ │ ├── StatelessClient.cs.meta │ │ ├── StatelessClientOptions.cs │ │ ├── StatelessClientOptions.cs.meta │ │ ├── Table.cs │ │ ├── Table.cs.meta │ │ ├── Util.cs │ │ └── Util.cs.meta │ ├── realtime-csharp.meta │ ├── realtime-csharp │ ├── Realtime.meta │ └── Realtime │ │ ├── Attributes.meta │ │ ├── Attributes │ │ ├── MapToAttribute.cs │ │ └── MapToAttribute.cs.meta │ │ ├── Channel.cs │ │ ├── Channel.cs.meta │ │ ├── Client.cs │ │ ├── Client.cs.meta │ │ ├── ClientOptions.cs │ │ ├── ClientOptions.cs.meta │ │ ├── Constants.cs │ │ ├── Constants.cs.meta │ │ ├── Converters.meta │ │ ├── Converters │ │ ├── DateTimeConverter.cs │ │ ├── DateTimeConverter.cs.meta │ │ ├── IntArrayConverter.cs │ │ ├── IntArrayConverter.cs.meta │ │ ├── StringArrayConverter.cs │ │ └── StringArrayConverter.cs.meta │ │ ├── CustomContractResolver.cs │ │ ├── CustomContractResolver.cs.meta │ │ ├── Push.cs │ │ ├── Push.cs.meta │ │ ├── Socket.cs │ │ ├── Socket.cs.meta │ │ ├── Utils.cs │ │ └── Utils.cs.meta │ ├── storage-csharp.meta │ └── storage-csharp │ ├── Storage.meta │ └── Storage │ ├── Bucket.cs │ ├── Bucket.cs.meta │ ├── Client.cs │ ├── Client.cs.meta │ ├── CreateSignedUrlResponse.cs │ ├── CreateSignedUrlResponse.cs.meta │ ├── Extensions.meta │ ├── Extensions │ ├── HttpClientProgress.cs │ ├── HttpClientProgress.cs.meta │ ├── ProgressableStreamContent.cs │ └── ProgressableStreamContent.cs.meta │ ├── FileObject.cs │ ├── FileObject.cs.meta │ ├── FileOptions.cs │ ├── FileOptions.cs.meta │ ├── Helpers.cs │ ├── Helpers.cs.meta │ ├── SearchOptions.cs │ ├── SearchOptions.cs.meta │ ├── SortBy.cs │ ├── SortBy.cs.meta │ ├── StorageBucketApi.cs │ ├── StorageBucketApi.cs.meta │ ├── StorageFileApi.cs │ ├── StorageFileApi.cs.meta │ ├── Util.cs │ └── Util.cs.meta ├── package.json └── package.json.meta /.Builder/.idea/.idea.SupabaseUnityBuilder/.idea/.name: -------------------------------------------------------------------------------- 1 | SupabaseUnityBuilder -------------------------------------------------------------------------------- /.Builder/.idea/.idea.SupabaseUnityBuilder/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.Builder/.idea/.idea.SupabaseUnityBuilder/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.Builder/.idea/.idea.SupabaseUnityBuilder/.idea/projectSettingsUpdater.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.Builder/.idea/.idea.SupabaseUnityBuilder/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SupabaseUnityBuilder/SupabaseUnityBuilder.csproj 5 | 6 | 7 | 8 | 13 | 14 | 16 | 17 | 19 | 20 | 22 | 23 | 24 | 27 | { 28 | "keyToString": { 29 | "RunOnceActivity.OpenProjectViewOnStart": "true", 30 | "RunOnceActivity.ShowReadmeOnStart": "true", 31 | "settings.editor.selected.configurable": "MTConfigurable" 32 | } 33 | } 34 | 35 | 36 | 53 | 54 | 55 | 56 | 57 | 58 | 1653396141759 59 | 70 | 71 | 72 | 73 | 74 | 76 | -------------------------------------------------------------------------------- /.Builder/SupabaseUnityBuilder.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SupabaseUnityBuilder", "SupabaseUnityBuilder\SupabaseUnityBuilder.csproj", "{F94986D5-84A9-4D92-BD40-0728DA5C90D4}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Any CPU = Debug|Any CPU 8 | Release|Any CPU = Release|Any CPU 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {F94986D5-84A9-4D92-BD40-0728DA5C90D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 12 | {F94986D5-84A9-4D92-BD40-0728DA5C90D4}.Debug|Any CPU.Build.0 = Debug|Any CPU 13 | {F94986D5-84A9-4D92-BD40-0728DA5C90D4}.Release|Any CPU.ActiveCfg = Release|Any CPU 14 | {F94986D5-84A9-4D92-BD40-0728DA5C90D4}.Release|Any CPU.Build.0 = Release|Any CPU 15 | EndGlobalSection 16 | EndGlobal 17 | -------------------------------------------------------------------------------- /.Builder/SupabaseUnityBuilder/.idea/.idea.SupabaseUnityBuilder/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SupabaseUnityBuilder/SupabaseUnityBuilder.csproj 5 | 6 | 7 | 8 | 13 | 14 | 16 | 17 | 19 | 20 | 21 | 24 | 31 | 32 | 33 | 50 | 51 | 52 | 53 | 54 | 55 | 1653396107027 56 | 61 | 62 | 63 | 64 | 65 | 67 | -------------------------------------------------------------------------------- /.Builder/SupabaseUnityBuilder/Program.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | string appDir = Environment.CurrentDirectory; 4 | var repoDir = Directory.GetParent(appDir).Parent.Parent.Parent.Parent; 5 | var submodulesDirPath = Path.Combine(repoDir.FullName, ".Submodules"); 6 | if(!Directory.Exists(submodulesDirPath)) 7 | throw new Exception($"Something went wrong, directory doesn't exists: {submodulesDirPath}"); 8 | 9 | var unityDirPath = Path.Combine(repoDir.FullName, "Unity"); 10 | var unityDir = new DirectoryInfo(unityDirPath); 11 | var supClonedDirPath = Path.Combine(unityDirPath, "supabase-cloned"); 12 | Console.WriteLine(supClonedDirPath); 13 | // make sure we aren't deleting random "Unity" folder 14 | if(Directory.Exists(supClonedDirPath)) 15 | { 16 | // unityDir.Delete(true); - this was bad as meta files shouldn't be deleted 17 | var filesToDelete = Directory.GetFiles(supClonedDirPath, "*.cs", SearchOption.AllDirectories); 18 | foreach(string delPath in filesToDelete) 19 | { 20 | File.Delete(delPath); 21 | } 22 | } 23 | unityDir.Create(); 24 | Directory.CreateDirectory(supClonedDirPath); 25 | 26 | 27 | // copy cs files 28 | DirectoryInfo submodulesDir = new DirectoryInfo(submodulesDirPath); 29 | Utils.CopyDirectoryRecursive(submodulesDir, supClonedDirPath); 30 | 31 | 32 | // build dlls 33 | DirectoryInfo supaDir = new DirectoryInfo(Path.Combine(submodulesDir.FullName, "supabase-csharp", "Supabase")); 34 | Process cmd = new Process() 35 | { 36 | StartInfo = new ProcessStartInfo("cmd.exe", "/c " + @"dotnet publish -o ../../../.build") 37 | { 38 | RedirectStandardOutput = true, 39 | CreateNoWindow = true, 40 | UseShellExecute = false, 41 | WorkingDirectory = supaDir.FullName 42 | } 43 | }; 44 | cmd.Start(); 45 | 46 | await cmd.WaitForExitAsync(); 47 | Console.WriteLine(cmd.StandardOutput.ReadToEnd()); 48 | 49 | 50 | 51 | // create main package 52 | string packageJsonTemplate = @" 53 | { 54 | ""name"": ""name_replace"", 55 | ""version"": ""1.0.0"" 56 | }"; 57 | await File.WriteAllTextAsync(Path.Combine(unityDirPath, "package.json"), packageJsonTemplate.Replace("name_replace", "com.supabase.unity")); 58 | 59 | string asmdefTemplate = @"{ 60 | ""name"": ""name_replace"", 61 | ""rootNamespace"": """", 62 | ""references"": [], 63 | ""includePlatforms"": [], 64 | ""excludePlatforms"": [], 65 | ""allowUnsafeCode"": false, 66 | ""overrideReferences"": false, 67 | ""precompiledReferences"": [], 68 | ""autoReferenced"": true, 69 | ""defineConstraints"": [], 70 | ""noEngineReferences"": false 71 | }"; 72 | await File.WriteAllTextAsync(Path.Combine(unityDirPath, "Supabase.asmdef"), asmdefTemplate.Replace("name_replace", "Supabase")); 73 | 74 | 75 | // create dlls packages 76 | var buildDir = new DirectoryInfo(Path.Combine(repoDir.FullName, ".build")); 77 | 78 | 79 | var unityDllsPath = Path.Combine(repoDir.FullName, ".UnityDlls"); 80 | if(Directory.Exists(unityDllsPath)) 81 | { 82 | // Directory.Delete(unityDllsPath, true); 83 | var filesToDelete = Directory.GetFiles(unityDllsPath, "*.dll", SearchOption.AllDirectories); 84 | foreach(string delPath in filesToDelete) 85 | { 86 | File.Delete(delPath); 87 | } 88 | } 89 | 90 | foreach(var file in buildDir.EnumerateFiles("*.dll")) 91 | { 92 | var nameWithoutExt = Path.GetFileNameWithoutExtension(file.Name); 93 | var destPath = Path.Combine(repoDir.FullName, ".UnityDlls", nameWithoutExt); 94 | Directory.CreateDirectory(destPath); 95 | file.CopyTo(Path.Combine(destPath, file.Name)); 96 | var packageJsonPath = Path.Combine(destPath, "package.json"); 97 | await File.WriteAllTextAsync(packageJsonPath, packageJsonTemplate.Replace("name_replace", $"com.supabase.dll.{nameWithoutExt.ToLowerInvariant()}")); 98 | } -------------------------------------------------------------------------------- /.Builder/SupabaseUnityBuilder/SupabaseUnityBuilder.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.Builder/SupabaseUnityBuilder/Utils.cs: -------------------------------------------------------------------------------- 1 | public class Utils 2 | { 3 | public static int CopyDirectoryRecursive(DirectoryInfo sourceDir, string destinationDir) 4 | { 5 | Directory.CreateDirectory(destinationDir); 6 | 7 | int totalFilesCopied = 0; 8 | 9 | foreach(FileInfo file in sourceDir.EnumerateFiles()) 10 | { 11 | if(file.Name.StartsWith(".")) 12 | continue; 13 | 14 | if(!file.Name.EndsWith("cs") ) 15 | continue; 16 | string targetFilePath = Path.Combine(destinationDir, file.Name); 17 | file.CopyTo(targetFilePath); 18 | totalFilesCopied++; 19 | } 20 | 21 | foreach(DirectoryInfo subDir in sourceDir.EnumerateDirectories()) 22 | { 23 | if(subDir.Name.StartsWith(".")) 24 | continue; 25 | 26 | if(subDir.Name.Contains("Test") 27 | || subDir.Name.Contains("Example")) 28 | continue; 29 | string newDir = Path.Combine(destinationDir, subDir.Name); 30 | totalFilesCopied += CopyDirectoryRecursive(subDir, newDir); 31 | } 32 | // if(totalFilesCopied == 0) 33 | // Directory.Delete(destinationDir); 34 | 35 | return totalFilesCopied; 36 | } 37 | } -------------------------------------------------------------------------------- /.UnityDlls/Functions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75e642c8410a4cc4fb666cf4f6519bc1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/Functions/Functions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/Functions/Functions.dll -------------------------------------------------------------------------------- /.UnityDlls/Functions/Functions.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db18dd5f2a3c4c6438e9ba31f7f9fbcb 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/Functions/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.functions", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/Functions/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f2f185cc69bf1045916a6f0c66071e6 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/Gotrue.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c645119461f1d341859186d51235b27 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/Gotrue/Gotrue.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/Gotrue/Gotrue.dll -------------------------------------------------------------------------------- /.UnityDlls/Gotrue/Gotrue.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a67b8bff27b56245ba0e16672e0aaa3 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/Gotrue/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.gotrue", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/Gotrue/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a264b7e04645d04ca9ce4a3bec9feb8 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/MimeMapping.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 146bd14e45798684d86acd26cd5f082c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/MimeMapping/MimeMapping.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/MimeMapping/MimeMapping.dll -------------------------------------------------------------------------------- /.UnityDlls/MimeMapping/MimeMapping.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44d63c61391f89441b940c8367cef3b9 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/MimeMapping/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.mimemapping", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/MimeMapping/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7efd0d331e847649aa8139514aa14cd 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/Newtonsoft.Json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7aebd3767c2a014a9f9bf92160c6c54 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/Newtonsoft.Json/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/Newtonsoft.Json/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /.UnityDlls/Newtonsoft.Json/Newtonsoft.Json.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 129cd4957030e41478f85cb9387a5200 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/Newtonsoft.Json/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.newtonsoft.json", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/Newtonsoft.Json/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52b5820742cb05b4fb40f19d70003af8 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/Postgrest.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd8eaf9a23afea643833d93bb7bb6181 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/Postgrest/Postgrest.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/Postgrest/Postgrest.dll -------------------------------------------------------------------------------- /.UnityDlls/Postgrest/Postgrest.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 822e7b3409ce81a4380d4c230b830010 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/Postgrest/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.postgrest", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/Postgrest/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98d7ac6889146af41a5a0c93e262aed3 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/Realtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 091ea1718f7bab549b9daf265b9fd36f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/Realtime/Realtime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/Realtime/Realtime.dll -------------------------------------------------------------------------------- /.UnityDlls/Realtime/Realtime.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb187c81ff1389943890985cd20ac9c5 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/Realtime/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.realtime", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/Realtime/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0226fed841dfb445b1680b5b914df79 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/Storage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da32ace429b46bf4bad42bcab29c9fcb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/Storage/Storage.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/Storage/Storage.dll -------------------------------------------------------------------------------- /.UnityDlls/Storage/Storage.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4deda8c58a2a69e41ac485490d80a8aa 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/Storage/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.storage", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/Storage/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 378240f2ceaa1d145a1cc27bc107e337 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/Supabase.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a180252389c271b4e8c2415b703853cd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/Supabase/Supabase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/Supabase/Supabase.dll -------------------------------------------------------------------------------- /.UnityDlls/Supabase/Supabase.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 47dd4d915b23d664689d2af13b772f91 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/Supabase/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.supabase", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/Supabase/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02f59b59f8231cd46b1ecb8017c44641 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/System.Reactive.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cdcaac4894c9f8488a00dc20ab0ca70 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/System.Reactive/System.Reactive.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/System.Reactive/System.Reactive.dll -------------------------------------------------------------------------------- /.UnityDlls/System.Reactive/System.Reactive.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d26531d1098175645b35321e8f776f93 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/System.Reactive/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.system.reactive", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/System.Reactive/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7658fc78e60e91c49aa4d47dcee356e4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.CompilerServices.Unsafe.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 711f73923854e2745abe30f846042d48 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe.dll -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f7b179f11e36f2428ad6ae0dfc8e254 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.CompilerServices.Unsafe/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.system.runtime.compilerservices.unsafe", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.CompilerServices.Unsafe/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02b9813a0517e21478b8413bea20f3ef 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.InteropServices.WindowsRuntime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70ec1f3ccd7d4e441a440aa3d9ac08fe 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.InteropServices.WindowsRuntime/System.Runtime.InteropServices.WindowsRuntime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/System.Runtime.InteropServices.WindowsRuntime/System.Runtime.InteropServices.WindowsRuntime.dll -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.InteropServices.WindowsRuntime/System.Runtime.InteropServices.WindowsRuntime.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e0ce957ba43c01488f4d10344433811 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.InteropServices.WindowsRuntime/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.system.runtime.interopservices.windowsruntime", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/System.Runtime.InteropServices.WindowsRuntime/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9d7da5758155694c8e2859e621a04c4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Channels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7412d370e93f9ea4184c7735b822f745 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Channels/System.Threading.Channels.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/System.Threading.Channels/System.Threading.Channels.dll -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Channels/System.Threading.Channels.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a6e647bf93ab3846a043673d2ad6538 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Channels/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.system.threading.channels", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Channels/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e0a9478c5dd0ab46b984b71009f0f2a 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Tasks.Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e71e1fa168eb3540857a89f14510c72 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Tasks.Extensions/System.Threading.Tasks.Extensions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/System.Threading.Tasks.Extensions/System.Threading.Tasks.Extensions.dll -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Tasks.Extensions/System.Threading.Tasks.Extensions.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89401d8655109b84c94c8f0436ab9db7 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Tasks.Extensions/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.system.threading.tasks.extensions", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/System.Threading.Tasks.Extensions/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7dec4d3c169e5494f8427e920eee72bc 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.UnityDlls/Websocket.Client.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f7d59da44876c94e87baf5181ded6a3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /.UnityDlls/Websocket.Client/Websocket.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kamyker/supabase-unity/2705e95b3bd1a0e49c03e2801db726f452697de1/.UnityDlls/Websocket.Client/Websocket.Client.dll -------------------------------------------------------------------------------- /.UnityDlls/Websocket.Client/Websocket.Client.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44ee0c3465433af488ef180ceac656a6 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /.UnityDlls/Websocket.Client/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.dll.websocket.client", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /.UnityDlls/Websocket.Client/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d3be5cd8fbdf2d4788833d14040a051 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: kamyker 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .build/ 2 | .Builder/SupabaseUnityBuilder/bin/ 3 | .Builder/SupabaseUnityBuilder/obj/ 4 | 5 | 6 | ### Rider ### 7 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 8 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 9 | 10 | # User-specific stuff 11 | .idea/**/workspace.xml 12 | .idea/**/tasks.xml 13 | .idea/**/usage.statistics.xml 14 | .idea/**/dictionaries 15 | .idea/**/shelf 16 | 17 | # AWS User-specific 18 | .idea/**/aws.xml 19 | 20 | # Generated files 21 | .idea/**/contentModel.xml 22 | 23 | # Sensitive or high-churn files 24 | .idea/**/dataSources/ 25 | .idea/**/dataSources.ids 26 | .idea/**/dataSources.local.xml 27 | .idea/**/sqlDataSources.xml 28 | .idea/**/dynamic.xml 29 | .idea/**/uiDesigner.xml 30 | .idea/**/dbnavigator.xml 31 | 32 | # Gradle 33 | .idea/**/gradle.xml 34 | .idea/**/libraries 35 | 36 | # Gradle and Maven with auto-import 37 | # When using Gradle or Maven with auto-import, you should exclude module files, 38 | # since they will be recreated, and may cause churn. Uncomment if using 39 | # auto-import. 40 | # .idea/artifacts 41 | # .idea/compiler.xml 42 | # .idea/jarRepositories.xml 43 | # .idea/modules.xml 44 | # .idea/*.iml 45 | # .idea/modules 46 | # *.iml 47 | # *.ipr 48 | 49 | # CMake 50 | cmake-build-*/ 51 | 52 | # Mongo Explorer plugin 53 | .idea/**/mongoSettings.xml 54 | 55 | # File-based project format 56 | *.iws 57 | 58 | # IntelliJ 59 | out/ 60 | 61 | # mpeltonen/sbt-idea plugin 62 | .idea_modules/ 63 | 64 | # JIRA plugin 65 | atlassian-ide-plugin.xml 66 | 67 | # Cursive Clojure plugin 68 | .idea/replstate.xml 69 | 70 | # SonarLint plugin 71 | .idea/sonarlint/ 72 | 73 | # Crashlytics plugin (for Android Studio and IntelliJ) 74 | com_crashlytics_export_strings.xml 75 | crashlytics.properties 76 | crashlytics-build.properties 77 | fabric.properties 78 | 79 | # Editor-based Rest Client 80 | .idea/httpRequests 81 | 82 | # Android studio 3.1+ serialized cache file 83 | .idea/caches/build_file_checksums.ser 84 | 85 | # End of https://www.toptal.com/developers/gitignore/api/rider -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".Submodules/supabase-csharp"] 2 | path = .Submodules/supabase-csharp 3 | url = https://github.com/supabase-community/supabase-csharp 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Stage: Alpha

2 |
(Tested in Unity 2021.3 Windows Mono/Il2cpp)
3 | 4 | --- 5 | 6 | Integrate your [Supabase](https://supabase.io) projects with Unity. 7 | 8 | Combined [spabase-csharp repo](https://github.com/supabase-community/supabase-csharp) into one easy to install Unity package. 9 | 10 | ## Installation 11 | 12 | ### Install via git URL 13 | In Unity click Package Manager -> "+" -> Install via git URL 14 | 15 | You can install cs files only: https://github.com/kamyker/supabase-unity.git?path=Unity 16 | 17 | Or whole builder to be able to generate .meta files in Unity: https://github.com/kamyker/supabase-unity.git 18 | 19 | Then you may have to add dependand dlls that aren't already in your project. They could be installed by other packages. Simply check Unity editor log and add what's needed. For ex: 20 | 21 | ``` 22 | Packages\supabase-unity\Unity\supabase-cloned\supabase-csharp\modules\realtime-csharp\Realtime\Socket.cs(36,17): 23 | error CS0246: The type or namespace name 'WebsocketClient' could not be found 24 | (are you missing a using directive or an assembly reference?) 25 | ``` 26 | 27 | Means you have to install https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/Websocket.Client (via git URL in package manager). 28 | 29 | Dlls list (may be incomplete check .UnityDlls folder for more): 30 | 31 | ``` 32 | https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/Websocket.Client 33 | https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/System.Reactive 34 | https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/Newtonsoft.Json 35 | https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/MimeMapping 36 | https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/System.Runtime.InteropServices.WindowsRuntime 37 | https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/System.Runtime.CompilerServices.Unsafe 38 | https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/System.Threading.Channels 39 | https://github.com/kamyker/supabase-unity.git?path=.UnityDlls/System.Threading.Tasks.Extensions 40 | ``` 41 | 42 | --- 43 | 44 | ## Common issues 45 | ### Il2cpp 46 | You may encounter runtime errors: "ExecutionEngineException: Attempting to call method (...) for which no ahead of time (AOT) code was generated. Consider increasing the --generic-virtual-method-iterations=1 argument." 47 | 48 | This post describes how to fix it https://github.com/SixLabors/ImageSharp/issues/1703#issuecomment-896900448 . Worth saying that in Unity 2022+ this error should be completely fixed. 49 | 50 | ### Platforms other than Windows 51 | Possible there may be errors because of use of System.Reactive by Websocket.Client. Here's a dll without WindowsRuntiem dependency: https://drive.google.com/file/d/1dvO7GXPpXBWS9zQmmTmD2rAOayrSGW_1/view?usp=sharing . Try this dll instead of package above if you get any errors. 52 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38d69b8aee7463f44a5bd22d3f12f667 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7fd8609c59cad64e99e667b9f5586cf 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/Supabase.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Supabase", 3 | "rootNamespace": "", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [], 12 | "noEngineReferences": false 13 | } -------------------------------------------------------------------------------- /Unity/Supabase.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbadd59d4e92d3a4cb4347860677e601 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity/package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "com.supabase.unity", 4 | "version": "1.0.0" 5 | } -------------------------------------------------------------------------------- /Unity/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84163b3fab7f43240ad73821eabd2eb6 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity/supabase-cloned.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 700dbc2179872c8478fad85fd613055d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 461193e63dd41a742ac8514045c26823 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 178dd3d18a4ae67429a84158d740446a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/Client.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 851f6e27aab89af45b53e8082800c767 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b99b1c7ec28acbd4ab42b9982079b8b9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/Extensions/DictionaryExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Supabase.Extensions 6 | { 7 | internal static class DictionaryExtensions 8 | { 9 | // Works in C#3/VS2008: 10 | // Returns a new dictionary of this ... others merged leftward. 11 | // Keeps the type of 'this', which must be default-instantiable. 12 | // Example: 13 | // result = map.MergeLeft(other1, other2, ...) 14 | // From: https://stackoverflow.com/a/2679857/3629438 15 | public static T MergeLeft(this T me, params IDictionary[] others) 16 | where T : IDictionary, new() 17 | { 18 | T newMap = new T(); 19 | foreach (IDictionary src in (new List> { me }).Concat(others)) 20 | { 21 | foreach (KeyValuePair p in src) 22 | { 23 | newMap[p.Key] = p.Value; 24 | } 25 | } 26 | return newMap; 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/Extensions/DictionaryExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a7361ddcec8d2c499db18f9e0841754 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/StatelessClient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea9375dcd6b800d42a2e683ed45e57a7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/SupabaseFunctions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using static Supabase.Functions.Client; 7 | 8 | namespace Supabase 9 | { 10 | public class SupabaseFunctions 11 | { 12 | private string _functionsUrl; 13 | private Dictionary _headers = new Dictionary(); 14 | 15 | public SupabaseFunctions(string functionsUrl, Dictionary headers) 16 | { 17 | _functionsUrl = functionsUrl.TrimEnd('/'); 18 | _headers = headers; 19 | } 20 | 21 | public Task Invoke(string functionName, Dictionary body = null) => Functions.Client.Invoke($"{_functionsUrl}/{functionName}", options: new InvokeFunctionOptions 22 | { 23 | Headers = _headers, 24 | Body = body 25 | }); 26 | 27 | public Task Invoke(string functionName, Dictionary body = null) => Functions.Client.Invoke($"{_functionsUrl}/{functionName}", options: new InvokeFunctionOptions 28 | { 29 | Headers = _headers, 30 | Body = body 31 | }); 32 | 33 | public Task RawInvoke(string functionName, Dictionary body = null) => Functions.Client.RawInvoke($"{_functionsUrl}/{functionName}", options: new InvokeFunctionOptions 34 | { 35 | Headers = _headers, 36 | Body = body 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/SupabaseFunctions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e7c3c1545255b8489d75d4e45636a5f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/SupabaseModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Postgrest.Models; 4 | using Postgrest.Responses; 5 | 6 | namespace Supabase 7 | { 8 | public abstract class SupabaseModel : BaseModel 9 | { 10 | public override Task> Update() 11 | { 12 | return Client.Instance.From().Update(this as T); 13 | } 14 | 15 | public override Task Delete() 16 | { 17 | return Client.Instance.From().Delete(this as T); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/SupabaseModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6162f7adde8d3f54383da211a9e364ae 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/SupabaseTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading.Tasks; 4 | using Postgrest; 5 | using Postgrest.Models; 6 | using Supabase.Realtime; 7 | using static Supabase.Client; 8 | 9 | namespace Supabase 10 | { 11 | public class SupabaseTable : Table where T : BaseModel, new() 12 | { 13 | private Channel channel; 14 | 15 | public SupabaseTable() : base(Client.Instance.RestUrl, new Postgrest.ClientOptions { Headers = Instance.GetAuthHeaders(), Schema = Instance.Schema }) 16 | { } 17 | 18 | public SupabaseTable(string restUrl, Postgrest.ClientOptions options) : base(restUrl, options) 19 | { } 20 | 21 | public async Task On(ChannelEventType e, Action action) 22 | { 23 | if (channel == null) 24 | { 25 | var parameters = new Dictionary(); 26 | 27 | // In regard to: https://github.com/supabase/supabase-js/pull/270 28 | var headers = Instance.GetAuthHeaders(); 29 | if (headers.ContainsKey("Authorization")) 30 | { 31 | parameters.Add("user_token", headers["Authorization"].Split(' ')[1]); 32 | } 33 | 34 | channel = Instance.Realtime.Channel("realtime", Instance.Schema, TableName, parameters: parameters); 35 | } 36 | 37 | if (Instance.Realtime.Socket == null || !Instance.Realtime.Socket.IsConnected) 38 | await Instance.Realtime.ConnectAsync(); 39 | 40 | switch (e) 41 | { 42 | case ChannelEventType.Insert: 43 | channel.OnInsert += (sender, args) => action.Invoke(sender, args); 44 | break; 45 | case ChannelEventType.Update: 46 | channel.OnUpdate += (sender, args) => action.Invoke(sender, args); 47 | break; 48 | case ChannelEventType.Delete: 49 | channel.OnDelete += (sender, args) => action.Invoke(sender, args); 50 | break; 51 | case ChannelEventType.All: 52 | channel.OnMessage += (sender, args) => action.Invoke(sender, args); 53 | break; 54 | } 55 | 56 | try 57 | { 58 | await channel.Subscribe(); 59 | } 60 | catch { } 61 | 62 | return channel; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/SupabaseTable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 36c489711988391479b520c91056f978 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/Util.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace Supabase 7 | { 8 | public static class Util 9 | { 10 | public static string GetAssemblyVersion() 11 | { 12 | var assembly = typeof(Supabase.Client).Assembly; 13 | var informationVersion = assembly.GetCustomAttribute().InformationalVersion; 14 | var name = assembly.GetName().Name; 15 | 16 | return $"{name.ToString().ToLower()}-csharp/{informationVersion}"; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/Util.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be4f06ecd2447ba479ca75da470b97f7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/bin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0d43a617e9cf0f49824ec371b3b4314 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/bin/Debug.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 082fb16c7a012284e928d68a1116f15a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/bin/Debug/netstandard2.0.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16b2c64e21dbce4409949a47b1a94fb7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/obj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d63882741a2e81b40a265fab2d91b2b4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/obj/Debug.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e107f365b3db2bc4ba32bf98a6c06577 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/obj/Debug/netstandard2.0.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8bee22021e64634ab2404b4f0419154 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/obj/Debug/netstandard2.0/Supabase.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | using System; 11 | using System.Reflection; 12 | 13 | [assembly: System.Reflection.AssemblyCompanyAttribute("Joseph Schultz ")] 14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 15 | [assembly: System.Reflection.AssemblyCopyrightAttribute("MIT")] 16 | [assembly: System.Reflection.AssemblyDescriptionAttribute("A C# implementation of the Supabase client")] 17 | [assembly: System.Reflection.AssemblyFileVersionAttribute("0.4.4.0")] 18 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.4.4")] 19 | [assembly: System.Reflection.AssemblyProductAttribute("Supabase")] 20 | [assembly: System.Reflection.AssemblyTitleAttribute("Supabase")] 21 | [assembly: System.Reflection.AssemblyVersionAttribute("0.4.4.0")] 22 | [assembly: System.Resources.NeutralResourcesLanguageAttribute("en-US")] 23 | 24 | // Generated by the MSBuild WriteCodeFragment class. 25 | 26 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/Supabase/obj/Debug/netstandard2.0/Supabase.AssemblyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8913eb21e4ddb2d46b0c5152c815baf2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31a56c41a4c4bc34ea1d8a25a4758978 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddb0de11cc32f7c4f992deb894875df4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50d47fa61b1a4a84bb1fe00548d20cc8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Client.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Supabase.Functions.Responses; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Net.Http; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Web; 9 | 10 | namespace Supabase.Functions 11 | { 12 | public class Client 13 | { 14 | private static readonly HttpClient client = new HttpClient(); 15 | 16 | /// 17 | /// Returns an response, allowing for coersion into Streams, Strings, and byte[] 18 | /// 19 | /// Url of function to invoke 20 | /// Anon Key. 21 | /// Options 22 | /// 23 | public static async Task RawInvoke(string url, string token = null, InvokeFunctionOptions options = null) => (await HandleRequest(url, token, options)).Content; 24 | 25 | /// 26 | /// Invokes a function and returns the Text content of the response. 27 | /// 28 | /// Url of the function to invoke 29 | /// Anon Key. 30 | /// Options 31 | /// 32 | public static async Task Invoke(string url, string token = null, InvokeFunctionOptions options = null) 33 | { 34 | var response = await HandleRequest(url, token, options); 35 | 36 | return await response.Content.ReadAsStringAsync(); 37 | } 38 | 39 | /// 40 | /// Invokes a function and returns a JSON Deserialized object according to the supplied generic Type 41 | /// 42 | /// 43 | /// Url of function to invoke 44 | /// Anon Key. 45 | /// Options 46 | /// 47 | public static async Task Invoke(string url, string token = null, InvokeFunctionOptions options = null) 48 | { 49 | var response = await HandleRequest(url, token, options); 50 | 51 | var content = await response.Content.ReadAsStringAsync(); 52 | 53 | return JsonConvert.DeserializeObject(content); 54 | } 55 | 56 | /// 57 | /// Internal request handling 58 | /// 59 | /// 60 | /// 61 | /// 62 | /// 63 | /// 64 | private static async Task HandleRequest(string url, string token = null, InvokeFunctionOptions options = null) 65 | { 66 | if (options == null) 67 | { 68 | options = new InvokeFunctionOptions(); 69 | } 70 | 71 | if (!string.IsNullOrEmpty(token)) 72 | { 73 | options.Headers["Authorization"] = $"Bearer {token}"; 74 | } 75 | 76 | options.Headers["X-Client-Info"] = Util.GetAssemblyVersion(); 77 | 78 | var builder = new UriBuilder(url); 79 | var query = HttpUtility.ParseQueryString(builder.Query); 80 | 81 | builder.Query = query.ToString(); 82 | 83 | using (var requestMessage = new HttpRequestMessage(HttpMethod.Post, builder.Uri)) 84 | { 85 | requestMessage.Content = new StringContent(JsonConvert.SerializeObject(options.Body), Encoding.UTF8, "application/json"); 86 | 87 | if (options.Headers != null) 88 | { 89 | foreach (var kvp in options.Headers) 90 | { 91 | requestMessage.Headers.TryAddWithoutValidation(kvp.Key, kvp.Value); 92 | } 93 | } 94 | 95 | var response = await client.SendAsync(requestMessage); 96 | 97 | if (!response.IsSuccessStatusCode || response.Headers.Contains("x-relay-error")) 98 | { 99 | var content = await response.Content.ReadAsStringAsync(); 100 | 101 | var obj = new ErrorResponse 102 | { 103 | Content = content, 104 | Message = content 105 | }; 106 | throw new RequestException(response, obj); 107 | } 108 | 109 | return response; 110 | } 111 | } 112 | 113 | public class RequestException : Exception 114 | { 115 | public HttpResponseMessage Response { get; private set; } 116 | public ErrorResponse Error { get; private set; } 117 | 118 | public RequestException(HttpResponseMessage response, ErrorResponse error) : base(error.Message) 119 | { 120 | Response = response; 121 | Error = error; 122 | } 123 | } 124 | 125 | /// 126 | /// Options that can be supplied to a function invocation. 127 | /// 128 | /// Note: If Headers.Authorization is set, it can be later overriden if a token is supplied in the method call. 129 | /// 130 | public class InvokeFunctionOptions 131 | { 132 | /// 133 | /// Headers to be included on the request. 134 | /// 135 | public Dictionary Headers { get; set; } = new Dictionary(); 136 | 137 | 138 | /// 139 | /// Body of the Request 140 | /// 141 | [JsonProperty("body")] 142 | public Dictionary Body { get; set; } = new Dictionary(); 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Client.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a54ebdbbd84a119468cc405f8ab202d3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Responses.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c121c295f5b78e54f88923f9ee116cd1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Responses/BaseResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | using Newtonsoft.Json; 4 | 5 | namespace Supabase.Functions.Responses 6 | { 7 | /// 8 | /// A wrapper class from which all Responses derive. 9 | /// 10 | public class BaseResponse 11 | { 12 | [JsonIgnore] 13 | public HttpResponseMessage ResponseMessage { get; set; } 14 | 15 | [JsonIgnore] 16 | public string Content { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Responses/BaseResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20ce245b091e9d6459e993d5dc60d411 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Responses/ErrorResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Supabase.Functions.Responses 5 | { 6 | /// 7 | /// A representation of Postgrest's API error response. 8 | /// 9 | public class ErrorResponse : BaseResponse 10 | { 11 | public string Message { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Responses/ErrorResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff6077af567f39d4a9ab6df5e45a560a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Util.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Supabase.Functions 5 | { 6 | public static class Util 7 | { 8 | public static string GetAssemblyVersion() 9 | { 10 | var assembly = typeof(Client).Assembly; 11 | var informationVersion = assembly.GetCustomAttribute().InformationalVersion; 12 | var name = assembly.GetName().Name; 13 | 14 | return $"{name.ToString().ToLower()}-csharp/{informationVersion}"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/Functions/Util.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97cf8b2fdab0c1443a211b4f033fd2f3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/supabase.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 678321942493b6e4fa064a8c2fc423c8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/supabase/functions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfd6383887acde14b96cdd3bbb3a15b4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/functions-csharp/supabase/functions/hello.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57476934a69a7d44a899f295a07ecf6a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 803ca18109226f24fb865a7cd85e26e1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62a2897b398631744bce9e4c23a1f3d6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Api.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d0bc77d4c527344498355969832adf9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c1c30b4ea8fb8246962b730f2b828a3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Attributes/MapToAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Supabase.Gotrue.Attributes 5 | { 6 | /// 7 | /// Used internally to add a string value to a C# field. 8 | /// 9 | [AttributeUsage(AttributeTargets.Field)] 10 | internal class MapToAttribute : Attribute 11 | { 12 | public string Mapping { get; set; } 13 | public string Formatter { get; set; } 14 | 15 | public MapToAttribute(string mapping, string formatter = null) 16 | { 17 | Mapping = mapping; 18 | Formatter = formatter; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Attributes/MapToAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6d9169e111df784386411e8284058db 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Client.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ad3b297592f4eb41855d6cd1419278d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Supabase.Gotrue.Attributes; 4 | 5 | namespace Supabase.Gotrue 6 | { 7 | public static class Constants 8 | { 9 | public static string GOTRUE_URL = "http://localhost:9999"; 10 | public static string AUDIENCE = ""; 11 | public static readonly Dictionary DEFAULT_HEADERS = new Dictionary(); 12 | public static int EXPIRY_MARGIN = 60 * 1000; 13 | public static string STORAGE_KEY = "supabase.auth.token"; 14 | public static readonly Dictionary COOKIE_OPTIONS = new Dictionary{ 15 | { "name", "sb:token" }, 16 | { "lifetime", 60 * 60 * 8 }, 17 | { "domain", "" }, 18 | { "path", "/" }, 19 | { "sameSite", "lax" } 20 | }; 21 | 22 | public enum SortOrder 23 | { 24 | [MapTo("asc")] 25 | Ascending, 26 | [MapTo("desc")] 27 | Descending 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Constants.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d213e5434d06a2e409b310d4d1e530ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/ExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Net.Http; 4 | 5 | namespace Supabase.Gotrue 6 | { 7 | /// 8 | /// Internal class for parsing Supabase specific exceptions. 9 | /// 10 | internal static class ExceptionHandler 11 | { 12 | internal static Exception Parse(RequestException ex) 13 | { 14 | switch (ex.Response.StatusCode) 15 | { 16 | case System.Net.HttpStatusCode.Unauthorized: 17 | Debug.WriteLine(ex.Message); 18 | return new UnauthorizedException(ex); 19 | case System.Net.HttpStatusCode.BadRequest: 20 | Debug.WriteLine(ex.Message); 21 | return new BadRequestException(ex); 22 | case System.Net.HttpStatusCode.Forbidden: 23 | Debug.WriteLine("Forbidden, are sign-ups disabled?"); 24 | return new ForbiddenException(ex); 25 | } 26 | return ex; 27 | } 28 | } 29 | 30 | public class UnauthorizedException : Exception 31 | { 32 | public HttpResponseMessage Response { get; private set; } 33 | 34 | public string Content { get; private set; } 35 | public UnauthorizedException(RequestException exception) 36 | { 37 | Response = exception.Response; 38 | Content = exception.Error.Message; 39 | } 40 | } 41 | 42 | public class BadRequestException : Exception 43 | { 44 | public HttpResponseMessage Response { get; private set; } 45 | 46 | public string Content { get; private set; } 47 | public BadRequestException(RequestException exception) 48 | { 49 | Response = exception.Response; 50 | Content = exception.Error.Message; 51 | } 52 | } 53 | 54 | public class ForbiddenException : Exception 55 | { 56 | public HttpResponseMessage Response { get; private set; } 57 | public string Content { get; private set; } 58 | public ForbiddenException(RequestException exception) 59 | { 60 | Response = exception.Response; 61 | Content = exception.Error.Message; 62 | } 63 | } 64 | 65 | public class InvalidEmailOrPasswordException : Exception 66 | { 67 | public HttpResponseMessage Response { get; private set; } 68 | public string Content { get; private set; } 69 | public InvalidEmailOrPasswordException(RequestException exception) 70 | { 71 | Response = exception.Response; 72 | Content = exception.Error.Message; 73 | } 74 | } 75 | 76 | public class ExistingUserException : Exception 77 | { 78 | public HttpResponseMessage Response { get; private set; } 79 | public string Content { get; private set; } 80 | public ExistingUserException(RequestException exception) 81 | { 82 | Response = exception.Response; 83 | Content = exception.Error.Message; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/ExceptionHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f8f1da266f061748a2243fcfe70bb63 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Helpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Net.Http; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Web; 8 | using Newtonsoft.Json; 9 | using System.Runtime.CompilerServices; 10 | using Supabase.Gotrue.Responses; 11 | using System.Threading; 12 | using Supabase.Gotrue.Attributes; 13 | using System.Linq; 14 | 15 | namespace Supabase.Gotrue 16 | { 17 | internal static class Helpers 18 | { 19 | public static T GetPropertyValue(object obj, string propName) => (T)obj.GetType().GetProperty(propName).GetValue(obj, null); 20 | public static T GetCustomAttribute(object obj) where T : Attribute => (T)Attribute.GetCustomAttribute(obj.GetType(), typeof(T)); 21 | public static T GetCustomAttribute(Type type) where T : Attribute => (T)Attribute.GetCustomAttribute(type, typeof(T)); 22 | 23 | public static MapToAttribute GetMappedToAttr(Enum obj) 24 | { 25 | var type = obj.GetType(); 26 | var name = Enum.GetName(type, obj); 27 | 28 | return type.GetField(name).GetCustomAttributes(false).OfType().SingleOrDefault(); 29 | } 30 | 31 | /// 32 | /// Adds query params to a given Url 33 | /// 34 | /// 35 | /// 36 | /// 37 | internal static Uri AddQueryParams(string url, Dictionary data) 38 | { 39 | var builder = new UriBuilder(url); 40 | var query = HttpUtility.ParseQueryString(builder.Query); 41 | 42 | foreach (var param in data) 43 | query[param.Key] = param.Value; 44 | 45 | builder.Query = query.ToString(); 46 | 47 | return builder.Uri; 48 | } 49 | 50 | private static readonly HttpClient client = new HttpClient(); 51 | 52 | /// 53 | /// Helper to make a request using the defined parameters to an API Endpoint and coerce into a model. 54 | /// 55 | /// 56 | /// 57 | /// 58 | /// 59 | /// 60 | /// 61 | public static async Task MakeRequest(HttpMethod method, string url, object data = null, Dictionary headers = null) 62 | { 63 | var baseResponse = await MakeRequest(method, url, data, headers); 64 | return JsonConvert.DeserializeObject(baseResponse.Content); 65 | } 66 | 67 | /// 68 | /// Helper to make a request using the defined parameters to an API Endpoint. 69 | /// 70 | /// 71 | /// 72 | /// 73 | /// 74 | /// 75 | public static async Task MakeRequest(HttpMethod method, string url, object data = null, Dictionary headers = null) 76 | { 77 | var builder = new UriBuilder(url); 78 | var query = HttpUtility.ParseQueryString(builder.Query); 79 | 80 | if (data != null && method == HttpMethod.Get) 81 | { 82 | // Case if it's a Get request the data object is a dictionary 83 | if (data is Dictionary reqParams) 84 | { 85 | foreach (var param in reqParams) 86 | query[param.Key] = param.Value; 87 | } 88 | 89 | } 90 | 91 | builder.Query = query.ToString(); 92 | 93 | using (var requestMessage = new HttpRequestMessage(method, builder.Uri)) 94 | { 95 | 96 | if (data != null && method != HttpMethod.Get) 97 | { 98 | requestMessage.Content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"); 99 | } 100 | 101 | if (headers != null) 102 | { 103 | foreach (var kvp in headers) 104 | { 105 | requestMessage.Headers.TryAddWithoutValidation(kvp.Key, kvp.Value); 106 | } 107 | } 108 | 109 | var response = await client.SendAsync(requestMessage); 110 | var content = await response.Content.ReadAsStringAsync(); 111 | 112 | if (!response.IsSuccessStatusCode) 113 | { 114 | var obj = new ErrorResponse 115 | { 116 | Content = content, 117 | Message = content 118 | }; 119 | throw new RequestException(response, obj); 120 | } 121 | else 122 | { 123 | return new BaseResponse { Content = content, ResponseMessage = response }; 124 | } 125 | } 126 | } 127 | } 128 | 129 | public class RequestException : Exception 130 | { 131 | public HttpResponseMessage Response { get; private set; } 132 | public ErrorResponse Error { get; private set; } 133 | 134 | public RequestException(HttpResponseMessage response, ErrorResponse error) : base(error.Message) 135 | { 136 | Response = response; 137 | Error = error; 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Helpers.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 727b3c37629d3bd4c9a66630ded51759 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Responses.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2cede2410562f44484e2326febb4cf0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Responses/BaseResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | using Newtonsoft.Json; 4 | 5 | namespace Supabase.Gotrue.Responses 6 | { 7 | /// 8 | /// A wrapper class from which all Responses derive. 9 | /// 10 | public class BaseResponse 11 | { 12 | [JsonIgnore] 13 | public HttpResponseMessage ResponseMessage { get; set; } 14 | 15 | [JsonIgnore] 16 | public string Content { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Responses/BaseResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71b20bffe524ded4a9c597190571506a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Responses/ErrorResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Supabase.Gotrue.Responses 5 | { 6 | /// 7 | /// A representation of Postgrest's API error response. 8 | /// 9 | public class ErrorResponse : BaseResponse 10 | { 11 | public string Message { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Responses/ErrorResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd3f15bc23aa81541961549561902425 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Session.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Supabase.Gotrue 5 | { 6 | /// 7 | /// Represents a Gotrue Session 8 | /// 9 | public class Session 10 | { 11 | [JsonProperty("access_token")] 12 | public string AccessToken { get; set; } 13 | 14 | [JsonProperty("expires_in")] 15 | public int ExpiresIn { get; set; } 16 | 17 | [JsonProperty("refresh_token")] 18 | public string RefreshToken { get; set; } 19 | 20 | [JsonProperty("token_type")] 21 | public string TokenType { get; set; } 22 | 23 | [JsonProperty("user")] 24 | public User User { get; set; } 25 | 26 | [JsonProperty("created_at")] 27 | public DateTime CreatedAt { get; private set; } = DateTime.Now; 28 | 29 | public DateTime ExpiresAt() => new DateTime(CreatedAt.Ticks).AddSeconds(ExpiresIn); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Session.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9c7dab71e87b1647806bbfaa256afb1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/StatelessClient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ceb3510fe1897a04dbaa1eee01862d8c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/User.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0dd02e26a5050a4a9e3572f990c85ad 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Util.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Supabase.Gotrue 5 | { 6 | public static class Util 7 | { 8 | public static string GetAssemblyVersion() 9 | { 10 | var assembly = typeof(Client).Assembly; 11 | var informationVersion = assembly.GetCustomAttribute().InformationalVersion; 12 | var name = assembly.GetName().Name; 13 | 14 | return $"{name.ToString().ToLower()}-csharp/{informationVersion}"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/gotrue-csharp/Gotrue/Util.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cff9d205ec8a6084b83bbe7dd3b483f6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 584a536ff61da4a4394cb70582e2e8e5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 698b72ffadbc7a248a5092b65a839f4c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74f020a3a63b1174696b66ccdad07d2e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes/ColumnAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using Newtonsoft.Json; 4 | 5 | namespace Postgrest.Attributes 6 | { 7 | /// 8 | /// Used to map a C# property to a Postgrest Column. 9 | /// 10 | /// 11 | /// 12 | /// class User : BaseModel { 13 | /// [ColumnName("firstName")] 14 | /// public string FirstName {get; set;} 15 | /// } 16 | /// 17 | /// 18 | [AttributeUsage(AttributeTargets.Property)] 19 | public class ColumnAttribute : Attribute 20 | { 21 | public string ColumnName { get; set; } 22 | public NullValueHandling NullValueHandling { get; set; } 23 | 24 | public ColumnAttribute([CallerMemberName] string columnName = null, NullValueHandling nullValueHandling = NullValueHandling.Include) 25 | { 26 | ColumnName = columnName; 27 | NullValueHandling = nullValueHandling; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes/ColumnAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4a184aa3b578824bb5f174d66170adf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes/MapToAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Postgrest.Attributes 4 | { 5 | /// 6 | /// Used internally to add a string value to a C# field. 7 | /// 8 | [AttributeUsage(AttributeTargets.Field)] 9 | internal class MapToAttribute : Attribute 10 | { 11 | public string Mapping { get; set; } 12 | public string Formatter { get; set; } 13 | 14 | public MapToAttribute(string mapping, string formatter = null) 15 | { 16 | Mapping = mapping; 17 | Formatter = formatter; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes/MapToAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3fb25341ecb7faa4da6a4c2163cd4462 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes/PrimaryKeyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace Postgrest.Attributes 5 | { 6 | /// 7 | /// Used to map a C# property to a Postgrest PrimaryKey. 8 | /// 9 | /// 10 | /// 11 | /// class User : BaseModel { 12 | /// [PrimaryKey("id")] 13 | /// public string Id {get; set;} 14 | /// } 15 | /// 16 | /// 17 | [AttributeUsage(AttributeTargets.Property)] 18 | public class PrimaryKeyAttribute : Attribute 19 | { 20 | public string ColumnName { get; set; } 21 | 22 | /// 23 | /// Would be set to false in the event that the database handles the generation of this property. 24 | /// 25 | public bool ShouldInsert { get; set; } 26 | 27 | public PrimaryKeyAttribute([CallerMemberName] string columnName = null, bool shouldInsert = true) 28 | { 29 | ColumnName = columnName; 30 | ShouldInsert = shouldInsert; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes/PrimaryKeyAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e9adfc36ced6104fb9cffedd191b425 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes/TableAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Postgrest.Attributes 3 | { 4 | /// 5 | /// Used to map a C# Model to a Postgres Table. 6 | /// 7 | /// 8 | /// 9 | /// [Table("user")] 10 | /// class User : BaseModel { 11 | /// [ColumnName("firstName")] 12 | /// public string FirstName {get; set;} 13 | /// } 14 | /// 15 | /// 16 | [AttributeUsage(AttributeTargets.Class)] 17 | public class TableAttribute : Attribute 18 | { 19 | public string Name { get; set; } 20 | 21 | public TableAttribute(string tableName) 22 | { 23 | Name = tableName; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Attributes/TableAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 133dd6027fd6cdd4388fc3f5b0994e67 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Client.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using Newtonsoft.Json; 6 | using Postgrest.Models; 7 | using Postgrest.Responses; 8 | 9 | namespace Postgrest 10 | { 11 | /// 12 | /// A Singleton that represents a single, reusable connection to a Postgrest endpoint. Should be first called with the `Initialize()` method. 13 | /// 14 | public class Client 15 | { 16 | /// 17 | /// API Base Url for subsequent calls. 18 | /// 19 | public string BaseUrl { get; private set; } 20 | 21 | private ClientOptions options; 22 | 23 | private static Client instance; 24 | 25 | /// 26 | /// Returns the Singleton Instance of this Class. 27 | /// 28 | public static Client Instance => instance ??= new Client(); 29 | 30 | private Client() 31 | { 32 | } 33 | 34 | /// 35 | /// Should be the first call to this class to initialize a connection with a Postgrest API Server 36 | /// 37 | /// Api Endpoint (ex: "http://localhost:8000"), no trailing slash required. 38 | /// Optional client configuration. 39 | /// 40 | public static Client Initialize(string baseUrl, ClientOptions options = null) 41 | { 42 | instance = new Client 43 | { 44 | BaseUrl = baseUrl 45 | }; 46 | 47 | options ??= new ClientOptions(); 48 | 49 | instance.options = options; 50 | 51 | return instance; 52 | } 53 | 54 | /// 55 | /// Returns a Table Query Builder instance for a defined model - representative of `USE $TABLE` 56 | /// 57 | /// Custom Model derived from `BaseModel` 58 | /// 59 | public Table Table() where T : BaseModel, new() => 60 | new Table(BaseUrl, options, StatelessClient.SerializerSettings(options)); 61 | 62 | /// 63 | /// Perform a stored procedure call. 64 | /// 65 | /// The function name to call 66 | /// The parameters to pass to the function call 67 | /// 68 | public Task Rpc(string procedureName, Dictionary parameters) 69 | { 70 | // Build Uri 71 | var builder = new UriBuilder($"{BaseUrl}/rpc/{procedureName}"); 72 | 73 | var canonicalUri = builder.Uri.ToString(); 74 | 75 | var serializerSettings = StatelessClient.SerializerSettings(options); 76 | 77 | // Prepare parameters 78 | var data = JsonConvert.DeserializeObject>( 79 | JsonConvert.SerializeObject(parameters, serializerSettings)); 80 | 81 | // Prepare headers 82 | var headers = Helpers.PrepareRequestHeaders(HttpMethod.Post, 83 | new Dictionary(options.Headers), options); 84 | 85 | // Send request 86 | var request = Helpers.MakeRequest(HttpMethod.Post, canonicalUri, serializerSettings, data, headers); 87 | return request; 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Client.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1feccf07f6cb0b479405907796bd50f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/ClientOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | 4 | namespace Postgrest 5 | { 6 | /// 7 | /// Options that can be passed to the Client configuration 8 | /// 9 | public class ClientOptions 10 | { 11 | public string Schema { get; set; } = "public"; 12 | 13 | public readonly DateTimeStyles DateTimeStyles = DateTimeStyles.AdjustToUniversal; 14 | 15 | public const string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFK"; 16 | 17 | public Dictionary Headers { get; set; } = new Dictionary(); 18 | 19 | public Dictionary QueryParams { get; set; } = new Dictionary(); 20 | } 21 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/ClientOptions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ff441c3d3578fc43948ba8b7b3c88a1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Constants.cs: -------------------------------------------------------------------------------- 1 | using Postgrest.Attributes; 2 | 3 | namespace Postgrest 4 | { 5 | public static class Constants 6 | { 7 | /// 8 | /// See: https://postgrest.org/en/v7.0.0/api.html?highlight=operators#operators 9 | /// 10 | public enum Operator 11 | { 12 | [MapTo("and")] 13 | And, 14 | [MapTo("or")] 15 | Or, 16 | [MapTo("eq")] 17 | Equals, 18 | [MapTo("gt")] 19 | GreaterThan, 20 | [MapTo("gte")] 21 | GreaterThanOrEqual, 22 | [MapTo("lt")] 23 | LessThan, 24 | [MapTo("lte")] 25 | LessThanOrEqual, 26 | [MapTo("neq")] 27 | NotEqual, 28 | [MapTo("like")] 29 | Like, 30 | [MapTo("ilike")] 31 | ILike, 32 | [MapTo("in")] 33 | In, 34 | [MapTo("is")] 35 | Is, 36 | [MapTo("fts")] 37 | FTS, 38 | [MapTo("plfts")] 39 | PLFTS, 40 | [MapTo("phfts")] 41 | PHFTS, 42 | [MapTo("wfts")] 43 | WFTS, 44 | [MapTo("cs")] 45 | Contains, 46 | [MapTo("cd")] 47 | ContainedIn, 48 | [MapTo("ov")] 49 | Overlap, 50 | [MapTo("sl")] 51 | StrictlyLeft, 52 | [MapTo("sr")] 53 | StrictlyRight, 54 | [MapTo("nxr")] 55 | NotRightOf, 56 | [MapTo("nxl")] 57 | NotLeftOf, 58 | [MapTo("adj")] 59 | Adjacent, 60 | [MapTo("not")] 61 | Not, 62 | } 63 | 64 | public enum Ordering 65 | { 66 | [MapTo("asc")] 67 | Ascending, 68 | [MapTo("desc")] 69 | Descending, 70 | } 71 | 72 | /// 73 | /// See: https://postgrest.org/en/v7.0.0/api.html?highlight=nulls%20first#ordering 74 | /// 75 | public enum NullPosition 76 | { 77 | [MapTo("nullsfirst")] 78 | First, 79 | [MapTo("nullslast")] 80 | Last 81 | } 82 | 83 | /// 84 | /// See: https://postgrest.org/en/v7.0.0/api.html?highlight=count#estimated-count 85 | /// 86 | public enum CountType 87 | { 88 | [MapTo("exact")] 89 | Exact, 90 | [MapTo("planned")] 91 | Planned, 92 | [MapTo("estimated")] 93 | Estimated 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Constants.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af9b28198410bb644b3caa4005ab77e1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Converters.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5bd937ad7ad8b74b8ffa11527d0d287 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Converters/DateTimeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Newtonsoft.Json; 5 | using Newtonsoft.Json.Linq; 6 | 7 | namespace Postgrest.Converters 8 | { 9 | public class DateTimeConverter : JsonConverter 10 | { 11 | public override bool CanConvert(Type objectType) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | public override bool CanWrite => false; 17 | 18 | public override object ReadJson( 19 | JsonReader reader, 20 | Type objectType, 21 | object existingValue, 22 | JsonSerializer serializer) 23 | { 24 | if (reader.Value != null) 25 | { 26 | var str = reader.Value.ToString(); 27 | 28 | var infinity = ParseInfinity(str); 29 | 30 | if (infinity != null) 31 | { 32 | return (DateTime) infinity; 33 | } 34 | 35 | var date = DateTime.Parse(str); 36 | return date; 37 | } 38 | 39 | var result = new List(); 40 | 41 | try 42 | { 43 | var jo = JArray.Load(reader); 44 | 45 | foreach (var item in jo.ToArray()) 46 | { 47 | var inner = item.ToString(); 48 | 49 | var infinity = ParseInfinity(inner); 50 | 51 | if (infinity != null) 52 | { 53 | result.Add((DateTime) infinity); 54 | } 55 | 56 | var date = DateTime.Parse(inner); 57 | result.Add(date); 58 | } 59 | } 60 | catch (JsonReaderException) 61 | { 62 | return null; 63 | } 64 | 65 | 66 | return result; 67 | } 68 | 69 | private static DateTime? ParseInfinity(string input) 70 | { 71 | if (input.Contains("infinity")) 72 | { 73 | return input.Contains("-") ? DateTime.MinValue : DateTime.MaxValue; 74 | } 75 | 76 | return null; 77 | } 78 | 79 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 80 | { 81 | throw new NotImplementedException(); 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Converters/DateTimeConverter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38a677e6980931a4e8b04672b891900d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Converters/IntConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | 5 | namespace Postgrest.Converters 6 | { 7 | public class IntArrayConverter : JsonConverter 8 | { 9 | public override bool CanConvert(Type objectType) 10 | { 11 | throw new NotImplementedException(); 12 | } 13 | 14 | public override bool CanRead => false; 15 | 16 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | 21 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 22 | { 23 | if (value is List list) 24 | { 25 | writer.WriteValue($"{{{string.Join(",", list)}}}"); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Converters/IntConverter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ef8184c72040af4fb3a97e4dcb8df72 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Converters/RangeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | using Newtonsoft.Json; 4 | using Postgrest.Extensions; 5 | 6 | namespace Postgrest.Converters 7 | { 8 | /// 9 | /// Used by Newtonsoft.Json to convert a C# range into a Postgrest range. 10 | /// 11 | internal class RangeConverter : JsonConverter 12 | { 13 | public override bool CanConvert(Type objectType) 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | 18 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, 19 | JsonSerializer serializer) 20 | { 21 | return reader.Value != null ? ParseIntRange(reader.Value.ToString()) : null; 22 | } 23 | 24 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 25 | { 26 | var val = (IntRange) value; 27 | writer.WriteValue(val.ToPostgresString()); 28 | } 29 | 30 | public static IntRange ParseIntRange(string value) 31 | { 32 | //int4range (0,1] , [123,4123], etc. etc. 33 | const string pattern = @"^(\[|\()(\d+),(\d+)(\]|\))$"; 34 | var matches = Regex.Matches(value, pattern); 35 | 36 | if (matches.Count <= 0) 37 | { 38 | throw new Exception("Unknown Range format."); 39 | } 40 | 41 | var groups = matches[0].Groups; 42 | var isInclusiveLower = groups[1].Value == "["; 43 | var isInclusiveUpper = groups[4].Value == "]"; 44 | var value1 = int.Parse(groups[2].Value); 45 | var value2 = int.Parse(groups[3].Value); 46 | 47 | var start = isInclusiveLower ? value1 : value1 + 1; 48 | var count = isInclusiveUpper ? value2 : value2 - 1; 49 | 50 | // Edge-case, includes no points 51 | return count < start 52 | ? new IntRange(0, 0) 53 | : new IntRange(start, count); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Converters/RangeConverter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9091f305ab28a50409f577e15eb42740 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7803fc4e6790cec439b19e17adf1daec 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Extensions/DictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Postgrest.Extensions 5 | { 6 | public static class DictionaryExtensions 7 | { 8 | // Works in C#3/VS2008: 9 | // Returns a new dictionary of this ... others merged leftward. 10 | // Keeps the type of 'this', which must be default-instantiable. 11 | // Example: 12 | // result = map.MergeLeft(other1, other2, ...) 13 | // From: https://stackoverflow.com/a/2679857/3629438 14 | public static T MergeLeft(this T me, params IDictionary[] others) 15 | where T : IDictionary, new() 16 | { 17 | var map = new T(); 18 | var dictionaries = new List> {me}.Concat(others); 19 | 20 | foreach (var dictionary in dictionaries) 21 | { 22 | // ^-- echk. Not quite there type-system. 23 | foreach (var keyValuePair in dictionary) 24 | { 25 | map[keyValuePair.Key] = keyValuePair.Value; 26 | } 27 | } 28 | 29 | return map; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Extensions/DictionaryExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 581e55d8defb24c4c9e5497d019f27a7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Extensions/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Postgrest.Extensions 4 | { 5 | public static class EnumExtensions 6 | { 7 | /// 8 | /// Gets a typed Attribute attached to an enum value. 9 | /// 10 | /// 11 | /// 12 | /// 13 | internal static T GetAttribute(this Enum value) where T : Attribute 14 | { 15 | var type = value.GetType(); 16 | var name = Enum.GetName(type, value); 17 | 18 | if (name == null) 19 | { 20 | return null; 21 | } 22 | 23 | var fieldInfo = type.GetField(name); 24 | 25 | if (fieldInfo == null) 26 | { 27 | return null; 28 | } 29 | 30 | if (Attribute.GetCustomAttribute(fieldInfo, typeof(T)) is T attribute) 31 | { 32 | return attribute; 33 | } 34 | 35 | return null; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Extensions/EnumExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfa7d33846c5f434693d4e396c29e5e0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Extensions/RangeExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Postgrest.Extensions 2 | { 3 | public static class RangeExtensions 4 | { 5 | /// 6 | /// Transforms a C# Range to a Postgrest String. 7 | /// 8 | /// 9 | /// 10 | internal static string ToPostgresString(this IntRange range) => $"[{range.Start},{range.End}]"; 11 | } 12 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Extensions/RangeExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1d3e0c826e34e640a04130b8025267b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Helpers.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8af0852cceaa9c46add238a5394226b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/IntRange.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6835143f8a80c614599fe26c5f46c48c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ad99040bd2fe8042845d3be1446229a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Models/BaseModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Newtonsoft.Json; 4 | using Postgrest.Attributes; 5 | using Postgrest.Responses; 6 | 7 | namespace Postgrest.Models 8 | { 9 | /// 10 | /// Abstract class that must be implemented by C# Postgrest Models. 11 | /// 12 | public abstract class BaseModel 13 | { 14 | public virtual Task> Update() where T : BaseModel, new() => 15 | Client.Instance.Table().Update((T) this); 16 | 17 | public virtual Task Delete() where T : BaseModel, new() => Client.Instance.Table().Delete((T) this); 18 | 19 | /// 20 | /// Gets the value of the PrimaryKey from a model's instance as defined by the [PrimaryKey] attribute on a property on the model. 21 | /// 22 | [JsonIgnore] 23 | public object PrimaryKeyValue 24 | { 25 | get 26 | { 27 | var props = this.GetType().GetProperties(); 28 | 29 | foreach (var prop in props) 30 | { 31 | var hasAttr = Attribute.GetCustomAttribute(prop, typeof(PrimaryKeyAttribute)); 32 | 33 | if (hasAttr is PrimaryKeyAttribute) 34 | { 35 | return prop.GetValue(this); 36 | } 37 | } 38 | 39 | throw new Exception("Models must specify their Primary Key via the [PrimaryKey] Attribute"); 40 | } 41 | } 42 | 43 | [JsonIgnore] 44 | public string TableName 45 | { 46 | get 47 | { 48 | var attribute = Attribute.GetCustomAttribute(GetType(), typeof(TableAttribute)); 49 | 50 | return attribute is TableAttribute tableAttr 51 | ? tableAttr.Name 52 | : GetType().Name; 53 | } 54 | } 55 | 56 | /// 57 | /// Gets the name of the PrimaryKey column on a model's instance as defined by the [PrimaryKey] attribute on a property on the model. 58 | /// 59 | [JsonIgnore] 60 | public string PrimaryKeyColumn 61 | { 62 | get 63 | { 64 | var propertyInfos = this.GetType().GetProperties(); 65 | 66 | foreach (var info in propertyInfos) 67 | { 68 | var hasAttr = Attribute.GetCustomAttribute(info, typeof(PrimaryKeyAttribute)); 69 | 70 | if (hasAttr is PrimaryKeyAttribute pka) 71 | { 72 | return pka.ColumnName; 73 | } 74 | } 75 | 76 | throw new Exception("Models must specify their Primary Key via the [PrimaryKey] Attribute"); 77 | } 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Models/BaseModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a522b2fe894ea34981a5cb046931254 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/PostgrestContractResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using Newtonsoft.Json; 6 | using Newtonsoft.Json.Serialization; 7 | using Postgrest.Converters; 8 | 9 | namespace Postgrest.Attributes 10 | { 11 | /// 12 | /// A custom resolver that handles mapping column names and property names as well 13 | /// as handling the conversion of Postgrest Ranges to a C# `Range`. 14 | /// 15 | public class PostgrestContractResolver : DefaultContractResolver 16 | { 17 | protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) 18 | { 19 | JsonProperty prop = base.CreateProperty(member, memberSerialization); 20 | 21 | // Handle non-primitive conversions from a Postgres type to C# 22 | if (prop.PropertyType == typeof(IntRange)) 23 | { 24 | prop.Converter = new RangeConverter(); 25 | } 26 | else if (prop.PropertyType != null && (prop.PropertyType == typeof(DateTime) || 27 | Nullable.GetUnderlyingType(prop.PropertyType) == typeof(DateTime))) 28 | { 29 | prop.Converter = new DateTimeConverter(); 30 | } 31 | else if (prop.PropertyType == typeof(List)) 32 | { 33 | prop.Converter = new IntArrayConverter(); 34 | } 35 | else if (prop.PropertyType != null && (prop.PropertyType == typeof(List) || 36 | Nullable.GetUnderlyingType(prop.PropertyType) == 37 | typeof(List))) 38 | { 39 | prop.Converter = new DateTimeConverter(); 40 | } 41 | 42 | // Dynamically set the name of the key we are serializing/deserializing from the model. 43 | if (!member.CustomAttributes.Any()) 44 | { 45 | return prop; 46 | } 47 | 48 | var columnAttribute = member.GetCustomAttribute(); 49 | 50 | if (columnAttribute != null) 51 | { 52 | prop.PropertyName = columnAttribute.ColumnName; 53 | prop.NullValueHandling = columnAttribute.NullValueHandling; 54 | return prop; 55 | } 56 | 57 | var primaryKeyAttribute = member.GetCustomAttribute(); 58 | 59 | if (primaryKeyAttribute == null) 60 | { 61 | return prop; 62 | } 63 | 64 | prop.PropertyName = primaryKeyAttribute.ColumnName; 65 | prop.ShouldSerialize = instance => primaryKeyAttribute.ShouldInsert; 66 | return prop; 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/PostgrestContractResolver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17ebd8b8c4ecb544a96ad018145dc934 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/QueryFilter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8195f6fd2cd6cd74baa985487e6c5418 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/QueryOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Postgrest.Attributes; 4 | using Postgrest.Extensions; 5 | 6 | namespace Postgrest 7 | { 8 | public class QueryOptions 9 | { 10 | public enum ReturnType 11 | { 12 | [MapTo("minimal")] 13 | Minimal, 14 | [MapTo("representation")] 15 | Representation 16 | }; 17 | 18 | public enum CountType 19 | { 20 | [MapTo("none")] 21 | None, 22 | [MapTo("exact")] 23 | Exact, 24 | [MapTo("planned")] 25 | Planned, 26 | [MapTo("estimated")] 27 | Estimated 28 | }; 29 | 30 | public enum DuplicateResolutionType 31 | { 32 | [MapTo("merge-duplicates")] 33 | MergeDuplicates, 34 | [MapTo("ignore-duplicates")] 35 | IgnoreDuplicates 36 | } 37 | 38 | /// 39 | /// By default the new record is returned. Set this to 'Minimal' if you don't need this value. 40 | /// 41 | public ReturnType Returning { get; set; } = ReturnType.Representation; 42 | 43 | /// 44 | /// Specifies if duplicate rows should be ignored and not inserted. 45 | /// 46 | public DuplicateResolutionType DuplicateResolution { get; set; } = DuplicateResolutionType.MergeDuplicates; 47 | 48 | /// 49 | /// Count algorithm to use to count rows in a table. 50 | /// 51 | public CountType Count { get; set; } = CountType.None; 52 | 53 | /// 54 | /// If the record should be upserted 55 | /// 56 | public bool Upsert { get; set; } 57 | 58 | /// 59 | /// /// By specifying the onConflict query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint. 60 | /// 61 | public string OnConflict { get; set; } 62 | 63 | public Dictionary ToHeaders() 64 | { 65 | var headers = new Dictionary(); 66 | var prefersHeaders = new List(); 67 | 68 | if (Upsert) 69 | { 70 | var resolverAttr = DuplicateResolution.GetAttribute(); 71 | prefersHeaders.Add($"resolution={resolverAttr.Mapping}"); 72 | } 73 | 74 | var returnAttr = Returning.GetAttribute(); 75 | if (returnAttr != null) 76 | { 77 | prefersHeaders.Add($"return={returnAttr.Mapping}"); 78 | } 79 | 80 | var countAttr = Count.GetAttribute(); 81 | if (Count != CountType.None && countAttr != null) 82 | { 83 | prefersHeaders.Add($"count={countAttr.Mapping}"); 84 | } 85 | 86 | headers.Add("Prefer", String.Join(",", prefersHeaders.ToArray())); 87 | 88 | if (Returning == ReturnType.Minimal) 89 | { 90 | headers.Add("Accept", "*/*"); 91 | } 92 | 93 | return headers; 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/QueryOptions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0483c63cb882be41865821b6e0299aa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/QueryOrderer.cs: -------------------------------------------------------------------------------- 1 | using static Postgrest.Constants; 2 | 3 | namespace Postgrest 4 | { 5 | public class QueryOrderer 6 | { 7 | public string ForeignTable { get; } 8 | public string Column { get; } 9 | public Ordering Ordering { get; } 10 | public NullPosition NullPosition { get; } 11 | 12 | public QueryOrderer(string foreignTable, string column, Ordering ordering, NullPosition nullPosition) 13 | { 14 | ForeignTable = foreignTable; 15 | Column = column; 16 | Ordering = ordering; 17 | NullPosition = nullPosition; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/QueryOrderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b766808c225093e42827bb00da504326 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Responses.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69056295569ad8e4bb1139daf31fd718 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Responses/BaseResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using Newtonsoft.Json; 3 | 4 | namespace Postgrest.Responses 5 | { 6 | /// 7 | /// A wrapper class from which all Responses derive. 8 | /// 9 | public class BaseResponse 10 | { 11 | [JsonIgnore] 12 | public HttpResponseMessage ResponseMessage { get; set; } 13 | 14 | [JsonIgnore] 15 | public string Content { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Responses/BaseResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a19c3712507bd7e4fb103797cec219b4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Responses/ErrorResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Postgrest.Responses 4 | { 5 | /// 6 | /// A representation of Postgrest's API error response. 7 | /// 8 | public class ErrorResponse : BaseResponse 9 | { 10 | [JsonProperty("hint")] 11 | public object Hint { get; set; } 12 | 13 | [JsonProperty("details")] 14 | public object Details { get; set; } 15 | 16 | [JsonProperty("code")] 17 | public string Code { get; set; } 18 | 19 | [JsonProperty("message")] 20 | public string Message { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Responses/ErrorResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf8cc0f13062a3040b857c23c0746f0f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Responses/ModeledResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | using Newtonsoft.Json.Linq; 4 | 5 | namespace Postgrest.Responses 6 | { 7 | /// 8 | /// A representation of a successful Postgrest response that transforms the string response into a C# Modelled response. 9 | /// 10 | /// 11 | public class ModeledResponse : BaseResponse 12 | { 13 | private JsonSerializerSettings SerializerSettings { get; set; } 14 | 15 | public List Models { get; private set; } = new List(); 16 | 17 | public ModeledResponse(BaseResponse baseResponse, JsonSerializerSettings serializerSettings, bool shouldParse = true) 18 | { 19 | SerializerSettings = serializerSettings; 20 | Content = baseResponse.Content; 21 | ResponseMessage = baseResponse.ResponseMessage; 22 | 23 | if (shouldParse && !string.IsNullOrEmpty(Content)) 24 | { 25 | var token = JToken.Parse(Content); 26 | 27 | if (token is JArray) 28 | { 29 | Models = JsonConvert.DeserializeObject>(Content, serializerSettings); 30 | } 31 | else if (token is JObject) 32 | { 33 | Models.Clear(); 34 | T obj = JsonConvert.DeserializeObject(Content, serializerSettings); 35 | Models.Add(obj); 36 | } 37 | } 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Responses/ModeledResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3369fc34fdc233041bb24d70e34a1365 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/StatelessClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using Newtonsoft.Json; 6 | using Newtonsoft.Json.Converters; 7 | using Postgrest.Attributes; 8 | using Postgrest.Models; 9 | using Postgrest.Responses; 10 | 11 | namespace Postgrest 12 | { 13 | /// 14 | /// A StatelessClient that allows one-off API interactions. 15 | /// 16 | public static class StatelessClient 17 | { 18 | /// 19 | /// Custom Serializer resolvers and converters that will be used for encoding and decoding Postgrest JSON responses. 20 | /// 21 | /// By default, Postgrest seems to use a date format that C# and Newtonsoft do not like, so this initial 22 | /// configuration handles that. 23 | /// 24 | internal static JsonSerializerSettings SerializerSettings(ClientOptions options = null) 25 | { 26 | options ??= new ClientOptions(); 27 | 28 | return new JsonSerializerSettings 29 | { 30 | ContractResolver = new PostgrestContractResolver(), 31 | Converters = 32 | { 33 | // 2020-08-28T12:01:54.763231 34 | new IsoDateTimeConverter 35 | { 36 | DateTimeStyles = options.DateTimeStyles, 37 | DateTimeFormat = ClientOptions.DateTimeFormat 38 | } 39 | } 40 | }; 41 | } 42 | 43 | /// 44 | /// Returns a Table Query Builder instance for a defined model - representative of `USE $TABLE` 45 | /// 46 | /// Custom Model derived from `BaseModel` 47 | /// 48 | public static Table Table(StatelessClientOptions options) where T : BaseModel, new() => 49 | new Table(options.BaseUrl, options, SerializerSettings(options)); 50 | 51 | /// 52 | /// Perform a stored procedure call. 53 | /// 54 | /// The function name to call 55 | /// The parameters to pass to the function call 56 | /// 57 | /// 58 | public static Task Rpc( 59 | string procedureName, 60 | Dictionary parameters, 61 | StatelessClientOptions options) 62 | { 63 | // Build Uri 64 | var builder = new UriBuilder($"{options.BaseUrl}/rpc/{procedureName}"); 65 | 66 | var canonicalUri = builder.Uri.ToString(); 67 | 68 | var serializerSettings = SerializerSettings(options); 69 | 70 | // Prepare parameters 71 | var data = JsonConvert.DeserializeObject>( 72 | JsonConvert.SerializeObject(parameters, serializerSettings)); 73 | 74 | // Prepare headers 75 | var headers = Helpers.PrepareRequestHeaders(HttpMethod.Post, 76 | new Dictionary(options.Headers), options); 77 | 78 | // Send request 79 | var request = Helpers.MakeRequest( 80 | HttpMethod.Post, 81 | canonicalUri, 82 | serializerSettings, 83 | data, 84 | headers); 85 | 86 | return request; 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/StatelessClient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc9fd8a3b1ace0446898b0f63aed99e9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/StatelessClientOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Postgrest 2 | { 3 | /// 4 | /// Options that can be passed to the Client configuration 5 | /// 6 | public class StatelessClientOptions : ClientOptions 7 | { 8 | public StatelessClientOptions(string baseUrl) 9 | { 10 | BaseUrl = baseUrl; 11 | } 12 | 13 | public string BaseUrl { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/StatelessClientOptions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 582851e523f4e2545b278d6dbf7b7db4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Table.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 65e54563ecb4f59488a922259dfafc60 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Util.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Postgrest 4 | { 5 | public static class Util 6 | { 7 | public static string GetAssemblyVersion() 8 | { 9 | var assembly = typeof(Client).Assembly; 10 | 11 | var informationVersion = assembly.GetCustomAttribute() 12 | .InformationalVersion; 13 | 14 | var name = assembly.GetName().Name; 15 | 16 | return $"{name.ToLower()}-csharp/{informationVersion}"; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/postgrest-csharp/Postgrest/Util.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7a5a1e404cc3b449994d9ba2b1c4395 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2ad4aca04a7a9841b27187a9d97d390 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e08393e015a5cc74c929a218b45e841d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9230db986cb397e488170aac8d094535 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Attributes/MapToAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Supabase.Realtime.Attributes 5 | { 6 | /// 7 | /// Used internally to add a string value to a C# field. 8 | /// 9 | [AttributeUsage(AttributeTargets.Field)] 10 | internal class MapToAttribute : Attribute 11 | { 12 | public string Mapping { get; set; } 13 | public string Formatter { get; set; } 14 | 15 | public MapToAttribute(string mapping, string formatter = null) 16 | { 17 | Mapping = mapping; 18 | Formatter = formatter; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Attributes/MapToAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57ec533642fc9d343bca1b5b654d8b91 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Channel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6c28af0c2375d64ea751452f3de4f2e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Client.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2d50a399ab88134db3393282960c4cc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/ClientOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Globalization; 5 | using Newtonsoft.Json; 6 | 7 | namespace Supabase.Realtime 8 | { 9 | public class ClientOptions 10 | { 11 | /// 12 | /// The function to encode outgoing messages. Defaults to JSON 13 | /// 14 | public Action> Encode { get; set; } = (payload, callback) => callback(JsonConvert.SerializeObject(payload,Client.Instance.SerializerSettings)); 15 | 16 | /// 17 | /// The function to decode incoming messages. 18 | /// 19 | public Action> Decode { get; set; } = (payload, callback) => callback(JsonConvert.DeserializeObject(payload, Client.Instance.SerializerSettings)); 20 | 21 | /// 22 | /// Logging function 23 | /// 24 | public Action Logger { get; set; } = (kind, msg, data) => Debug.WriteLine($"{kind}: {msg}, {JsonConvert.SerializeObject(data, Formatting.Indented)}"); 25 | 26 | /// 27 | /// The Websocket Transport, for example WebSocket. 28 | /// 29 | public string Transport { get; set; } = Constants.TRANSPORT_WEBSOCKET; 30 | 31 | /// 32 | /// The default timeout in milliseconds to trigger push timeouts. 33 | /// 34 | public TimeSpan Timeout { get; set; } = TimeSpan.FromMilliseconds(Constants.DEFAULT_TIMEOUT); 35 | 36 | /// 37 | /// The interval to send a heartbeat message 38 | /// 39 | public TimeSpan HeartbeatInterval { get; set; } = TimeSpan.FromSeconds(30); 40 | 41 | /// 42 | /// The interval to reconnect 43 | /// 44 | public Func ReconnectAfterInterval { get; set; } = (tries) => 45 | { 46 | var intervals = new int[] { 1, 2, 5, 10 }; 47 | return TimeSpan.FromSeconds(tries < intervals.Length ? tries - 1 : 10); 48 | }; 49 | 50 | /// 51 | /// The maximum timeout of a long poll AJAX request. 52 | /// 53 | public TimeSpan LongPollerTimeout = TimeSpan.FromSeconds(20); 54 | 55 | /// 56 | /// Request headers to be appended to the connection string. 57 | /// 58 | public Dictionary Headers = new Dictionary(); 59 | 60 | /// 61 | /// The optional params to pass when connecting 62 | /// 63 | public SocketOptionsParameters Parameters = new SocketOptionsParameters(); 64 | 65 | /// 66 | /// Datetime Style for JSON Deserialization of Models 67 | /// 68 | public DateTimeStyles DateTimeStyles = DateTimeStyles.AdjustToUniversal; 69 | 70 | /// 71 | /// Datetime format for JSON Deserialization of Models (Postgrest style) 72 | /// 73 | public string DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss.FFFFFFK"; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/ClientOptions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: adf8cc51412efcf4c8f47f3ab9ee2b81 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Supabase.Realtime 3 | { 4 | public static class Constants 5 | { 6 | public static string VERSION = "1.0.0"; 7 | 8 | public enum SocketStates 9 | { 10 | connecting = 0, 11 | open = 1, 12 | closing = 2, 13 | closed = 3 14 | } 15 | 16 | public enum EventType 17 | { 18 | Insert, 19 | Update, 20 | Delete, 21 | Unknown 22 | } 23 | 24 | /// 25 | /// Timeout interval for requests (used in Socket and Push) 26 | /// 27 | public const int DEFAULT_TIMEOUT = 10000; 28 | public const int WS_CLOSE_NORMAL = 1000; 29 | 30 | /// 31 | /// Pheonix Socket Server Event: CLOSE 32 | /// 33 | public static string CHANNEL_EVENT_CLOSE = "phx_close"; 34 | 35 | /// 36 | /// Pheonix Socket Server Event: ERROR 37 | /// 38 | public static string CHANNEL_EVENT_ERROR = "phx_error"; 39 | 40 | /// 41 | /// Pheonix Socket Server Event: JOIN 42 | /// 43 | public static string CHANNEL_EVENT_JOIN = "phx_join"; 44 | 45 | /// 46 | /// Pheonix Socket Server Event: REPLY 47 | /// 48 | public static string CHANNEL_EVENT_REPLY = "phx_reply"; 49 | 50 | /// 51 | /// Pheonix Socket Server Event: LEAVE 52 | /// 53 | public static string CHANNEL_EVENT_LEAVE = "phx_leave"; 54 | 55 | public static string PHEONIX_STATUS_OK = "ok"; 56 | public static string PHEONIX_STATUS_ERROR = "error"; 57 | 58 | public static string TRANSPORT_WEBSOCKET = "websocket"; 59 | 60 | public static string CHANNEL_ACCESS_TOKEN = "access_token"; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Constants.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 486f604ffd32cb442aa7f66ce43d0551 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Converters.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 647d90367eafe5a428e765c0cea61b36 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Converters/DateTimeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Newtonsoft.Json; 5 | using Newtonsoft.Json.Linq; 6 | 7 | namespace Supabase.Realtime.Converters 8 | { 9 | internal class DateTimeConverter : JsonConverter 10 | { 11 | public override bool CanConvert(Type objectType) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | public override bool CanWrite => false; 17 | 18 | public override object ReadJson( 19 | JsonReader reader, 20 | Type objectType, 21 | object existingValue, 22 | JsonSerializer serializer) 23 | { 24 | if (reader.Value != null) 25 | { 26 | var str = reader.Value.ToString(); 27 | 28 | var infinity = ParseInfinity(str); 29 | 30 | if (infinity != null) 31 | { 32 | return (DateTime)infinity; 33 | } 34 | 35 | var date = DateTime.Parse(str); 36 | return date; 37 | } 38 | 39 | var result = new List(); 40 | 41 | try 42 | { 43 | var jo = JArray.Load(reader); 44 | 45 | foreach (var item in jo.ToArray()) 46 | { 47 | var inner = item.ToString(); 48 | 49 | var infinity = ParseInfinity(inner); 50 | 51 | if (infinity != null) 52 | { 53 | result.Add((DateTime)infinity); 54 | } 55 | 56 | var date = DateTime.Parse(inner); 57 | result.Add(date); 58 | } 59 | } 60 | catch (JsonReaderException) 61 | { 62 | return null; 63 | } 64 | 65 | 66 | return result; 67 | } 68 | 69 | private static DateTime? ParseInfinity(string input) 70 | { 71 | if (input.Contains("infinity")) 72 | { 73 | return input.Contains("-") ? DateTime.MinValue : DateTime.MaxValue; 74 | } 75 | 76 | return null; 77 | } 78 | 79 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 80 | { 81 | throw new NotImplementedException(); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Converters/DateTimeConverter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc5026b28204c4b4283b9b032922b4b7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Converters/IntArrayConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.CompilerServices; 4 | using Newtonsoft.Json; 5 | using Newtonsoft.Json.Linq; 6 | 7 | [assembly: InternalsVisibleTo("RealtimeTests")] 8 | namespace Supabase.Realtime.Converters 9 | { 10 | public class IntArrayConverter : JsonConverter 11 | { 12 | public override bool CanRead => true; 13 | 14 | public override bool CanWrite => false; 15 | 16 | public override bool CanConvert(Type objectType) => throw new NotImplementedException(); 17 | 18 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) 19 | { 20 | try 21 | { 22 | if (reader.Value != null) 23 | { 24 | return Parse(reader.Value as string); 25 | } 26 | else 27 | { 28 | JArray jo = JArray.Load(reader); 29 | string json = jo.ToString(Formatting.None); 30 | return jo.ToObject>(serializer); 31 | } 32 | } 33 | catch 34 | { 35 | return null; 36 | } 37 | } 38 | 39 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | 44 | internal List Parse(string value) 45 | { 46 | var result = new List(); 47 | 48 | var firstChar = value[0]; 49 | var lastChar = value[value.Length - 1]; 50 | 51 | // {1,2,3} 52 | if (firstChar == '{' && lastChar == '}') 53 | { 54 | var array = value.Trim(new char[] { '{', '}' }).Split(','); 55 | foreach (var item in array) 56 | { 57 | if (string.IsNullOrEmpty(item)) continue; 58 | result.Add(int.Parse(item)); 59 | } 60 | 61 | return result; 62 | } 63 | // [1,2,3] 64 | else if (firstChar == '[' && lastChar == ']') 65 | { 66 | var array = value.Trim(new char[] { '[', ']' }).Split(','); 67 | foreach (var item in array) 68 | { 69 | if (string.IsNullOrEmpty(item)) continue; 70 | result.Add(int.Parse(item)); 71 | } 72 | 73 | return result; 74 | } 75 | 76 | return result; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Converters/IntArrayConverter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07d69d08a4bfac3409922f9e47c84dcd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Converters/StringArrayConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.CompilerServices; 4 | using Newtonsoft.Json; 5 | using Newtonsoft.Json.Linq; 6 | 7 | [assembly: InternalsVisibleTo("RealtimeTests")] 8 | namespace Supabase.Realtime.Converters 9 | { 10 | public class StringArrayConverter : JsonConverter 11 | { 12 | public override bool CanRead => true; 13 | 14 | public override bool CanWrite => false; 15 | 16 | public override bool CanConvert(Type objectType) => throw new NotImplementedException(); 17 | 18 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) 19 | { 20 | try 21 | { 22 | if (reader.Value != null) 23 | { 24 | return Parse(reader.Value as string); 25 | } 26 | else 27 | { 28 | JArray jo = JArray.Load(reader); 29 | string json = jo.ToString(Formatting.None); 30 | return jo.ToObject>(serializer); 31 | } 32 | } 33 | catch 34 | { 35 | return null; 36 | } 37 | } 38 | 39 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | 44 | internal List Parse(string value) 45 | { 46 | var result = new List(); 47 | 48 | var firstChar = value[0]; 49 | var lastChar = value[value.Length - 1]; 50 | 51 | // {1,2,3} 52 | if (firstChar == '{' && lastChar == '}') 53 | { 54 | var array = value.Trim(new char[] { '{', '}' }).Split(','); 55 | foreach (var item in array) 56 | { 57 | if (string.IsNullOrEmpty(item)) continue; 58 | result.Add(item); 59 | } 60 | 61 | return result; 62 | } 63 | // [1,2,3] 64 | else if (firstChar == '[' && lastChar == ']') 65 | { 66 | var array = value.Trim(new char[] { '[', ']' }).Split(','); 67 | foreach (var item in array) 68 | { 69 | if (string.IsNullOrEmpty(item)) continue; 70 | result.Add(item); 71 | } 72 | 73 | return result; 74 | } 75 | 76 | return result; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Converters/StringArrayConverter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 766390fdba30f6a44a1975de3298c1e7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/CustomContractResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using Newtonsoft.Json; 6 | using Newtonsoft.Json.Serialization; 7 | using Postgrest.Attributes; 8 | using Supabase.Realtime.Converters; 9 | 10 | namespace Supabase.Realtime 11 | { 12 | /// 13 | /// A custom resolver that handles mapping column names and property names as well 14 | /// as handling the conversion of Postgrest Ranges to a C# `Range`. 15 | /// 16 | internal class CustomContractResolver : DefaultContractResolver 17 | { 18 | protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) 19 | { 20 | JsonProperty prop = base.CreateProperty(member, memberSerialization); 21 | 22 | if (prop.PropertyType == typeof(List)) 23 | { 24 | prop.Converter = new IntArrayConverter(); 25 | } 26 | else if (prop.PropertyType == typeof(List)) 27 | { 28 | prop.Converter = new StringArrayConverter(); 29 | } 30 | else if (prop.PropertyType == typeof(DateTime) || Nullable.GetUnderlyingType(prop.PropertyType) == typeof(DateTime)) 31 | { 32 | prop.Converter = new DateTimeConverter(); 33 | } 34 | else if (prop.PropertyType == typeof(List) || Nullable.GetUnderlyingType(prop.PropertyType) == typeof(List)) 35 | { 36 | prop.Converter = new DateTimeConverter(); 37 | } 38 | 39 | // Dynamically set the name of the key we are serializing/deserializing from the model. 40 | if (member.CustomAttributes.Count() > 0) 41 | { 42 | ColumnAttribute columnAtt = member.GetCustomAttribute(); 43 | 44 | if (columnAtt != null) 45 | { 46 | prop.PropertyName = columnAtt.ColumnName; 47 | prop.NullValueHandling = columnAtt.NullValueHandling; 48 | return prop; 49 | } 50 | 51 | PrimaryKeyAttribute primaryKeyAtt = member.GetCustomAttribute(); 52 | 53 | if (primaryKeyAtt != null) 54 | { 55 | prop.PropertyName = primaryKeyAtt.ColumnName; 56 | prop.ShouldSerialize = instance => primaryKeyAtt.ShouldInsert; 57 | return prop; 58 | } 59 | } 60 | 61 | return prop; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/CustomContractResolver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ff8a2a449be4ba478c58b57b74157fb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Push.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Timers; 3 | 4 | namespace Supabase.Realtime 5 | { 6 | /// 7 | /// Class representation of a single request sent to the Socket server. 8 | /// 9 | /// `Push` also adds additional functionality for retrying, timeouts, and listeners 10 | /// for its associated response from the server. 11 | /// 12 | public class Push 13 | { 14 | /// 15 | /// Flag representing the `sent` state of a request. 16 | /// 17 | public bool IsSent { get; private set; } = false; 18 | 19 | /// 20 | /// Invoked when the server has responded to a request. 21 | /// 22 | public event EventHandler OnMessage; 23 | 24 | /// 25 | /// Invoked when this `Push` has not been responded to within the timeout interval. 26 | /// 27 | public event EventHandler OnTimeout; 28 | public SocketResponse Response { get; private set; } 29 | 30 | /// 31 | /// The associated channel. 32 | /// 33 | public Channel Channel { get; private set; } 34 | 35 | /// 36 | /// The event requested. 37 | /// 38 | public string EventName { get; private set; } 39 | 40 | /// 41 | /// Payload of data to be sent. 42 | /// 43 | public object Payload { get; private set; } 44 | 45 | /// 46 | /// Represents the Pushed (sent) Message 47 | /// 48 | public SocketRequest Message { get; private set; } 49 | 50 | /// 51 | /// Ref Of this Message 52 | /// 53 | public string Ref { get; private set; } 54 | 55 | private int timeoutMs; 56 | private Timer timer; 57 | 58 | private string msgRefEvent; 59 | 60 | /// 61 | /// Initilizes a single request that will be `Pushed` to the Socket server. 62 | /// 63 | /// 64 | /// 65 | /// 66 | /// 67 | public Push(Channel channel, string eventName, object payload, int timeoutMs = Constants.DEFAULT_TIMEOUT) 68 | { 69 | Channel = channel; 70 | EventName = eventName; 71 | Payload = payload; 72 | 73 | this.timeoutMs = timeoutMs; 74 | 75 | timer = new Timer(this.timeoutMs); 76 | timer.Elapsed += TimeoutReached; 77 | 78 | Channel.Socket.OnMessage += HandleSocketMessage; 79 | } 80 | 81 | /// 82 | /// Resends a `Push` request. 83 | /// 84 | /// 85 | public void Resend(int timeoutMs = Constants.DEFAULT_TIMEOUT) 86 | { 87 | this.timeoutMs = timeoutMs; 88 | Ref = null; 89 | msgRefEvent = null; 90 | 91 | IsSent = false; 92 | Send(); 93 | } 94 | 95 | /// 96 | /// Sends a `Push` request and initializes the Timeout timer. 97 | /// 98 | public void Send() 99 | { 100 | StartTimeout(); 101 | IsSent = true; 102 | Message = new SocketRequest 103 | { 104 | Topic = Channel.Topic, 105 | Event = EventName, 106 | Payload = Payload, 107 | Ref = Ref 108 | }; 109 | Channel.Socket.Push(Message); 110 | } 111 | 112 | /// 113 | /// Keeps an internal timer for raising an event if this message is not responded to. 114 | /// 115 | internal void StartTimeout() 116 | { 117 | timer.Stop(); 118 | timer.Start(); 119 | Ref = Client.Instance.Socket.MakeMsgRef(); 120 | msgRefEvent = Client.Instance.Socket.ReplyEventName(Ref); 121 | } 122 | 123 | /// 124 | /// Verifies that the request `ref` matches the response `ref`. 125 | /// 126 | /// 127 | /// 128 | private void HandleSocketMessage(object sender, SocketResponseEventArgs args) 129 | { 130 | if (args.Response.Ref == Ref) 131 | { 132 | CancelTimeout(); 133 | Response = args.Response; 134 | OnMessage?.Invoke(this, args); 135 | Channel.Socket.OnMessage -= HandleSocketMessage; 136 | } 137 | } 138 | 139 | private void TimeoutReached(object sender, ElapsedEventArgs e) => OnTimeout?.Invoke(this, null); 140 | 141 | private void CancelTimeout() => timer.Stop(); 142 | } 143 | 144 | public class PushTimeoutException : Exception { } 145 | } 146 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Push.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62e473229cf438143a78c9781243c811 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Socket.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc575a1a758b5ca459d8208f0cf996ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | 6 | namespace Supabase.Realtime 7 | { 8 | internal static class Utils 9 | { 10 | /// 11 | /// Simple method to form a query string (albeit poorly) from a dictionary. 12 | /// 13 | /// 14 | /// 15 | public static string QueryString(IDictionary dict) 16 | { 17 | var list = new List(); 18 | foreach (var item in dict) 19 | { 20 | if (!String.IsNullOrEmpty(item.Value)) 21 | list.Add(item.Key + "=" + item.Value); 22 | } 23 | return string.Join("&", list); 24 | } 25 | 26 | /// 27 | /// Generates a Channel topic string of format: `realtime{:schema?}{:table?}{:col.eq.:val?}` 28 | /// 29 | /// 30 | /// 31 | /// 32 | /// 33 | /// 34 | /// 35 | public static string GenerateChannelTopic(string database, string schema, string table, string col, string value) 36 | { 37 | var list = new List { database, schema, table }; 38 | string channel = String.Join(":", list.Where(s => !string.IsNullOrEmpty(s))); 39 | 40 | if (!string.IsNullOrEmpty(col) && !string.IsNullOrEmpty(value)) 41 | { 42 | channel += $":{col}=eq.{value}"; 43 | } 44 | 45 | return channel; 46 | } 47 | 48 | public static string GetAssemblyVersion() 49 | { 50 | var assembly = typeof(Client).Assembly; 51 | var informationVersion = assembly.GetCustomAttribute().InformationalVersion; 52 | var name = assembly.GetName().Name; 53 | 54 | return $"{name.ToString().ToLower()}-csharp/{informationVersion}"; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/realtime-csharp/Realtime/Utils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e99d19d69a69cd7449049cd4b994d65c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae1a4b8af54acd445b79ad6c2d0fed1c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5c5eccd7e9abe44faa909a7b39ae53d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Bucket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Supabase.Storage 5 | { 6 | public class Bucket 7 | { 8 | [JsonProperty("id")] 9 | public string Id { get; set; } 10 | 11 | [JsonProperty("name")] 12 | public string Name { get; set; } 13 | 14 | [JsonProperty("owner")] 15 | public string Owner { get; set; } 16 | 17 | [JsonProperty("created_at")] 18 | public DateTime CreatedAt { get; set; } 19 | 20 | [JsonProperty("updated_at")] 21 | public DateTime UpdatedAt { get; set; } 22 | 23 | [JsonProperty("public")] 24 | public bool Public { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Bucket.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee270002172af5245b3e6abcc93f5cef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Client.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Supabase.Storage 5 | { 6 | public class Client : StorageBucketApi 7 | { 8 | public Client(string url, Dictionary headers) : base(url, headers) 9 | {} 10 | 11 | /// 12 | /// Perform a file operation in a bucket 13 | /// 14 | /// Bucket Id 15 | /// 16 | public StorageFileApi From(string id) => new StorageFileApi(Url, Headers, id); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Client.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 612b4e67e3d70b04e913b45e6beb4051 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/CreateSignedUrlResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Supabase.Storage 5 | { 6 | public class CreateSignedUrlResponse 7 | { 8 | [JsonProperty("signedURL")] 9 | public string SignedUrl { get; set; } 10 | } 11 | 12 | public class CreateSignedUrlsResponse: CreateSignedUrlResponse 13 | { 14 | [JsonProperty("path")] 15 | public string Path { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/CreateSignedUrlResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce5cf53f3ef309943841461dc29616a9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5c7bd49a680c7c44affd940b8d78393 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Extensions/HttpClientProgress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Net.Http; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace Supabase.Storage.Extensions 10 | { 11 | /// 12 | /// Adapted from: https://gist.github.com/dalexsoto/9fd3c5bdbe9f61a717d47c5843384d11 13 | /// 14 | internal static class HttpClientProgress 15 | { 16 | public static async Task DownloadDataAsync(this HttpClient client, Uri uri, Dictionary headers = null, IProgress progress = null, CancellationToken cancellationToken = default(CancellationToken)) 17 | { 18 | var destination = new MemoryStream(); 19 | var message = new HttpRequestMessage(HttpMethod.Get, uri); 20 | 21 | if (headers != null) 22 | { 23 | foreach (var header in headers) 24 | { 25 | message.Headers.Add(header.Key, header.Value); 26 | } 27 | } 28 | 29 | using (var response = await client.SendAsync(message, HttpCompletionOption.ResponseHeadersRead)) 30 | { 31 | var contentLength = response.Content.Headers.ContentLength; 32 | using (var download = await response.Content.ReadAsStreamAsync()) 33 | { 34 | // no progress... no contentLength... very sad 35 | if (progress is null || !contentLength.HasValue) 36 | { 37 | await download.CopyToAsync(destination); 38 | return destination; 39 | } 40 | // Such progress and contentLength much reporting Wow! 41 | var progressWrapper = new Progress(totalBytes => progress.Report(GetProgressPercentage(totalBytes, contentLength.Value))); 42 | await download.CopyToAsync(destination, 81920, progressWrapper, cancellationToken); 43 | } 44 | } 45 | 46 | float GetProgressPercentage(float totalBytes, float currentBytes) => (totalBytes / currentBytes) * 100f; 47 | 48 | return destination; 49 | } 50 | 51 | static async Task CopyToAsync(this Stream source, Stream destination, int bufferSize, IProgress progress = null, CancellationToken cancellationToken = default(CancellationToken)) 52 | { 53 | if (bufferSize < 0) 54 | throw new ArgumentOutOfRangeException(nameof(bufferSize)); 55 | if (source is null) 56 | throw new ArgumentNullException(nameof(source)); 57 | if (!source.CanRead) 58 | throw new InvalidOperationException($"'{nameof(source)}' is not readable."); 59 | if (destination == null) 60 | throw new ArgumentNullException(nameof(destination)); 61 | if (!destination.CanWrite) 62 | throw new InvalidOperationException($"'{nameof(destination)}' is not writable."); 63 | 64 | var buffer = new byte[bufferSize]; 65 | long totalBytesRead = 0; 66 | int bytesRead; 67 | while ((bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) != 0) 68 | { 69 | await destination.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false); 70 | totalBytesRead += bytesRead; 71 | progress?.Report(totalBytesRead); 72 | } 73 | } 74 | 75 | public static Task UploadFileAsync(this HttpClient client, Uri uri, string filePath, Dictionary headers = null, Progress progress = null) 76 | { 77 | var fileStream = new FileStream(filePath, mode: FileMode.Open, FileAccess.Read); 78 | return UploadAsync(client, uri, fileStream, headers, progress); 79 | } 80 | 81 | public static Task UploadBytesAsync(this HttpClient client, Uri uri, byte[] data, Dictionary headers = null, Progress progress = null) 82 | { 83 | var stream = new MemoryStream(data); 84 | return UploadAsync(client, uri, stream, headers, progress); 85 | } 86 | 87 | public static async Task UploadAsync(this HttpClient client, Uri uri, Stream stream, Dictionary headers = null, Progress progress = null) 88 | { 89 | var content = new ProgressableStreamContent(stream, 4096, progress); 90 | 91 | if (headers != null) 92 | { 93 | foreach (var header in headers) 94 | { 95 | if (header.Key.Contains("content")) 96 | { 97 | content.Headers.Add(header.Key, header.Value); 98 | } 99 | else 100 | { 101 | client.DefaultRequestHeaders.Add(header.Key, header.Value); 102 | } 103 | } 104 | } 105 | 106 | var response = await client.PostAsync(uri, content); 107 | 108 | return response; 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Extensions/HttpClientProgress.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ff5f30aa0153ea4d902453baed29055 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Extensions/ProgressableStreamContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.Contracts; 4 | using System.IO; 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Supabase.Storage.Extensions 11 | { 12 | internal class ProgressableStreamContent : HttpContent 13 | { 14 | private const int defaultBufferSize = 4096; 15 | 16 | private Stream content; 17 | private int bufferSize; 18 | 19 | public EventHandler StateChanged; 20 | public IProgress Progress { get; private set; } 21 | 22 | public enum UploadState 23 | { 24 | PendingUpload, 25 | InProgress, 26 | PendingResponse, 27 | Complete 28 | } 29 | 30 | public ProgressableStreamContent(Stream content) : this(content, defaultBufferSize) { } 31 | 32 | public ProgressableStreamContent(Stream content, int bufferSize, Progress progress = null) 33 | { 34 | if (content == null) 35 | { 36 | throw new ArgumentNullException("content"); 37 | } 38 | 39 | if (bufferSize <= 0) 40 | { 41 | throw new ArgumentOutOfRangeException("bufferSize"); 42 | } 43 | 44 | if (progress == null) 45 | { 46 | progress = new Progress(); 47 | } 48 | 49 | this.content = content; 50 | this.bufferSize = bufferSize; 51 | 52 | Progress = progress; 53 | } 54 | 55 | protected override Task SerializeToStreamAsync(Stream stream, TransportContext context) 56 | { 57 | Contract.Assert(stream != null); 58 | 59 | return Task.Run(() => 60 | { 61 | var buffer = new byte[bufferSize]; 62 | var size = content.Length; 63 | var uploaded = 0; 64 | 65 | StateChanged?.Invoke(this, UploadState.PendingUpload); 66 | 67 | using (content) while (true) 68 | { 69 | var length = content.Read(buffer, 0, buffer.Length); 70 | if (length <= 0) break; 71 | 72 | uploaded += length; 73 | 74 | Progress.Report((uploaded / size) * 100f); 75 | 76 | stream.Write(buffer, 0, length); 77 | 78 | StateChanged?.Invoke(this, UploadState.InProgress); 79 | } 80 | 81 | StateChanged?.Invoke(this, UploadState.PendingResponse); 82 | }); 83 | } 84 | 85 | protected override bool TryComputeLength(out long length) 86 | { 87 | length = content.Length; 88 | return length > 0; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Extensions/ProgressableStreamContent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9564e0121c957ac4d81082119e1c519b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/FileObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | 5 | namespace Supabase.Storage 6 | { 7 | public class FileObject 8 | { 9 | [JsonProperty("name")] 10 | public string Name { get; set; } 11 | 12 | [JsonProperty("bucket_id")] 13 | public string BucketId { get; set; } 14 | 15 | [JsonProperty("owner")] 16 | public string Owner { get; set; } 17 | 18 | [JsonProperty("id")] 19 | public string Id { get; set; } 20 | 21 | [JsonProperty("updated_at")] 22 | public DateTime UpdatedAt { get; set; } 23 | 24 | [JsonProperty("created_at")] 25 | public DateTime CreatedAt { get; set; } 26 | 27 | [JsonProperty("last_accessed_at")] 28 | public DateTime LastAccessedAt { get; set; } 29 | 30 | [JsonProperty("metadata")] 31 | public Dictionary MetaData = new Dictionary(); 32 | 33 | [JsonProperty("buckets")] 34 | public Bucket Buckets { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/FileObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d79921e99947d584193183dc32534efb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/FileOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Supabase.Storage 5 | { 6 | public class FileOptions 7 | { 8 | [JsonProperty("cacheControl")] 9 | public string CacheControl { get; set; } = "3600"; 10 | 11 | [JsonProperty("contentType")] 12 | public string ContentType { get; set; } = "text/plain;charset=UTF-8"; 13 | 14 | [JsonProperty("upsert")] 15 | public bool Upsert { get; set; } = false; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/FileOptions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e32dd9741ed150a41a16e734c852e655 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Helpers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Net.Http; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Web; 8 | using Newtonsoft.Json; 9 | using System.Runtime.CompilerServices; 10 | using System.IO; 11 | 12 | [assembly: InternalsVisibleTo("SupabaseTests")] 13 | namespace Supabase.Storage 14 | { 15 | internal static class Helpers 16 | { 17 | private static readonly HttpClient client = new HttpClient(); 18 | 19 | /// 20 | /// Helper to make a request using the defined parameters to an API Endpoint and coerce into a model. 21 | /// 22 | /// 23 | /// 24 | /// 25 | /// 26 | /// 27 | /// 28 | public static async Task MakeRequest(HttpMethod method, string url, object data = null, Dictionary headers = null) 29 | { 30 | var response = await MakeRequest(method, url, data, headers); 31 | var content = await response.Content.ReadAsStringAsync(); 32 | 33 | if (response.IsSuccessStatusCode) 34 | { 35 | return JsonConvert.DeserializeObject(content); 36 | } else 37 | { 38 | throw new BadRequestException(response, content); 39 | } 40 | } 41 | 42 | /// 43 | /// Helper to make a request using the defined parameters to an API Endpoint. 44 | /// 45 | /// 46 | /// 47 | /// 48 | /// 49 | /// 50 | public static async Task MakeRequest(HttpMethod method, string url, object data = null, Dictionary headers = null) 51 | { 52 | var builder = new UriBuilder(url); 53 | var query = HttpUtility.ParseQueryString(builder.Query); 54 | 55 | if (data != null && method != HttpMethod.Get) 56 | { 57 | // Case if it's a Get request the data object is a dictionary 58 | if (data is Dictionary reqParams) 59 | { 60 | foreach (var param in reqParams) 61 | query[param.Key] = param.Value; 62 | } 63 | } 64 | 65 | builder.Query = query.ToString(); 66 | 67 | using (var requestMessage = new HttpRequestMessage(method, builder.Uri)) 68 | { 69 | 70 | if (data != null && method != HttpMethod.Get) 71 | { 72 | requestMessage.Content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"); 73 | } 74 | 75 | if (headers != null) 76 | { 77 | foreach (var kvp in headers) 78 | { 79 | requestMessage.Headers.TryAddWithoutValidation(kvp.Key, kvp.Value); 80 | } 81 | } 82 | 83 | var response = await client.SendAsync(requestMessage); 84 | 85 | return response; 86 | } 87 | } 88 | } 89 | 90 | public class BadRequestException : Exception 91 | { 92 | public ErrorResponse ErrorResponse { get; private set; } 93 | 94 | public HttpResponseMessage HttpResponse { get; private set; } 95 | 96 | public BadRequestException(HttpResponseMessage httpResponse, string content) 97 | { 98 | HttpResponse = httpResponse; 99 | ErrorResponse = JsonConvert.DeserializeObject(content); 100 | } 101 | } 102 | 103 | public class GenericResponse 104 | { 105 | [JsonProperty("message")] 106 | public string Message { get; } 107 | } 108 | 109 | public class ErrorResponse 110 | { 111 | [JsonProperty("message")] 112 | public string Message { get; } 113 | 114 | [JsonProperty("error")] 115 | public string Error { get; set; } 116 | } 117 | } -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Helpers.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1069fc1b6efeeb4d93c9d0f2e6aa12e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/SearchOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Supabase.Storage 5 | { 6 | public class SearchOptions 7 | { 8 | /// 9 | /// Number of files to be returned 10 | /// 11 | [JsonProperty("limit")] 12 | public int Limit { get; set; } = 100; 13 | 14 | /// 15 | /// Starting position of query 16 | /// 17 | [JsonProperty("offset")] 18 | public int Offset { get; set; } = 0; 19 | 20 | /// 21 | /// Column to sort by. Can be any colum inside of a 22 | /// 23 | [JsonProperty("sortBy")] 24 | public SortBy SortBy { get; set; } = new SortBy { Column = "name", Order = "asc" }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/SearchOptions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d13170b24258d54db1e2e6959898c05 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/SortBy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Supabase.Storage 5 | { 6 | public class SortBy 7 | { 8 | [JsonProperty("column")] 9 | public string Column { get; set; } 10 | 11 | [JsonProperty("order")] 12 | public string Order { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/SortBy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0799c73c26ade884283775e8518b6681 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/StorageBucketApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using Newtonsoft.Json; 6 | 7 | namespace Supabase.Storage 8 | { 9 | public class StorageBucketApi 10 | { 11 | protected string Url { get; set; } 12 | protected Dictionary Headers { get; set; } 13 | 14 | public StorageBucketApi(string url, Dictionary headers = null) 15 | { 16 | Url = url; 17 | 18 | if (headers == null) 19 | { 20 | Headers = new Dictionary(); 21 | } 22 | else 23 | { 24 | Headers = headers; 25 | } 26 | 27 | if (!Headers.ContainsKey("X-Client-Info")) 28 | { 29 | Headers.Add("X-Client-Info", Util.GetAssemblyVersion()); 30 | } 31 | } 32 | 33 | /// 34 | /// Retrieves the details of all Storage buckets within an existing product. 35 | /// 36 | /// 37 | public async Task> ListBuckets() 38 | { 39 | var result = await Helpers.MakeRequest>(HttpMethod.Get, $"{Url}/bucket", null, Headers); 40 | return result; 41 | } 42 | 43 | /// 44 | /// Retrieves the details of an existing Storage bucket. 45 | /// 46 | /// 47 | /// 48 | public async Task GetBucket(string id) 49 | { 50 | try 51 | { 52 | var result = await Helpers.MakeRequest(HttpMethod.Get, $"{Url}/bucket/{id}", null, Headers); 53 | return result; 54 | } 55 | catch (BadRequestException ex) 56 | { 57 | if (ex.ErrorResponse.Error == "Not found") return null; 58 | else throw ex; 59 | } 60 | } 61 | 62 | /// 63 | /// Creates a new Storage bucket 64 | /// 65 | /// 66 | /// 67 | /// Bucket Id 68 | public async Task CreateBucket(string id, BucketUpsertOptions options = null) 69 | { 70 | if (options == null) 71 | { 72 | options = new BucketUpsertOptions(); 73 | } 74 | 75 | var data = new Bucket { Id = id, Name = id, Public = options.Public }; 76 | var result = await Helpers.MakeRequest(HttpMethod.Post, $"{Url}/bucket", data, Headers); 77 | return result.Name; 78 | } 79 | 80 | /// 81 | /// Updates a Storage bucket 82 | /// 83 | /// 84 | /// 85 | /// 86 | public async Task UpdateBucket(string id, BucketUpsertOptions options = null) 87 | { 88 | if (options == null) 89 | { 90 | options = new BucketUpsertOptions(); 91 | } 92 | 93 | var data = new Bucket { Id = id, Public = options.Public }; 94 | var result = await Helpers.MakeRequest(HttpMethod.Put, $"{Url}/bucket/{id}", data, Headers); 95 | return result; 96 | } 97 | 98 | /// 99 | /// Removes all objects inside a single bucket. 100 | /// 101 | /// 102 | /// 103 | public async Task EmptyBucket(string id) 104 | { 105 | var result = await Helpers.MakeRequest(HttpMethod.Post, $"{Url}/bucket/{id}/empty", null, Headers); 106 | return result; 107 | } 108 | 109 | /// 110 | /// Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. 111 | /// You must first 112 | /// 113 | /// 114 | /// 115 | public async Task DeleteBucket(string id) 116 | { 117 | var result = await Helpers.MakeRequest(HttpMethod.Delete, $"{Url}/bucket/{id}", null, Headers); 118 | return result; 119 | } 120 | 121 | } 122 | 123 | public class BucketUpsertOptions 124 | { 125 | [JsonProperty("public")] 126 | public bool Public { get; set; } = false; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/StorageBucketApi.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d5db5eaf62314746b32678a5e14bda8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/StorageFileApi.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bf414060a87a9a4c8b8b4a75cddeae9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Util.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace Supabase.Storage 7 | { 8 | public static class Util 9 | { 10 | public static string GetAssemblyVersion() 11 | { 12 | var assembly = typeof(Client).Assembly; 13 | var informationVersion = assembly.GetCustomAttribute().InformationalVersion; 14 | var name = assembly.GetName().Name; 15 | 16 | return $"{name.ToString().ToLower()}-csharp/{informationVersion}"; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity/supabase-cloned/supabase-csharp/modules/storage-csharp/Storage/Util.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2748551eaa055d146a54dc35c9ab04db 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.supabase.unitybuilder", 3 | "version": "1.0.0" 4 | } -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c09ca496269b4aa4aafa43ac4b123f6a 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------