示例#1
0
        /// <summary>
        /// Checks the given token is registered in the given server
        /// </summary>
        /// <param name="address">The address of the server to query</param>
        /// <param name="token">The token to check for</param>
        /// <returns></returns>
        public async Task <Result> CheckToken(string address, string token)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                { "token", token }
            };

            HttpResponseMessage response =
                await _requestsClient.SendRequest(address, CrossConnectionEndpoints.CheckToken, parameters)
                .ConfigureAwait(false);

            return(await ResponseParser.ParseJsonResponse(response).ConfigureAwait(false));
        }
        /// <summary>
        /// Gets a list of URLs for the separate services of an instance
        /// </summary>
        /// <param name="address">The address to query</param>
        /// <returns></returns>
        public static async Task <Result <ServerURLs> > GetServerURLs(string address)
        {
            // Instantiates temporary objects
            RequestsClient requestsClient = new RequestsClient();
            Endpoint       target         = new Endpoint("/Home/InstanceInfo", HttpMethod.Get);

            // Retrieves URL information and converts to stream
            HttpResponseMessage response = await requestsClient.SendRequest(address, target);

            return(await ResponseParser.ParseJsonResponse <ServerURLs>(response));
        }