top |
EQProcess _eq = new EQProcess(yourAccessKey, yourSecretKey); _eq.SessionService.Create(yourUsername, yourPassword, (Session session, EQException ex) => // onComplete { if (ex == null) { _eq.UserService.ListCollections(ListCollectionsContext, PagingParameters, (ListIn this example after the SessionService.Create command has completeted, a UserService.ListCollections command will be executed for that logged in user. All of the commands have been grouped together into services... these services are as follows:collections, bool hasMore, EQException ex) => // onComplete { // do something with the collections returned } ); } else { HandleException("SessionService.Create", ex); } } );
• SessionService | • UserService | • CollectionService | • ContentFileService | |||
• PostService | • UploadService | • InvitationService | • RequestService | |||
• MiscService |
As the clients evolved terminology diverged from the backend database (or sometimes, the backend is a little more generic). Here is a list of equivalent objects in the system.
Backend | Client | ||
---|---|---|---|
User | Account | ||
Collection | Channel | ||
ContentFile | Video | ||
Post | Comment |
Users own (or follow, or contribute to) Collections. Collections have ContentFiles. ContentFiles have Posts. Posts have Posts (but only one level deep). The synchronous, or blocking, functions will throw an exception if an error occurs. The asynchronous, or non-blocking, functions return an EQException parameter to the "onComplete" action block. If the EQException parameter is not null, then an error has occurred.
The souce code for the SDK and an example project can be downloaded at eqnetwork-csharp-source.zip.
top |
public class Session { public User User { get; set; } public Guid? SessionGuid { get; set; } public string ExpiredVersion { get; set; } public int? InvitationCount { get; set; } public int? NotificationCount { get; set; } public int? RequestCount { get; set; } public List<int> Following { get; set; } public List<int> FollowingUser { get; set; } public int? MyCollectionCount { get; set; } public long? MyStorage { get; set; } }
Returns a partially filled in Session object with InvitationCount, NotificationCount and RequestCount. These are the number of invitations, the number of notifications, and the number requests that have been made to this user.
Note: If the session has expired an error would be returned.
TODO: Return everything a Session_Create does
top |
In many responses you may get one (or a list of) User objects. A User object is a mix of user attributes and computed user values.
public class User { // fields that can be set on the backend by the SDK public string Username { get; set; } public string Password { get; set; } public string Company { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public DateTime? DateOfBirth { get; set; } public string Gender { get; set; } public string Phone { get; set; } public string Carrier { get; set; } // social info public bool? IsSocialOn { get; set; } public long? FbBits { get; set; } public long? TwitterBits { get; set; } // facebook public bool? FbIsLinked { get; private set; } public string FacebookId { get; private set; } public string FbAccessToken { get; private set; } public DateTime FbExpirationDate { get; private set; } // twitter public bool? TwitterIsLinked { get; private set; } public string TwitterUserId { get; private set; } public string TwitterScreenName { get; private set; } public string TwitterOAuthToken { get; private set; } public string TwitterOAuthTokenSecret { get; private set; } public FileUploadSpec Icon { private get; set; } // only one way serialization // not writeable, but returned as computed fields public int? UserId { get; private set; } public bool? Active { get; private set; } public DateTime? Created { get; private set; } public DateTime? Modified { get; private set; } public int? UserTypeId { get; private set; } public string IconFilename { get; private set; } public bool? Verified { get; private set; } public Guid? ConfirmationGuid { get; private set; } public string AgreementAccepted { get; private set; } public DateTime? CreatedOn { get; private set; } public int? MembershipTypeId { get; private set; } public DateTime? MembershipExpiration { get; private set; } public long MembershipStorageLevelExpires { get; private set; } public long MembershipStorageLevel { get; private set; } public long MembershipStorageUsed { get; private set; } public DateTime? LastNotificationEmail { get; private set; } public DateTime? CurrentNotificationEmail { get; private set; } public long? MembershipStorageLevelEarned { get; private set; } // helper enum conversion public Db.UserType UserType { get { return (UserTypeId == null) ? Db.UserType.Unknown : (Db.UserType)UserTypeId; } set { UserTypeId = (int)value; } } public Db.MembershipType MembershipType { get { return (MembershipTypeId == null) ? Db.MembershipType.Unknown : (Db.MembershipType)MembershipTypeId; } set { MembershipTypeId = (int)value; } } // calculated results from the backend public int? UnviewedCount { get; private set; } public bool? FollowedBy { get; private set; } public bool? Blocked { get; private set; } public bool? Following { get; private set; } public int? Followers { get; private set; } public int? ChannelFollowers { get; private set; } public string UserTitle { get; private set; } }
You will also be returned a session object. With this you are essentially already logged in.
ListCollectionsContext listCollectionsContext,
PagingParameters pagingParameters);
public class ListCollectionsContext
{
public enum SortOrder
{
Alpha, Recent, Popularity, Comments,
};
public SearchFilters SearchFilters { get; set; }
public bool? IncludeEmpty { get; set; }
public bool? includeUsers { get; set; }
public bool? NotificationCountInSort { private get; set; }
public List<Db.User_CollectionType> User_CollectionTypes { get; set; }
}
IncludeEmpty will include Collections that have no ContentFiles
includeUsers when true the search results will include Collection objects that represent matching Users.
NotificationCountInSort will cause Collections to be first sorted by NotificationCount (currently used in the Watch section)
User_CollectionTypes if specified will limit the results to the Collections of the specified type of relationship (owner, follower, and/or contributor)
PagingParameters the parameters to specify the size, offset and sort order of the returned results (see PagingParameters)
PagingParameters the parameters to specify the size, offset and sort order of the returned results (see PagingParameters)
public class ListUsersContext
{
public enum SortOrder
{
Alpha, Recent,
};
public SearchFilters SearchFilters { get; set; }
public bool? Following { get; set; }
public bool? Blocked { get; set; }
public bool? IncludeChannelFollowers { get; set; }
public bool? ShowInverse { get; set; }
public int? UserId { get; set; }
}
}
Following only include users that are following
ShowInverse will show, for example, who is following a user instead of who a user is following.
Blocked only include users that are blocked
IncludeChannelFollowers only include users that are following the logged in user
PagingParameters the parameters to specify the size, offset and sort order of the returned results (see PagingParameters)
public class AddUserRelationshipContext
{
public int? Other_UserId { get; set; }
public bool? Following { get; set; }
public bool? Blocked { get; set; }
}
Following if set to 'Y' will follow the other user. If set to 'N' will "unfollow" the other user.
Block if set to 'Y' will block the other user. If set to 'N' will "unblock" the other user.
ListContentFilesContext listContentFilesContext,
PagingParameters pagingParameters);
PagingParameters the parameters to specify the size, offset and sort order of the returned results (see PagingParameters)
public class PurchaseContext { public enum PaymentTypeNames { AlreadyOwn, Apple, Simulator, PayPal, } public string ProductCode { get; set; } public string UUID { get; set; } public string PaymentType { private get; set; } public string ReceiptData { private get; set; } public float Price { private get; set; } public string PriceLocale { private get; set; } public string CurrencyCode { private get; set; } public string CountryCode { private get; set; } public bool? IsSandbox { private get; set; } }
public class PurchaseTransaction { public int? PurchaseTransactionId { get; private set; } public List<Product> Products { get; private set; } }
PurchaseContext is the information about the purchase
Response is a list of Product objects.
top |
In responses you may get one (or a list of) Collection objects. A Collection object is a mix of collection attributes and calculated collection values. It will look like this:
public class Collection { public string Name { get; set; } public string Description { get; set; } public Db.CollectionType CollectionType { get; set; } public string IconFilename { get; set; } public List<string> CategoryList { get; set; } public FileUploadSpec Icon { private get; set; } // computed fields public int? CollectionId { get; private set; } public bool? Active { get; private set; } public DateTime? Created { get; private set; } public DateTime? Modified { get; private set; } public float SortBy { get; set; } public int User_CollectionTypeId { get; set; } public int FollowersCollection { get; set; } public int FollowersUser { get; set; } public int OwnerUserId { get; set; } public string OwnerUserIconFilename { get; set; } public string OwnerUserTitle { get; set; } public int ContentFileCount { get; set; } public int UnviewedCount { get; set; } public DateTime MostRecent { get; set; } public int NotificationCount { get; set; } public int ViewCount { get; set; } public int SortTypeId { get; set; } public int NumberOfComments { get; set; } }
Note: A Collection can have only one Owner. A Collection can have multiple Followers and/or Contributors. A Follower will receive notifications about changes in a Collection and the Collection will appear in the Followers Watch list. A Contributor is like a Follower, but additionally can add ContentFiles to this Collection.
public class ListContentFilesContext { public enum SortByStrings { Alpha, Recent, Popularity, Comments, }; public enum ColumnSetStrings { Normal, Lean, }; public SearchFilters SearchFilters { get; set; } public bool SearchMatchOnly { get; set; } public int? Current_ContentFileId { get; set; } public int? GetNext_Offset { get; set; } public string ColumnSet { get; set; } }
CollectionId is the unique identifier of the Collection.
User_CollectionTypeId defines the relationship being added between the user and the collection (e.g. follower or contributor).
Note: To remove this relationship, call CollectionService.Delete.
Action the action to share. ("share", "follow", "create", "like")
Exclude a specific SocialService to exclude from this action.
Force indicates if the action is to be forced through regardless of social settings
top |
public class ContentFile { public int CollectionId { get; set; } public string Name { get; set; } public string Description { get; set; } public string VideoFilename { get; set; } public string ThumbnailFilename { get; set; } public List<string> CategoryList { get; set; } public FileUploadSpec Video { private get; set; } // only one way serialization public FileUploadSpec ThumbnailFile { private get; set; } // only one way serialization public int? ContentFileId { get; private set; } public bool? Active { get; private set; } public DateTime? Created { get; private set; } public DateTime? Modified { get; private set; } public float? SortBy { get; set; } public string MuxKey { get; set; } public int? UserId { get; set; } public string Keywords { get; set; } public int? ContentFileTypeId { get; set; } public int? DeliveryRequestId { get; set; } public string JdiResult { get; set; } public bool? IsAdult { get; set; } public int? ViewCount { get; set; } public string OriginalUrl { get; set; } public long? OriginalFilesize { get; set; } public string DownloadUrl { get; set; } public int? Width { get; set; } public int? Height { get; set; } public float? Duration { get; set; } public string Thumbnail { get; set; } public bool? IsFlashVideo { get; set; } public string Filename { get; set; } public string CurrentMuxKey { get; set; } }
Note: A ContentFile can belong to only one collection.
ContentFile ContentFileService.Get(string filename);
Filename is as system generated unique filename for the ContentFile.
Response is the ContentFile object of the requested ContentFile (see ContentFile Object).
top |
public class Post { public string Title { get; set; } public string Message { get; set; } public int? CommentOn_PostId { get; set; } public int? CommentOn_UserId { get; set; } public int? CommentOn_ContentFileId { get; set; } public Db.PostType PostType { get; set; } public int? PostId { get; private set; } public bool? Active { get; private set; } public DateTime? Created { get; private set; } public DateTime? Modified { get; private set; } public int UserId { get; set; } public int Child_PostId { get; set; } public string UserName { get; set; } public string UserTitle { get; set; } public int Level { get; set; } }
top |
public void Upload_Controller_Test() { ContentFile contentFile = new ContentFile(); contentFile.Name = "SmallOne"; contentFile.CategoryList = new List<string>() { "Sports", "Music" }; contentFile.CollectionId = 262; DateTime start = DateTime.Now; Upload_Controller upload_Controller = new Upload_Controller(_eq); upload_Controller.Start(contentFile.Name, @"c:\projects\SmallOne.mp4", (UploadContext uploadContext, UploadContext.UploadState uploadState) => // onStateChange { if (uploadState == UploadContext.UploadState.CREATE_CONTENTFILE) { uploadContext.ContentFile = contentFile; } if (uploadState == UploadContext.UploadState.FINISHED) { upload_Controller.Cancel(); _message = "success"; } }, (EQException ex) => // onError { _message = ex.Message; } ); }
top |
public class InvitationContext { int? collectionId; int? user_CollectionTypeId; int? other_UserId; bool? user_UserFollowing; string emails; string message; string sendTo_FacebookIds; string sendTo_TwitterIds; string sendTo_UserIds; string sendTo_SmsPhones; bool? sentClientSide; string data; }
top |
public class RequestContext { public int? UserId { get; set; } public string Domain { get; set; } public int? CollectionId { get; set; } public Guid? CollectionGuid { get; set; } public Guid? CollectionRequestGuid { get; set; } public Db.User_CollectionType? User_CollectionType { get; set; } public bool? User_UserFollowing { get; set; } public string Message { get; set; } }
top |
public class Hashtag { public string Name { get; set; } public int? NumberOfContentFiles { get; set; } public int? HashtagId { get; private set; } public bool? Active { get; private set; } public DateTime? Created { get; private set; } }
Categories are an attribute of ContentFiles. They are stored in the content file record as a comma delimited string. The following is the only Category function.
public class Category { public string Name { get; set; } public string Description { get; set; } public Db.CategoryType CategoryType { get; set; } // not writeable public int? CategoryId { get; private set; } public bool? Active { get; private set; } public DateTime? Created { get; private set; } public DateTime? Modified { get; private set; } }
top |
As a general overview on searching, typically several searches are performed. A search is performed on all content files (ContentFileService.Search), this gives you results that show up in the "top row". Additionally a search is performed on the collections and content files (Search_CollectionsAndContentFiles). This is used to retrieve a list of collection that match (or whose content files match) the search criteria.
Then, when one of these collections is viewed, the content files in that collection are retrieved by listing the content files (Collection_ListContentFiles), specifying the search criteria. This will cause *all* content files for that collection to be returned, but the ones that match the search criteria are at the front of the list.
The following are the major Search functions.
ContentFileService.Search will search content files. CollectionService.Search will search collections and their content files.
Other functions that utilize search criteria parameters are:
UserService.ListCollections will list a users collections. UserService.ListUsers will list a users relationships with other users. CollectionService.ListContentFiles will list a collections ContentFiles.
The following are the parameters that make up the "search criteria" in a request.
Search is a search term that will match the names, descriptions, and categories of an item.
Categories will filter based on a comma delimited list of Categories (e.g. Sports, Golf).
HasPrefix will filter the results by the first
letter of the items name (e.g. A, B, C) will limit the list to items
whose name starts with the letter A, B, or C).
IncludeAdult filter to include content flagged as adult.
top |
A MuxKey contains information on the processing status and the playback versions of a movie file that are available. Currently the four playback versions are 3G, WiFi, WebM, and 720p. Each playback version is associated with a "DeliveryRequestId". An example of a MuxKey is:
M2960,13466~3G~3,13467~WiFi~3,13468~WebM~3,13469~720p~4
M2960 is the unique MuxKey identifier.
13466~3G~3 is the 3G asset with a DeliveryRequestId of 13466 and a successful completion status.
13467~WiFi~3 is the WiFi asset with a DeliveryRequestId of 13467 and a successful completion status.
13468~WebM~3 is the WebM asset with a DeliveryRequestId of 13468 and a successful completion status.
13469~720p~4 is the 720p asset with a DeliveryRequestId of 13469 and a failed completion status.
The DeliveryRequestId is the token used to retrieve thumbnail and movie urls. Note: The 3G asset DeliveryRequestId is used to retrieve thumbnails.
Currently the valid asset types are:
3G used for the iPhone (low bandwidth)
WiFi used for the iPhone (high bandwidth)
WebM used for desktop browsers
720p used on all platforms (very high bandwidth)
The completion status is as follows:
-1: waiting on another process
0: not yet started
1: about to start
2: in progress
3: finished (success)
4: finished (failed)
Finally, a MuxKey can also contain information about the download status of an asset:
M2962,-1~3G~2,-1~WiFi~2,-1~WebM~2,-1~720p~2,-1~(Downloading 12.3M of 16.5M)~2
M2962,13474~3G~2,13475~WiFi~2,13476~WebM~2,13477~720p~4,-1~(Downloading Complete)~3
Notes: 720p will only succeed only if the source movie is high-def. The 3G asset can be used on Safari, the Wifi asset is used on IE, Chrome, and Safari. The WebM asset is pretty much only used on Firefox, however Chrome could use the WebM asset as well if the WiFi asset wasn't generated yet.
A movie url is created by combining a DeliveryRequestId and a subType.
http://delivery.eqnetwork.com/service/store/get/?drid=13474&subType=3g
drid=13474 is a DeliveryRequestId of 13474
subType=3g specifies a 3g movie asset
In most cases the subType is the same (or similar) to the asset type returned with the DeliveryRequestId in the MuxKey:
3G: use 3g for subType
WiFi: use iphonewifi for subType
WebM: use webm for subType
720p: use 720p for subType
A movie preview url is created by combining a DeliveryRequestId and a subType.
http://delivery.eqnetwork.com/service/store/get/?drid=13474&subType=mpx
drid=13474 is the 3G asset DeliveryRequestId
subType=mpx specifies that the returned movie should be a 30 second preview.
A thumbnail is created by combining a DeliveryRequestId and a subType.
http://delivery.eqnetwork.com/icons/mgen/overplayThumbnail.ms?drid=13474&subType=ljpg&w=120&h=90&o=0
drid=13474 is the 3G asset DeliveryRequestId
subType=ljpg specifies that the returned thumbnail be a jpg.
w=120 is the maximum width for the retrieved image.
h=90 is the maximum height for the retrieved image.
o=0 specifies if a "play button" image is overlayed (0: no, 1: yes)
A 20 frame animated gif thumbnail is created by combining a DeliveryRequestId and a subType.
http://delivery.eqnetwork.com/service/store/get/?drid=13474&subType=gif
drid=13474 is the 3G asset DeliveryRequestId
subType=gif specifies that the returned thumbnail be an animated gif.
Note: This will generate a 90 x 90 size thumbnail.
The user icons filename is available as an attribute called IconFilename on a User node. Also, it is sometimes available in other nodes and called OwnerUserIconFilename.
The url to retrieve a user icon is as follows:
http://delivery.eqnetwork.com/icons/mgen/scaleImage.ms?file=UserIcons/eedda75b-0b35-425c-bf72-9effa931907e.tiff&w=80&h=80
file=UserIcons/eedda75b-0b35-425c-bf72-9effa931907e.tiff is the path to the IconFilename
(eedda75b-0b35-425c-bf72-9effa931907e.tiff is the IconFilename in this example).
w=80 is the maximum width for the retrieved image.
h=80 is the maximum height for the retrieved image.
The collection icons filename is available as an attribute called IconFilename on a Collection object.
The url to retrieve a collection icon is as follows:
http://delivery.eqnetwork.com/icons/mgen/scaleImage.ms?file=CollectionIcons/2b6a6503-db21-4a34-a496-1f488de5c5c3.jpg&w=80&h=80
file=CollectionIcons/2b6a6503-db21-4a34-a496-1f488de5c5c3.jpg is the path to the IconFilename
(2b6a6503-db21-4a34-a496-1f488de5c5c3.jpg is the IconFilename in this example).
w=80 is the maximum width for the retrieved image.
h=80 is the maximum height for the retrieved image.
public class SearchFilters { public string Search { get; set; } public List<string> Categories { get; set; } public string HasPrefix { get; set; } }
public class PagingParameters { public string OrderBy { get; set; } public int? Page { get; set; } public int? PageSize { get; set; } // returned by API functions public bool hasMore { get; set; } public PagingParameters(); public PagingParameters(int pageSize, string orderBy); public void NextPage(); }
public enum PostType { Unknown, ContentFileComment, WallComment, PostComment, }
public enum MembershipType { Unknown, BasicQuota, }
public enum InvitationType { Unknown, FollowCollection, FollowUser, }
public enum RequestType { Unknown, FollowCollection, FollowUser, }
public enum SocialService { Unknown, Facebook, Twitter, }
public enum SocialSearchType { SearchAll = 0, SearchEqMembers = 1 << 0, SearchNonEqMembers = 1 << 1 }
public enum CollectionType { Unknown, User, Private, }
public enum User_CollectionType { Unknown, Owner, Follower, Contributor, ViewInfoOnly, }
public enum SocialBits { VideosIWatch = 1, VideosIUpload = 2, VideosICommentOn = 4, VideosIShare = 8, ChannelsIFollow = 16, ChannelsICreate = 32, ChannelsIShare = 64, UsersIFollow = 128, VideosILike = 256, ChannelsILike = 512, UsersILike = 1024, VideosIFavorite = 2048, }