示例#1
0
 public static HttpRequest Delete(string groupId, string userId, string faceId)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Delete,
         RelativePath = $"face/v1.0/persongroups/{groupId}/persons/{userId}/persistedFaces/{faceId}",
         Cost = ServiceCost.FaceApiTransaction(1),
         CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523e"
     });
 }
示例#2
0
 public static HttpRequest CheckTraining(string groupId)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Get,
         RelativePath = $"face/v1.0/persongroups/{groupId}/training",
         Cost = ServiceCost.FaceApiTransaction(1),
         CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395247"
     });
 }
 public static HttpRequest GetResultFromForm(string operationLocation)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Get,
         Cost = ServiceCost.FormApiTransaction(0),
         AbsoluteUrl = operationLocation,
         CognitiveServiceDoc = "https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2/operations/GetAnalyzeFormResult"
     });
 }
示例#4
0
 public static HttpRequest Update(string groupId, string userId, string faceId, string userData)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Patch,
         RelativePath = $"face/v1.0/persongroups/{groupId}/persons/{userId}/persistedFaces/{faceId}",
         Body = JsonSerializer.Serialize(new { userData }),
         Cost = ServiceCost.FaceApiTransaction(1),
         CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395243"
     });
 }
示例#5
0
 public static HttpRequest Add(string groupId, string userId, string imageUrl, string?detectionModel = null, string?userData = null, string?targetFace = null)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Post,
         RelativePath = $"face/v1.0/persongroups/{groupId}/persons/{userId}/persistedFaces",
         Queries = GenerateQueries(detectionModel, userData, targetFace),
         Body = JsonSerializer.Serialize(new { url = imageUrl }),
         Cost = ServiceCost.FaceApiTransaction(1),
         CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523b"
     });
 }
示例#6
0
 public static HttpRequest Add(string groupId, string userId, byte[] data, string?detectionModel = null, string?userData = null, string?targetFace = null)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Post,
         RelativePath = $"face/v1.0/persongroups/{groupId}/persons/{userId}/persistedFaces",
         Queries = GenerateQueries(detectionModel, userData, targetFace),
         BinaryContent = data,
         ContentType = "application/octet-stream",
         Cost = ServiceCost.FaceApiTransaction(1),
         CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523b"
     });
 }
示例#7
0
 public static HttpRequest List()
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Get,
         RelativePath = $"face/v1.0/persongroups",
         Queries = new Dictionary <string, string>
         {
             { "returnRecognitionModel", "true" }
         },
         Cost = ServiceCost.FaceApiTransaction(1),
         CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395248"
     });
 }
 public static HttpRequest GetModels(bool showSummary = true)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Get,
         ContentType = "application/json",
         RelativePath = "formrecognizer/v2.0/custom/models",
         Cost = ServiceCost.FormApiTransaction(1),
         Queries = new Dictionary <string, string> {
             { "op", showSummary.ToString() }
         },
         CognitiveServiceDoc = "https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2/operations/GetCustomModels"
     });
 }
 public static HttpRequest StartAnalyzeForm(string modelId, string imageUrl, bool includeTextDetails = true)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Post,
         Body = JsonSerializer.Serialize(new { source = imageUrl }),
         ContentType = "application/json",
         RelativePath = $"formrecognizer/v2.0/custom/models/{modelId}/analyze",
         Queries = new Dictionary <string, string> {
             { "includeTextDetails", includeTextDetails.ToString() }
         },
         Cost = ServiceCost.FormApiTransaction(1),
         CognitiveServiceDoc = "https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2/operations/AnalyzeWithCustomForm"
     });
 }
示例#10
0
 public static HttpRequest Create(string groupId, string name, string?userData = null)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Post,
         RelativePath = $"face/v1.0/persongroups/{groupId}/persons",
         Body = JsonSerializer.Serialize(new
         {
             name,
             userData
         }),
         Cost = ServiceCost.FaceApiTransaction(1),
         CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c"
     });
 }
 public static HttpRequest StartAnalyzeForm(string modelId, byte[] data, string contentType, bool includeTextDetails = true)
 {
     // Content type should be image/jpeg, image/png, image/tiff or application/pdf.
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Post,
         BinaryContent = data,
         ContentType = contentType,
         RelativePath = $"formrecognizer/v2.0/custom/models/{modelId}/analyze",
         Queries = new Dictionary <string, string> {
             { "includeTextDetails", includeTextDetails.ToString() }
         },
         Cost = ServiceCost.FormApiTransaction(1),
         CognitiveServiceDoc = "https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2/operations/AnalyzeWithCustomForm"
     });
 }
示例#12
0
 public static HttpRequest Identify(string personGroupId, IEnumerable <string> faceIds, int maxNumOfCandidatesReturned = 1, float?confidenceThreshold = 0.5f)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Post,
         ContentType = "application/json",
         RelativePath = "face/v1.0/identify",
         Body = JsonSerializer.Serialize(new
         {
             personGroupId,
             faceIds,
             maxNumOfCandidatesReturned,
             confidenceThreshold
         }),
         Cost = ServiceCost.FaceApiTransaction(1),
         CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239"
     });
 }
示例#13
0
        public static HttpRequest Detect(
            string url,
            string?returnFaceAttributes = null,
            bool?returnFaceLandmarks    = null,
            string recognitionModel     = DefaultRecognitionModel,
            string detectionModel       = DefaultDetectionModel)
        {
            var queries = GenerateQueries(returnFaceAttributes, returnFaceLandmarks, recognitionModel, detectionModel);

            return(new HttpRequest
            {
                HttpMethod = HttpMethods.Post,
                ContentType = "application/json",
                RelativePath = $"face/v1.0/detect",
                Queries = queries,
                Body = JsonSerializer.Serialize(new { url }),
                Cost = ServiceCost.FaceApiTransaction(returnFaceAttributes == null ? 1 : 2),
                CognitiveServiceDoc = "https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236"
            });
        }
示例#14
0
 private static HttpRequest MakeSingleRequest(string url, string text, string language, string docUrl)
 {
     return(new HttpRequest
     {
         HttpMethod = HttpMethods.Post,
         ContentType = "application/json",
         RelativePath = $"text/analytics/{url}",
         Body = JsonSerializer.Serialize(new TextApiRequest
         {
             documents = new Document[]
             {
                 new Document
                 {
                     id = Guid.NewGuid().ToString(),
                     text = text,
                     language = language
                 }
             }
         }),
         Cost = ServiceCost.TextApiTransaction(1),
         CognitiveServiceDoc = docUrl
     });
 }
示例#15
0
 void AddCost(ServiceCost cost)
 {
     service.ServiceCost.Add(cost);
     OnPropertyChanged(nameof(Costs));
 }