Exemplo n.º 1
0
        /// <summary>
        /// Reads the place type by the ID specified.
        /// </summary>
        /// <param name="id">The place type ID to read.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="VocabElementState"/> instance containing the REST API response.
        /// </returns>
        public VocabElementState ReadPlaceTypeById(String id, params IStateTransitionOption[] options)
        {
            Link link = GetLink(Rel.PLACE_TYPE);

            if (link == null || link.Template == null)
            {
                return(null);
            }

            String template = link.Template;
            String uri      = new UriTemplate(template).AddParameter("ptid", id).Resolve();

            IRestRequest request = RequestUtil.ApplyFamilySearchJson(CreateAuthenticatedRequest()).Build(uri, Method.GET);

            return(this.stateFactory.NewVocabElementState(request, Invoke(request, options), this.Client, this.CurrentAccessToken));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads place element list using a link with a rel equal to the path specified.
        /// </summary>
        /// <param name="path">The path to use in search of the resource link.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="VocabElementListState"/> instance containing the REST API response.
        /// </returns>
        private VocabElementListState ReadPlaceElementList(String path, params IStateTransitionOption[] options)
        {
            Link link = GetLink(path);

            if (null == link || null == link.Template)
            {
                return(null);
            }

            String template = link.Template;
            String uri      = new UriTemplate(template).Resolve();

            IRestRequest request = RequestUtil.ApplyFamilySearchJson(CreateAuthenticatedRequest()).Build(uri, Method.GET);

            return(this.stateFactory.NewVocabElementListState(request, Invoke(request, options), this.Client, this.CurrentAccessToken));
        }