コード例 #1
0
        public Response Send(ApiInfo apiInfo, string username, string text)
        {
            Message message = CreateMessage(text, apiInfo.BotId);
            User    user    = CreateUser(username);

            Payload data = CreatePayload(message, user);

            string dataJson = _jsonHelper.ToJson <Payload>(data);
            string request  = GetRequestUri(apiInfo, dataJson);

            try
            {
                return(_jsonHelper.ToObject <Response>(MakeRequest(request)));
            }
            catch (Exception e)
            {
                throw new PersonalityForgeException(e.Message, e);
            }
        }
コード例 #2
0
 private string GetRequestUri(ApiInfo apiInfo, string dataJson)
 {
     return(string.Format("{0}?apiKey={1}&hash={2}&message={3}", _host, apiInfo.Key, _utils.GenerateSecret(apiInfo.Secret, dataJson), HttpUtility.UrlEncode(dataJson)));
 }