C# Class DrutNET.Services

enable to connect to drupal services using XML RPC
Inheritance: DrutNETBase, IConnection
显示文件 Open project: bricel/DrutNet Class Usage Examples

Public Methods

Method Description
AttachFileToNode ( string fileFieldName, int fid, int fileIndex, CookComputing.XmlRpc.XmlRpcStruct node ) : bool

Add an already upload file to cck file field, without saving the node

AttachFileToNode ( string fileFieldName, int fid, int fileIndex, int nid ) : bool

Add an already upload file to cck file field, also saving node

FileGet ( int fid ) : CookComputing.XmlRpc.XmlRpcStruct

Get file structure information

FileSave ( string filePath, string serverPath ) : string

Save file structure

FileUpload ( string filePath, string fieldName, int fileIndex, int nodeID ) : bool
FileUpload ( string filePath, string fieldName, int fileIndex, int nodeID, string serverDirectory ) : bool

Upload and attach a file to an existing NODE.

Login ( string user, string password ) : bool
Login ( string user, string password, string debugURL ) : bool
Logout ( ) : bool
NodeGet ( int nid ) : CookComputing.XmlRpc.XmlRpcStruct

Return node structure

NodeGet ( int nid, string fields ) : XmlRpcStruct
NodeSave ( XmlRpcStruct node ) : int
OGgetVocab ( int ogID ) : XmlRpcStruct
ParseField ( Enum fieldName, XmlRpcStruct nodeStruct ) : string
ParseField ( Enum fieldName, XmlRpcStruct nodeStruct, int arrayIndex ) : string
ParseField ( string fieldName, XmlRpcStruct nodeStruct ) : string
ParseFieldArray ( Enum arrayfieldName, Enum fieldName, XmlRpcStruct parentStruct ) : string
ReLogin ( ) : bool
Services ( ServicesSettings settings ) : System

Single Tone constructor

TaxonomyGetTree ( int vid ) : XmlRpcStruct[]
UserGet ( ) : XmlRpcStruct

Get logged in user information

UserGet ( int nid ) : XmlRpcStruct
ViewsGet ( string viewName, int limit ) : XmlRpcStruct[]
ViewsGet ( string viewName, int limit, object args ) : XmlRpcStruct[]
ViewsGet ( string viewName, string args ) : XmlRpcStruct[]

Private Methods

Method Description
GetHMAC ( string message, string key ) : string
GetNonce ( int length ) : string
GetUnixTimestamp ( ) : string
buildFileStruct ( string filePath, string serverPath ) : XmlRpcStruct

Create a drupal file structure

errorMessage ( string msg ) : void
handleExeption ( Exception ex ) : XmlRpcStruct
handleExeption ( Exception ex, string functionName ) : XmlRpcStruct
handleExeptionStr ( Exception ex, string functionName ) : string

Method Details

AttachFileToNode() public method

Add an already upload file to cck file field, without saving the node
public AttachFileToNode ( string fileFieldName, int fid, int fileIndex, CookComputing.XmlRpc.XmlRpcStruct node ) : bool
fileFieldName string CCK field name
fid int File ID to attach
fileIndex int file index in case of multiple file field, for single file use 0
node CookComputing.XmlRpc.XmlRpcStruct Node to attach file to (alresdy load with node load)
return bool

AttachFileToNode() public method

Add an already upload file to cck file field, also saving node
public AttachFileToNode ( string fileFieldName, int fid, int fileIndex, int nid ) : bool
fileFieldName string CCK field name
fid int File ID to attach
fileIndex int file index in case of multiple file field, for single file use 0
nid int
return bool

FileGet() public method

Get file structure information
public FileGet ( int fid ) : CookComputing.XmlRpc.XmlRpcStruct
fid int file id
return CookComputing.XmlRpc.XmlRpcStruct

FileSave() public method

Save file structure
public FileSave ( string filePath, string serverPath ) : string
filePath string
serverPath string
return string

FileUpload() public method

public FileUpload ( string filePath, string fieldName, int fileIndex, int nodeID ) : bool
filePath string
fieldName string
fileIndex int
nodeID int
return bool

FileUpload() public method

Upload and attach a file to an existing NODE.
public FileUpload ( string filePath, string fieldName, int fileIndex, int nodeID, string serverDirectory ) : bool
filePath string Local path to file
fieldName string CCK field name of the file field in the node
fileIndex int file index in case of multiple file field, for single file use 0
nodeID int Node ID to attache file to
serverDirectory string Server directory path e.g: sites/default/files/
return bool

Login() public method

public Login ( string user, string password ) : bool
user string
password string
return bool

Login() public method

public Login ( string user, string password, string debugURL ) : bool
user string
password string
debugURL string
return bool

Logout() public method

public Logout ( ) : bool
return bool

NodeGet() public method

Return node structure
public NodeGet ( int nid ) : CookComputing.XmlRpc.XmlRpcStruct
nid int Node ID
return CookComputing.XmlRpc.XmlRpcStruct

NodeGet() public method

public NodeGet ( int nid, string fields ) : XmlRpcStruct
nid int
fields string
return XmlRpcStruct

NodeSave() public method

public NodeSave ( XmlRpcStruct node ) : int
node XmlRpcStruct
return int

OGgetVocab() public method

public OGgetVocab ( int ogID ) : XmlRpcStruct
ogID int
return XmlRpcStruct

ParseField() public method

public ParseField ( Enum fieldName, XmlRpcStruct nodeStruct ) : string
fieldName Enum
nodeStruct XmlRpcStruct
return string

ParseField() public method

public ParseField ( Enum fieldName, XmlRpcStruct nodeStruct, int arrayIndex ) : string
fieldName Enum
nodeStruct XmlRpcStruct
arrayIndex int
return string

ParseField() public method

public ParseField ( string fieldName, XmlRpcStruct nodeStruct ) : string
fieldName string
nodeStruct XmlRpcStruct
return string

ParseFieldArray() public method

public ParseFieldArray ( Enum arrayfieldName, Enum fieldName, XmlRpcStruct parentStruct ) : string
arrayfieldName Enum
fieldName Enum
parentStruct XmlRpcStruct
return string

ReLogin() public method

public ReLogin ( ) : bool
return bool

Services() public method

Single Tone constructor
public Services ( ServicesSettings settings ) : System
settings ServicesSettings
return System

TaxonomyGetTree() public method

public TaxonomyGetTree ( int vid ) : XmlRpcStruct[]
vid int
return XmlRpcStruct[]

UserGet() public method

Get logged in user information
public UserGet ( ) : XmlRpcStruct
return XmlRpcStruct

UserGet() public method

public UserGet ( int nid ) : XmlRpcStruct
nid int
return XmlRpcStruct

ViewsGet() public method

public ViewsGet ( string viewName, int limit ) : XmlRpcStruct[]
viewName string
limit int
return XmlRpcStruct[]

ViewsGet() public method

public ViewsGet ( string viewName, int limit, object args ) : XmlRpcStruct[]
viewName string
limit int
args object
return XmlRpcStruct[]

ViewsGet() public method

public ViewsGet ( string viewName, string args ) : XmlRpcStruct[]
viewName string
args string
return XmlRpcStruct[]