1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936
// This file is @generated by prost-build.
/// Representes a singular feature of a model. If the feature is `recognizer`,
/// the release_state of the feature represents the release_state of the model
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModelFeature {
/// The name of the feature (Note: the feature can be `recognizer`)
#[prost(string, tag = "1")]
pub feature: ::prost::alloc::string::String,
/// The release state of the feature
#[prost(string, tag = "2")]
pub release_state: ::prost::alloc::string::String,
}
/// Represents the collection of features belonging to a model
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModelFeatures {
/// Repeated field that contains all features of the model
#[prost(message, repeated, tag = "1")]
pub model_feature: ::prost::alloc::vec::Vec<ModelFeature>,
}
/// The metadata about the models in a given region for a specific locale.
/// Currently this is just the features of the model
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModelMetadata {
/// Map of the model name -> features of that model
#[prost(btree_map = "string, message", tag = "1")]
pub model_features: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
ModelFeatures,
>,
}
/// The metadata about locales available in a given region. Currently this is
/// just the models that are available for each locale
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LanguageMetadata {
/// Map of locale (language code) -> models
#[prost(btree_map = "string, message", tag = "1")]
pub models: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
ModelMetadata,
>,
}
/// The access metadata for a particular region. This can be applied if the org
/// policy for the given project disallows a particular region.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AccessMetadata {
/// Describes the different types of constraints that are applied.
#[prost(enumeration = "access_metadata::ConstraintType", tag = "1")]
pub constraint_type: i32,
}
/// Nested message and enum types in `AccessMetadata`.
pub mod access_metadata {
/// Describes the different types of constraints that can be applied on a
/// region.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ConstraintType {
/// Unspecified constraint applied.
Unspecified = 0,
/// The project's org policy disallows the given region.
ResourceLocationsOrgPolicyCreateConstraint = 1,
}
impl ConstraintType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ConstraintType::Unspecified => "CONSTRAINT_TYPE_UNSPECIFIED",
ConstraintType::ResourceLocationsOrgPolicyCreateConstraint => {
"RESOURCE_LOCATIONS_ORG_POLICY_CREATE_CONSTRAINT"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CONSTRAINT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"RESOURCE_LOCATIONS_ORG_POLICY_CREATE_CONSTRAINT" => {
Some(Self::ResourceLocationsOrgPolicyCreateConstraint)
}
_ => None,
}
}
}
}
/// Main metadata for the Locations API for STT V2. Currently this is just the
/// metadata about locales, models, and features
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocationsMetadata {
/// Information about available locales, models, and features represented in
/// the hierarchical structure of locales -> models -> features
#[prost(message, optional, tag = "1")]
pub languages: ::core::option::Option<LanguageMetadata>,
/// Information about access metadata for the region and given project.
#[prost(message, optional, tag = "2")]
pub access_metadata: ::core::option::Option<AccessMetadata>,
}
/// Request message for the
/// [CreateRecognizer][google.cloud.speech.v2.Speech.CreateRecognizer] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateRecognizerRequest {
/// Required. The Recognizer to create.
#[prost(message, optional, tag = "1")]
pub recognizer: ::core::option::Option<Recognizer>,
/// If set, validate the request and preview the Recognizer, but do not
/// actually create it.
#[prost(bool, tag = "2")]
pub validate_only: bool,
/// The ID to use for the Recognizer, which will become the final component of
/// the Recognizer's resource name.
///
/// This value should be 4-63 characters, and valid characters
/// are /[a-z][0-9]-/.
#[prost(string, tag = "3")]
pub recognizer_id: ::prost::alloc::string::String,
/// Required. The project and location where this Recognizer will be created.
/// The expected format is `projects/{project}/locations/{location}`.
#[prost(string, tag = "4")]
pub parent: ::prost::alloc::string::String,
}
/// Represents the metadata of a long-running operation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationMetadata {
/// The time the operation was created.
#[prost(message, optional, tag = "1")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// The time the operation was last updated.
#[prost(message, optional, tag = "2")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
/// The resource path for the target of the operation.
#[prost(string, tag = "3")]
pub resource: ::prost::alloc::string::String,
/// The method that triggered the operation.
#[prost(string, tag = "4")]
pub method: ::prost::alloc::string::String,
/// The [KMS key
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#keys>) with which
/// the content of the Operation is encrypted. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
#[prost(string, tag = "6")]
pub kms_key_name: ::prost::alloc::string::String,
/// The [KMS key version
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#key_versions>)
/// with which content of the Operation is encrypted. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
#[prost(string, tag = "7")]
pub kms_key_version_name: ::prost::alloc::string::String,
/// The percent progress of the Operation. Values can range from 0-100. If the
/// value is 100, then the operation is finished.
#[prost(int32, tag = "22")]
pub progress_percent: i32,
/// The request that spawned the Operation.
#[prost(
oneof = "operation_metadata::Request",
tags = "8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21"
)]
pub request: ::core::option::Option<operation_metadata::Request>,
/// Specific metadata per RPC.
#[prost(oneof = "operation_metadata::Metadata", tags = "23")]
pub metadata: ::core::option::Option<operation_metadata::Metadata>,
}
/// Nested message and enum types in `OperationMetadata`.
pub mod operation_metadata {
/// The request that spawned the Operation.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
/// The BatchRecognizeRequest that spawned the Operation.
#[prost(message, tag = "8")]
BatchRecognizeRequest(super::BatchRecognizeRequest),
/// The CreateRecognizerRequest that spawned the Operation.
#[prost(message, tag = "9")]
CreateRecognizerRequest(super::CreateRecognizerRequest),
/// The UpdateRecognizerRequest that spawned the Operation.
#[prost(message, tag = "10")]
UpdateRecognizerRequest(super::UpdateRecognizerRequest),
/// The DeleteRecognizerRequest that spawned the Operation.
#[prost(message, tag = "11")]
DeleteRecognizerRequest(super::DeleteRecognizerRequest),
/// The UndeleteRecognizerRequest that spawned the Operation.
#[prost(message, tag = "12")]
UndeleteRecognizerRequest(super::UndeleteRecognizerRequest),
/// The CreateCustomClassRequest that spawned the Operation.
#[prost(message, tag = "13")]
CreateCustomClassRequest(super::CreateCustomClassRequest),
/// The UpdateCustomClassRequest that spawned the Operation.
#[prost(message, tag = "14")]
UpdateCustomClassRequest(super::UpdateCustomClassRequest),
/// The DeleteCustomClassRequest that spawned the Operation.
#[prost(message, tag = "15")]
DeleteCustomClassRequest(super::DeleteCustomClassRequest),
/// The UndeleteCustomClassRequest that spawned the Operation.
#[prost(message, tag = "16")]
UndeleteCustomClassRequest(super::UndeleteCustomClassRequest),
/// The CreatePhraseSetRequest that spawned the Operation.
#[prost(message, tag = "17")]
CreatePhraseSetRequest(super::CreatePhraseSetRequest),
/// The UpdatePhraseSetRequest that spawned the Operation.
#[prost(message, tag = "18")]
UpdatePhraseSetRequest(super::UpdatePhraseSetRequest),
/// The DeletePhraseSetRequest that spawned the Operation.
#[prost(message, tag = "19")]
DeletePhraseSetRequest(super::DeletePhraseSetRequest),
/// The UndeletePhraseSetRequest that spawned the Operation.
#[prost(message, tag = "20")]
UndeletePhraseSetRequest(super::UndeletePhraseSetRequest),
/// The UpdateConfigRequest that spawned the Operation.
#[prost(message, tag = "21")]
UpdateConfigRequest(super::UpdateConfigRequest),
}
/// Specific metadata per RPC.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Metadata {
/// Metadata specific to the BatchRecognize method.
#[prost(message, tag = "23")]
BatchRecognizeMetadata(super::BatchRecognizeMetadata),
}
}
/// Request message for the
/// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListRecognizersRequest {
/// Required. The project and location of Recognizers to list. The expected
/// format is `projects/{project}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of Recognizers to return. The service may return fewer
/// than this value. If unspecified, at most 5 Recognizers will be returned.
/// The maximum value is 100; values above 100 will be coerced to 100.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous
/// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to
/// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
/// the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
/// Whether, or not, to show resources that have been deleted.
#[prost(bool, tag = "4")]
pub show_deleted: bool,
}
/// Response message for the
/// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListRecognizersResponse {
/// The list of requested Recognizers.
#[prost(message, repeated, tag = "1")]
pub recognizers: ::prost::alloc::vec::Vec<Recognizer>,
/// A token, which can be sent as
/// [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
/// retrieve the next page. If this field is omitted, there are no subsequent
/// pages. This token expires after 72 hours.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for the
/// [GetRecognizer][google.cloud.speech.v2.Speech.GetRecognizer] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRecognizerRequest {
/// Required. The name of the Recognizer to retrieve. The expected format is
/// `projects/{project}/locations/{location}/recognizers/{recognizer}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request message for the
/// [UpdateRecognizer][google.cloud.speech.v2.Speech.UpdateRecognizer] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateRecognizerRequest {
/// Required. The Recognizer to update.
///
/// The Recognizer's `name` field is used to identify the Recognizer to update.
/// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
#[prost(message, optional, tag = "1")]
pub recognizer: ::core::option::Option<Recognizer>,
/// The list of fields to update. If empty, all non-default valued fields are
/// considered for update. Use `*` to update the entire Recognizer resource.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
/// If set, validate the request and preview the updated Recognizer, but do not
/// actually update it.
#[prost(bool, tag = "4")]
pub validate_only: bool,
}
/// Request message for the
/// [DeleteRecognizer][google.cloud.speech.v2.Speech.DeleteRecognizer] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRecognizerRequest {
/// Required. The name of the Recognizer to delete.
/// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// If set, validate the request and preview the deleted Recognizer, but do not
/// actually delete it.
#[prost(bool, tag = "2")]
pub validate_only: bool,
/// If set to true, and the Recognizer is not found, the request will succeed
/// and be a no-op (no Operation is recorded in this case).
#[prost(bool, tag = "4")]
pub allow_missing: bool,
/// This checksum is computed by the server based on the value of other
/// fields. This may be sent on update, undelete, and delete requests to ensure
/// the client has an up-to-date value before proceeding.
#[prost(string, tag = "3")]
pub etag: ::prost::alloc::string::String,
}
/// Request message for the
/// [UndeleteRecognizer][google.cloud.speech.v2.Speech.UndeleteRecognizer]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UndeleteRecognizerRequest {
/// Required. The name of the Recognizer to undelete.
/// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// If set, validate the request and preview the undeleted Recognizer, but do
/// not actually undelete it.
#[prost(bool, tag = "3")]
pub validate_only: bool,
/// This checksum is computed by the server based on the value of other
/// fields. This may be sent on update, undelete, and delete requests to ensure
/// the client has an up-to-date value before proceeding.
#[prost(string, tag = "4")]
pub etag: ::prost::alloc::string::String,
}
/// A Recognizer message. Stores recognition configuration and metadata.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Recognizer {
/// Output only. Identifier. The resource name of the Recognizer.
/// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Output only. System-assigned unique identifier for the Recognizer.
#[prost(string, tag = "2")]
pub uid: ::prost::alloc::string::String,
/// User-settable, human-readable name for the Recognizer. Must be 63
/// characters or less.
#[prost(string, tag = "3")]
pub display_name: ::prost::alloc::string::String,
/// Optional. This field is now deprecated. Prefer the
/// [`model`][google.cloud.speech.v2.RecognitionConfig.model] field in the
/// [`RecognitionConfig`][google.cloud.speech.v2.RecognitionConfig] message.
///
/// Which model to use for recognition requests. Select the model best suited
/// to your domain to get best results.
///
/// Guidance for choosing which model to use can be found in the [Transcription
/// Models
/// Documentation](<https://cloud.google.com/speech-to-text/v2/docs/transcription-model>)
/// and the models supported in each region can be found in the [Table Of
/// Supported
/// Models](<https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages>).
#[deprecated]
#[prost(string, tag = "4")]
pub model: ::prost::alloc::string::String,
/// Optional. This field is now deprecated. Prefer the
/// [`language_codes`][google.cloud.speech.v2.RecognitionConfig.language_codes]
/// field in the
/// [`RecognitionConfig`][google.cloud.speech.v2.RecognitionConfig] message.
///
/// The language of the supplied audio as a
/// [BCP-47](<https://www.rfc-editor.org/rfc/bcp/bcp47.txt>) language tag.
///
/// Supported languages for each model are listed in the [Table of Supported
/// Models](<https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages>).
///
/// If additional languages are provided, recognition result will contain
/// recognition in the most likely language detected. The recognition result
/// will include the language tag of the language detected in the audio.
/// When you create or update a Recognizer, these values are
/// stored in normalized BCP-47 form. For example, "en-us" is stored as
/// "en-US".
#[deprecated]
#[prost(string, repeated, tag = "17")]
pub language_codes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Default configuration to use for requests with this Recognizer.
/// This can be overwritten by inline configuration in the
/// [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
/// field.
#[prost(message, optional, tag = "6")]
pub default_recognition_config: ::core::option::Option<RecognitionConfig>,
/// Allows users to store small amounts of arbitrary data.
/// Both the key and the value must be 63 characters or less each.
/// At most 100 annotations.
#[prost(btree_map = "string, string", tag = "7")]
pub annotations: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Output only. The Recognizer lifecycle state.
#[prost(enumeration = "recognizer::State", tag = "8")]
pub state: i32,
/// Output only. Creation time.
#[prost(message, optional, tag = "9")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The most recent time this Recognizer was modified.
#[prost(message, optional, tag = "10")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The time at which this Recognizer was requested for deletion.
#[prost(message, optional, tag = "11")]
pub delete_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The time at which this Recognizer will be purged.
#[prost(message, optional, tag = "14")]
pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. This checksum is computed by the server based on the value of
/// other fields. This may be sent on update, undelete, and delete requests to
/// ensure the client has an up-to-date value before proceeding.
#[prost(string, tag = "12")]
pub etag: ::prost::alloc::string::String,
/// Output only. Whether or not this Recognizer is in the process of being
/// updated.
#[prost(bool, tag = "13")]
pub reconciling: bool,
/// Output only. The [KMS key
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#keys>) with which
/// the Recognizer is encrypted. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
#[prost(string, tag = "15")]
pub kms_key_name: ::prost::alloc::string::String,
/// Output only. The [KMS key version
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#key_versions>)
/// with which the Recognizer is encrypted. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
#[prost(string, tag = "16")]
pub kms_key_version_name: ::prost::alloc::string::String,
}
/// Nested message and enum types in `Recognizer`.
pub mod recognizer {
/// Set of states that define the lifecycle of a Recognizer.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// The default value. This value is used if the state is omitted.
Unspecified = 0,
/// The Recognizer is active and ready for use.
Active = 2,
/// This Recognizer has been deleted.
Deleted = 4,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Active => "ACTIVE",
State::Deleted => "DELETED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"ACTIVE" => Some(Self::Active),
"DELETED" => Some(Self::Deleted),
_ => None,
}
}
}
}
/// Automatically detected decoding parameters.
/// Supported for the following encodings:
///
/// * WAV_LINEAR16: 16-bit signed little-endian PCM samples in a WAV container.
///
/// * WAV_MULAW: 8-bit companded mulaw samples in a WAV container.
///
/// * WAV_ALAW: 8-bit companded alaw samples in a WAV container.
///
/// * RFC4867_5_AMR: AMR frames with an rfc4867.5 header.
///
/// * RFC4867_5_AMRWB: AMR-WB frames with an rfc4867.5 header.
///
/// * FLAC: FLAC frames in the "native FLAC" container format.
///
/// * MP3: MPEG audio frames with optional (ignored) ID3 metadata.
///
/// * OGG_OPUS: Opus audio frames in an Ogg container.
///
/// * WEBM_OPUS: Opus audio frames in a WebM container.
///
/// * MP4_AAC: AAC audio frames in an MP4 container.
///
/// * M4A_AAC: AAC audio frames in an M4A container.
///
/// * MOV_AAC: AAC audio frames in an MOV container.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AutoDetectDecodingConfig {}
/// Explicitly specified decoding parameters.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ExplicitDecodingConfig {
/// Required. Encoding of the audio data sent for recognition.
#[prost(enumeration = "explicit_decoding_config::AudioEncoding", tag = "1")]
pub encoding: i32,
/// Sample rate in Hertz of the audio data sent for recognition. Valid
/// values are: 8000-48000. 16000 is optimal. For best results, set the
/// sampling rate of the audio source to 16000 Hz. If that's not possible, use
/// the native sample rate of the audio source (instead of re-sampling).
/// Supported for the following encodings:
///
/// * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
///
/// * MULAW: Headerless 8-bit companded mulaw samples.
///
/// * ALAW: Headerless 8-bit companded alaw samples.
#[prost(int32, tag = "2")]
pub sample_rate_hertz: i32,
/// Number of channels present in the audio data sent for recognition.
/// Supported for the following encodings:
///
/// * LINEAR16: Headerless 16-bit signed little-endian PCM samples.
///
/// * MULAW: Headerless 8-bit companded mulaw samples.
///
/// * ALAW: Headerless 8-bit companded alaw samples.
///
/// The maximum allowed value is 8.
#[prost(int32, tag = "3")]
pub audio_channel_count: i32,
}
/// Nested message and enum types in `ExplicitDecodingConfig`.
pub mod explicit_decoding_config {
/// Supported audio data encodings.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum AudioEncoding {
/// Default value. This value is unused.
Unspecified = 0,
/// Headerless 16-bit signed little-endian PCM samples.
Linear16 = 1,
/// Headerless 8-bit companded mulaw samples.
Mulaw = 2,
/// Headerless 8-bit companded alaw samples.
Alaw = 3,
}
impl AudioEncoding {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
AudioEncoding::Unspecified => "AUDIO_ENCODING_UNSPECIFIED",
AudioEncoding::Linear16 => "LINEAR16",
AudioEncoding::Mulaw => "MULAW",
AudioEncoding::Alaw => "ALAW",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"AUDIO_ENCODING_UNSPECIFIED" => Some(Self::Unspecified),
"LINEAR16" => Some(Self::Linear16),
"MULAW" => Some(Self::Mulaw),
"ALAW" => Some(Self::Alaw),
_ => None,
}
}
}
}
/// Configuration to enable speaker diarization.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SpeakerDiarizationConfig {
/// Required. Minimum number of speakers in the conversation. This range gives
/// you more flexibility by allowing the system to automatically determine the
/// correct number of speakers.
///
/// To fix the number of speakers detected in the audio, set
/// `min_speaker_count` = `max_speaker_count`.
#[prost(int32, tag = "2")]
pub min_speaker_count: i32,
/// Required. Maximum number of speakers in the conversation. Valid values are:
/// 1-6. Must be >= `min_speaker_count`. This range gives you more flexibility
/// by allowing the system to automatically determine the correct number of
/// speakers.
#[prost(int32, tag = "3")]
pub max_speaker_count: i32,
}
/// Available recognition features.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RecognitionFeatures {
/// If set to `true`, the server will attempt to filter out profanities,
/// replacing all but the initial character in each filtered word with
/// asterisks, for instance, "f***". If set to `false` or omitted, profanities
/// won't be filtered out.
#[prost(bool, tag = "1")]
pub profanity_filter: bool,
/// If `true`, the top result includes a list of words and the start and end
/// time offsets (timestamps) for those words. If `false`, no word-level time
/// offset information is returned. The default is `false`.
#[prost(bool, tag = "2")]
pub enable_word_time_offsets: bool,
/// If `true`, the top result includes a list of words and the confidence for
/// those words. If `false`, no word-level confidence information is returned.
/// The default is `false`.
#[prost(bool, tag = "3")]
pub enable_word_confidence: bool,
/// If `true`, adds punctuation to recognition result hypotheses. This feature
/// is only available in select languages. The default `false` value does not
/// add punctuation to result hypotheses.
#[prost(bool, tag = "4")]
pub enable_automatic_punctuation: bool,
/// The spoken punctuation behavior for the call. If `true`, replaces spoken
/// punctuation with the corresponding symbols in the request. For example,
/// "how are you question mark" becomes "how are you?". See
/// <https://cloud.google.com/speech-to-text/docs/spoken-punctuation> for
/// support. If `false`, spoken punctuation is not replaced.
#[prost(bool, tag = "14")]
pub enable_spoken_punctuation: bool,
/// The spoken emoji behavior for the call. If `true`, adds spoken emoji
/// formatting for the request. This will replace spoken emojis with the
/// corresponding Unicode symbols in the final transcript. If `false`, spoken
/// emojis are not replaced.
#[prost(bool, tag = "15")]
pub enable_spoken_emojis: bool,
/// Mode for recognizing multi-channel audio.
#[prost(enumeration = "recognition_features::MultiChannelMode", tag = "17")]
pub multi_channel_mode: i32,
/// Configuration to enable speaker diarization and set additional
/// parameters to make diarization better suited for your application.
/// When this is enabled, we send all the words from the beginning of the
/// audio for the top alternative in every consecutive STREAMING responses.
/// This is done in order to improve our speaker tags as our models learn to
/// identify the speakers in the conversation over time.
/// For non-streaming requests, the diarization results will be provided only
/// in the top alternative of the FINAL SpeechRecognitionResult.
#[prost(message, optional, tag = "9")]
pub diarization_config: ::core::option::Option<SpeakerDiarizationConfig>,
/// Maximum number of recognition hypotheses to be returned.
/// The server may return fewer than `max_alternatives`.
/// Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
/// one. If omitted, will return a maximum of one.
#[prost(int32, tag = "16")]
pub max_alternatives: i32,
}
/// Nested message and enum types in `RecognitionFeatures`.
pub mod recognition_features {
/// Options for how to recognize multi-channel audio.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum MultiChannelMode {
/// Default value for the multi-channel mode. If the audio contains
/// multiple channels, only the first channel will be transcribed; other
/// channels will be ignored.
Unspecified = 0,
/// If selected, each channel in the provided audio is transcribed
/// independently. This cannot be selected if the selected
/// [model][google.cloud.speech.v2.Recognizer.model] is `latest_short`.
SeparateRecognitionPerChannel = 1,
}
impl MultiChannelMode {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
MultiChannelMode::Unspecified => "MULTI_CHANNEL_MODE_UNSPECIFIED",
MultiChannelMode::SeparateRecognitionPerChannel => {
"SEPARATE_RECOGNITION_PER_CHANNEL"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MULTI_CHANNEL_MODE_UNSPECIFIED" => Some(Self::Unspecified),
"SEPARATE_RECOGNITION_PER_CHANNEL" => {
Some(Self::SeparateRecognitionPerChannel)
}
_ => None,
}
}
}
}
/// Transcription normalization configuration. Use transcription normalization
/// to automatically replace parts of the transcript with phrases of your
/// choosing. For StreamingRecognize, this normalization only applies to stable
/// partial transcripts (stability > 0.8) and final transcripts.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TranscriptNormalization {
/// A list of replacement entries. We will perform replacement with one entry
/// at a time. For example, the second entry in ["cat" => "dog", "mountain cat"
/// => "mountain dog"] will never be applied because we will always process the
/// first entry before it. At most 100 entries.
#[prost(message, repeated, tag = "1")]
pub entries: ::prost::alloc::vec::Vec<transcript_normalization::Entry>,
}
/// Nested message and enum types in `TranscriptNormalization`.
pub mod transcript_normalization {
/// A single replacement configuration.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Entry {
/// What to replace. Max length is 100 characters.
#[prost(string, tag = "1")]
pub search: ::prost::alloc::string::String,
/// What to replace with. Max length is 100 characters.
#[prost(string, tag = "2")]
pub replace: ::prost::alloc::string::String,
/// Whether the search is case sensitive.
#[prost(bool, tag = "3")]
pub case_sensitive: bool,
}
}
/// Translation configuration. Use to translate the given audio into text for the
/// desired language.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TranslationConfig {
/// Required. The language code to translate to.
#[prost(string, tag = "1")]
pub target_language: ::prost::alloc::string::String,
}
/// Provides "hints" to the speech recognizer to favor specific words and phrases
/// in the results. PhraseSets can be specified as an inline resource, or a
/// reference to an existing PhraseSet resource.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SpeechAdaptation {
/// A list of inline or referenced PhraseSets.
#[prost(message, repeated, tag = "1")]
pub phrase_sets: ::prost::alloc::vec::Vec<speech_adaptation::AdaptationPhraseSet>,
/// A list of inline CustomClasses. Existing CustomClass resources can be
/// referenced directly in a PhraseSet.
#[prost(message, repeated, tag = "2")]
pub custom_classes: ::prost::alloc::vec::Vec<CustomClass>,
}
/// Nested message and enum types in `SpeechAdaptation`.
pub mod speech_adaptation {
/// A biasing PhraseSet, which can be either a string referencing the name of
/// an existing PhraseSets resource, or an inline definition of a PhraseSet.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AdaptationPhraseSet {
#[prost(oneof = "adaptation_phrase_set::Value", tags = "1, 2")]
pub value: ::core::option::Option<adaptation_phrase_set::Value>,
}
/// Nested message and enum types in `AdaptationPhraseSet`.
pub mod adaptation_phrase_set {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
/// The name of an existing PhraseSet resource. The user must have read
/// access to the resource and it must not be deleted.
#[prost(string, tag = "1")]
PhraseSet(::prost::alloc::string::String),
/// An inline defined PhraseSet.
#[prost(message, tag = "2")]
InlinePhraseSet(super::super::PhraseSet),
}
}
}
/// Provides information to the Recognizer that specifies how to process the
/// recognition request.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecognitionConfig {
/// Optional. Which model to use for recognition requests. Select the model
/// best suited to your domain to get best results.
///
/// Guidance for choosing which model to use can be found in the [Transcription
/// Models
/// Documentation](<https://cloud.google.com/speech-to-text/v2/docs/transcription-model>)
/// and the models supported in each region can be found in the [Table Of
/// Supported
/// Models](<https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages>).
#[prost(string, tag = "9")]
pub model: ::prost::alloc::string::String,
/// Optional. The language of the supplied audio as a
/// [BCP-47](<https://www.rfc-editor.org/rfc/bcp/bcp47.txt>) language tag.
/// Language tags are normalized to BCP-47 before they are used eg "en-us"
/// becomes "en-US".
///
/// Supported languages for each model are listed in the [Table of Supported
/// Models](<https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages>).
///
/// If additional languages are provided, recognition result will contain
/// recognition in the most likely language detected. The recognition result
/// will include the language tag of the language detected in the audio.
#[prost(string, repeated, tag = "10")]
pub language_codes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Speech recognition features to enable.
#[prost(message, optional, tag = "2")]
pub features: ::core::option::Option<RecognitionFeatures>,
/// Speech adaptation context that weights recognizer predictions for specific
/// words and phrases.
#[prost(message, optional, tag = "6")]
pub adaptation: ::core::option::Option<SpeechAdaptation>,
/// Optional. Use transcription normalization to automatically replace parts of
/// the transcript with phrases of your choosing. For StreamingRecognize, this
/// normalization only applies to stable partial transcripts (stability > 0.8)
/// and final transcripts.
#[prost(message, optional, tag = "11")]
pub transcript_normalization: ::core::option::Option<TranscriptNormalization>,
/// Optional. Optional configuration used to automatically run translation on
/// the given audio to the desired language for supported models.
#[prost(message, optional, tag = "15")]
pub translation_config: ::core::option::Option<TranslationConfig>,
/// Decoding parameters for audio being sent for recognition.
#[prost(oneof = "recognition_config::DecodingConfig", tags = "7, 8")]
pub decoding_config: ::core::option::Option<recognition_config::DecodingConfig>,
}
/// Nested message and enum types in `RecognitionConfig`.
pub mod recognition_config {
/// Decoding parameters for audio being sent for recognition.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum DecodingConfig {
/// Automatically detect decoding parameters.
/// Preferred for supported formats.
#[prost(message, tag = "7")]
AutoDecodingConfig(super::AutoDetectDecodingConfig),
/// Explicitly specified decoding parameters.
/// Required if using headerless PCM audio (linear16, mulaw, alaw).
#[prost(message, tag = "8")]
ExplicitDecodingConfig(super::ExplicitDecodingConfig),
}
}
/// Request message for the
/// [Recognize][google.cloud.speech.v2.Speech.Recognize] method. Either
/// `content` or `uri` must be supplied. Supplying both or neither returns
/// [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See [content
/// limits](<https://cloud.google.com/speech-to-text/quotas#content>).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecognizeRequest {
/// Required. The name of the Recognizer to use during recognition. The
/// expected format is
/// `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
/// {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
#[prost(string, tag = "3")]
pub recognizer: ::prost::alloc::string::String,
/// Features and audio metadata to use for the Automatic Speech Recognition.
/// This field in combination with the
/// [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
/// can be used to override parts of the
/// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
/// of the Recognizer resource.
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<RecognitionConfig>,
/// The list of fields in
/// [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
/// values in the
/// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
/// of the recognizer during this recognition request. If no mask is provided,
/// all non-default valued fields in
/// [config][google.cloud.speech.v2.RecognizeRequest.config] override the
/// values in the recognizer for this recognition request. If a mask is
/// provided, only the fields listed in the mask override the config in the
/// recognizer for this recognition request. If a wildcard (`*`) is provided,
/// [config][google.cloud.speech.v2.RecognizeRequest.config] completely
/// overrides and replaces the config in the recognizer for this recognition
/// request.
#[prost(message, optional, tag = "8")]
pub config_mask: ::core::option::Option<::prost_types::FieldMask>,
/// The audio source, which is either inline content or a Google Cloud
/// Storage URI.
#[prost(oneof = "recognize_request::AudioSource", tags = "5, 6")]
pub audio_source: ::core::option::Option<recognize_request::AudioSource>,
}
/// Nested message and enum types in `RecognizeRequest`.
pub mod recognize_request {
/// The audio source, which is either inline content or a Google Cloud
/// Storage URI.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum AudioSource {
/// The audio data bytes encoded as specified in
/// [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
/// with all bytes fields, proto buffers use a pure binary representation,
/// whereas JSON representations use base64.
#[prost(bytes, tag = "5")]
Content(::prost::bytes::Bytes),
/// URI that points to a file that contains audio data bytes as specified in
/// [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
/// must not be compressed (for example, gzip). Currently, only Google Cloud
/// Storage URIs are supported, which must be specified in the following
/// format: `gs://bucket_name/object_name` (other URI formats return
/// [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
/// information, see [Request
/// URIs](<https://cloud.google.com/storage/docs/reference-uris>).
#[prost(string, tag = "6")]
Uri(::prost::alloc::string::String),
}
}
/// Metadata about the recognition request and response.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecognitionResponseMetadata {
/// Global request identifier auto-generated by the API.
#[prost(string, tag = "9")]
pub request_id: ::prost::alloc::string::String,
/// When available, billed audio seconds for the corresponding request.
#[prost(message, optional, tag = "6")]
pub total_billed_duration: ::core::option::Option<::prost_types::Duration>,
}
/// Alternative hypotheses (a.k.a. n-best list).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SpeechRecognitionAlternative {
/// Transcript text representing the words that the user spoke.
#[prost(string, tag = "1")]
pub transcript: ::prost::alloc::string::String,
/// The confidence estimate between 0.0 and 1.0. A higher number
/// indicates an estimated greater likelihood that the recognized words are
/// correct. This field is set only for the top alternative of a non-streaming
/// result or, of a streaming result where
/// [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
/// set to `true`. This field is not guaranteed to be accurate and users should
/// not rely on it to be always provided. The default of 0.0 is a sentinel
/// value indicating `confidence` was not set.
#[prost(float, tag = "2")]
pub confidence: f32,
/// A list of word-specific information for each recognized word.
/// When the
/// [SpeakerDiarizationConfig][google.cloud.speech.v2.SpeakerDiarizationConfig]
/// is set, you will see all the words from the beginning of the audio.
#[prost(message, repeated, tag = "3")]
pub words: ::prost::alloc::vec::Vec<WordInfo>,
}
/// Word-specific information for recognized words.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WordInfo {
/// Time offset relative to the beginning of the audio,
/// and corresponding to the start of the spoken word.
/// This field is only set if
/// [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
/// is `true` and only in the top hypothesis. This is an experimental feature
/// and the accuracy of the time offset can vary.
#[prost(message, optional, tag = "1")]
pub start_offset: ::core::option::Option<::prost_types::Duration>,
/// Time offset relative to the beginning of the audio,
/// and corresponding to the end of the spoken word.
/// This field is only set if
/// [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
/// is `true` and only in the top hypothesis. This is an experimental feature
/// and the accuracy of the time offset can vary.
#[prost(message, optional, tag = "2")]
pub end_offset: ::core::option::Option<::prost_types::Duration>,
/// The word corresponding to this set of information.
#[prost(string, tag = "3")]
pub word: ::prost::alloc::string::String,
/// The confidence estimate between 0.0 and 1.0. A higher number
/// indicates an estimated greater likelihood that the recognized words are
/// correct. This field is set only for the top alternative of a non-streaming
/// result or, of a streaming result where
/// [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
/// set to `true`. This field is not guaranteed to be accurate and users should
/// not rely on it to be always provided. The default of 0.0 is a sentinel
/// value indicating `confidence` was not set.
#[prost(float, tag = "4")]
pub confidence: f32,
/// A distinct label is assigned for every speaker within the audio. This field
/// specifies which one of those speakers was detected to have spoken this
/// word. `speaker_label` is set if
/// [SpeakerDiarizationConfig][google.cloud.speech.v2.SpeakerDiarizationConfig]
/// is given and only in the top alternative.
#[prost(string, tag = "6")]
pub speaker_label: ::prost::alloc::string::String,
}
/// A speech recognition result corresponding to a portion of the audio.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SpeechRecognitionResult {
/// May contain one or more recognition hypotheses. These alternatives are
/// ordered in terms of accuracy, with the top (first) alternative being the
/// most probable, as ranked by the recognizer.
#[prost(message, repeated, tag = "1")]
pub alternatives: ::prost::alloc::vec::Vec<SpeechRecognitionAlternative>,
/// For multi-channel audio, this is the channel number corresponding to the
/// recognized result for the audio from that channel.
/// For `audio_channel_count` = `N`, its output values can range from `1` to
/// `N`.
#[prost(int32, tag = "2")]
pub channel_tag: i32,
/// Time offset of the end of this result relative to the beginning of the
/// audio.
#[prost(message, optional, tag = "4")]
pub result_end_offset: ::core::option::Option<::prost_types::Duration>,
/// Output only. The [BCP-47](<https://www.rfc-editor.org/rfc/bcp/bcp47.txt>)
/// language tag of the language in this result. This language code was
/// detected to have the most likelihood of being spoken in the audio.
#[prost(string, tag = "5")]
pub language_code: ::prost::alloc::string::String,
}
/// Response message for the
/// [Recognize][google.cloud.speech.v2.Speech.Recognize] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecognizeResponse {
/// Sequential list of transcription results corresponding to sequential
/// portions of audio.
#[prost(message, repeated, tag = "3")]
pub results: ::prost::alloc::vec::Vec<SpeechRecognitionResult>,
/// Metadata about the recognition.
#[prost(message, optional, tag = "2")]
pub metadata: ::core::option::Option<RecognitionResponseMetadata>,
}
/// Available recognition features specific to streaming recognition requests.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StreamingRecognitionFeatures {
/// If `true`, responses with voice activity speech events will be returned as
/// they are detected.
#[prost(bool, tag = "1")]
pub enable_voice_activity_events: bool,
/// Whether or not to stream interim results to the client. If set to true,
/// interim results will be streamed to the client. Otherwise, only the final
/// response will be streamed back.
#[prost(bool, tag = "2")]
pub interim_results: bool,
/// If set, the server will automatically close the stream after the specified
/// duration has elapsed after the last VOICE_ACTIVITY speech event has been
/// sent. The field `voice_activity_events` must also be set to true.
#[prost(message, optional, tag = "3")]
pub voice_activity_timeout: ::core::option::Option<
streaming_recognition_features::VoiceActivityTimeout,
>,
}
/// Nested message and enum types in `StreamingRecognitionFeatures`.
pub mod streaming_recognition_features {
/// Events that a timeout can be set on for voice activity.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct VoiceActivityTimeout {
/// Duration to timeout the stream if no speech begins. If this is set and
/// no speech is detected in this duration at the start of the stream, the
/// server will close the stream.
#[prost(message, optional, tag = "1")]
pub speech_start_timeout: ::core::option::Option<::prost_types::Duration>,
/// Duration to timeout the stream after speech ends. If this is set and no
/// speech is detected in this duration after speech was detected, the server
/// will close the stream.
#[prost(message, optional, tag = "2")]
pub speech_end_timeout: ::core::option::Option<::prost_types::Duration>,
}
}
/// Provides configuration information for the StreamingRecognize request.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamingRecognitionConfig {
/// Required. Features and audio metadata to use for the Automatic Speech
/// Recognition. This field in combination with the
/// [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
/// field can be used to override parts of the
/// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
/// of the Recognizer resource.
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<RecognitionConfig>,
/// The list of fields in
/// [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
/// override the values in the
/// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
/// of the recognizer during this recognition request. If no mask is provided,
/// all non-default valued fields in
/// [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
/// the values in the Recognizer for this recognition request. If a mask is
/// provided, only the fields listed in the mask override the config in the
/// Recognizer for this recognition request. If a wildcard (`*`) is provided,
/// [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
/// completely overrides and replaces the config in the recognizer for this
/// recognition request.
#[prost(message, optional, tag = "3")]
pub config_mask: ::core::option::Option<::prost_types::FieldMask>,
/// Speech recognition features to enable specific to streaming audio
/// recognition requests.
#[prost(message, optional, tag = "2")]
pub streaming_features: ::core::option::Option<StreamingRecognitionFeatures>,
}
/// Request message for the
/// [StreamingRecognize][google.cloud.speech.v2.Speech.StreamingRecognize]
/// method. Multiple
/// [StreamingRecognizeRequest][google.cloud.speech.v2.StreamingRecognizeRequest]
/// messages are sent in one call.
///
/// If the [Recognizer][google.cloud.speech.v2.Recognizer] referenced by
/// [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer]
/// contains a fully specified request configuration then the stream may only
/// contain messages with only
/// [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio] set.
///
/// Otherwise the first message must contain a
/// [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer] and
/// a
/// [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config]
/// message that together fully specify the request configuration and must not
/// contain [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio]. All
/// subsequent messages must only have
/// [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio] set.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamingRecognizeRequest {
/// Required. The name of the Recognizer to use during recognition. The
/// expected format is
/// `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
/// {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
#[prost(string, tag = "3")]
pub recognizer: ::prost::alloc::string::String,
#[prost(oneof = "streaming_recognize_request::StreamingRequest", tags = "6, 5")]
pub streaming_request: ::core::option::Option<
streaming_recognize_request::StreamingRequest,
>,
}
/// Nested message and enum types in `StreamingRecognizeRequest`.
pub mod streaming_recognize_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum StreamingRequest {
/// StreamingRecognitionConfig to be used in this recognition attempt.
/// If provided, it will override the default RecognitionConfig stored in the
/// Recognizer.
#[prost(message, tag = "6")]
StreamingConfig(super::StreamingRecognitionConfig),
/// Inline audio bytes to be Recognized.
/// Maximum size for this field is 15 KB per request.
#[prost(bytes, tag = "5")]
Audio(::prost::bytes::Bytes),
}
}
/// Request message for the
/// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRecognizeRequest {
/// Required. The name of the Recognizer to use during recognition. The
/// expected format is
/// `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
/// {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
#[prost(string, tag = "1")]
pub recognizer: ::prost::alloc::string::String,
/// Features and audio metadata to use for the Automatic Speech Recognition.
/// This field in combination with the
/// [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
/// field can be used to override parts of the
/// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
/// of the Recognizer resource.
#[prost(message, optional, tag = "4")]
pub config: ::core::option::Option<RecognitionConfig>,
/// The list of fields in
/// [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
/// the values in the
/// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
/// of the recognizer during this recognition request. If no mask is provided,
/// all given fields in
/// [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
/// values in the recognizer for this recognition request. If a mask is
/// provided, only the fields listed in the mask override the config in the
/// recognizer for this recognition request. If a wildcard (`*`) is provided,
/// [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
/// overrides and replaces the config in the recognizer for this recognition
/// request.
#[prost(message, optional, tag = "5")]
pub config_mask: ::core::option::Option<::prost_types::FieldMask>,
/// Audio files with file metadata for ASR.
/// The maximum number of files allowed to be specified is 15.
#[prost(message, repeated, tag = "3")]
pub files: ::prost::alloc::vec::Vec<BatchRecognizeFileMetadata>,
/// Configuration options for where to output the transcripts of each file.
#[prost(message, optional, tag = "6")]
pub recognition_output_config: ::core::option::Option<RecognitionOutputConfig>,
/// Processing strategy to use for this request.
#[prost(enumeration = "batch_recognize_request::ProcessingStrategy", tag = "7")]
pub processing_strategy: i32,
}
/// Nested message and enum types in `BatchRecognizeRequest`.
pub mod batch_recognize_request {
/// Possible processing strategies for batch requests.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ProcessingStrategy {
/// Default value for the processing strategy. The request is processed as
/// soon as its received.
Unspecified = 0,
/// If selected, processes the request during lower utilization periods for a
/// price discount. The request is fulfilled within 24 hours.
DynamicBatching = 1,
}
impl ProcessingStrategy {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ProcessingStrategy::Unspecified => "PROCESSING_STRATEGY_UNSPECIFIED",
ProcessingStrategy::DynamicBatching => "DYNAMIC_BATCHING",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PROCESSING_STRATEGY_UNSPECIFIED" => Some(Self::Unspecified),
"DYNAMIC_BATCHING" => Some(Self::DynamicBatching),
_ => None,
}
}
}
}
/// Output configurations for Cloud Storage.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcsOutputConfig {
/// The Cloud Storage URI prefix with which recognition results will be
/// written.
#[prost(string, tag = "1")]
pub uri: ::prost::alloc::string::String,
}
/// Output configurations for inline response.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct InlineOutputConfig {}
/// Output configurations for serialized `BatchRecognizeResults` protos.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NativeOutputFileFormatConfig {}
/// Output configurations for [WebVTT](<https://www.w3.org/TR/webvtt1/>) formatted
/// subtitle file.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct VttOutputFileFormatConfig {}
/// Output configurations [SubRip
/// Text](<https://www.matroska.org/technical/subtitles.html#srt-subtitles>)
/// formatted subtitle file.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SrtOutputFileFormatConfig {}
/// Configuration for the format of the results stored to `output`.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct OutputFormatConfig {
/// Configuration for the native output format. If this field is set or if no
/// other output format field is set then transcripts will be written to the
/// sink in the native format.
#[prost(message, optional, tag = "1")]
pub native: ::core::option::Option<NativeOutputFileFormatConfig>,
/// Configuration for the vtt output format. If this field is set then
/// transcripts will be written to the sink in the vtt format.
#[prost(message, optional, tag = "2")]
pub vtt: ::core::option::Option<VttOutputFileFormatConfig>,
/// Configuration for the srt output format. If this field is set then
/// transcripts will be written to the sink in the srt format.
#[prost(message, optional, tag = "3")]
pub srt: ::core::option::Option<SrtOutputFileFormatConfig>,
}
/// Configuration options for the output(s) of recognition.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RecognitionOutputConfig {
/// Optional. Configuration for the format of the results stored to `output`.
/// If unspecified transcripts will be written in the `NATIVE` format only.
#[prost(message, optional, tag = "3")]
pub output_format_config: ::core::option::Option<OutputFormatConfig>,
#[prost(oneof = "recognition_output_config::Output", tags = "1, 2")]
pub output: ::core::option::Option<recognition_output_config::Output>,
}
/// Nested message and enum types in `RecognitionOutputConfig`.
pub mod recognition_output_config {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Output {
/// If this message is populated, recognition results are written to the
/// provided Google Cloud Storage URI.
#[prost(message, tag = "1")]
GcsOutputConfig(super::GcsOutputConfig),
/// If this message is populated, recognition results are provided in the
/// [BatchRecognizeResponse][google.cloud.speech.v2.BatchRecognizeResponse]
/// message of the Operation when completed. This is only supported when
/// calling [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]
/// with just one audio file.
#[prost(message, tag = "2")]
InlineResponseConfig(super::InlineOutputConfig),
}
}
/// Response message for
/// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize] that is
/// packaged into a longrunning [Operation][google.longrunning.Operation].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRecognizeResponse {
/// Map from filename to the final result for that file.
#[prost(btree_map = "string, message", tag = "1")]
pub results: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
BatchRecognizeFileResult,
>,
/// When available, billed audio seconds for the corresponding request.
#[prost(message, optional, tag = "2")]
pub total_billed_duration: ::core::option::Option<::prost_types::Duration>,
}
/// Output type for Cloud Storage of BatchRecognize transcripts. Though this
/// proto isn't returned in this API anywhere, the Cloud Storage transcripts will
/// be this proto serialized and should be parsed as such.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRecognizeResults {
/// Sequential list of transcription results corresponding to sequential
/// portions of audio.
#[prost(message, repeated, tag = "1")]
pub results: ::prost::alloc::vec::Vec<SpeechRecognitionResult>,
/// Metadata about the recognition.
#[prost(message, optional, tag = "2")]
pub metadata: ::core::option::Option<RecognitionResponseMetadata>,
}
/// Final results written to Cloud Storage.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CloudStorageResult {
/// The Cloud Storage URI to which recognition results were written.
#[prost(string, tag = "1")]
pub uri: ::prost::alloc::string::String,
/// The Cloud Storage URI to which recognition results were written as VTT
/// formatted captions. This is populated only when `VTT` output is requested.
#[prost(string, tag = "2")]
pub vtt_format_uri: ::prost::alloc::string::String,
/// The Cloud Storage URI to which recognition results were written as SRT
/// formatted captions. This is populated only when `SRT` output is requested.
#[prost(string, tag = "3")]
pub srt_format_uri: ::prost::alloc::string::String,
}
/// Final results returned inline in the recognition response.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InlineResult {
/// The transcript for the audio file.
#[prost(message, optional, tag = "1")]
pub transcript: ::core::option::Option<BatchRecognizeResults>,
/// The transcript for the audio file as VTT formatted captions. This is
/// populated only when `VTT` output is requested.
#[prost(string, tag = "2")]
pub vtt_captions: ::prost::alloc::string::String,
/// The transcript for the audio file as SRT formatted captions. This is
/// populated only when `SRT` output is requested.
#[prost(string, tag = "3")]
pub srt_captions: ::prost::alloc::string::String,
}
/// Final results for a single file.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRecognizeFileResult {
/// Error if one was encountered.
#[prost(message, optional, tag = "2")]
pub error: ::core::option::Option<super::super::super::rpc::Status>,
#[prost(message, optional, tag = "3")]
pub metadata: ::core::option::Option<RecognitionResponseMetadata>,
/// Deprecated. Use `cloud_storage_result.native_format_uri` instead.
#[deprecated]
#[prost(string, tag = "1")]
pub uri: ::prost::alloc::string::String,
/// Deprecated. Use `inline_result.transcript` instead.
#[deprecated]
#[prost(message, optional, tag = "4")]
pub transcript: ::core::option::Option<BatchRecognizeResults>,
#[prost(oneof = "batch_recognize_file_result::Result", tags = "5, 6")]
pub result: ::core::option::Option<batch_recognize_file_result::Result>,
}
/// Nested message and enum types in `BatchRecognizeFileResult`.
pub mod batch_recognize_file_result {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Result {
/// Recognition results written to Cloud Storage. This is
/// populated only when
/// [GcsOutputConfig][google.cloud.speech.v2.GcsOutputConfig] is set in
/// the
/// [RecognitionOutputConfig][\[google.cloud.speech.v2.RecognitionOutputConfig\].
#[prost(message, tag = "5")]
CloudStorageResult(super::CloudStorageResult),
/// Recognition results. This is populated only when
/// [InlineOutputConfig][google.cloud.speech.v2.InlineOutputConfig] is set in
/// the
/// [RecognitionOutputConfig][\[google.cloud.speech.v2.RecognitionOutputConfig\].
#[prost(message, tag = "6")]
InlineResult(super::InlineResult),
}
}
/// Metadata about transcription for a single file (for example, progress
/// percent).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRecognizeTranscriptionMetadata {
/// How much of the file has been transcribed so far.
#[prost(int32, tag = "1")]
pub progress_percent: i32,
/// Error if one was encountered.
#[prost(message, optional, tag = "2")]
pub error: ::core::option::Option<super::super::super::rpc::Status>,
/// The Cloud Storage URI to which recognition results will be written.
#[prost(string, tag = "3")]
pub uri: ::prost::alloc::string::String,
}
/// Operation metadata for
/// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRecognizeMetadata {
/// Map from provided filename to the transcription metadata for that file.
#[prost(btree_map = "string, message", tag = "1")]
pub transcription_metadata: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
BatchRecognizeTranscriptionMetadata,
>,
}
/// Metadata about a single file in a batch for BatchRecognize.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRecognizeFileMetadata {
/// Features and audio metadata to use for the Automatic Speech Recognition.
/// This field in combination with the
/// [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
/// field can be used to override parts of the
/// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
/// of the Recognizer resource as well as the
/// [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
/// request level.
#[prost(message, optional, tag = "4")]
pub config: ::core::option::Option<RecognitionConfig>,
/// The list of fields in
/// [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
/// override the values in the
/// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
/// of the recognizer during this recognition request. If no mask is provided,
/// all non-default valued fields in
/// [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
/// the values in the recognizer for this recognition request. If a mask is
/// provided, only the fields listed in the mask override the config in the
/// recognizer for this recognition request. If a wildcard (`*`) is provided,
/// [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
/// completely overrides and replaces the config in the recognizer for this
/// recognition request.
#[prost(message, optional, tag = "5")]
pub config_mask: ::core::option::Option<::prost_types::FieldMask>,
/// The audio source, which is a Google Cloud Storage URI.
#[prost(oneof = "batch_recognize_file_metadata::AudioSource", tags = "1")]
pub audio_source: ::core::option::Option<batch_recognize_file_metadata::AudioSource>,
}
/// Nested message and enum types in `BatchRecognizeFileMetadata`.
pub mod batch_recognize_file_metadata {
/// The audio source, which is a Google Cloud Storage URI.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum AudioSource {
/// Cloud Storage URI for the audio file.
#[prost(string, tag = "1")]
Uri(::prost::alloc::string::String),
}
}
/// A streaming speech recognition result corresponding to a portion of the audio
/// that is currently being processed.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamingRecognitionResult {
/// May contain one or more recognition hypotheses. These alternatives are
/// ordered in terms of accuracy, with the top (first) alternative being the
/// most probable, as ranked by the recognizer.
#[prost(message, repeated, tag = "1")]
pub alternatives: ::prost::alloc::vec::Vec<SpeechRecognitionAlternative>,
/// If `false`, this
/// [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult]
/// represents an interim result that may change. If `true`, this is the final
/// time the speech service will return this particular
/// [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult],
/// the recognizer will not return any further hypotheses for this portion of
/// the transcript and corresponding audio.
#[prost(bool, tag = "2")]
pub is_final: bool,
/// An estimate of the likelihood that the recognizer will not change its guess
/// about this interim result. Values range from 0.0 (completely unstable)
/// to 1.0 (completely stable). This field is only provided for interim results
/// ([is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`).
/// The default of 0.0 is a sentinel value indicating `stability` was not set.
#[prost(float, tag = "3")]
pub stability: f32,
/// Time offset of the end of this result relative to the beginning of the
/// audio.
#[prost(message, optional, tag = "4")]
pub result_end_offset: ::core::option::Option<::prost_types::Duration>,
/// For multi-channel audio, this is the channel number corresponding to the
/// recognized result for the audio from that channel.
/// For
/// `audio_channel_count` = `N`, its output values can range from `1` to `N`.
#[prost(int32, tag = "5")]
pub channel_tag: i32,
/// Output only. The [BCP-47](<https://www.rfc-editor.org/rfc/bcp/bcp47.txt>)
/// language tag of the language in this result. This language code was
/// detected to have the most likelihood of being spoken in the audio.
#[prost(string, tag = "6")]
pub language_code: ::prost::alloc::string::String,
}
/// `StreamingRecognizeResponse` is the only message returned to the client by
/// `StreamingRecognize`. A series of zero or more `StreamingRecognizeResponse`
/// messages are streamed back to the client. If there is no recognizable
/// audio then no messages are streamed back to the client.
///
/// Here are some examples of `StreamingRecognizeResponse`s that might
/// be returned while processing audio:
///
/// 1. results { alternatives { transcript: "tube" } stability: 0.01 }
///
/// 2. results { alternatives { transcript: "to be a" } stability: 0.01 }
///
/// 3. results { alternatives { transcript: "to be" } stability: 0.9 }
/// results { alternatives { transcript: " or not to be" } stability: 0.01 }
///
/// 4. results { alternatives { transcript: "to be or not to be"
/// confidence: 0.92 }
/// alternatives { transcript: "to bee or not to bee" }
/// is_final: true }
///
/// 5. results { alternatives { transcript: " that's" } stability: 0.01 }
///
/// 6. results { alternatives { transcript: " that is" } stability: 0.9 }
/// results { alternatives { transcript: " the question" } stability: 0.01 }
///
/// 7. results { alternatives { transcript: " that is the question"
/// confidence: 0.98 }
/// alternatives { transcript: " that was the question" }
/// is_final: true }
///
/// Notes:
///
/// - Only two of the above responses #4 and #7 contain final results; they are
/// indicated by `is_final: true`. Concatenating these together generates the
/// full transcript: "to be or not to be that is the question".
///
/// - The others contain interim `results`. #3 and #6 contain two interim
/// `results`: the first portion has a high stability and is less likely to
/// change; the second portion has a low stability and is very likely to
/// change. A UI designer might choose to show only high stability `results`.
///
/// - The specific `stability` and `confidence` values shown above are only for
/// illustrative purposes. Actual values may vary.
///
/// - In each response, only one of these fields will be set:
/// `error`,
/// `speech_event_type`, or
/// one or more (repeated) `results`.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamingRecognizeResponse {
/// This repeated list contains zero or more results that
/// correspond to consecutive portions of the audio currently being processed.
/// It contains zero or one
/// [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
/// result (the newly settled portion), followed by zero or more
/// [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
/// results (the interim results).
#[prost(message, repeated, tag = "6")]
pub results: ::prost::alloc::vec::Vec<StreamingRecognitionResult>,
/// Indicates the type of speech event.
#[prost(enumeration = "streaming_recognize_response::SpeechEventType", tag = "3")]
pub speech_event_type: i32,
/// Time offset between the beginning of the audio and event emission.
#[prost(message, optional, tag = "7")]
pub speech_event_offset: ::core::option::Option<::prost_types::Duration>,
/// Metadata about the recognition.
#[prost(message, optional, tag = "5")]
pub metadata: ::core::option::Option<RecognitionResponseMetadata>,
}
/// Nested message and enum types in `StreamingRecognizeResponse`.
pub mod streaming_recognize_response {
/// Indicates the type of speech event.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum SpeechEventType {
/// No speech event specified.
Unspecified = 0,
/// This event indicates that the server has detected the end of the user's
/// speech utterance and expects no additional speech. Therefore, the server
/// will not process additional audio and will close the gRPC bidirectional
/// stream. This event is only sent if there was a force cutoff due to
/// silence being detected early. This event is only available through the
/// `latest_short` [model][google.cloud.speech.v2.Recognizer.model].
EndOfSingleUtterance = 1,
/// This event indicates that the server has detected the beginning of human
/// voice activity in the stream. This event can be returned multiple times
/// if speech starts and stops repeatedly throughout the stream. This event
/// is only sent if `voice_activity_events` is set to true.
SpeechActivityBegin = 2,
/// This event indicates that the server has detected the end of human voice
/// activity in the stream. This event can be returned multiple times if
/// speech starts and stops repeatedly throughout the stream. This event is
/// only sent if `voice_activity_events` is set to true.
SpeechActivityEnd = 3,
}
impl SpeechEventType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
SpeechEventType::Unspecified => "SPEECH_EVENT_TYPE_UNSPECIFIED",
SpeechEventType::EndOfSingleUtterance => "END_OF_SINGLE_UTTERANCE",
SpeechEventType::SpeechActivityBegin => "SPEECH_ACTIVITY_BEGIN",
SpeechEventType::SpeechActivityEnd => "SPEECH_ACTIVITY_END",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SPEECH_EVENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"END_OF_SINGLE_UTTERANCE" => Some(Self::EndOfSingleUtterance),
"SPEECH_ACTIVITY_BEGIN" => Some(Self::SpeechActivityBegin),
"SPEECH_ACTIVITY_END" => Some(Self::SpeechActivityEnd),
_ => None,
}
}
}
}
/// Message representing the config for the Speech-to-Text API. This includes an
/// optional [KMS key](<https://cloud.google.com/kms/docs/resource-hierarchy#keys>)
/// with which incoming data will be encrypted.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Config {
/// Output only. Identifier. The name of the config resource. There is exactly
/// one config resource per project per location. The expected format is
/// `projects/{project}/locations/{location}/config`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Optional. An optional [KMS key
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#keys>) that if
/// present, will be used to encrypt Speech-to-Text resources at-rest. Updating
/// this key will not encrypt existing resources using this key; only new
/// resources will be encrypted using this key. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
#[prost(string, tag = "2")]
pub kms_key_name: ::prost::alloc::string::String,
/// Output only. The most recent time this resource was modified.
#[prost(message, optional, tag = "3")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Request message for the
/// [GetConfig][google.cloud.speech.v2.Speech.GetConfig] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConfigRequest {
/// Required. The name of the config to retrieve. There is exactly one config
/// resource per project per location. The expected format is
/// `projects/{project}/locations/{location}/config`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request message for the
/// [UpdateConfig][google.cloud.speech.v2.Speech.UpdateConfig] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateConfigRequest {
/// Required. The config to update.
///
/// The config's `name` field is used to identify the config to be updated.
/// The expected format is `projects/{project}/locations/{location}/config`.
#[prost(message, optional, tag = "1")]
pub config: ::core::option::Option<Config>,
/// The list of fields to be updated.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// CustomClass for biasing in speech recognition. Used to define a set of words
/// or phrases that represents a common concept or theme likely to appear in your
/// audio, for example a list of passenger ship names.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CustomClass {
/// Output only. Identifier. The resource name of the CustomClass.
/// Format:
/// `projects/{project}/locations/{location}/customClasses/{custom_class}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Output only. System-assigned unique identifier for the CustomClass.
#[prost(string, tag = "2")]
pub uid: ::prost::alloc::string::String,
/// Optional. User-settable, human-readable name for the CustomClass. Must be
/// 63 characters or less.
#[prost(string, tag = "4")]
pub display_name: ::prost::alloc::string::String,
/// A collection of class items.
#[prost(message, repeated, tag = "5")]
pub items: ::prost::alloc::vec::Vec<custom_class::ClassItem>,
/// Output only. The CustomClass lifecycle state.
#[prost(enumeration = "custom_class::State", tag = "15")]
pub state: i32,
/// Output only. Creation time.
#[prost(message, optional, tag = "6")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The most recent time this resource was modified.
#[prost(message, optional, tag = "7")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The time at which this resource was requested for deletion.
#[prost(message, optional, tag = "8")]
pub delete_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The time at which this resource will be purged.
#[prost(message, optional, tag = "9")]
pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
/// Optional. Allows users to store small amounts of arbitrary data.
/// Both the key and the value must be 63 characters or less each.
/// At most 100 annotations.
#[prost(btree_map = "string, string", tag = "10")]
pub annotations: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Output only. This checksum is computed by the server based on the value of
/// other fields. This may be sent on update, undelete, and delete requests to
/// ensure the client has an up-to-date value before proceeding.
#[prost(string, tag = "11")]
pub etag: ::prost::alloc::string::String,
/// Output only. Whether or not this CustomClass is in the process of being
/// updated.
#[prost(bool, tag = "12")]
pub reconciling: bool,
/// Output only. The [KMS key
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#keys>) with which
/// the CustomClass is encrypted. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
#[prost(string, tag = "13")]
pub kms_key_name: ::prost::alloc::string::String,
/// Output only. The [KMS key version
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#key_versions>)
/// with which the CustomClass is encrypted. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
#[prost(string, tag = "14")]
pub kms_key_version_name: ::prost::alloc::string::String,
}
/// Nested message and enum types in `CustomClass`.
pub mod custom_class {
/// An item of the class.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClassItem {
/// The class item's value.
#[prost(string, tag = "1")]
pub value: ::prost::alloc::string::String,
}
/// Set of states that define the lifecycle of a CustomClass.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// Unspecified state. This is only used/useful for distinguishing
/// unset values.
Unspecified = 0,
/// The normal and active state.
Active = 2,
/// This CustomClass has been deleted.
Deleted = 4,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Active => "ACTIVE",
State::Deleted => "DELETED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"ACTIVE" => Some(Self::Active),
"DELETED" => Some(Self::Deleted),
_ => None,
}
}
}
}
/// PhraseSet for biasing in speech recognition. A PhraseSet is used to provide
/// "hints" to the speech recognizer to favor specific words and phrases in the
/// results.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PhraseSet {
/// Output only. Identifier. The resource name of the PhraseSet.
/// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Output only. System-assigned unique identifier for the PhraseSet.
#[prost(string, tag = "2")]
pub uid: ::prost::alloc::string::String,
/// A list of word and phrases.
#[prost(message, repeated, tag = "3")]
pub phrases: ::prost::alloc::vec::Vec<phrase_set::Phrase>,
/// Hint Boost. Positive value will increase the probability that a specific
/// phrase will be recognized over other similar sounding phrases. The higher
/// the boost, the higher the chance of false positive recognition as well.
/// Valid `boost` values are between 0 (exclusive) and 20. We recommend using a
/// binary search approach to finding the optimal value for your use case as
/// well as adding phrases both with and without boost to your requests.
#[prost(float, tag = "4")]
pub boost: f32,
/// User-settable, human-readable name for the PhraseSet. Must be 63
/// characters or less.
#[prost(string, tag = "5")]
pub display_name: ::prost::alloc::string::String,
/// Output only. The PhraseSet lifecycle state.
#[prost(enumeration = "phrase_set::State", tag = "15")]
pub state: i32,
/// Output only. Creation time.
#[prost(message, optional, tag = "6")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The most recent time this resource was modified.
#[prost(message, optional, tag = "7")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The time at which this resource was requested for deletion.
#[prost(message, optional, tag = "8")]
pub delete_time: ::core::option::Option<::prost_types::Timestamp>,
/// Output only. The time at which this resource will be purged.
#[prost(message, optional, tag = "9")]
pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
/// Allows users to store small amounts of arbitrary data.
/// Both the key and the value must be 63 characters or less each.
/// At most 100 annotations.
#[prost(btree_map = "string, string", tag = "10")]
pub annotations: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Output only. This checksum is computed by the server based on the value of
/// other fields. This may be sent on update, undelete, and delete requests to
/// ensure the client has an up-to-date value before proceeding.
#[prost(string, tag = "11")]
pub etag: ::prost::alloc::string::String,
/// Output only. Whether or not this PhraseSet is in the process of being
/// updated.
#[prost(bool, tag = "12")]
pub reconciling: bool,
/// Output only. The [KMS key
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#keys>) with which
/// the PhraseSet is encrypted. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
#[prost(string, tag = "13")]
pub kms_key_name: ::prost::alloc::string::String,
/// Output only. The [KMS key version
/// name](<https://cloud.google.com/kms/docs/resource-hierarchy#key_versions>)
/// with which the PhraseSet is encrypted. The expected format is
/// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
#[prost(string, tag = "14")]
pub kms_key_version_name: ::prost::alloc::string::String,
}
/// Nested message and enum types in `PhraseSet`.
pub mod phrase_set {
/// A Phrase contains words and phrase "hints" so that the speech recognition
/// is more likely to recognize them. This can be used to improve the accuracy
/// for specific words and phrases, for example, if specific commands are
/// typically spoken by the user. This can also be used to add additional words
/// to the vocabulary of the recognizer.
///
/// List items can also include CustomClass references containing groups of
/// words that represent common concepts that occur in natural language.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Phrase {
/// The phrase itself.
#[prost(string, tag = "1")]
pub value: ::prost::alloc::string::String,
/// Hint Boost. Overrides the boost set at the phrase set level.
/// Positive value will increase the probability that a specific phrase will
/// be recognized over other similar sounding phrases. The higher the boost,
/// the higher the chance of false positive recognition as well. Negative
/// boost values would correspond to anti-biasing. Anti-biasing is not
/// enabled, so negative boost values will return an error. Boost values must
/// be between 0 and 20. Any values outside that range will return an error.
/// We recommend using a binary search approach to finding the optimal value
/// for your use case as well as adding phrases both with and without boost
/// to your requests.
#[prost(float, tag = "2")]
pub boost: f32,
}
/// Set of states that define the lifecycle of a PhraseSet.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// Unspecified state. This is only used/useful for distinguishing
/// unset values.
Unspecified = 0,
/// The normal and active state.
Active = 2,
/// This PhraseSet has been deleted.
Deleted = 4,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Active => "ACTIVE",
State::Deleted => "DELETED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"ACTIVE" => Some(Self::Active),
"DELETED" => Some(Self::Deleted),
_ => None,
}
}
}
}
/// Request message for the
/// [CreateCustomClass][google.cloud.speech.v2.Speech.CreateCustomClass] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCustomClassRequest {
/// Required. The CustomClass to create.
#[prost(message, optional, tag = "1")]
pub custom_class: ::core::option::Option<CustomClass>,
/// If set, validate the request and preview the CustomClass, but do not
/// actually create it.
#[prost(bool, tag = "2")]
pub validate_only: bool,
/// The ID to use for the CustomClass, which will become the final component of
/// the CustomClass's resource name.
///
/// This value should be 4-63 characters, and valid characters
/// are /[a-z][0-9]-/.
#[prost(string, tag = "3")]
pub custom_class_id: ::prost::alloc::string::String,
/// Required. The project and location where this CustomClass will be created.
/// The expected format is `projects/{project}/locations/{location}`.
#[prost(string, tag = "4")]
pub parent: ::prost::alloc::string::String,
}
/// Request message for the
/// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCustomClassesRequest {
/// Required. The project and location of CustomClass resources to list. The
/// expected format is `projects/{project}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Number of results per requests. A valid page_size ranges from 0 to 100
/// inclusive. If the page_size is zero or unspecified, a page size of 5 will
/// be chosen. If the page size exceeds 100, it will be coerced down to 100.
/// Note that a call might return fewer results than the requested page size.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous
/// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to
/// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
/// match the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
/// Whether, or not, to show resources that have been deleted.
#[prost(bool, tag = "4")]
pub show_deleted: bool,
}
/// Response message for the
/// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCustomClassesResponse {
/// The list of requested CustomClasses.
#[prost(message, repeated, tag = "1")]
pub custom_classes: ::prost::alloc::vec::Vec<CustomClass>,
/// A token, which can be sent as
/// [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
/// retrieve the next page. If this field is omitted, there are no subsequent
/// pages. This token expires after 72 hours.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for the
/// [GetCustomClass][google.cloud.speech.v2.Speech.GetCustomClass] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCustomClassRequest {
/// Required. The name of the CustomClass to retrieve. The expected format is
/// `projects/{project}/locations/{location}/customClasses/{custom_class}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request message for the
/// [UpdateCustomClass][google.cloud.speech.v2.Speech.UpdateCustomClass] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateCustomClassRequest {
/// Required. The CustomClass to update.
///
/// The CustomClass's `name` field is used to identify the CustomClass to
/// update. Format:
/// `projects/{project}/locations/{location}/customClasses/{custom_class}`.
#[prost(message, optional, tag = "1")]
pub custom_class: ::core::option::Option<CustomClass>,
/// The list of fields to be updated. If empty, all fields are considered for
/// update.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
/// If set, validate the request and preview the updated CustomClass, but do
/// not actually update it.
#[prost(bool, tag = "4")]
pub validate_only: bool,
}
/// Request message for the
/// [DeleteCustomClass][google.cloud.speech.v2.Speech.DeleteCustomClass] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteCustomClassRequest {
/// Required. The name of the CustomClass to delete.
/// Format:
/// `projects/{project}/locations/{location}/customClasses/{custom_class}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// If set, validate the request and preview the deleted CustomClass, but do
/// not actually delete it.
#[prost(bool, tag = "2")]
pub validate_only: bool,
/// If set to true, and the CustomClass is not found, the request will succeed
/// and be a no-op (no Operation is recorded in this case).
#[prost(bool, tag = "4")]
pub allow_missing: bool,
/// This checksum is computed by the server based on the value of other
/// fields. This may be sent on update, undelete, and delete requests to ensure
/// the client has an up-to-date value before proceeding.
#[prost(string, tag = "3")]
pub etag: ::prost::alloc::string::String,
}
/// Request message for the
/// [UndeleteCustomClass][google.cloud.speech.v2.Speech.UndeleteCustomClass]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UndeleteCustomClassRequest {
/// Required. The name of the CustomClass to undelete.
/// Format:
/// `projects/{project}/locations/{location}/customClasses/{custom_class}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// If set, validate the request and preview the undeleted CustomClass, but do
/// not actually undelete it.
#[prost(bool, tag = "3")]
pub validate_only: bool,
/// This checksum is computed by the server based on the value of other
/// fields. This may be sent on update, undelete, and delete requests to ensure
/// the client has an up-to-date value before proceeding.
#[prost(string, tag = "4")]
pub etag: ::prost::alloc::string::String,
}
/// Request message for the
/// [CreatePhraseSet][google.cloud.speech.v2.Speech.CreatePhraseSet] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreatePhraseSetRequest {
/// Required. The PhraseSet to create.
#[prost(message, optional, tag = "1")]
pub phrase_set: ::core::option::Option<PhraseSet>,
/// If set, validate the request and preview the PhraseSet, but do not
/// actually create it.
#[prost(bool, tag = "2")]
pub validate_only: bool,
/// The ID to use for the PhraseSet, which will become the final component of
/// the PhraseSet's resource name.
///
/// This value should be 4-63 characters, and valid characters
/// are /[a-z][0-9]-/.
#[prost(string, tag = "3")]
pub phrase_set_id: ::prost::alloc::string::String,
/// Required. The project and location where this PhraseSet will be created.
/// The expected format is `projects/{project}/locations/{location}`.
#[prost(string, tag = "4")]
pub parent: ::prost::alloc::string::String,
}
/// Request message for the
/// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPhraseSetsRequest {
/// Required. The project and location of PhraseSet resources to list. The
/// expected format is `projects/{project}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of PhraseSets to return. The service may return fewer
/// than this value. If unspecified, at most 5 PhraseSets will be returned.
/// The maximum value is 100; values above 100 will be coerced to 100.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous
/// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to
/// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
/// the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
/// Whether, or not, to show resources that have been deleted.
#[prost(bool, tag = "4")]
pub show_deleted: bool,
}
/// Response message for the
/// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPhraseSetsResponse {
/// The list of requested PhraseSets.
#[prost(message, repeated, tag = "1")]
pub phrase_sets: ::prost::alloc::vec::Vec<PhraseSet>,
/// A token, which can be sent as
/// [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
/// retrieve the next page. If this field is omitted, there are no subsequent
/// pages. This token expires after 72 hours.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for the
/// [GetPhraseSet][google.cloud.speech.v2.Speech.GetPhraseSet] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetPhraseSetRequest {
/// Required. The name of the PhraseSet to retrieve. The expected format is
/// `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request message for the
/// [UpdatePhraseSet][google.cloud.speech.v2.Speech.UpdatePhraseSet] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdatePhraseSetRequest {
/// Required. The PhraseSet to update.
///
/// The PhraseSet's `name` field is used to identify the PhraseSet to update.
/// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
#[prost(message, optional, tag = "1")]
pub phrase_set: ::core::option::Option<PhraseSet>,
/// The list of fields to update. If empty, all non-default valued fields are
/// considered for update. Use `*` to update the entire PhraseSet resource.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
/// If set, validate the request and preview the updated PhraseSet, but do not
/// actually update it.
#[prost(bool, tag = "4")]
pub validate_only: bool,
}
/// Request message for the
/// [DeletePhraseSet][google.cloud.speech.v2.Speech.DeletePhraseSet] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeletePhraseSetRequest {
/// Required. The name of the PhraseSet to delete.
/// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// If set, validate the request and preview the deleted PhraseSet, but do not
/// actually delete it.
#[prost(bool, tag = "2")]
pub validate_only: bool,
/// If set to true, and the PhraseSet is not found, the request will succeed
/// and be a no-op (no Operation is recorded in this case).
#[prost(bool, tag = "4")]
pub allow_missing: bool,
/// This checksum is computed by the server based on the value of other
/// fields. This may be sent on update, undelete, and delete requests to ensure
/// the client has an up-to-date value before proceeding.
#[prost(string, tag = "3")]
pub etag: ::prost::alloc::string::String,
}
/// Request message for the
/// [UndeletePhraseSet][google.cloud.speech.v2.Speech.UndeletePhraseSet]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UndeletePhraseSetRequest {
/// Required. The name of the PhraseSet to undelete.
/// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// If set, validate the request and preview the undeleted PhraseSet, but do
/// not actually undelete it.
#[prost(bool, tag = "3")]
pub validate_only: bool,
/// This checksum is computed by the server based on the value of other
/// fields. This may be sent on update, undelete, and delete requests to ensure
/// the client has an up-to-date value before proceeding.
#[prost(string, tag = "4")]
pub etag: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod speech_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Enables speech transcription and resource management.
#[derive(Debug, Clone)]
pub struct SpeechClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> SpeechClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SpeechClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
SpeechClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
pub async fn create_recognizer(
&mut self,
request: impl tonic::IntoRequest<super::CreateRecognizerRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/CreateRecognizer",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "CreateRecognizer"),
);
self.inner.unary(req, path, codec).await
}
/// Lists Recognizers.
pub async fn list_recognizers(
&mut self,
request: impl tonic::IntoRequest<super::ListRecognizersRequest>,
) -> std::result::Result<
tonic::Response<super::ListRecognizersResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/ListRecognizers",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "ListRecognizers"),
);
self.inner.unary(req, path, codec).await
}
/// Returns the requested
/// [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
/// [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't
/// exist.
pub async fn get_recognizer(
&mut self,
request: impl tonic::IntoRequest<super::GetRecognizerRequest>,
) -> std::result::Result<tonic::Response<super::Recognizer>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/GetRecognizer",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "GetRecognizer"),
);
self.inner.unary(req, path, codec).await
}
/// Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
pub async fn update_recognizer(
&mut self,
request: impl tonic::IntoRequest<super::UpdateRecognizerRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/UpdateRecognizer",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "UpdateRecognizer"),
);
self.inner.unary(req, path, codec).await
}
/// Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
pub async fn delete_recognizer(
&mut self,
request: impl tonic::IntoRequest<super::DeleteRecognizerRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/DeleteRecognizer",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "DeleteRecognizer"),
);
self.inner.unary(req, path, codec).await
}
/// Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
pub async fn undelete_recognizer(
&mut self,
request: impl tonic::IntoRequest<super::UndeleteRecognizerRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/UndeleteRecognizer",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.speech.v2.Speech",
"UndeleteRecognizer",
),
);
self.inner.unary(req, path, codec).await
}
/// Performs synchronous Speech recognition: receive results after all audio
/// has been sent and processed.
pub async fn recognize(
&mut self,
request: impl tonic::IntoRequest<super::RecognizeRequest>,
) -> std::result::Result<
tonic::Response<super::RecognizeResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/Recognize",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("google.cloud.speech.v2.Speech", "Recognize"));
self.inner.unary(req, path, codec).await
}
/// Performs bidirectional streaming speech recognition: receive results while
/// sending audio. This method is only available via the gRPC API (not REST).
pub async fn streaming_recognize(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::StreamingRecognizeRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::StreamingRecognizeResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/StreamingRecognize",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.speech.v2.Speech",
"StreamingRecognize",
),
);
self.inner.streaming(req, path, codec).await
}
/// Performs batch asynchronous speech recognition: send a request with N
/// audio files and receive a long running operation that can be polled to see
/// when the transcriptions are finished.
pub async fn batch_recognize(
&mut self,
request: impl tonic::IntoRequest<super::BatchRecognizeRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/BatchRecognize",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "BatchRecognize"),
);
self.inner.unary(req, path, codec).await
}
/// Returns the requested [Config][google.cloud.speech.v2.Config].
pub async fn get_config(
&mut self,
request: impl tonic::IntoRequest<super::GetConfigRequest>,
) -> std::result::Result<tonic::Response<super::Config>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/GetConfig",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("google.cloud.speech.v2.Speech", "GetConfig"));
self.inner.unary(req, path, codec).await
}
/// Updates the [Config][google.cloud.speech.v2.Config].
pub async fn update_config(
&mut self,
request: impl tonic::IntoRequest<super::UpdateConfigRequest>,
) -> std::result::Result<tonic::Response<super::Config>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/UpdateConfig",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "UpdateConfig"),
);
self.inner.unary(req, path, codec).await
}
/// Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
pub async fn create_custom_class(
&mut self,
request: impl tonic::IntoRequest<super::CreateCustomClassRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/CreateCustomClass",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "CreateCustomClass"),
);
self.inner.unary(req, path, codec).await
}
/// Lists CustomClasses.
pub async fn list_custom_classes(
&mut self,
request: impl tonic::IntoRequest<super::ListCustomClassesRequest>,
) -> std::result::Result<
tonic::Response<super::ListCustomClassesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/ListCustomClasses",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "ListCustomClasses"),
);
self.inner.unary(req, path, codec).await
}
/// Returns the requested
/// [CustomClass][google.cloud.speech.v2.CustomClass].
pub async fn get_custom_class(
&mut self,
request: impl tonic::IntoRequest<super::GetCustomClassRequest>,
) -> std::result::Result<tonic::Response<super::CustomClass>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/GetCustomClass",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "GetCustomClass"),
);
self.inner.unary(req, path, codec).await
}
/// Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
pub async fn update_custom_class(
&mut self,
request: impl tonic::IntoRequest<super::UpdateCustomClassRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/UpdateCustomClass",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "UpdateCustomClass"),
);
self.inner.unary(req, path, codec).await
}
/// Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
pub async fn delete_custom_class(
&mut self,
request: impl tonic::IntoRequest<super::DeleteCustomClassRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/DeleteCustomClass",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "DeleteCustomClass"),
);
self.inner.unary(req, path, codec).await
}
/// Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
pub async fn undelete_custom_class(
&mut self,
request: impl tonic::IntoRequest<super::UndeleteCustomClassRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/UndeleteCustomClass",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.speech.v2.Speech",
"UndeleteCustomClass",
),
);
self.inner.unary(req, path, codec).await
}
/// Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
pub async fn create_phrase_set(
&mut self,
request: impl tonic::IntoRequest<super::CreatePhraseSetRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/CreatePhraseSet",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "CreatePhraseSet"),
);
self.inner.unary(req, path, codec).await
}
/// Lists PhraseSets.
pub async fn list_phrase_sets(
&mut self,
request: impl tonic::IntoRequest<super::ListPhraseSetsRequest>,
) -> std::result::Result<
tonic::Response<super::ListPhraseSetsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/ListPhraseSets",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "ListPhraseSets"),
);
self.inner.unary(req, path, codec).await
}
/// Returns the requested
/// [PhraseSet][google.cloud.speech.v2.PhraseSet].
pub async fn get_phrase_set(
&mut self,
request: impl tonic::IntoRequest<super::GetPhraseSetRequest>,
) -> std::result::Result<tonic::Response<super::PhraseSet>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/GetPhraseSet",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "GetPhraseSet"),
);
self.inner.unary(req, path, codec).await
}
/// Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
pub async fn update_phrase_set(
&mut self,
request: impl tonic::IntoRequest<super::UpdatePhraseSetRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/UpdatePhraseSet",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "UpdatePhraseSet"),
);
self.inner.unary(req, path, codec).await
}
/// Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
pub async fn delete_phrase_set(
&mut self,
request: impl tonic::IntoRequest<super::DeletePhraseSetRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/DeletePhraseSet",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "DeletePhraseSet"),
);
self.inner.unary(req, path, codec).await
}
/// Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
pub async fn undelete_phrase_set(
&mut self,
request: impl tonic::IntoRequest<super::UndeletePhraseSetRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.speech.v2.Speech/UndeletePhraseSet",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("google.cloud.speech.v2.Speech", "UndeletePhraseSet"),
);
self.inner.unary(req, path, codec).await
}
}
}