Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves an <see cref="Person"/> by it's <paramref name="idPart"/>.
        /// </summary>
        /// <param name="idPart">The identifying part.</param>
        /// <param name="fields">The <see cref="ProfileField"/>s  which to load into the <see cref="Person"/>.</param>
        /// <returns>Returns the <see cref="Person"/> with the specified <paramref name="fields"/> loaded.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="idPart"/> or <paramref name="fields"/> is null.</exception>
        /// <exception cref="LinkedINHttpResponseException">Thrown when the an unexepcted response was returned from LinkedIN.</exception>
        /// <exception cref="LinkedINUnauthorizedException">Thrown when an request was made to an protected resource without the proper authorization.</exception>
        protected Person RetrieveProfileById(string idPart, IEnumerable <ProfileField> fields)
        {
            // validate arguments
            if (string.IsNullOrEmpty(idPart))
            {
                throw new ArgumentNullException("idPart");
            }
            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }

            // create the request
            var request = new RestRequest("people/" + idPart + FieldSelector.ToFieldSelector(fields));

            // execute the request
            return(ExecuteRequest <Person>(request));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a list of <see cref="Connections"/> for the member identified by <paramref name="idPart"/>.
        /// </summary>
        /// <param name="idPart">The identifying part.</param>
        /// <param name="fields">The <see cref="ProfileField"/>s  which to load into the connections.</param>
        /// <param name="start">Starting location within the result set for paginated returns. Ranges are specified with a starting index and a number of results (count) to return. The default value for this parameter is 0.</param>
        /// <param name="count">Ranges are specified with a starting index and a number of results to return. You may specify any number. Default and max page size is 500. Implement pagination to retrieve more than 500 connections.</param>
        /// <returns>Returns the <see cref="Connections"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="idPart"/> or <paramref name="fields"/> is null.</exception>
        /// <exception cref="LinkedINHttpResponseException">Thrown when the an unexepcted response was returned from LinkedIN.</exception>
        /// <exception cref="LinkedINUnauthorizedException">Thrown when an request was made to an protected resource without the proper authorization.</exception>
        protected Connections RetrieveConnections(string idPart, IEnumerable <ProfileField> fields, int start, int count)
        {
            // validate arguments
            if (string.IsNullOrEmpty(idPart))
            {
                throw new ArgumentNullException("idPart");
            }
            //	if ( fields == null )
            //	throw new ArgumentNullException( "fields" );

            // create the request
            var request = new RestRequest("people/" + idPart + "/connections" + FieldSelector.ToFieldSelector(fields));

            // set the parameters
            request.AddParameter("start", start);
            request.AddParameter("count", count);

            // execute the request
            return(ExecuteRequest <Connections>(request));
        }