/// <summary> /// Returns the XML RPC interface version of the remote Wiki. /// This is DokuWiki implementation specific and independent of the supported /// standard API version returned by wiki.getRPCVersionSupported /// </summary> /// <returns>Int32</returns> public int DokuXMLRPCAPIVersion() { try { this._CheckAuth(); Data.XMLMethodGetInt rv = this.Get <Data.XMLMethodGetInt>( XmlRpcRequest.dokuwiki_getXMLRPCAPIVersion ); int id; if ( (rv == null) || (!Int32.TryParse(rv.Params.Param.Value.Int, out id)) ) { throw new ArgumentNullException(); } return(id); } catch (Exception e) { throw new RpcXmlException( className + e.Message, 5022 ); } }
/// <summary> /// Deletes a file. Fails if the file is still referenced from any page in the wiki. /// </summary> /// <param name="id">Attachment id (file name)</param> /// <returns>Bolean</returns> public bool DokuAttachmentRemove(string id) { try { this._CheckAuth(); Data.XMLMethodGetInt ad = this.Get <Data.XMLMethodGetInt>( XmlRpcRequest.wiki_deleteAttachment, id ); if (ad == null) { throw new ArgumentNullException(); } int result = 0; if (Int32.TryParse(ad.Params.Param.Value.Int, out result)) { return((result == 0) ? true : false); } throw new ArgumentNullException(); } catch (Exception e) { throw new RpcXmlException( className + e.Message, 5029 ); } }
/// <summary> /// Returns the current time at the remote wiki server as DateTime. /// </summary> /// <returns>DateTime</returns> public DateTime DokuGetDateTime() { try { this._CheckAuth(); Data.XMLMethodGetInt rv = this.Get <Data.XMLMethodGetInt>( XmlRpcRequest.dokuwiki_getTime ); int id; if ( (rv == null) || (!Int32.TryParse(rv.Params.Param.Value.Int, out id)) ) { throw new ArgumentNullException(); } return(id.GetDateTimeFromUnixTimeStamp()); } catch (Exception e) { throw new RpcXmlException( className + e.Message, 5020 ); } }
/// <summary> /// Uploads a file as a given media id, source as Base64 encoded. /// </summary> /// <param name="id">Attachment id (file name)</param> /// <param name="base64">source string - Base64 encoded</param> /// <param name="owr"></param> /// <returns></returns> public bool DokuAttachmentPut(string id, string base64, bool owr = false) { try { this._CheckAuth(); id = ((id.Contains(":")) ? id : (((string.IsNullOrWhiteSpace(this._namespace)) ? _defaultns : this._namespace) + id) ); Data.XMLMethodGetInt ad = this.Get <Data.XMLMethodGetInt>( XmlRpcRequest.wiki_putAttachment, id, base64, "" ); if (ad == null) { throw new ArgumentNullException(); } int result = 0; if (Int32.TryParse(ad.Params.Param.Value.Int, out result)) { return((result == 0) ? true : false); } throw new ArgumentNullException(); } catch (Exception e) { throw new RpcXmlException( className + e.Message, 5030 ); } }