xref: /plugin/stdokuwikiconnector/README.md (revision 15ad96519a17b8ab8aef4e68b4105ba3111a2ed8)
1# DokuWikiConnector
2[![Release](https://img.shields.io/github/release/PetersSharp/DokuWikiConnector.svg?style=flat)](https://github.com/PetersSharp/DokuWikiConnector/releases/latest)
3[![Issues](https://img.shields.io/github/issues/PetersSharp/stCoCServer.svg?style=flat)](https://github.com/PetersSharp/stCoCServer/issues)
4[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/PetersSharp/stCoCServer/blob/master/LICENSE)
5
6####.NET RPC-XML DokuWiki Connector API & Auth manager
7
8 this part of stCoCServer, see [stCoCServer](https://github.com/PetersSharp/stCoCServer)
9
10####Features:
11
12* API .NET library allows to XML-RPC connect to remote DokuWiki.
13* Support all DokuWiki API operations.
14* Local DokuWiki file credential authenticate managements.
15
16* DokuWikiConnector [source](https://github.com/PetersSharp/stCoCServer/tree/master/stCoCServer/stExtLib/stDokuWikiConnector-dll)
17* DokuWikiConnector [Test suite](https://github.com/PetersSharp/stCoCServer/tree/master/stCoCServer/stTest/TestDokuWikiConnector)
18* DokuWikiConnector [Method Documentation](https://github.com/PetersSharp/stCoCServer/tree/master/stCoCServer/stExtLib/stDokuWikiConnector-dll/Doc)
19* Plugins publish   [dokuwiki.org](https://www.dokuwiki.org/plugins:stdokuwikiconnector?s[]=dokuwikiconnector)
20
21####Example use stDokuWiki.Connector:
22
23```csharp
24
25using stDokuWiki.Connector;
26using stDokuWiki.Data;
27
28    RpcXml xml = new RpcXml("http://you-dokuwiki-url.org/", "userquest", "userquest");
29    XMLMethodPageList dokuList = xml.DokuPageList("wiki:") as XMLMethodPageList;
30    foreach (var items in dokuList.Params.Param.Value.Array.Data.Value)
31    {
32        foreach (var item in items.Struct.Member)
33        {
34            Console.WriteLine(
35              item.Name +
36              ((string.IsNullOrWhiteSpace(item.Value.Int)) ? " " : " [" + item.Value.Int + "] ") +
37              ((string.IsNullOrWhiteSpace(item.Value.String)) ? "" : item.Value.String)
38            );
39        }
40    }
41
42```
43
44####Example use stDokuWiki.AuthManager:
45
46```csharp
47
48using stDokuWiki.AuthManager
49using stDokuWiki.Data;
50
51    DokuAuthManager dam;
52    try
53    {
54       dam = new DokuAuthManager("/path/to/dokuwiki/root/dir","mygroup");
55
56       List<DokuAuthUser> uadd = new List<DokuAuthUser>()
57       {
58          new DokuAuthUser() { Login = "userLogin1", Password = "pwd1234", Name = "Nikolas", Email = "Nikolas@nomail.com", Group = "personalGroup"},
59          new DokuAuthUser() { ... },
60       };
61       List<DokuAuthUser> udel = new List<DokuAuthUser>()
62       {
63          new DokuAuthUser() { Login = "userLogin2" },
64          new DokuAuthUser() { ... },
65       };
66
67       dam.UserAdd(uadd);
68       dam.UserDelete(udel);
69       dam.AuthSave();
70
71       DokuAuthUser dau = dam.UserGet("Nikolas");
72       if (dau != null)
73       {
74          Console.WriteLine(
75             dau.Name + " : " + dau.Email
76          );
77       }
78    }
79    catch (RpcXmlException e)
80    {
81        Console.WriteLine("[" + e.errcode + "] " +e.Message); return;
82    }
83    catch (Exception e)
84    {
85        Console.WriteLine(e.Message); return;
86    }
87
88```
89