Esempio n. 1
0
        /// <summary>
        /// Get Ping Api Result
        /// </summary>
        /// <returns></returns>
        public async Task <bool> GetPingResult()
        {
            RestRequestParameter parameters = new RestRequestParameter(
                ServiceSettings.ServiceAddress.GetRequestUrl($"/api/ping"),
                HttpMethod.Get)
            {
                IgnoreCertificateErrors = true
            };

            RestServiceClient       client = new RestServiceClient();
            RestServiceCallResponse result = await client.CallRestServiceAsync <String>(parameters);

            var resultObject = JsonConvert.DeserializeObject <bool>(result.ResultObject.ToString());

            return(resultObject);
        }
Esempio n. 2
0
        /// <summary>
        /// classworks POST Api Client Method
        /// </summary>
        /// <param name="qp"></param>
        /// <returns></returns>
        public async Task <List <ClassworkSummary> > GetClassworkSummary(QueryParameter qp)
        {
            RestRequestParameter parameters = new RestRequestParameter(
                ServiceSettings.ServiceAddress.GetRequestUrl($"/api/{_endpointName}?offset={qp.Offset}&limit={qp.Limit}"),
                HttpMethod.Get,
                headerParameters: GetAccessTokenHeader())
            {
                IgnoreCertificateErrors = true
            };

            RestServiceClient       client = new RestServiceClient();
            RestServiceCallResponse result = await client.CallRestServiceAsync <String>(parameters);

            var resultObject = JsonConvert.DeserializeObject <List <ClassworkSummary> >(result.ResultObject.ToString());

            return(resultObject);
        }
Esempio n. 3
0
        /// <summary>
        /// classworkd/summary POST Api Client Method
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public async Task <List <ClassworkSummary> > GetClassworkSummary(DateTime startDate, DateTime endDate)
        {
            FilterParameter param = new FilterParameter()
            {
                StartDate = startDate,
                EndDate   = endDate
            };
            StringContent        postContent = new StringContent(JsonConvert.SerializeObject(param), Encoding.UTF8, "application/json");
            RestRequestParameter parameters  = new RestRequestParameter(
                ServiceSettings.ServiceAddress.GetRequestUrl($"/api/{_endpointName}/summary"),
                HttpMethod.Post,
                headerParameters: GetAccessTokenHeader(),
                contentParameter: postContent)
            {
                IgnoreCertificateErrors = true
            };

            RestServiceClient       client = new RestServiceClient();
            RestServiceCallResponse result = await client.CallRestServiceAsync <String>(parameters);

            var resultObject = JsonConvert.DeserializeObject <List <ClassworkSummary> >(result.ResultObject.ToString());

            return(resultObject);
        }