public CreateBotUserResponse CreateBotUser(CreateBotUserRequest botUserRequest)
        {
            //preparing header
            NameValueCollection header = new NameValueCollection();

            header.Add(Constants.ACCESS_TOKEN_STRING, this.session.GetAccessToken());
            string request = JsonConvert.SerializeObject(botUserRequest);
            CreateBotUserResponse response = AsyncHelpers.RunSync <CreateBotUserResponse>(() => APICallHandler.PostAsync <CreateBotUserResponse>(header, string.Format(Constants.CREATE_BOT_USER_URL, Constants.API_ROOT), request));

            if (!ErrorValidator.IsResponseValid(response) && ErrorValidator.IsAccessTokenExpired(response))
            {
                header.Remove(Constants.ACCESS_TOKEN_STRING);
                header.Add(Constants.ACCESS_TOKEN_STRING, this.session.GenerateAccessToken());
                response = AsyncHelpers.RunSync <CreateBotUserResponse>(() => APICallHandler.PostAsync <CreateBotUserResponse>(header, string.Format(Constants.CREATE_BOT_USER_URL, Constants.API_ROOT), request));
            }

            return(response);
        }
Beispiel #2
0
 public CreateBotUserResponse CreateBotUser(CreateBotUserRequest botRequest)
 {
     return(BotUserAPI.CreateBotUser(botRequest));
 }
Beispiel #3
0
 public ErrorDetails UpdateBotUser(string botUserId, CreateBotUserRequest botUserRequest)
 {
     return(BotUserAPI.UpdateBotUser(botUserId, botUserRequest));
 }