示例#1
0
        public string ProcessPayloadRequest()
        {
            requestPayloadModel = new RequestPayloadModel();


            return("");
        }
示例#2
0
        /// <summary>
        /// Formulates the requested Graph snippets and returns it as string
        /// </summary>
        /// <returns></returns>
        public string GenerateCsharpSnippet()
        {
            //get all the HttpRequestMessage to our RequestPayloadModel
            RequestPayloadModel requestPayloadModel;

            // TODO
            // Assign all properties from the above model all their respective
            // values

            /*** Sample Data for Test Purposes **/

            requestPayloadModel = new RequestPayloadModel()
            {
                Uri     = new Uri(@"https://graph.microsoft.com/v1.0/me/messages?$select=subject,IsRead,sender,toRecipients&$filter=IsRead eq false&$skip=10"),
                Headers = new List <string>()
                {
                    "Content-Type: application/json"
                },
                Body       = string.Empty,
                HttpMethod = HttpMethod.Get
            };

            Uri       serviceRootV1 = new Uri(serviceRoot);
            Uri       fullUriV1     = requestPayloadModel.Uri;
            IEdmModel iedmModel     = CsdlReader.Parse(XmlReader.Create(serviceRootV1 + "/$metadata"));
            /*** End of sample data for test purposes **/

            ODataUriParser parser   = new ODataUriParser(iedmModel, serviceRootV1, fullUriV1);
            ODataUri       odatauri = parser.ParseUri();

            StringBuilder snippet = new StringBuilder();

            //Fomulate all resources path
            snippet = GenerateResourcesPath(odatauri);

            /********************************/
            /**Formulate the Query options**/
            /*******************************/

            if (odatauri.Filter != null)
            {
                snippet.Append(FilterExpression(odatauri).ToString());
            }

            if (odatauri.SelectAndExpand != null)
            {
                snippet.Append(SelectExpression(odatauri).ToString());
            }

            if (odatauri.Search != null)
            {
                snippet.Append(SearchExpression(odatauri).ToString());
            }

            snippet.Append(".GetAsync();");
            return(snippet.ToString());
        }