Ejemplo n.º 1
0
 public static LinkedInAccount Create(string userId, LinkedInAccountType personalOrOrganization)
 {
     return(new LinkedInAccount()
     {
         UserId = userId, PersonalOrOrganization = personalOrOrganization
     });
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Uses an ID to create URN for the owner based on accountType.
        /// Owner in format: urn:li:person:{linkedInUserId}
        /// Owner in format: urn:li:organization:{linkedInUserId}
        /// </summary>
        /// <param name="linkedInUserId"></param>
        /// <param name="accountType"></param>
        /// <returns></returns>
        public static LinkedInRegisterUploadRequest Create(string linkedInUserId, LinkedInAccountType accountType)
        {
            LinkedInRegisterUploadRequest request = new LinkedInRegisterUploadRequest();

            request.RegisterUploadRequest.Owner = linkedInUserId.ToOwnerInfo(accountType);
            request.RegisterUploadRequest.Recipes.Add("urn:li:digitalmediaRecipe:feedshare-video");
            request.RegisterUploadRequest.ServiceRelationships.Add(new ServiceRelationship()
            {
                Identifier       = "urn:li:userGeneratedContent",
                RelationshipType = "OWNER"
            });

            return(request);
        }
Ejemplo n.º 3
0
        public static string ToOwnerInfo(this string accountId, LinkedInAccountType personalOrOrganization)
        {
            if (personalOrOrganization.Equals(LinkedInAccountType.Personal))
            {
                return($"urn:li:person:{accountId}");
            }

            else if (personalOrOrganization.Equals(LinkedInAccountType.Organization))
            {
                return($"urn:li:organization:{accountId}");
            }

            else
            {
                throw new InvalidOperationException("Something interesting happened in AuthorExtensions...");
            }
        }