コード例 #1
0
        /// <summary>
        /// Creates external form fill session
        /// </summary>
        /// <param name="basePath">BasePath for API calls (URI)</param>
        /// <param name="accessToken">Access Token for API call (OAuth)</param>
        /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param>
        /// <param name="documentId">The Id of a specified document</param>
        /// <param name="roomId">The Id of a specified room</param>
        /// <returns>ExternalFormFillSession</returns>
        public static ExternalFormFillSession CreateSession(
            string basePath,
            string accessToken,
            string accountId,
            ExternalFormFillSessionForCreate sessionForCreate)
        {
            // Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", $"Bearer {accessToken}");
            var externalFormFillSessionsApi = new ExternalFormFillSessionsApi(apiClient);

            // Call the Rooms API to create external form fill session
            var url = externalFormFillSessionsApi.CreateExternalFormFillSession(accountId, sessionForCreate);

            return(url);
        }
        /// <summary>
        /// Creates an external form fill session.
        /// </summary>
        /// <exception cref="DocuSign.Rooms.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId"></param>
        /// <param name="body"> (optional)</param>

        /// <returns>Task of ApiResponse (ExternalFormFillSession)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <ExternalFormFillSession> > CreateExternalFormFillSessionAsyncWithHttpInfo(string accountId, ExternalFormFillSessionForCreate body = null)
        {
            // verify the required parameter 'accountId' is set
            if (accountId == null)
            {
                throw new ApiException(400, "Missing required parameter 'accountId' when calling ExternalFormFillSessionsApi->CreateExternalFormFillSession");
            }

            var    localVarPath         = "/v2/accounts/{accountId}/external_form_fill_sessions";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(this.ApiClient.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json-patch+json",
                "application/json",
                "text/json",
                "application/_*+json"
            };
            String localVarHttpContentType = this.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "text/plain",
                "application/json",
                "text/json"
            };
            String localVarHttpHeaderAccept = this.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (accountId != null)
            {
                localVarPathParams.Add("accountId", this.ApiClient.ParameterToString(accountId));                    // path parameter
            }
            if (body != null && body.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.ApiClient.Serialize(body); // http body (model) parameter
            }
            else
            {
                localVarPostBody = body; // byte array
            }

            // authentication (docusignAccessCode) required
            // oauth required
            if (!String.IsNullOrEmpty(this.ApiClient.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.ApiClient.Configuration.AccessToken;
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.ApiClient.CallApiAsync(localVarPath,
                                                                                              Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                              localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("CreateExternalFormFillSession", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <ExternalFormFillSession>(localVarStatusCode,
                                                             localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                             (ExternalFormFillSession)this.ApiClient.Deserialize(localVarResponse, typeof(ExternalFormFillSession))));
        }
        /// <summary>
        /// Creates an external form fill session.
        /// </summary>
        /// <exception cref="DocuSign.Rooms.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId"></param>
        /// <param name="body"> (optional)</param>

        /// <returns>Task of ExternalFormFillSession</returns>
        public async System.Threading.Tasks.Task <ExternalFormFillSession> CreateExternalFormFillSessionAsync(string accountId, ExternalFormFillSessionForCreate body = null)
        {
            ApiResponse <ExternalFormFillSession> localVarResponse = await CreateExternalFormFillSessionAsyncWithHttpInfo(accountId, body);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Creates an external form fill session.
        /// </summary>
        /// <exception cref="DocuSign.Rooms.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId"></param>
        /// <param name="body"> (optional)</param>

        /// <returns>ExternalFormFillSession</returns>
        public ExternalFormFillSession CreateExternalFormFillSession(string accountId, ExternalFormFillSessionForCreate body = null)
        {
            ApiResponse <ExternalFormFillSession> localVarResponse = CreateExternalFormFillSessionWithHttpInfo(accountId, body);

            return(localVarResponse.Data);
        }