Exemplo n.º 1
0
 /// <summary>
 ///  Serialize .
 /// </summary>
 /// <returns>
 /// Method payload as Json string.
 /// </returns>
 public override string GetPayloadAsJson()
 {
     GraphBody            = new MediaGraphTopologySetRequestBody(Graph.Name);
     GraphBody.SystemData = Graph.SystemData;
     GraphBody.Properties = Graph.Properties;
     return(GraphBody.GetPayloadAsJson());
 }
        internal static MethodRequest DeserializeMethodRequest(JsonElement element)
        {
            if (element.TryGetProperty("methodName", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "GraphInstanceActivate": return(MediaGraphInstanceActivateRequest.DeserializeMediaGraphInstanceActivateRequest(element));

                case "GraphInstanceDeactivate": return(MediaGraphInstanceDeActivateRequest.DeserializeMediaGraphInstanceDeActivateRequest(element));

                case "GraphInstanceDelete": return(MediaGraphInstanceDeleteRequest.DeserializeMediaGraphInstanceDeleteRequest(element));

                case "GraphInstanceGet": return(MediaGraphInstanceGetRequest.DeserializeMediaGraphInstanceGetRequest(element));

                case "GraphInstanceList": return(MediaGraphInstanceListRequest.DeserializeMediaGraphInstanceListRequest(element));

                case "GraphInstanceSet": return(MediaGraphInstanceSetRequest.DeserializeMediaGraphInstanceSetRequest(element));

                case "GraphTopologyDelete": return(MediaGraphTopologyDeleteRequest.DeserializeMediaGraphTopologyDeleteRequest(element));

                case "GraphTopologyGet": return(MediaGraphTopologyGetRequest.DeserializeMediaGraphTopologyGetRequest(element));

                case "GraphTopologyList": return(MediaGraphTopologyListRequest.DeserializeMediaGraphTopologyListRequest(element));

                case "GraphTopologySet": return(MediaGraphTopologySetRequest.DeserializeMediaGraphTopologySetRequest(element));

                case "ItemNonSetRequestBase": return(ItemNonSetRequestBase.DeserializeItemNonSetRequestBase(element));

                case "MediaGraphTopologySetRequestBody": return(MediaGraphTopologySetRequestBody.DeserializeMediaGraphTopologySetRequestBody(element));

                case "MediaGraphInstanceSetRequestBody": return(MediaGraphInstanceSetRequestBody.DeserializeMediaGraphInstanceSetRequestBody(element));
                }
            }
            string            methodName = default;
            Optional <string> apiVersion = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("methodName"))
                {
                    methodName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("@apiVersion"))
                {
                    apiVersion = property.Value.GetString();
                    continue;
                }
            }
            return(new MethodRequest(methodName, apiVersion.Value));
        }