Exemple #1
0
        internal virtual CreateFlowResponse CreateFlow(CreateFlowRequest request)
        {
            var marshaller   = CreateFlowRequestMarshaller.Instance;
            var unmarshaller = CreateFlowResponseUnmarshaller.Instance;

            return(Invoke <CreateFlowRequest, CreateFlowResponse>(request, marshaller, unmarshaller));
        }
        public async Task <IActionResult> CreateFlow([FromBody] CreateFlowRequest request)
        {
            try
            {
                var validator  = new CreateFlowRequestValidator();
                var validation = validator.Validate(request);
                if (!validation.IsValid)
                {
                    return(BadRequest(validation.Errors));
                }

                var flowModel = new FlowModel();
                flowModel.Name   = request.Name;
                flowModel.States = new List <FlowStateModel>();
                foreach (var state in request.States)
                {
                    flowModel.States.Add(new FlowStateModel
                    {
                        StateId = state.StateId,
                        Order   = state.Order
                    });
                }
                var id = await _flowService.Create(flowModel);

                return(Ok(id));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Exemple #3
0
        /// <summary>
        /// Specific for when sending request data for creating a new survey to email out to a list of recipients
        /// </summary>
        private string MakeApiRequest(string endPoint, CreateFlowRequest data)
        {
            string url = BaseURL + endPoint;
            var    serializedParameters = JsonConvert.SerializeObject(data);

            return(MakeApiRequest(url, serializedParameters));
        }
        public void CreateFlowResourceNames()
        {
            moq::Mock <Flows.FlowsClient> mockGrpcClient = new moq::Mock <Flows.FlowsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            CreateFlowRequest request = new CreateFlowRequest
            {
                ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
                Flow = new Flow(),
            };
            Flow expectedResponse = new Flow
            {
                FlowName         = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                DisplayName      = "display_name137f65c2",
                Description      = "description2cf9da67",
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
                EventHandlers = { new EventHandler(), },
                NluSettings   = new NluSettings(),
            };

            mockGrpcClient.Setup(x => x.CreateFlow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FlowsClient client   = new FlowsClientImpl(mockGrpcClient.Object, null);
            Flow        response = client.CreateFlow(request.ParentAsAgentName, request.Flow);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task CreateFlowRequestObjectAsync()
        {
            moq::Mock <Flows.FlowsClient> mockGrpcClient = new moq::Mock <Flows.FlowsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            CreateFlowRequest request = new CreateFlowRequest
            {
                ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
                Flow         = new Flow(),
                LanguageCode = "language_code2f6c7160",
            };
            Flow expectedResponse = new Flow
            {
                FlowName         = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                DisplayName      = "display_name137f65c2",
                Description      = "description2cf9da67",
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
                EventHandlers = { new EventHandler(), },
                NluSettings   = new NluSettings(),
            };

            mockGrpcClient.Setup(x => x.CreateFlowAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Flow>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            FlowsClient client = new FlowsClientImpl(mockGrpcClient.Object, null);
            Flow        responseCallSettings = await client.CreateFlowAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Flow responseCancellationToken = await client.CreateFlowAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #6
0
        public async Task <IActionResult> Produce(CreateFlowRequest request)
        {
            var validatorActionResult = await _validationArrangement.Validate(request);

            var actionResult = await _operationArrangement.Process(request, validatorActionResult);

            return(actionResult);
        }
Exemple #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateFlow operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateFlow operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/CreateFlow">REST API Reference for CreateFlow Operation</seealso>
        public virtual Task <CreateFlowResponse> CreateFlowAsync(CreateFlowRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = CreateFlowRequestMarshaller.Instance;
            var unmarshaller = CreateFlowResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateFlowRequest, CreateFlowResponse>(request, marshaller,
                                                                       unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateFlow operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateFlow operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/CreateFlow">REST API Reference for CreateFlow Operation</seealso>
        public virtual Task <CreateFlowResponse> CreateFlowAsync(CreateFlowRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateFlowRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateFlowResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateFlowResponse>(request, options, cancellationToken));
        }
Exemple #9
0
        /// <summary>
        /// Create a survey, email collector, and email message based on a template or existing survey. ###Notes * You cannot specify both template_id and from survey_id * Maximum number of recipients supported is 10000
        /// Endpoint : https://api.surveymonkey.net/v2/batch/create_flow?api_key=your_api_key
        /// Example Request
        ///     curl -H 'Authorization:bearer XXXYYYZZZ' -H 'Content-Type: application/json' https://api.surveymonkey.net/v2/batch/create_flow?api_key=your_api_key --data-binary
        /// </summary>
        public CreateFlowResponse CreateFlow(CreateFlowRequest requestData)
        {
            CreateFlowResponse flowResponse;

            JsonResponse = MakeApiRequest(CREATE_FLOW, requestData);
            flowResponse = JsonConvert.DeserializeObject <CreateFlowResponse>(JsonResponse);

            return(flowResponse);
        }
        internal virtual CreateFlowResponse CreateFlow(CreateFlowRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateFlowRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateFlowResponseUnmarshaller.Instance;

            return(Invoke <CreateFlowResponse>(request, options));
        }
Exemple #11
0
        public async Task <IActionResult> Create([FromQuery] CreateFlowFromQuery query,
                                                 [FromBody] CreateFlowFromBody body)
        {
            var request = new CreateFlowRequest(query, body);

            var result = await _apiResult.Produce(request);

            return(result);
        }
        /// <summary>
        /// 创建签署流程
        /// </summary>
        /// <param name="req"><see cref="CreateFlowRequest"/></param>
        /// <returns><see cref="CreateFlowResponse"/></returns>
        public CreateFlowResponse CreateFlowSync(CreateFlowRequest req)
        {
            JsonResponseModel <CreateFlowResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "CreateFlow");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <CreateFlowResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
Exemple #13
0
 /// <summary>Snippet for CreateFlow</summary>
 public void CreateFlowRequestObject()
 {
     // Snippet: CreateFlow(CreateFlowRequest, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     CreateFlowRequest request = new CreateFlowRequest
     {
         ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
         Flow         = new Flow(),
         LanguageCode = "",
     };
     // Make the request
     Flow response = flowsClient.CreateFlow(request);
     // End snippet
 }
        public CreateFlowForm()
        {
            InitializeComponent();

            btnDone.Click    += BtnDone_Click;
            this.FormClosing += CreateFlowForm_FormClosing;

            cfrData = new CreateFlowRequest();

            cbxLanguage.DataSource = Enum.GetNames(typeof(LanguageEnum));

            List <RecipientInfo> rfi = new List <RecipientInfo>();
            BindingSource        bs  = new BindingSource();

            bs.DataSource            = rfi;
            dgvRecipients.DataSource = bs;
        }
Exemple #15
0
        /// <summary>Snippet for CreateFlowAsync</summary>
        public async Task CreateFlowRequestObjectAsync()
        {
            // Snippet: CreateFlowAsync(CreateFlowRequest, CallSettings)
            // Additional: CreateFlowAsync(CreateFlowRequest, CancellationToken)
            // Create client
            FlowsClient flowsClient = await FlowsClient.CreateAsync();

            // Initialize request argument(s)
            CreateFlowRequest request = new CreateFlowRequest
            {
                ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
                Flow         = new Flow(),
                LanguageCode = "",
            };
            // Make the request
            Flow response = await flowsClient.CreateFlowAsync(request);

            // End snippet
        }
        public async Task<IActionResult> Process(CreateFlowRequest request, IValidatorActionResult validatorActionResult)
        {
            IActionResult actionResult;

            if (validatorActionResult.Result == null)
            {
                var call = _cqsMapper.Map(request);

                var result = await _mediator.Send(call);

                actionResult = result.IsFailure ? _apiResponse.Fail(result)
                                                : _apiResponse.Created(string.Format("/api/flows/{0}", ((Result<Guid>)result).Value), result.Version.ToString());
            }
            else
            {
                actionResult = validatorActionResult.Result;
            }

            return actionResult;
        }
Exemple #17
0
        public CreateFlowCommand Map(CreateFlowRequest request)
        {
            var result = new CreateFlowCommand(request.BodyName, request.BodyDescription, request.BodyImage);

            return(result);
        }