-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArticleKeywordsExamples.cs
48 lines (42 loc) · 1.49 KB
/
ArticleKeywordsExamples.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ParatureSDK;
using ParatureSDK.ApiHandler;
namespace Exercises
{
public static class ArticleKeywordsExamples
{
/// <summary>
/// Add keywords to an article that we're assuming does not already have articles
/// </summary>
/// <param name="articleID"></param>
/// <param name="keywords"></param>
/// <param name="creds"></param>
/// <returns></returns>
public static bool AddKeywords(long articleId, List<string> keywords, ParaCredentials creds)
{
//Get the article
var article = ParatureSDK.ApiHandler.Article.GetDetails(articleId, creds);
//Set the keywords
article.Keywords = String.Join(",", keywords);
//Perform the update
var response = ParatureSDK.ApiHandler.Article.Update(article, creds);
//Verify response
return !response.HasException;
}
/// <summary>
/// Get the keywords from an article
/// </summary>
/// <param name="articleID"></param>
/// <param name="creds"></param>
/// <returns></returns>
public static List<string> GetKeywords(long articleId, ParaCredentials creds)
{
//Get the article
var article = ParatureSDK.ApiHandler.Article.GetDetails(articleId, creds);
return article.Keywords.Split(',').ToList();
}
}
}