void runCreateRequestWithAttachmentUploadTest() { ZendeskSDK.ZDKUploadProvider.UploadAttachment("TestAttachment", "TestAttachment.txt", "text", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUploadProvider.UploadAttachment - " + error.Description); } else { Debug.Log("UploadAttachmentCallbackRan: " + MakeResultString(result)); string[] tags = new string[0]; string[] attachments = new string[1]; #if UNITY_ANDROID attachments[0] = (string)result["token"]; #else attachments[0] = (string)result["uploadToken"]; #endif ZDKCreateRequest req = new ZDKCreateRequest("*****@*****.**", "Test Attachments1", "Test Description1", tags, attachments); ZendeskSDK.ZDKRequestProvider.CreateRequest(req, (result2, error2) => { if (error2 != null) { Debug.Log("ERROR: ZDKRequestProvider.CreateRequest - " + error2.Description); } else { Debug.Log("CreateRequest Successful Callback - " + MakeResultString(result2)); } }); } }); }
void RunProviderTests() { // ZDKRequestProvider Tests string[] tags = new string[0]; string[] attachments = new string[0]; ZDKCreateRequest req = new ZDKCreateRequest("*****@*****.**", "Test Subject", "Test Description", tags); ZendeskSDK.ZDKRequestProvider.CreateRequest(req, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.CreateRequest - " + error.Description); } else { Debug.Log("ZDKRequestProvider.CreateRequest Successful Callback - " + MakeResultString(result)); } }); req = new ZDKCreateRequest("*****@*****.**", "Test Subject", "Test Description", tags, attachments); ZendeskSDK.ZDKRequestProvider.CreateRequest(req, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.CreateRequest - " + error.Description); } else { Debug.Log("ZDKRequestProvider.CreateRequest Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKRequestProvider.GetAllRequests((result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.GetAllRequests - " + error.Description); } else { Debug.Log("ZDKRequestProvider.GetAllRequests Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKRequestProvider.GetAllRequests("Test Status", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.GetAllRequests - " + error.Description); } else { Debug.Log("ZDKRequestProvider.GetAllRequests Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKRequestProvider.GetComments("{requestId}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.GetComments - " + error.Description); } else { Debug.Log("ZDKRequestProvider.GetComments Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKRequestProvider.AddComment("Test Comment", "{requestId}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.AddComment - " + error.Description); } else { Debug.Log("ZDKRequestProvider.AddComment Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKRequestProvider.AddComment("Test Comment", "{requestId}", attachments, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.AddComment2 - " + error.Description); } else { Debug.Log("ZDKRequestProvider.AddComment2 Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKRequestProvider.GetRequest("{requestId}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKRequestProvider.GetRequest - " + error.Description); } else { Debug.Log("ZDKRequestProvider.GetRequest Successful Callback - " + MakeResultString(result)); } }); // ZDKHelpCenterProvider Tests string[] labels = new string[0]; ZendeskSDK.ZDKHelpCenterProvider.GetCategories((result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetCategories - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetCategories Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetSections("{id}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetSections - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetSections Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetArticles("{id}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.SearchForArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.SearchForArticles Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.SearchArticles("Test query", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.SearchForArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.SearchForArticles Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.SearchArticles("Test query", labels, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.SearchForArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.SearchForArticles Successful Callback - " + MakeResultString(result)); } }); ZDKHelpCenterSearch helpCenterSearch = new ZDKHelpCenterSearch(); helpCenterSearch.SectionIds = new [] { "123L" }; ZendeskSDK.ZDKHelpCenterProvider.SearchArticles(helpCenterSearch, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.SearchArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.SearchArticles Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetAttachments("{id}", ZDKHelpCenterProvider.AttachmentType.Block, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetAttachment - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetAttachment Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetArticles(labels, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetArticles2 Successful Callback - " + MakeResultString(result)); } }); ZDKListArticleQuery getArticlesQuery = new ZDKListArticleQuery(); getArticlesQuery.LabelNames = labels; getArticlesQuery.SortOrder = SortOrder.Descending; getArticlesQuery.SortBy = SortBy.Title; ZendeskSDK.ZDKHelpCenterProvider.GetArticles(getArticlesQuery, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetArticles3 Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetFlatArticles((result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetFlatArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetFlatArticles Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetFlatArticles(getArticlesQuery, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetFlatArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetFlatArticles2 Successful Callback - " + MakeResultString(result)); } }); ZDKHelpCenterDeflection deflectQuery = new ZDKHelpCenterDeflection(); deflectQuery.Query = "help"; ZendeskSDK.ZDKHelpCenterProvider.GetSuggestedArticles(deflectQuery, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetSuggestedArticles - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetSuggestedArticles Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetArticle("{id}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetArticle - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetArticle Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetSection("{id}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetSection - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetSection Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.GetCategory("{id}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.GetCategory - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.GetCategory Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.UpvoteArticle("{id}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.UpvoteArticle - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.UpvoteArticle Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.DownvoteArticle("{id}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.DownvoteArticle - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.DownvoteArticle Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.DeleteVote("{id}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.DeleteVote - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.DeleteVote Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKHelpCenterProvider.SubmitRecordArticleView("{id}", null, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKHelpCenterProvider.SubmitRecordArticleView - " + error.Description); } else { Debug.Log("ZDKHelpCenterProvider.SubmitRecordArticleView Successful Callback - " + MakeResultString(result)); } }); // ZDKAvatarProvider Tests ZendeskSDK.ZDKAvatarProvider.GetAvatar( "https://example.com/images/image.png", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKAvatarProvider.GetAvatar - " + error.Description); } else { Debug.Log("ZDKAvatarProvider.GetAvatar Successful Callback"); avatarTexture.LoadImage(result); } }); // ZDKSettingsProvider Tests ZendeskSDK.ZDKSettingsProvider.GetSdkSettings((result, error) => { if (error != null) { Debug.Log("ERROR: ZDKSettingsProvider.GetSdkSettings - " + error.Description); } else { Debug.Log("ZDKSettingsProvider.GetSdkSettings Successful Callback - " + MakeResultString(result)); } }); ZendeskSDK.ZDKSettingsProvider.GetSdkSettings("fr_FR", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKSettingsProvider.GetSdkSettings2 - " + error.Description); } else { Debug.Log("ZDKSettingsProvider.GetSdkSettings2 Successful Callback - " + MakeResultString(result)); } }); // ZDKUploadProvider Tests ZendeskSDK.ZDKUploadProvider.UploadAttachment("TestAttachment", "TestAttachment.txt", "text", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUploadProvider.UploadAttachment - " + error.Description); } else { Debug.Log("ZDKUploadProvider.UploadAttachment Successful Callback: " + MakeResultString(result)); } }); ZendeskSDK.ZDKUploadProvider.DeleteUpload("TestUploadToken", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUploadProvider.DeleteUpload - " + error.Description); } else { Debug.Log("ZDKUploadProvider.DeleteUpload Successful Callback: " + MakeResultString(result)); } }); runCreateRequestWithAttachmentUploadTest(); runUploadImageAndAttachToCreateRequestTest(); // ZDKUserProvider Tests ZendeskSDK.ZDKUserProvider.GetUser((result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUserProvider.GetUser - " + error.Description); } else { Debug.Log("ZDKUserProvider.GetUser Successful Callback: " + MakeResultString(result)); } }); Hashtable userFields = new Hashtable(); userFields ["key1"] = "value1"; userFields ["key2"] = "value2"; ZendeskSDK.ZDKUserProvider.SetUserFields(userFields, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUserProvider.SetUserFields - " + error.Description); } else { Debug.Log("ZDKUserProvider.SetUserFields Successful Callback: " + MakeResultString(result)); } }); ZendeskSDK.ZDKUserProvider.GetUserFields((result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUserProvider.GetUserFields - " + error.Description); } else { Debug.Log("ZDKUserProvider.GetUserFields Successful Callback: " + MakeResultString(result)); } }); ZendeskSDK.ZDKUserProvider.AddTags(new string[] { "someTag", "anotherTag" }, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUserProvider.AddTags - " + error.Description); } else { Debug.Log("ZDKUserProvider.AddTags Successful Callback: " + MakeResultString(result)); } }); ZendeskSDK.ZDKUserProvider.DeleteTags(new string[] { "someTag" }, (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUserProvider.DeleteTags - " + error.Description); } else { Debug.Log("ZDKUserProvider.DeleteTags Successful Callback: " + MakeResultString(result)); } }); ZendeskSDK.ZDKUserProvider.GetUserFields((result, error) => { if (error != null) { Debug.Log("ERROR: ZDKUserProvider.GetUserFields - " + error.Description); } else { Debug.Log("ZDKUserProvider.GetUserFields Successful Callback: " + MakeResultString(result)); } }); }