Represent an Ipernity account
Namespace:
IpernityNET.IpernityObjectsAssembly: IpernityNET (in IpernityNET.dll) Version: 0.3.1.0 (0.3.1.0)
Syntax
C# |
---|
public class Account : IpernityObject |
Visual Basic (Declaration) |
---|
Public Class Account _ Inherits IpernityObject |
Visual C++ |
---|
public ref class Account : public IpernityObject |
Examples
CopyC#
int ticket; static void Main(string[] args) { Ipernity ipernity = new Ipernity("apiKey", "apiSecret"); ipernity.AlwaysSign = true; ipernity.UploadProgress += new UploadProgressEventHandler(ipernity_UploadProgress); ipernity.UploadCompleted += new UploadCompletedEventHandler(ipernity_UploadCompleted); try { Account account = ipernity.AuthGetAccount("token"); // upload a file ticket = -1; account.UploadFile("a photo.jpg", "A photo", "This is a photo", "photo,sample,test,upload"); // check ticket do { TicketResults tr = acc.UploadCheckTickets(ticket); // wait until eta is elapsed System.Threading.Thread.Sleep(tr.Eta * 1000); } while (tr.Eta > 0); if(tr.CountDone > 0) { //Get the uploaded document; Document doc = tr.Eta.First(ti => ti.Done).Document; // create an album Album album = account.AlbumCreate("An album", "This is an album", doc.Id, PermissionPeople.Friends); /// } // network autocomplete NetworkAutocompleteResult networkResult = account.NetworkAutocomplete("pau", Relation.Friend); foreach(User u in networkResult.Users) { Console.WriteLine(u.Name); } } catch(IpernityException ex) { Console.WriteLine("Ipernity returned an error : {0}", ex.Message); } } static void ipernity_UploadCompleted(object sender, UploadCompletedEventArgs e) { if (e.Cancelled) { if (e.Error == null) Console.WriteLine("Cancelled by user"); else Console.WriteLine("Error : {0}. {1}", e.Error.ErrorCode, e.Error.ErrorMessage); } else { Console.WriteLine("Done. Ticket : {0}", e.Ticket); ticket = e.Ticket; } } static void ipernity_UploadProgress(object sender, UploadProgressEventArgs e) { Console.Clear(); Console.WriteLine("Envoi du fichier..."); //Console.WriteLine("Fichier {0}/{1}", count, files.Count); Console.WriteLine(e.Filepath); Console.WriteLine("{0} kB / {1} kB", (int)(e.TotalBytesSent/1024), (int)(e.TotalBytes/1024)); Console.WriteLine("{0}%", e.ProgressPercent); }
Inheritance Hierarchy
System..::.Object
IpernityNET.IpernityObjects..::.IpernityObject
IpernityNET.IpernityObjects..::.Account
IpernityNET.IpernityObjects..::.IpernityObject
IpernityNET.IpernityObjects..::.Account