Represent a "link" to the Ipernity website.
Namespace:
IpernityNETAssembly: IpernityNET (in IpernityNET.dll) Version: 0.3.1.0 (0.3.1.0)
Syntax
C# |
---|
public class Ipernity |
Visual Basic (Declaration) |
---|
Public Class Ipernity |
Visual C++ |
---|
public ref class Ipernity |
Examples
CopyC#
static void Main(string[] args) { Ipernity ipernity = new Ipernity("apiKey", "apiSecret"); ipernity.AlwaysSign = true; // subscribe to upload events ipernity.UploadProgress += new UploadProgressEventHandler(ipernity_UploadProgress); ipernity.UploadCompleted += new UploadCompletedEventHandler(ipernity_UploadCompleted); try { // Get an account, and set the token. Account account1 = ipernity.GetAccount("token1"); Account account2 = ipernity.GetAccount("token2"); } catch(IpernityException ex) { Console.WriteLine("Ipernity returned an error : {0}", ex.Message); } //Uses account1 to make requests account1.SelectAccount(); // set the parameters DocExploreParameters parameters = new DocExploreParameters(); parameters.Count = 50; parameters.MediaType = DocumentMedia.Photo; parameters.Extra.Add(ExtraInformation.Geo); parameters.Extra.Add(ExtraInformation.Notes); parameters.ThumbnailSize = Thumbsize.OneHundred; try { // explore document IEnumerable<Document> exploreDocs = ipernity.ExploreDocGetRecent(parameters); // show found documents showDocs(exploreDocs); } catch(IpernityException ex) { Console.WriteLine("Ipernity returned an error : {0}", ex.Message); } // search for documents try { IEnumerable<Document> searchDocs = ipernity.ExploreDocGetRecent("bird", DocumentMedia.Photo); showDocs(searchDocs); } catch(IpernityException ex) { Console.WriteLine("Ipernity returned an error : {0}", ex.Message); } // search for groups try { GroupSearchParameters gparameters = new GroupSearchParameters(); gparameters.Lang = "fr"; gparameters.Text = "bird"; GroupSearchResults gresults = ipernity.GroupSearch(gparameters); showGroups(gresults.Groups); } catch(IpernityException ex) { Console.WriteLine("Ipernity returned an error : {0}", ex.Message); } // check token try { Console.WriteLine(ipernity.CheckAuthToken() ? "Token is valid" : "Token is invalid"); Console.WriteLine(ipernity.TestEcho("some text")); Console.WriteLine(ipernity.TestHello()); } catch(IpernityException ex) { Console.WriteLine("Ipernity returned an error : {0}", ex.Message); } } static void showDocs(IEnumerable<Document> docs) { foreach(Document d in docs) { Console.WriteLine("[{0}] {1} by {2}", d.Id, d.Title, d.Owner.Name); } } static void showGroups(IEnumerable<Group> groups) { foreach(Group g in groups) { Console.WriteLine("[{0}] {1}", g.Id, g.Title); } }