Beispiel #1
0
        public async Task <MatchResult> MatchImageAsync(Stream content, bool cacheImage, string listid)
        {
            var imageType = ModeratorHelper.GetImageFormat(content);

            if (imageType.Equals(ModeratorHelper.ImageFormat.unknown))
            {
                throw new Exception($"Image type: {imageType} not supported");
            }
            content.Position = 0;
            List <KeyValue> metaData = new List <KeyValue>();

            metaData.Add(new KeyValue()
            {
                Key   = "CacheImage",
                Value = cacheImage.ToString()
            });

            metaData.Add(new KeyValue()
            {
                Key   = "listid",
                Value = listid
            });

            return(await this.InvokeImageModeratorAsync <Stream, MatchResult>(content, Constants.Operations.Match.ToString(), metaData).ConfigureAwait(false));
        }
Beispiel #2
0
        public async Task <CreateJobResult> CreateJob(string teamName, Stream content, ContentType contentType,
                                                      string contentId, string workFlowName,
                                                      string callBackEndpoint)
        {
            var imageType = ModeratorHelper.GetImageFormat(content);

            if (imageType.Equals(ModeratorHelper.ImageFormat.unknown))
            {
                throw new Exception($"Image type: {imageType} not supported");
            }
            content.Position = 0;
            List <KeyValue> metaData = new List <KeyValue>();

            metaData.Add(new KeyValue()
            {
                Key   = "ContentType",
                Value = contentType.ToString()
            });

            metaData.Add(new KeyValue()
            {
                Key   = "ContentId",
                Value = contentId
            });

            metaData.Add(new KeyValue()
            {
                Key   = "WorkflowName",
                Value = workFlowName
            });

            metaData.Add(new KeyValue()
            {
                Key   = "CallBackEndpoint",
                Value = callBackEndpoint
            });

            return
                (await
                 InvokeAsync <Stream, CreateJobResult>(content,
                                                       string.Format(Constants.CREATE_JOB, teamName), Constants.HttpMethod.POST, metaData)
                 .ConfigureAwait(false));
        }