Exemplo n.º 1
0
        private static Person ReadMyProfile(string code, string redirectUrl)
        {
            var api = CreateAPI();

            var userToken = api.OAuth2.GetAccessToken(code, redirectUrl);

            var user = new Sparkle.LinkedInNET.UserAuthorization(userToken.AccessToken);

            var fieldSelector = FieldSelector.For<Person>().WithFirstName().WithLastName().WithEmailAddress();

            var profile = api.Profiles.GetMyProfile(user, null, fieldSelector);

            return profile;
        }
Exemplo n.º 2
0
        private static Person ReadMyProfile(string code, string redirectUrl)
        {
            var api = CreateAPI();

            var userToken = api.OAuth2.GetAccessToken(code, redirectUrl);

            var user = new Sparkle.LinkedInNET.UserAuthorization(userToken.AccessToken);

            var fieldSelector = FieldSelector.For <Person>().WithFirstName().WithLastName().WithEmailAddress();

            var profile = api.Profiles.GetMyProfile(user, null, fieldSelector);

            return(profile);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="code"></param>
        /// <param name="redirectUrl"></param>
        /// <param name="linkedInClientId"></param>
        /// <param name="LinkedInClientSecret"></param>
        /// <returns></returns>
        public async Task <Person> ReadMyProfile(string code, string redirectUrl, string linkedInClientId, string linkedInClientSecret)
        {
            try
            {
                var api           = ConfigLinkedInAPI(linkedInClientId, linkedInClientSecret);
                var userToken     = api.OAuth2.GetAccessToken(code, redirectUrl);
                var user          = new Sparkle.LinkedInNET.UserAuthorization(userToken.AccessToken);
                var fieldSelector = FieldSelector.For <Person>().WithFirstName()
                                    .WithLastName()
                                    .WithEmailAddress()
                                    .WithFormattedName()
                                    .WithEmailAddress()
                                    .WithHeadline()

                                    .WithLocationName()
                                    .WithLocationCountryCode()

                                    .WithPictureUrl()
                                    .WithPublicProfileUrl()
                                    .WithSummary()
                                    .WithIndustry()

                                    .WithPositions()
                                    .WithPositionsSummary()
                                    .WithThreeCurrentPositions()
                                    .WithThreePastPositions()

                                    .WithProposalComments()
                                    .WithAssociations()
                                    .WithInterests()
                                    .WithLanguageId()
                                    .WithLanguageName()
                                    .WithLanguageProficiency()
                                    .WithCertifications()
                                    .WithEducations()
                                    .WithFullVolunteer()
                                    .WithPatents();
                var profile = await api.Profiles.GetMyProfileAsync(user, null, fieldSelector);

                return(profile);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Executes a custom GET API query.
        /// </summary>
        /// <param name="path">The URL path and query (ex: /v1/companies?whatnot=stuff).</param>
        /// <param name="user">The user access token.</param>
        /// <returns>The resulting JSON response.</returns>
        public string RawGetJsonQuery(string path, UserAuthorization user)
        {
            var context = new RequestContext();

            context.UserAuthorization = user;
            context.Method            = "GET";
            context.UrlPath           = path;

            if (!this.ExecuteQuery(context))
            {
                this.HandleJsonErrorResponse(context);
            }

            var result = this.HandleJsonRawResponse(context);

            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Executes a custom POST API query.
        /// </summary>
        /// <param name="path">The URL path and query (ex: /v1/companies?whatnot=stuff).</param>
        /// <param name="user">The user access token.</param>
        /// <param name="content">The JSON content to POST.</param>
        /// <returns>The resulting JSON response.</returns>
        public string RawPostJsonQuery(string path, string content, UserAuthorization user)
        {
            var context = new RequestContext();

            context.UserAuthorization = user;
            context.Method            = "POST";
            context.UrlPath           = path;
            this.CreateJsonPostStream(context, content);

            if (!this.ExecuteQuery(context))
            {
                this.HandleJsonErrorResponse(context);
            }

            var result = this.HandleJsonRawResponse(context);

            return(result);
        }