Represent a document

Namespace:  IpernityNET.IpernityObjects
Assembly:  IpernityNET (in IpernityNET.dll) Version: 0.3.1.0 (0.3.1.0)

Syntax

C#
public class Document : IpernityObject
Visual Basic (Declaration)
Public Class Document _
	Inherits IpernityObject
Visual C++
public ref class Document : public IpernityObject

Examples

CopyC#
static void Main(string[] args)
{
    Ipernity ipernity = new Ipernity("apiKey", "apiSecret");
    ipernity.AlwaysSign = true;
    //Create a new document and configure it
    Document document = new Document(123456);
    ipernity.ConfigureIpernityObject(document);
    try
    {
        // get document informations with tags, geo localisation and notes
        document.Get(new ExtraInformation[] {ExtraInformation.Tags,
           ExtraInformation.Geo, ExtraInformation.Notes});
        Console.WriteLine("{0} by {1}", document.Title, document.Owner.Name);
        // get document containers
        Containers cont = document.GetContainers();
        // get the document context, with 2 previous document and 6 next documents
        DocumentContext context = document.GetContext(2, 6, Thumbsize.OneHundred);
        // get document faves
        IEnumerable>Fave< faves = document.GetFaves();
        // get document medias (originale file, all thumbnails and medias)
        document.GetMedias();
        // get document permissions
        document.GetPerms();
        // get document visitors
        IEnumerable>Visitor< v = document.GetVisitors();
        // Add a comment to the document
        document.CommentsAdd("Commentaire");
        // get all comments
        IEnumerable>Comment< comments = document.CommentsGetList();
        Comment comment = comments.First();
        // edit a comment
        comment.Edit("Plop");
        // reply to a comment
        comment.Reply("Reponse");
        // delete a comment
        comment.Delete();
        Note note = new Note("Test note", 100, 100, 100, 100);
        // add a note
        document.NotesAdd(note);
        note = document.Notes.First().Value;
        // edit a note
        note.Edit("Test note edit", 50, 50, 50, 50);
        // delete a note
        note.Delete();
        // add tags and members to the document
        document.TagsAdd("night,test tag", "Galad");
        // create parameters to remove members from the document
        TagsEditParameters tp = new TagsEditParameters();
        tp.RemoveMembers = true;
        // edit the document with the parameters
        document.TagsEdit(tp);
        // Add a member to the document (
        document.TagsAdd(null, "Galad");
        // get the tag list
        document.TagsGetList();
        // search for the member named "Galad" and remove him from the document
        document.TagsRemove(document.Members.First(m => m.Value.MemberUser.Name == "Galad").Value);
        // set the document description and title
        document.Set("Test", "description test");
        // set the document license
        document.SetLicense(License.Attribution);
        // create parameters to edit the permissions
        Visibility vi = new Visibility();
        vi.Share = PermissionShare.Family;
        CommentPermissions cp = new CommentPermissions();
        cp.Comment = PermissionPeople.Friends;
        cp.Tag = PermissionPeople.Family;
        cp.TagMe = PermissionPeople.Contacts;
        // edit the permissions
        document.SetPerms(vi, cp);
        // delete the document
        document.Delete();
    }                
    catch (IpernityException ex) 
    {
        Console.WriteLine("Ipernity returned an error : {0}", ex.Message);
    }
}

Inheritance Hierarchy

System..::.Object
  IpernityNET.IpernityObjects..::.IpernityObject
    IpernityNET.IpernityObjects..::.Document

See Also