Exemple #1
0
        /// <summary>
        /// List Templates Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
        /// </summary>
        /// <exception cref="IO.Dyspatch.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accept">A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;</param>
        /// <param name="cursor">A cursor value used to retrieve a specific page from a paginated result set. (optional)</param>
        /// <returns>ApiResponse of TemplatesRead</returns>
        public IO.Dyspatch.Client.ApiResponse <TemplatesRead> GetTemplatesWithHttpInfo(string accept, string cursor = default(string))
        {
            // verify the required parameter 'accept' is set
            if (accept == null)
            {
                throw new IO.Dyspatch.Client.ApiException(400, "Missing required parameter 'accept' when calling TemplatesApi->GetTemplates");
            }

            IO.Dyspatch.Client.RequestOptions localVarRequestOptions = new IO.Dyspatch.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/vnd.dyspatch.2020.11+json",
                "*/*"
            };

            var localVarContentType = IO.Dyspatch.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = IO.Dyspatch.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (cursor != null)
            {
                localVarRequestOptions.QueryParameters.Add(IO.Dyspatch.Client.ClientUtils.ParameterToMultiMap("", "cursor", cursor));
            }
            localVarRequestOptions.HeaderParameters.Add("Accept", IO.Dyspatch.Client.ClientUtils.ParameterToString(accept)); // header parameter

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get <TemplatesRead>("/templates", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetTemplates", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Exemple #2
0
        /// <summary>
        /// Get Template by ID Gets a template object with the matching ID. If the template has published content the \&quot;compiled\&quot; field will contain the template .
        /// </summary>
        /// <exception cref="IO.Dyspatch.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="templateId">A template ID</param>
        /// <param name="targetLanguage">The type of templating language to compile as. Should only be used for visual templates.</param>
        /// <param name="accept">A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;</param>
        /// <returns>Task of ApiResponse (TemplateRead)</returns>
        public async System.Threading.Tasks.Task <IO.Dyspatch.Client.ApiResponse <TemplateRead> > GetTemplateByIdAsyncWithHttpInfo(string templateId, string targetLanguage, string accept)
        {
            // verify the required parameter 'templateId' is set
            if (templateId == null)
            {
                throw new IO.Dyspatch.Client.ApiException(400, "Missing required parameter 'templateId' when calling TemplatesApi->GetTemplateById");
            }

            // verify the required parameter 'targetLanguage' is set
            if (targetLanguage == null)
            {
                throw new IO.Dyspatch.Client.ApiException(400, "Missing required parameter 'targetLanguage' when calling TemplatesApi->GetTemplateById");
            }

            // verify the required parameter 'accept' is set
            if (accept == null)
            {
                throw new IO.Dyspatch.Client.ApiException(400, "Missing required parameter 'accept' when calling TemplatesApi->GetTemplateById");
            }


            IO.Dyspatch.Client.RequestOptions localVarRequestOptions = new IO.Dyspatch.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/vnd.dyspatch.2020.11+json",
                "*/*"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            localVarRequestOptions.PathParameters.Add("templateId", IO.Dyspatch.Client.ClientUtils.ParameterToString(templateId)); // path parameter
            localVarRequestOptions.QueryParameters.Add(IO.Dyspatch.Client.ClientUtils.ParameterToMultiMap("", "targetLanguage", targetLanguage));
            localVarRequestOptions.HeaderParameters.Add("Accept", IO.Dyspatch.Client.ClientUtils.ParameterToString(accept));       // header parameter

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <TemplateRead>("/templates/{templateId}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetTemplateById", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
        /// <summary>
        /// Get Localization Object by ID Returns the published content associated with the localization of the matching ID
        /// </summary>
        /// <exception cref="IO.Dyspatch.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="localizationId">A localization ID</param>
        /// <param name="targetLanguage">The type of templating language to compile as. Should only be used for visual templates.</param>
        /// <param name="accept">A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;</param>
        /// <returns>ApiResponse of LocalizationRead</returns>
        public IO.Dyspatch.Client.ApiResponse <LocalizationRead> GetPublishedLocalizationByIdWithHttpInfo(string localizationId, string targetLanguage, string accept)
        {
            // verify the required parameter 'localizationId' is set
            if (localizationId == null)
            {
                throw new IO.Dyspatch.Client.ApiException(400, "Missing required parameter 'localizationId' when calling LocalizationsApi->GetPublishedLocalizationById");
            }

            // verify the required parameter 'targetLanguage' is set
            if (targetLanguage == null)
            {
                throw new IO.Dyspatch.Client.ApiException(400, "Missing required parameter 'targetLanguage' when calling LocalizationsApi->GetPublishedLocalizationById");
            }

            // verify the required parameter 'accept' is set
            if (accept == null)
            {
                throw new IO.Dyspatch.Client.ApiException(400, "Missing required parameter 'accept' when calling LocalizationsApi->GetPublishedLocalizationById");
            }

            IO.Dyspatch.Client.RequestOptions localVarRequestOptions = new IO.Dyspatch.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/vnd.dyspatch.2020.11+json",
                "*/*"
            };

            var localVarContentType = IO.Dyspatch.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = IO.Dyspatch.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.PathParameters.Add("localizationId", IO.Dyspatch.Client.ClientUtils.ParameterToString(localizationId)); // path parameter
            localVarRequestOptions.QueryParameters.Add(IO.Dyspatch.Client.ClientUtils.ParameterToMultiMap("", "targetLanguage", targetLanguage));
            localVarRequestOptions.HeaderParameters.Add("Accept", IO.Dyspatch.Client.ClientUtils.ParameterToString(accept));               // header parameter

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get <LocalizationRead>("/localizations/{localizationId}", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetPublishedLocalizationById", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }