Ejemplo n.º 1
0
 public RippleSubmitRequestException(string error, string errorException, System.Text.Json.JsonElement request)
     : base(errorException == null ? error : error + ": " + errorException, error, request)
 {
     ErrorException = errorException;
 }
Ejemplo n.º 2
0
        public System.Text.Json.JsonElement Send()
        {
            if (System.String.IsNullOrWhiteSpace(this.URL))
            {
                throw new System.Exception(SoftmakeAll.SDK.Communication.REST.EmptyURLErrorMessage);
            }

            this.HasRequestErrors = false;

            if (System.String.IsNullOrWhiteSpace(this.Method))
            {
                this.Method = SoftmakeAll.SDK.Communication.REST.DefaultMethod;
            }

            System.Text.Json.JsonElement Result = new System.Text.Json.JsonElement();
            try
            {
                System.Net.HttpWebRequest HttpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(this.URL);
                HttpWebRequest.Method = this.Method;

                if (this.Headers.Count > 0)
                {
                    foreach (System.Collections.Generic.KeyValuePair <System.String, System.String> Header in this.Headers)
                    {
                        if (Header.Key != "Content-Type")
                        {
                            HttpWebRequest.Headers.Add(Header.Key, Header.Value);
                        }
                        else
                        {
                            HttpWebRequest.ContentType = Header.Value;
                        }
                    }
                }
                this.AddAuthorizationHeader(HttpWebRequest);

                if (this.Body.ValueKind == System.Text.Json.JsonValueKind.Undefined)
                {
                    HttpWebRequest.ContentLength = 0;
                }
                else
                {
                    System.Byte[] BodyBytes = new System.Text.UTF8Encoding().GetBytes(Body.ToString());
                    HttpWebRequest.ContentType   = SoftmakeAll.SDK.Communication.REST.DefaultContentType;
                    HttpWebRequest.ContentLength = BodyBytes.Length;
                    HttpWebRequest.GetRequestStream().Write(BodyBytes, 0, BodyBytes.Length);
                }

                if (this.Timeout > 0)
                {
                    HttpWebRequest.Timeout = this.Timeout;
                }

                using (System.Net.HttpWebResponse HttpWebResponse = (System.Net.HttpWebResponse)HttpWebRequest.GetResponse())
                {
                    this._StatusCode = HttpWebResponse.StatusCode;
                    Result           = this.ReadResponseStream(HttpWebResponse);
                }
            }
            catch (System.Net.WebException ex)
            {
                this.HasRequestErrors = true;
                System.Net.HttpWebResponse HttpWebResponse = ex.Response as System.Net.HttpWebResponse;
                if (HttpWebResponse == null)
                {
                    this._StatusCode = System.Net.HttpStatusCode.InternalServerError;
                    Result           = new { Error = true, Message = ex.Message }.ToJsonElement();
                    return(Result);
                }
                this._StatusCode = HttpWebResponse.StatusCode;
                Result           = this.ReadResponseStream(HttpWebResponse);
            }
            catch (System.Exception ex)
            {
                this.HasRequestErrors = true;
                this._StatusCode      = System.Net.HttpStatusCode.InternalServerError;
                Result = new { Error = true, Message = ex.Message }.ToJsonElement();
            }

            return(Result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Authenticate user/application using Credentials.
        /// </summary>
        /// <param name="Credentials">Credentials to use during authentication process.</param>
        public static async System.Threading.Tasks.Task AuthenticateAsync(SoftmakeAll.SDK.Fluent.Authentication.ICredentials Credentials)
        {
            if (Credentials != null)
            {
                SoftmakeAll.SDK.Fluent.SDKContext.SignOut();
                SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials = Credentials;

                // From AccessKey
                if (Credentials.AuthenticationType == SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes.Application)
                {
                    SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.Authorization = $"Basic {System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes($"{Credentials.ClientID}@{Credentials.ContextIdentifier.ToString().ToLower()}:{Credentials.ClientSecret}"))}";
                    SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.Store();
                    await SoftmakeAll.SDK.Fluent.SDKContext.ClientWebSocket.ConfigureAsync(SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.Authorization);

                    return;
                }
            }
            else if (SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials == null)
            {
                try
                {
                    System.Text.Json.JsonElement CacheData = SoftmakeAll.SDK.Fluent.GeneralCacheHelper.ReadString().ToJsonElement();
                    if (!(CacheData.IsValid()))
                    {
                        throw new System.Exception();
                    }

                    // From AccessKey
                    if (CacheData.GetInt32("AuthType") == (int)SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes.Application)
                    {
                        SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials = new SoftmakeAll.SDK.Fluent.Authentication.Credentials(CacheData.GetGuid("ContextIdentifier"), CacheData.GetString("ClientID"), null, (SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes)CacheData.GetInt32("AuthType"));
                        SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.Authorization = CacheData.GetString("Authorization");
                        if (System.String.IsNullOrWhiteSpace(SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.Authorization))
                        {
                            throw new System.Exception();
                        }

                        await SoftmakeAll.SDK.Fluent.SDKContext.ClientWebSocket.ConfigureAsync(SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.Authorization);

                        return;
                    }
                    else
                    {
                        SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials = new SoftmakeAll.SDK.Fluent.Authentication.Credentials(CacheData.GetJsonElement("AppMetadata").EnumerateObject().First().Value.GetGuid("client_id"));
                        SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.AuthenticationType = SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes.Interactive;
                    }
                }
                catch { }
            }

            if (SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials == null)
            {
                SoftmakeAll.SDK.Fluent.SDKContext.SignOut();
                throw new System.Exception("Invalid Credentials from cache.");
            }


            // From AccessKey
            if (SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.AuthenticationType == SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes.Application)
            {
                return;
            }


            // From Public Client Application
            if ((SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult == null) || (SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult.ExpiresOn.Subtract(System.DateTimeOffset.UtcNow).TotalMinutes <= 5.0D))
            {
                System.String[] Scopes = new System.String[] { "openid", "https://softmakeb2c.onmicrosoft.com/48512da7-b030-4e62-be61-9e19b2c52d8a/user_impersonation" };
                if (SoftmakeAll.SDK.Fluent.SDKContext.PublicClientApplication == null)
                {
                    if (SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.AuthenticationType == SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes.Interactive) // From Interactive
                    {
                        SoftmakeAll.SDK.Fluent.SDKContext.PublicClientApplication = SoftmakeAll.SDK.Fluent.SDKContext.CreatePublicClientApplication(SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.ContextIdentifier, "A_signup_signin", "http://localhost:1435");
                    }
                    else if (SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.AuthenticationType == SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes.Credentials) // From Username and Password
                    {
                        SoftmakeAll.SDK.Fluent.SDKContext.PublicClientApplication = SoftmakeAll.SDK.Fluent.SDKContext.CreatePublicClientApplication(SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.ContextIdentifier, "_ROPC");
                    }
                    else
                    {
                        throw new System.Exception("Invalid authentication type.");
                    }
                }

                // Getting existing Account in cache
                try
                {
                    System.Collections.Generic.IEnumerable <Microsoft.Identity.Client.IAccount> Accounts = await SoftmakeAll.SDK.Fluent.SDKContext.PublicClientApplication.GetAccountsAsync();

                    if (Accounts.Any())
                    {
                        SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult = await SoftmakeAll.SDK.Fluent.SDKContext.PublicClientApplication.AcquireTokenSilent(Scopes, Accounts.FirstOrDefault()).ExecuteAsync();

                        if (SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult != null)
                        {
                            SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.Authorization = $"Bearer {SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult.AccessToken}";
                            await SoftmakeAll.SDK.Fluent.SDKContext.ClientWebSocket.ConfigureAsync(SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult.AccessToken);

                            return;
                        }
                    }
                }
                catch
                {
                    SoftmakeAll.SDK.Fluent.GeneralCacheHelper.Clear();
                }


                if (SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.AuthenticationType == SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes.Interactive) // From Interactive
                {
                    try
                    {
                        SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult = await SoftmakeAll.SDK.Fluent.SDKContext.PublicClientApplication.AcquireTokenInteractive(Scopes).WithPrompt(Microsoft.Identity.Client.Prompt.ForceLogin).ExecuteAsync();
                    }
                    catch { }
                }
                else if (SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.AuthenticationType == SoftmakeAll.SDK.Fluent.Authentication.AuthenticationTypes.Credentials) // From Username and Password
                {
                    if (System.String.IsNullOrWhiteSpace(SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.ClientSecret))
                    {
                        SoftmakeAll.SDK.Fluent.SDKContext.SignOut();
                        throw new System.Exception("Authentication aborted. Please, re-enter credentials.");
                    }

                    System.Security.SecureString Password = new System.Security.SecureString();
                    foreach (System.Char Char in SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.ClientSecret)
                    {
                        Password.AppendChar(Char);
                    }
                    Password.MakeReadOnly();

                    try
                    {
                        SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult = await SoftmakeAll.SDK.Fluent.SDKContext.PublicClientApplication.AcquireTokenByUsernamePassword(Scopes, SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.ClientID, Password).ExecuteAsync();

                        Password.Dispose();
                    }
                    catch
                    {
                        Password.Dispose();
                        SoftmakeAll.SDK.Fluent.SDKContext.SignOut();
                        throw new System.Exception("Invalid username or password.");
                    }
                }

                if (SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult == null)
                {
                    SoftmakeAll.SDK.Fluent.SDKContext.SignOut();
                    throw new System.Exception("Authentication aborted.");
                }


                SoftmakeAll.SDK.Fluent.SDKContext.InMemoryCredentials.Authorization = $"Bearer {SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult.AccessToken}";
                await SoftmakeAll.SDK.Fluent.SDKContext.ClientWebSocket.ConfigureAsync(SoftmakeAll.SDK.Fluent.SDKContext.AuthenticationResult.AccessToken);

                return;
            }
        }
Ejemplo n.º 4
0
 public bool TryGetProperty(System.ReadOnlySpan <char> propertyName, out System.Text.Json.JsonElement value)
 {
     throw null;
 }
Ejemplo n.º 5
0
 public DynamicJson(System.Text.Json.JsonElement element)
 {
 }
 internal LicenseTemplate(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
Ejemplo n.º 7
0
        public SoftmakeAll.SDK.OperationResult <System.Text.Json.JsonElement> CompileTo(System.IO.Stream Stream)
        {
            if (Stream == null)
            {
                throw new System.Exception(System.String.Format(SoftmakeAll.SDK.NetReflector.Compiler.NullOrEmptyMessage, "Stream"));
            }
            if (System.String.IsNullOrWhiteSpace(this.OutputFileName))
            {
                throw new System.Exception(System.String.Format(SoftmakeAll.SDK.NetReflector.Compiler.NullOrEmptyMessage, "OutputFileName"));
            }
            if ((this.CodeFiles == null) || (!(this.CodeFiles.Any())))
            {
                throw new System.Exception(System.String.Format(SoftmakeAll.SDK.NetReflector.Compiler.NullOrEmptyMessage, "Code"));
            }

            System.Collections.Generic.List <Microsoft.CodeAnalysis.SyntaxTree> SyntaxTrees = new System.Collections.Generic.List <Microsoft.CodeAnalysis.SyntaxTree>();
            foreach (System.Collections.Generic.KeyValuePair <System.String, System.String> CodeFile in this.CodeFiles.Where(c => (!(System.String.IsNullOrWhiteSpace(c.Value)))))
            {
                SyntaxTrees.Add(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.ParseText(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.ParseText(CodeFile.Value.Trim()).GetRoot().NormalizeWhitespace(new System.String(' ', this.IndentSize), System.Environment.NewLine, false).ToFullString(), null, CodeFile.Key));
            }
            if (!(SyntaxTrees.Any()))
            {
                throw new System.Exception(System.String.Format(SoftmakeAll.SDK.NetReflector.Compiler.NullOrEmptyMessage, "Code"));
            }

            SoftmakeAll.SDK.OperationResult <System.Text.Json.JsonElement> CompileResult = new SoftmakeAll.SDK.OperationResult <System.Text.Json.JsonElement>();

            System.Collections.Generic.List <Microsoft.CodeAnalysis.MetadataReference> CurrentReferences = new System.Collections.Generic.List <Microsoft.CodeAnalysis.MetadataReference>();
            if (!(System.String.IsNullOrWhiteSpace(this.DefaultReferencesDirectoryPath)))
            {
                if (!(System.IO.Directory.Exists(this.DefaultReferencesDirectoryPath)))
                {
                    throw new System.IO.DirectoryNotFoundException();
                }
                else
                {
                    foreach (System.String ReferencedFile in System.IO.Directory.GetFiles(this.DefaultReferencesDirectoryPath, "*.*", System.IO.SearchOption.AllDirectories))
                    {
                        CurrentReferences.Add(Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(ReferencedFile));
                    }
                }
            }

            if ((this.AdditionalReferences != null) && (this.AdditionalReferences.Any()))
            {
                foreach (System.String ReferencedFile in this.AdditionalReferences)
                {
                    CurrentReferences.Add(Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(ReferencedFile));
                }
            }


            Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions CSharpCompilationOptions = new Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions
                                                                                              (
                optimizationLevel: Microsoft.CodeAnalysis.OptimizationLevel.Release,
                outputKind: (Microsoft.CodeAnalysis.OutputKind) this.OutputKind,
                platform: (Microsoft.CodeAnalysis.Platform) this.Platform
                                                                                              );

            System.IO.FileInfo OutputFileNameInfo = new System.IO.FileInfo(this.OutputFileName);
            System.String      AssemblyName       = OutputFileNameInfo.Name.Substring(0, OutputFileNameInfo.Name.Length - OutputFileNameInfo.Extension.Length);
            Microsoft.CodeAnalysis.CSharp.CSharpCompilation CSharpCompilation = Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Create(AssemblyName, SyntaxTrees, CurrentReferences, CSharpCompilationOptions);


            Microsoft.CodeAnalysis.Emit.EmitResult EmitResult = CSharpCompilation.Emit(Stream);
            if (EmitResult.Diagnostics.Length > 0)
            {
                System.Collections.Generic.List <System.Text.Json.JsonElement> Diagnostics = new System.Collections.Generic.List <System.Text.Json.JsonElement>();
                foreach (Microsoft.CodeAnalysis.Diagnostic Diagnostic in EmitResult.Diagnostics)
                {
                    if ((this.OmitCompilationHiddenSeverity) && (Diagnostic.Descriptor.DefaultSeverity == Microsoft.CodeAnalysis.DiagnosticSeverity.Hidden))
                    {
                        continue;
                    }
                    if ((this.OmitCompilationInfoSeverity) && (Diagnostic.Descriptor.DefaultSeverity == Microsoft.CodeAnalysis.DiagnosticSeverity.Info))
                    {
                        continue;
                    }
                    if ((this.OmitCompilationWarningSeverity) && (Diagnostic.Descriptor.DefaultSeverity == Microsoft.CodeAnalysis.DiagnosticSeverity.Warning))
                    {
                        continue;
                    }

                    System.String ID = Diagnostic.Descriptor.Id;
                    if (ID == "CS8019") // CS8019 = using directives
                    {
                        continue;
                    }

                    System.String Severity = Diagnostic.Descriptor.DefaultSeverity.ToString();
                    System.String Category = Diagnostic.Descriptor.Category;
                    System.String Message  = Diagnostic.GetMessage();
                    System.Text.Json.JsonElement Location = new System.Text.Json.JsonElement();
                    if ((Diagnostic.Location != null) && (Diagnostic.Location.SourceSpan != null) && (!(Diagnostic.Location.SourceSpan.IsEmpty)))
                    {
                        Microsoft.CodeAnalysis.FileLinePositionSpan FileLinePositionSpan = Diagnostic.Location.GetMappedLineSpan();
                        System.Nullable <System.Int32> Line      = null;
                        System.Nullable <System.Int32> Character = null;
                        if (FileLinePositionSpan.IsValid)
                        {
                            Line      = FileLinePositionSpan.StartLinePosition.Line;
                            Character = FileLinePositionSpan.StartLinePosition.Character;
                        }
                        Location = new { Diagnostic.Location.SourceTree.FilePath, Line, Character, Code = Diagnostic.Location.SourceTree.ToString().Substring(Diagnostic.Location.SourceSpan.Start, Diagnostic.Location.SourceSpan.End - Diagnostic.Location.SourceSpan.Start) }.ToJsonElement();
                    }
                    Diagnostics.Add(new { Severity, Category, ID, Message, Location }.ToJsonElement());
                }
                CompileResult.Data = Diagnostics.ToJsonElement();
            }

            CompileResult.ExitCode = System.Convert.ToInt16((!(EmitResult.Success)) ? -1 : CompileResult.Data.IsValid() ? 1 : 0);

            return(CompileResult);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 根据JsonElement对象, 设置指定的属性值
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        /// <param name="propertyName">属性的名字</param>
        /// <param name="jsonValue">JsonElement 属性值</param>
        /// <remarks>
        /// 属性值运行时类型如果不符合, 将会抛出异常
        /// </remarks>
        public static void Set <T>(this T obj, string propertyName, System.Text.Json.JsonElement jsonValue)
        {
            var pi = obj?.GetType().GetPropertyInfo(propertyName);

            if (pi is null)
            {
                throw new ArgumentOutOfRangeException(propertyName);
            }
            var type = pi.PropertyType;

            if (type == typeof(string))
            {
                pi.SetValue(obj, jsonValue.GetString());
            }
            else if (type == typeof(Int16))
            {
                pi.SetValue(obj, jsonValue.GetInt16());
            }
            else if (type == typeof(Int32))
            {
                pi.SetValue(obj, jsonValue.GetInt32());
            }
            else if (type == typeof(Int64))
            {
                pi.SetValue(obj, jsonValue.GetInt64());
            }
            else if (type == typeof(Single))
            {
                pi.SetValue(obj, jsonValue.GetSingle());
            }
            else if (type == typeof(Double))
            {
                pi.SetValue(obj, jsonValue.GetDouble());
            }
            else if (type == typeof(Decimal))
            {
                pi.SetValue(obj, jsonValue.GetDecimal());
            }
            else if (type == typeof(DateTime))
            {
                pi.SetValue(obj, jsonValue.GetDateTime());
            }
            else if (type == typeof(UInt16?))
            {
                pi.SetValue(obj, jsonValue.GetUInt16());
            }
            else if (type == typeof(UInt32?))
            {
                pi.SetValue(obj, jsonValue.GetUInt32());
            }
            else if (type == typeof(UInt64?))
            {
                pi.SetValue(obj, jsonValue.GetUInt64());
            }
            else if (type == typeof(Boolean))
            {
                pi.SetValue(obj, jsonValue.GetBoolean());
            }
            else if (type == typeof(Byte))
            {
                pi.SetValue(obj, jsonValue.GetByte());
            }
            else if (type == typeof(SByte))
            {
                pi.SetValue(obj, jsonValue.GetSByte());
            }
            else if (type == typeof(Guid))
            {
                pi.SetValue(obj, jsonValue.GetGuid());
            }
            else
            {
                throw new TypeNotSupportException(type);
            }
        }
Ejemplo n.º 9
0
 internal UserAvatar(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
Ejemplo n.º 10
0
 public ChartEvent(IChartComponent sender, System.Text.Json.JsonElement data)
 {
     Sender = sender;
     Data   = data;
 }
 internal Project(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
Ejemplo n.º 12
0
 public OAuthCreatingTicketContext(System.Security.Claims.ClaimsPrincipal principal, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties, Microsoft.AspNetCore.Http.HttpContext context, Microsoft.AspNetCore.Authentication.AuthenticationScheme scheme, Microsoft.AspNetCore.Authentication.OAuth.OAuthOptions options, System.Net.Http.HttpClient backchannel, Microsoft.AspNetCore.Authentication.OAuth.OAuthTokenResponse tokens, System.Text.Json.JsonElement user) : base(default(Microsoft.AspNetCore.Http.HttpContext), default(Microsoft.AspNetCore.Authentication.AuthenticationScheme), default(Microsoft.AspNetCore.Authentication.OAuth.OAuthOptions))
 {
 }
Ejemplo n.º 13
0
 public void RunClaimActions(System.Text.Json.JsonElement userData)
 {
 }
 internal ImpersonationToken(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
 public static string GetString(this System.Text.Json.JsonElement element, string key)
 {
     throw null;
 }
 internal SystemHook(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
 internal UserSafe(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
 internal SharedGroup(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
 internal RunnerRegistered(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
 internal RenderMarkdownResult(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
Ejemplo n.º 21
0
 void IBaubleButton.LoadFromJson(System.Text.Json.JsonElement json)
 {
 }
Ejemplo n.º 22
0
 internal Job(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
Ejemplo n.º 23
0
 public bool TryGetProperty(string propertyName, out System.Text.Json.JsonElement value)
 {
     throw null;
 }
Ejemplo n.º 24
0
        private JSONSchemaProps(
            string @ref,

            string schema,

            Union <Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps, bool> additionalItems,

            Union <Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps, bool> additionalProperties,

            ImmutableArray <Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps> allOf,

            ImmutableArray <Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps> anyOf,

            System.Text.Json.JsonElement @default,

            ImmutableDictionary <string, Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps> definitions,

            ImmutableDictionary <string, Union <Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps, ImmutableArray <string> > > dependencies,

            string description,

            ImmutableArray <System.Text.Json.JsonElement> @enum,

            System.Text.Json.JsonElement example,

            bool exclusiveMaximum,

            bool exclusiveMinimum,

            Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.ExternalDocumentation externalDocs,

            string format,

            string id,

            Union <Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps, ImmutableArray <System.Text.Json.JsonElement> > items,

            int maxItems,

            int maxLength,

            int maxProperties,

            double maximum,

            int minItems,

            int minLength,

            int minProperties,

            double minimum,

            double multipleOf,

            Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps not,

            bool nullable,

            ImmutableArray <Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps> oneOf,

            string pattern,

            ImmutableDictionary <string, Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps> patternProperties,

            ImmutableDictionary <string, Pulumi.Kubernetes.Types.Outputs.ApiExtensions.V1Beta1.JSONSchemaProps> properties,

            ImmutableArray <string> required,

            string title,

            string type,

            bool uniqueItems,

            bool x_kubernetes_embedded_resource,

            bool x_kubernetes_int_or_string,

            ImmutableArray <string> x_kubernetes_list_map_keys,

            string x_kubernetes_list_type,

            string x_kubernetes_map_type,

            bool x_kubernetes_preserve_unknown_fields)
        {
            Ref                  = @ref;
            Schema               = schema;
            AdditionalItems      = additionalItems;
            AdditionalProperties = additionalProperties;
            AllOf                = allOf;
            AnyOf                = anyOf;
            Default              = @default;
            Definitions          = definitions;
            Dependencies         = dependencies;
            Description          = description;
            Enum                 = @enum;
            Example              = example;
            ExclusiveMaximum     = exclusiveMaximum;
            ExclusiveMinimum     = exclusiveMinimum;
            ExternalDocs         = externalDocs;
            Format               = format;
            Id                = id;
            Items             = items;
            MaxItems          = maxItems;
            MaxLength         = maxLength;
            MaxProperties     = maxProperties;
            Maximum           = maximum;
            MinItems          = minItems;
            MinLength         = minLength;
            MinProperties     = minProperties;
            Minimum           = minimum;
            MultipleOf        = multipleOf;
            Not               = not;
            Nullable          = nullable;
            OneOf             = oneOf;
            Pattern           = pattern;
            PatternProperties = patternProperties;
            Properties        = properties;
            Required          = required;
            Title             = title;
            Type              = type;
            UniqueItems       = uniqueItems;
            X_kubernetes_embedded_resource       = x_kubernetes_embedded_resource;
            X_kubernetes_int_or_string           = x_kubernetes_int_or_string;
            X_kubernetes_list_map_keys           = x_kubernetes_list_map_keys;
            X_kubernetes_list_type               = x_kubernetes_list_type;
            X_kubernetes_map_type                = x_kubernetes_map_type;
            X_kubernetes_preserve_unknown_fields = x_kubernetes_preserve_unknown_fields;
        }
Ejemplo n.º 25
0
 public static Azure.Core.DynamicJson Create(System.Text.Json.JsonElement element)
 {
     throw null;
 }
Ejemplo n.º 26
0
 internal Issue(System.Text.Json.JsonElement obj)
     : base(obj)
 {
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Creates a OperationResult object based on HTTP Request.
        /// </summary>
        /// <param name="REST">REST object that contains the HTTP Request information.</param>
        /// <param name="RESTResult">The output of Send method.</param>
        /// <returns>A OperationResult with JSON property Data.</returns>
        private static SoftmakeAll.SDK.OperationResult <System.Text.Json.JsonElement> ProcessRESTRequestResult(SoftmakeAll.SDK.Communication.REST REST, System.Text.Json.JsonElement RESTResult)
        {
            SoftmakeAll.SDK.OperationResult <System.Text.Json.JsonElement> Result = new SoftmakeAll.SDK.OperationResult <System.Text.Json.JsonElement>();
            if (REST.HasRequestErrors)
            {
                Result.ExitCode = (int)REST.StatusCode;
            }
            else
            {
                Result.ExitCode = RESTResult.GetInt32("ExitCode");
            }

            if (RESTResult.IsValid())
            {
                Result.Message = RESTResult.GetString("Message");
                Result.ID      = RESTResult.GetString("ID");
                Result.Count   = RESTResult.GetInt32("Count");
                Result.Data    = RESTResult.GetJsonElement("Data").ToObject <System.Text.Json.JsonElement>();
            }

            SoftmakeAll.SDK.Fluent.SDKContext.LastOperationResult.ExitCode = Result.ExitCode;
            SoftmakeAll.SDK.Fluent.SDKContext.LastOperationResult.Message  = Result.Message;
            SoftmakeAll.SDK.Fluent.SDKContext.LastOperationResult.Count    = Result.Count;
            SoftmakeAll.SDK.Fluent.SDKContext.LastOperationResult.ID       = Result.ID;

            return(Result);
        }
        public ActionResult GetWebhookResponse([FromBody] System.Text.Json.JsonElement dados)
        {
            if (!Autorizado(Request.Headers))
            {
                return(StatusCode(401));
            }

            WebhookRequest request =
                _jsonParser.Parse <WebhookRequest>(dados.GetRawText());

            WebhookResponse response = new WebhookResponse();


            if (request != null)
            {
                string action     = request.QueryResult.Action;
                var    parameters = request.QueryResult.Parameters;

                if (action == "ActionTesteWH")
                {
                    response.FulfillmentText = "testando o webhook 2";
                }
                else if (action == "ActionCursoOferta")
                {
                    DAL.CursoDAL dal = new DAL.CursoDAL();

                    if (parameters != null &&
                        parameters.Fields.ContainsKey("Cursos"))
                    {
                        var cursos = parameters.Fields["Cursos"];

                        if (cursos != null && cursos.ListValue.Values.Count > 0)
                        {
                            string curso = cursos.ListValue.Values[0].StringValue;
                            if (dal.ObterCurso(curso) != null)
                            {
                                response.FulfillmentText = "Sim, temos " + curso + ".";
                            }
                        }
                        else
                        {
                            response.FulfillmentText = "Não temos, mas temos esses: " + dal.ObterTodosFormatoTexto() + ".";
                        }
                    }
                }
                else if (action == "ActionCursoValor")
                {
                    var contexto = request.QueryResult.OutputContexts;

                    if (contexto[0].ContextName.ContextId == "ctxcurso")
                    {
                        if (contexto[0].Parameters != null &&
                            contexto[0].Parameters.Fields.ContainsKey("Cursos"))
                        {
                            var          cursos = contexto[0].Parameters.Fields["Cursos"];
                            string       curso  = cursos.ListValue.Values[0].StringValue;
                            DAL.CursoDAL dal    = new DAL.CursoDAL();

                            Models.Curso c = dal.ObterCurso(curso);
                            if (c != null)
                            {
                                response.FulfillmentText =
                                    "A mensalidade para " + c.Nome + " é " + c.Preco + ".";
                            }
                        }
                    }
                }

                else if (action == "ActionTesteWHPayload")
                {
                    var contexto = request.QueryResult.OutputContexts;

                    var payload = "{\"list\": {\"replacementKey\": \"@contexto\",\"invokeEvent\": true,\"afterDialog\": true,\"itemsName\": [\"Sim\",\"Não\"],\"itemsEventName\": [\"QueroInscrever\",\"NaoQueroInscrever\"]}}";


                    response = new WebhookResponse()
                    {
                        FulfillmentText = "Teste Payload no WH com sucesso...",
                        Payload         = Google.Protobuf.WellKnownTypes.Struct.Parser.ParseJson(payload)
                    };
                }
            }

            return(Ok(response));
        }
Ejemplo n.º 29
0
 public override void Run(System.Text.Json.JsonElement userData, System.Security.Claims.ClaimsIdentity identity, string issuer)
 {
 }
Ejemplo n.º 30
0
 public RippleRequestException(string error, System.Text.Json.JsonElement request)
     : base(error)
 {
     Error   = error;
     Request = request;
 }