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 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132
|
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------
from msrest import Serializer, Deserializer
from ...client import Client
from . import models
class GitClientBase(Client):
"""Git
:param str base_url: Service URL
:param Authentication creds: Authenticated credentials.
"""
def __init__(self, base_url=None, creds=None):
super(GitClientBase, self).__init__(base_url, creds)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
resource_area_identifier = '4e080c62-fa21-4fbc-8fef-2a10a2b38049'
def create_annotated_tag(self, tag_object, project, repository_id):
"""CreateAnnotatedTag.
[Preview API] Create an annotated tag.
:param :class:`<GitAnnotatedTag> <azure.devops.v5_0.git.models.GitAnnotatedTag>` tag_object: Object containing details of tag to be created.
:param str project: Project ID or project name
:param str repository_id: ID or name of the repository.
:rtype: :class:`<GitAnnotatedTag> <azure.devops.v5_0.git.models.GitAnnotatedTag>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(tag_object, 'GitAnnotatedTag')
response = self._send(http_method='POST',
location_id='5e8a8081-3851-4626-b677-9891cc04102e',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitAnnotatedTag', response)
def get_annotated_tag(self, project, repository_id, object_id):
"""GetAnnotatedTag.
[Preview API] Get an annotated tag.
:param str project: Project ID or project name
:param str repository_id: ID or name of the repository.
:param str object_id: ObjectId (Sha1Id) of tag to get.
:rtype: :class:`<GitAnnotatedTag> <azure.devops.v5_0.git.models.GitAnnotatedTag>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if object_id is not None:
route_values['objectId'] = self._serialize.url('object_id', object_id, 'str')
response = self._send(http_method='GET',
location_id='5e8a8081-3851-4626-b677-9891cc04102e',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('GitAnnotatedTag', response)
def get_blob(self, repository_id, sha1, project=None, download=None, file_name=None, resolve_lfs=None):
"""GetBlob.
Get a single blob.
:param str repository_id: The name or ID of the repository.
:param str sha1: SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.
:param str project: Project ID or project name
:param bool download: If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip
:param str file_name: Provide a fileName to use for a download.
:param bool resolve_lfs: If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types
:rtype: :class:`<GitBlobRef> <azure.devops.v5_0.git.models.GitBlobRef>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if sha1 is not None:
route_values['sha1'] = self._serialize.url('sha1', sha1, 'str')
query_parameters = {}
if download is not None:
query_parameters['download'] = self._serialize.query('download', download, 'bool')
if file_name is not None:
query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str')
if resolve_lfs is not None:
query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool')
response = self._send(http_method='GET',
location_id='7b28e929-2c99-405d-9c5c-6167a06e6816',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitBlobRef', response)
def get_blob_content(self, repository_id, sha1, project=None, download=None, file_name=None, resolve_lfs=None, **kwargs):
"""GetBlobContent.
Get a single blob.
:param str repository_id: The name or ID of the repository.
:param str sha1: SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.
:param str project: Project ID or project name
:param bool download: If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip
:param str file_name: Provide a fileName to use for a download.
:param bool resolve_lfs: If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if sha1 is not None:
route_values['sha1'] = self._serialize.url('sha1', sha1, 'str')
query_parameters = {}
if download is not None:
query_parameters['download'] = self._serialize.query('download', download, 'bool')
if file_name is not None:
query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str')
if resolve_lfs is not None:
query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool')
response = self._send(http_method='GET',
location_id='7b28e929-2c99-405d-9c5c-6167a06e6816',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
accept_media_type='application/octet-stream')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None, **kwargs):
"""GetBlobsZip.
Gets one or more blobs in a zip file download.
:param [str] blob_ids: Blob IDs (SHA1 hashes) to be returned in the zip file.
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:param str filename:
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if filename is not None:
query_parameters['filename'] = self._serialize.query('filename', filename, 'str')
content = self._serialize.body(blob_ids, '[str]')
response = self._send(http_method='POST',
location_id='7b28e929-2c99-405d-9c5c-6167a06e6816',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
content=content,
accept_media_type='application/zip')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
def get_blob_zip(self, repository_id, sha1, project=None, download=None, file_name=None, resolve_lfs=None, **kwargs):
"""GetBlobZip.
Get a single blob.
:param str repository_id: The name or ID of the repository.
:param str sha1: SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.
:param str project: Project ID or project name
:param bool download: If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip
:param str file_name: Provide a fileName to use for a download.
:param bool resolve_lfs: If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if sha1 is not None:
route_values['sha1'] = self._serialize.url('sha1', sha1, 'str')
query_parameters = {}
if download is not None:
query_parameters['download'] = self._serialize.query('download', download, 'bool')
if file_name is not None:
query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str')
if resolve_lfs is not None:
query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool')
response = self._send(http_method='GET',
location_id='7b28e929-2c99-405d-9c5c-6167a06e6816',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
accept_media_type='application/zip')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
def get_branch(self, repository_id, name, project=None, base_version_descriptor=None):
"""GetBranch.
Retrieve statistics about a single branch.
:param str repository_id: The name or ID of the repository.
:param str name: Name of the branch.
:param str project: Project ID or project name
:param :class:`<GitVersionDescriptor> <azure.devops.v5_0.git.models.GitVersionDescriptor>` base_version_descriptor: Identifies the commit or branch to use as the base.
:rtype: :class:`<GitBranchStats> <azure.devops.v5_0.git.models.GitBranchStats>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if name is not None:
query_parameters['name'] = self._serialize.query('name', name, 'str')
if base_version_descriptor is not None:
if base_version_descriptor.version_type is not None:
query_parameters['baseVersionDescriptor.versionType'] = base_version_descriptor.version_type
if base_version_descriptor.version is not None:
query_parameters['baseVersionDescriptor.version'] = base_version_descriptor.version
if base_version_descriptor.version_options is not None:
query_parameters['baseVersionDescriptor.versionOptions'] = base_version_descriptor.version_options
response = self._send(http_method='GET',
location_id='d5b216de-d8d5-4d32-ae76-51df755b16d3',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitBranchStats', response)
def get_branches(self, repository_id, project=None, base_version_descriptor=None):
"""GetBranches.
Retrieve statistics about all branches within a repository.
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:param :class:`<GitVersionDescriptor> <azure.devops.v5_0.git.models.GitVersionDescriptor>` base_version_descriptor: Identifies the commit or branch to use as the base.
:rtype: [GitBranchStats]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if base_version_descriptor is not None:
if base_version_descriptor.version_type is not None:
query_parameters['baseVersionDescriptor.versionType'] = base_version_descriptor.version_type
if base_version_descriptor.version is not None:
query_parameters['baseVersionDescriptor.version'] = base_version_descriptor.version
if base_version_descriptor.version_options is not None:
query_parameters['baseVersionDescriptor.versionOptions'] = base_version_descriptor.version_options
response = self._send(http_method='GET',
location_id='d5b216de-d8d5-4d32-ae76-51df755b16d3',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitBranchStats]', self._unwrap_collection(response))
def get_changes(self, commit_id, repository_id, project=None, top=None, skip=None):
"""GetChanges.
Retrieve changes for a particular commit.
:param str commit_id: The id of the commit.
:param str repository_id: The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
:param str project: Project ID or project name
:param int top: The maximum number of changes to return.
:param int skip: The number of changes to skip.
:rtype: :class:`<GitCommitChanges> <azure.devops.v5_0.git.models.GitCommitChanges>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if commit_id is not None:
route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if top is not None:
query_parameters['top'] = self._serialize.query('top', top, 'int')
if skip is not None:
query_parameters['skip'] = self._serialize.query('skip', skip, 'int')
response = self._send(http_method='GET',
location_id='5bf884f5-3e07-42e9-afb8-1b872267bf16',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitCommitChanges', response)
def create_cherry_pick(self, cherry_pick_to_create, project, repository_id):
"""CreateCherryPick.
[Preview API] Cherry pick a specific commit or commits that are associated to a pull request into a new branch.
:param :class:`<GitAsyncRefOperationParameters> <azure.devops.v5_0.git.models.GitAsyncRefOperationParameters>` cherry_pick_to_create:
:param str project: Project ID or project name
:param str repository_id: ID of the repository.
:rtype: :class:`<GitCherryPick> <azure.devops.v5_0.git.models.GitCherryPick>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(cherry_pick_to_create, 'GitAsyncRefOperationParameters')
response = self._send(http_method='POST',
location_id='033bad68-9a14-43d1-90e0-59cb8856fef6',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitCherryPick', response)
def get_cherry_pick(self, project, cherry_pick_id, repository_id):
"""GetCherryPick.
[Preview API] Retrieve information about a cherry pick by cherry pick Id.
:param str project: Project ID or project name
:param int cherry_pick_id: ID of the cherry pick.
:param str repository_id: ID of the repository.
:rtype: :class:`<GitCherryPick> <azure.devops.v5_0.git.models.GitCherryPick>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if cherry_pick_id is not None:
route_values['cherryPickId'] = self._serialize.url('cherry_pick_id', cherry_pick_id, 'int')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
response = self._send(http_method='GET',
location_id='033bad68-9a14-43d1-90e0-59cb8856fef6',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('GitCherryPick', response)
def get_cherry_pick_for_ref_name(self, project, repository_id, ref_name):
"""GetCherryPickForRefName.
[Preview API] Retrieve information about a cherry pick for a specific branch.
:param str project: Project ID or project name
:param str repository_id: ID of the repository.
:param str ref_name: The GitAsyncRefOperationParameters generatedRefName used for the cherry pick operation.
:rtype: :class:`<GitCherryPick> <azure.devops.v5_0.git.models.GitCherryPick>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if ref_name is not None:
query_parameters['refName'] = self._serialize.query('ref_name', ref_name, 'str')
response = self._send(http_method='GET',
location_id='033bad68-9a14-43d1-90e0-59cb8856fef6',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitCherryPick', response)
def get_commit_diffs(self, repository_id, project=None, diff_common_commit=None, top=None, skip=None, base_version_descriptor=None, target_version_descriptor=None):
"""GetCommitDiffs.
Find the closest common commit (the merge base) between base and target commits, and get the diff between either the base and target commits or common and target commits.
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:param bool diff_common_commit: If true, diff between common and target commits. If false, diff between base and target commits.
:param int top: Maximum number of changes to return. Defaults to 100.
:param int skip: Number of changes to skip
:param :class:`<GitBaseVersionDescriptor> <azure.devops.v5_0.git.models.GitBaseVersionDescriptor>` base_version_descriptor: Descriptor for base commit.
:param :class:`<GitTargetVersionDescriptor> <azure.devops.v5_0.git.models.GitTargetVersionDescriptor>` target_version_descriptor: Descriptor for target commit.
:rtype: :class:`<GitCommitDiffs> <azure.devops.v5_0.git.models.GitCommitDiffs>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if diff_common_commit is not None:
query_parameters['diffCommonCommit'] = self._serialize.query('diff_common_commit', diff_common_commit, 'bool')
if top is not None:
query_parameters['$top'] = self._serialize.query('top', top, 'int')
if skip is not None:
query_parameters['$skip'] = self._serialize.query('skip', skip, 'int')
if base_version_descriptor is not None:
if base_version_descriptor.base_version_type is not None:
query_parameters['baseVersionType'] = base_version_descriptor.base_version_type
if base_version_descriptor.base_version is not None:
query_parameters['baseVersion'] = base_version_descriptor.base_version
if base_version_descriptor.base_version_options is not None:
query_parameters['baseVersionOptions'] = base_version_descriptor.base_version_options
if target_version_descriptor is not None:
if target_version_descriptor.target_version_type is not None:
query_parameters['targetVersionType'] = target_version_descriptor.target_version_type
if target_version_descriptor.target_version is not None:
query_parameters['targetVersion'] = target_version_descriptor.target_version
if target_version_descriptor.target_version_options is not None:
query_parameters['targetVersionOptions'] = target_version_descriptor.target_version_options
response = self._send(http_method='GET',
location_id='615588d5-c0c7-4b88-88f8-e625306446e8',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitCommitDiffs', response)
def get_commit(self, commit_id, repository_id, project=None, change_count=None):
"""GetCommit.
Retrieve a particular commit.
:param str commit_id: The id of the commit.
:param str repository_id: The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
:param str project: Project ID or project name
:param int change_count: The number of changes to include in the result.
:rtype: :class:`<GitCommit> <azure.devops.v5_0.git.models.GitCommit>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if commit_id is not None:
route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if change_count is not None:
query_parameters['changeCount'] = self._serialize.query('change_count', change_count, 'int')
response = self._send(http_method='GET',
location_id='c2570c3b-5b3f-41b8-98bf-5407bfde8d58',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitCommit', response)
def get_commits(self, repository_id, search_criteria, project=None, skip=None, top=None):
"""GetCommits.
Retrieve git commits for a project
:param str repository_id: The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
:param :class:`<GitQueryCommitsCriteria> <azure.devops.v5_0.git.models.GitQueryCommitsCriteria>` search_criteria:
:param str project: Project ID or project name
:param int skip:
:param int top:
:rtype: [GitCommitRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if search_criteria is not None:
if search_criteria.ids is not None:
query_parameters['searchCriteria.ids'] = search_criteria.ids
if search_criteria.from_date is not None:
query_parameters['searchCriteria.fromDate'] = search_criteria.from_date
if search_criteria.to_date is not None:
query_parameters['searchCriteria.toDate'] = search_criteria.to_date
if search_criteria.item_version is not None:
if search_criteria.item_version.version_type is not None:
query_parameters['searchCriteria.itemVersion.versionType'] = search_criteria.item_version.version_type
if search_criteria.item_version.version is not None:
query_parameters['searchCriteria.itemVersion.version'] = search_criteria.item_version.version
if search_criteria.item_version.version_options is not None:
query_parameters['searchCriteria.itemVersion.versionOptions'] = search_criteria.item_version.version_options
if search_criteria.compare_version is not None:
if search_criteria.compare_version.version_type is not None:
query_parameters['searchCriteria.compareVersion.versionType'] = search_criteria.compare_version.version_type
if search_criteria.compare_version.version is not None:
query_parameters['searchCriteria.compareVersion.version'] = search_criteria.compare_version.version
if search_criteria.compare_version.version_options is not None:
query_parameters['searchCriteria.compareVersion.versionOptions'] = search_criteria.compare_version.version_options
if search_criteria.from_commit_id is not None:
query_parameters['searchCriteria.fromCommitId'] = search_criteria.from_commit_id
if search_criteria.to_commit_id is not None:
query_parameters['searchCriteria.toCommitId'] = search_criteria.to_commit_id
if search_criteria.user is not None:
query_parameters['searchCriteria.user'] = search_criteria.user
if search_criteria.author is not None:
query_parameters['searchCriteria.author'] = search_criteria.author
if search_criteria.item_path is not None:
query_parameters['searchCriteria.itemPath'] = search_criteria.item_path
if search_criteria.exclude_deletes is not None:
query_parameters['searchCriteria.excludeDeletes'] = search_criteria.exclude_deletes
if search_criteria.skip is not None:
query_parameters['searchCriteria.$skip'] = search_criteria.skip
if search_criteria.top is not None:
query_parameters['searchCriteria.$top'] = search_criteria.top
if search_criteria.include_links is not None:
query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links
if search_criteria.include_work_items is not None:
query_parameters['searchCriteria.includeWorkItems'] = search_criteria.include_work_items
if search_criteria.include_user_image_url is not None:
query_parameters['searchCriteria.includeUserImageUrl'] = search_criteria.include_user_image_url
if search_criteria.include_push_data is not None:
query_parameters['searchCriteria.includePushData'] = search_criteria.include_push_data
if search_criteria.history_mode is not None:
query_parameters['searchCriteria.historyMode'] = search_criteria.history_mode
if skip is not None:
query_parameters['$skip'] = self._serialize.query('skip', skip, 'int')
if top is not None:
query_parameters['$top'] = self._serialize.query('top', top, 'int')
response = self._send(http_method='GET',
location_id='c2570c3b-5b3f-41b8-98bf-5407bfde8d58',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitCommitRef]', self._unwrap_collection(response))
def get_push_commits(self, repository_id, push_id, project=None, top=None, skip=None, include_links=None):
"""GetPushCommits.
Retrieve a list of commits associated with a particular push.
:param str repository_id: The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
:param int push_id: The id of the push.
:param str project: Project ID or project name
:param int top: The maximum number of commits to return ("get the top x commits").
:param int skip: The number of commits to skip.
:param bool include_links: Set to false to avoid including REST Url links for resources. Defaults to true.
:rtype: [GitCommitRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if push_id is not None:
query_parameters['pushId'] = self._serialize.query('push_id', push_id, 'int')
if top is not None:
query_parameters['top'] = self._serialize.query('top', top, 'int')
if skip is not None:
query_parameters['skip'] = self._serialize.query('skip', skip, 'int')
if include_links is not None:
query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool')
response = self._send(http_method='GET',
location_id='c2570c3b-5b3f-41b8-98bf-5407bfde8d58',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitCommitRef]', self._unwrap_collection(response))
def get_commits_batch(self, search_criteria, repository_id, project=None, skip=None, top=None, include_statuses=None):
"""GetCommitsBatch.
Retrieve git commits for a project matching the search criteria
:param :class:`<GitQueryCommitsCriteria> <azure.devops.v5_0.git.models.GitQueryCommitsCriteria>` search_criteria: Search options
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:param int skip: Number of commits to skip.
:param int top: Maximum number of commits to return.
:param bool include_statuses: True to include additional commit status information.
:rtype: [GitCommitRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if skip is not None:
query_parameters['$skip'] = self._serialize.query('skip', skip, 'int')
if top is not None:
query_parameters['$top'] = self._serialize.query('top', top, 'int')
if include_statuses is not None:
query_parameters['includeStatuses'] = self._serialize.query('include_statuses', include_statuses, 'bool')
content = self._serialize.body(search_criteria, 'GitQueryCommitsCriteria')
response = self._send(http_method='POST',
location_id='6400dfb2-0bcb-462b-b992-5a57f8f1416c',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
content=content)
return self._deserialize('[GitCommitRef]', self._unwrap_collection(response))
def get_deleted_repositories(self, project):
"""GetDeletedRepositories.
[Preview API] Retrieve deleted git repositories.
:param str project: Project ID or project name
:rtype: [GitDeletedRepository]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
response = self._send(http_method='GET',
location_id='2b6869c4-cb25-42b5-b7a3-0d3e6be0a11a',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('[GitDeletedRepository]', self._unwrap_collection(response))
def get_forks(self, repository_name_or_id, collection_id, project=None, include_links=None):
"""GetForks.
[Preview API] Retrieve all forks of a repository in the collection.
:param str repository_name_or_id: The name or ID of the repository.
:param str collection_id: Team project collection ID.
:param str project: Project ID or project name
:param bool include_links: True to include links.
:rtype: [GitRepositoryRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_name_or_id is not None:
route_values['repositoryNameOrId'] = self._serialize.url('repository_name_or_id', repository_name_or_id, 'str')
if collection_id is not None:
route_values['collectionId'] = self._serialize.url('collection_id', collection_id, 'str')
query_parameters = {}
if include_links is not None:
query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool')
response = self._send(http_method='GET',
location_id='158c0340-bf6f-489c-9625-d572a1480d57',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitRepositoryRef]', self._unwrap_collection(response))
def create_fork_sync_request(self, sync_params, repository_name_or_id, project=None, include_links=None):
"""CreateForkSyncRequest.
[Preview API] Request that another repository's refs be fetched into this one.
:param :class:`<GitForkSyncRequestParameters> <azure.devops.v5_0.git.models.GitForkSyncRequestParameters>` sync_params: Source repository and ref mapping.
:param str repository_name_or_id: The name or ID of the repository.
:param str project: Project ID or project name
:param bool include_links: True to include links
:rtype: :class:`<GitForkSyncRequest> <azure.devops.v5_0.git.models.GitForkSyncRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_name_or_id is not None:
route_values['repositoryNameOrId'] = self._serialize.url('repository_name_or_id', repository_name_or_id, 'str')
query_parameters = {}
if include_links is not None:
query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool')
content = self._serialize.body(sync_params, 'GitForkSyncRequestParameters')
response = self._send(http_method='POST',
location_id='1703f858-b9d1-46af-ab62-483e9e1055b5',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters,
content=content)
return self._deserialize('GitForkSyncRequest', response)
def get_fork_sync_request(self, repository_name_or_id, fork_sync_operation_id, project=None, include_links=None):
"""GetForkSyncRequest.
[Preview API] Get a specific fork sync operation's details.
:param str repository_name_or_id: The name or ID of the repository.
:param int fork_sync_operation_id: OperationId of the sync request.
:param str project: Project ID or project name
:param bool include_links: True to include links.
:rtype: :class:`<GitForkSyncRequest> <azure.devops.v5_0.git.models.GitForkSyncRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_name_or_id is not None:
route_values['repositoryNameOrId'] = self._serialize.url('repository_name_or_id', repository_name_or_id, 'str')
if fork_sync_operation_id is not None:
route_values['forkSyncOperationId'] = self._serialize.url('fork_sync_operation_id', fork_sync_operation_id, 'int')
query_parameters = {}
if include_links is not None:
query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool')
response = self._send(http_method='GET',
location_id='1703f858-b9d1-46af-ab62-483e9e1055b5',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitForkSyncRequest', response)
def get_fork_sync_requests(self, repository_name_or_id, project=None, include_abandoned=None, include_links=None):
"""GetForkSyncRequests.
[Preview API] Retrieve all requested fork sync operations on this repository.
:param str repository_name_or_id: The name or ID of the repository.
:param str project: Project ID or project name
:param bool include_abandoned: True to include abandoned requests.
:param bool include_links: True to include links.
:rtype: [GitForkSyncRequest]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_name_or_id is not None:
route_values['repositoryNameOrId'] = self._serialize.url('repository_name_or_id', repository_name_or_id, 'str')
query_parameters = {}
if include_abandoned is not None:
query_parameters['includeAbandoned'] = self._serialize.query('include_abandoned', include_abandoned, 'bool')
if include_links is not None:
query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool')
response = self._send(http_method='GET',
location_id='1703f858-b9d1-46af-ab62-483e9e1055b5',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitForkSyncRequest]', self._unwrap_collection(response))
def create_import_request(self, import_request, project, repository_id):
"""CreateImportRequest.
[Preview API] Create an import request.
:param :class:`<GitImportRequest> <azure.devops.v5_0.git.models.GitImportRequest>` import_request: The import request to create.
:param str project: Project ID or project name
:param str repository_id: The name or ID of the repository.
:rtype: :class:`<GitImportRequest> <azure.devops.v5_0.git.models.GitImportRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(import_request, 'GitImportRequest')
response = self._send(http_method='POST',
location_id='01828ddc-3600-4a41-8633-99b3a73a0eb3',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitImportRequest', response)
def get_import_request(self, project, repository_id, import_request_id):
"""GetImportRequest.
[Preview API] Retrieve a particular import request.
:param str project: Project ID or project name
:param str repository_id: The name or ID of the repository.
:param int import_request_id: The unique identifier for the import request.
:rtype: :class:`<GitImportRequest> <azure.devops.v5_0.git.models.GitImportRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if import_request_id is not None:
route_values['importRequestId'] = self._serialize.url('import_request_id', import_request_id, 'int')
response = self._send(http_method='GET',
location_id='01828ddc-3600-4a41-8633-99b3a73a0eb3',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('GitImportRequest', response)
def query_import_requests(self, project, repository_id, include_abandoned=None):
"""QueryImportRequests.
[Preview API] Retrieve import requests for a repository.
:param str project: Project ID or project name
:param str repository_id: The name or ID of the repository.
:param bool include_abandoned: True to include abandoned import requests in the results.
:rtype: [GitImportRequest]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if include_abandoned is not None:
query_parameters['includeAbandoned'] = self._serialize.query('include_abandoned', include_abandoned, 'bool')
response = self._send(http_method='GET',
location_id='01828ddc-3600-4a41-8633-99b3a73a0eb3',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitImportRequest]', self._unwrap_collection(response))
def update_import_request(self, import_request_to_update, project, repository_id, import_request_id):
"""UpdateImportRequest.
[Preview API] Retry or abandon a failed import request.
:param :class:`<GitImportRequest> <azure.devops.v5_0.git.models.GitImportRequest>` import_request_to_update: The updated version of the import request. Currently, the only change allowed is setting the Status to Queued or Abandoned.
:param str project: Project ID or project name
:param str repository_id: The name or ID of the repository.
:param int import_request_id: The unique identifier for the import request to update.
:rtype: :class:`<GitImportRequest> <azure.devops.v5_0.git.models.GitImportRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if import_request_id is not None:
route_values['importRequestId'] = self._serialize.url('import_request_id', import_request_id, 'int')
content = self._serialize.body(import_request_to_update, 'GitImportRequest')
response = self._send(http_method='PATCH',
location_id='01828ddc-3600-4a41-8633-99b3a73a0eb3',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitImportRequest', response)
def get_item(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, resolve_lfs=None):
"""GetItem.
Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download.
:param str repository_id: The name or ID of the repository.
:param str path: The item path.
:param str project: Project ID or project name
:param str scope_path: The path scope. The default is null.
:param str recursion_level: The recursion level of this request. The default is 'none', no recursion.
:param bool include_content_metadata: Set to true to include content metadata. Default is false.
:param bool latest_processed_change: Set to true to include the lastest changes. Default is false.
:param bool download: Set to true to download the response as a file. Default is false.
:param :class:`<GitVersionDescriptor> <azure.devops.v5_0.git.models.GitVersionDescriptor>` version_descriptor: Version descriptor. Default is null.
:param bool include_content: Set to true to include item content when requesting json. Default is false.
:param bool resolve_lfs: Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.
:rtype: :class:`<GitItem> <azure.devops.v5_0.git.models.GitItem>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if path is not None:
query_parameters['path'] = self._serialize.query('path', path, 'str')
if scope_path is not None:
query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str')
if recursion_level is not None:
query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str')
if include_content_metadata is not None:
query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool')
if latest_processed_change is not None:
query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool')
if download is not None:
query_parameters['download'] = self._serialize.query('download', download, 'bool')
if version_descriptor is not None:
if version_descriptor.version_type is not None:
query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type
if version_descriptor.version is not None:
query_parameters['versionDescriptor.version'] = version_descriptor.version
if version_descriptor.version_options is not None:
query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options
if include_content is not None:
query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool')
if resolve_lfs is not None:
query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool')
response = self._send(http_method='GET',
location_id='fb93c0db-47ed-4a31-8c20-47552878fb44',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitItem', response)
def get_item_content(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, resolve_lfs=None, **kwargs):
"""GetItemContent.
Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download.
:param str repository_id: The name or ID of the repository.
:param str path: The item path.
:param str project: Project ID or project name
:param str scope_path: The path scope. The default is null.
:param str recursion_level: The recursion level of this request. The default is 'none', no recursion.
:param bool include_content_metadata: Set to true to include content metadata. Default is false.
:param bool latest_processed_change: Set to true to include the lastest changes. Default is false.
:param bool download: Set to true to download the response as a file. Default is false.
:param :class:`<GitVersionDescriptor> <azure.devops.v5_0.git.models.GitVersionDescriptor>` version_descriptor: Version descriptor. Default is null.
:param bool include_content: Set to true to include item content when requesting json. Default is false.
:param bool resolve_lfs: Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if path is not None:
query_parameters['path'] = self._serialize.query('path', path, 'str')
if scope_path is not None:
query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str')
if recursion_level is not None:
query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str')
if include_content_metadata is not None:
query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool')
if latest_processed_change is not None:
query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool')
if download is not None:
query_parameters['download'] = self._serialize.query('download', download, 'bool')
if version_descriptor is not None:
if version_descriptor.version_type is not None:
query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type
if version_descriptor.version is not None:
query_parameters['versionDescriptor.version'] = version_descriptor.version
if version_descriptor.version_options is not None:
query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options
if include_content is not None:
query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool')
if resolve_lfs is not None:
query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool')
response = self._send(http_method='GET',
location_id='fb93c0db-47ed-4a31-8c20-47552878fb44',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
accept_media_type='application/octet-stream')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
def get_items(self, repository_id, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, include_links=None, version_descriptor=None):
"""GetItems.
Get Item Metadata and/or Content for a collection of items. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:param str scope_path: The path scope. The default is null.
:param str recursion_level: The recursion level of this request. The default is 'none', no recursion.
:param bool include_content_metadata: Set to true to include content metadata. Default is false.
:param bool latest_processed_change: Set to true to include the lastest changes. Default is false.
:param bool download: Set to true to download the response as a file. Default is false.
:param bool include_links: Set to true to include links to items. Default is false.
:param :class:`<GitVersionDescriptor> <azure.devops.v5_0.git.models.GitVersionDescriptor>` version_descriptor: Version descriptor. Default is null.
:rtype: [GitItem]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if scope_path is not None:
query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str')
if recursion_level is not None:
query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str')
if include_content_metadata is not None:
query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool')
if latest_processed_change is not None:
query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool')
if download is not None:
query_parameters['download'] = self._serialize.query('download', download, 'bool')
if include_links is not None:
query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool')
if version_descriptor is not None:
if version_descriptor.version_type is not None:
query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type
if version_descriptor.version is not None:
query_parameters['versionDescriptor.version'] = version_descriptor.version
if version_descriptor.version_options is not None:
query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options
response = self._send(http_method='GET',
location_id='fb93c0db-47ed-4a31-8c20-47552878fb44',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitItem]', self._unwrap_collection(response))
def get_item_text(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, resolve_lfs=None, **kwargs):
"""GetItemText.
Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download.
:param str repository_id: The name or ID of the repository.
:param str path: The item path.
:param str project: Project ID or project name
:param str scope_path: The path scope. The default is null.
:param str recursion_level: The recursion level of this request. The default is 'none', no recursion.
:param bool include_content_metadata: Set to true to include content metadata. Default is false.
:param bool latest_processed_change: Set to true to include the lastest changes. Default is false.
:param bool download: Set to true to download the response as a file. Default is false.
:param :class:`<GitVersionDescriptor> <azure.devops.v5_0.git.models.GitVersionDescriptor>` version_descriptor: Version descriptor. Default is null.
:param bool include_content: Set to true to include item content when requesting json. Default is false.
:param bool resolve_lfs: Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if path is not None:
query_parameters['path'] = self._serialize.query('path', path, 'str')
if scope_path is not None:
query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str')
if recursion_level is not None:
query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str')
if include_content_metadata is not None:
query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool')
if latest_processed_change is not None:
query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool')
if download is not None:
query_parameters['download'] = self._serialize.query('download', download, 'bool')
if version_descriptor is not None:
if version_descriptor.version_type is not None:
query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type
if version_descriptor.version is not None:
query_parameters['versionDescriptor.version'] = version_descriptor.version
if version_descriptor.version_options is not None:
query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options
if include_content is not None:
query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool')
if resolve_lfs is not None:
query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool')
response = self._send(http_method='GET',
location_id='fb93c0db-47ed-4a31-8c20-47552878fb44',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
accept_media_type='text/plain')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
def get_item_zip(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, resolve_lfs=None, **kwargs):
"""GetItemZip.
Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download.
:param str repository_id: The name or ID of the repository.
:param str path: The item path.
:param str project: Project ID or project name
:param str scope_path: The path scope. The default is null.
:param str recursion_level: The recursion level of this request. The default is 'none', no recursion.
:param bool include_content_metadata: Set to true to include content metadata. Default is false.
:param bool latest_processed_change: Set to true to include the lastest changes. Default is false.
:param bool download: Set to true to download the response as a file. Default is false.
:param :class:`<GitVersionDescriptor> <azure.devops.v5_0.git.models.GitVersionDescriptor>` version_descriptor: Version descriptor. Default is null.
:param bool include_content: Set to true to include item content when requesting json. Default is false.
:param bool resolve_lfs: Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if path is not None:
query_parameters['path'] = self._serialize.query('path', path, 'str')
if scope_path is not None:
query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str')
if recursion_level is not None:
query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str')
if include_content_metadata is not None:
query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool')
if latest_processed_change is not None:
query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool')
if download is not None:
query_parameters['download'] = self._serialize.query('download', download, 'bool')
if version_descriptor is not None:
if version_descriptor.version_type is not None:
query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type
if version_descriptor.version is not None:
query_parameters['versionDescriptor.version'] = version_descriptor.version
if version_descriptor.version_options is not None:
query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options
if include_content is not None:
query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool')
if resolve_lfs is not None:
query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool')
response = self._send(http_method='GET',
location_id='fb93c0db-47ed-4a31-8c20-47552878fb44',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
accept_media_type='application/zip')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
def get_items_batch(self, request_data, repository_id, project=None):
"""GetItemsBatch.
Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path
:param :class:`<GitItemRequestData> <azure.devops.v5_0.git.models.GitItemRequestData>` request_data: Request data attributes: ItemDescriptors, IncludeContentMetadata, LatestProcessedChange, IncludeLinks. ItemDescriptors: Collection of items to fetch, including path, version, and recursion level. IncludeContentMetadata: Whether to include metadata for all items LatestProcessedChange: Whether to include shallow ref to commit that last changed each item. IncludeLinks: Whether to include the _links field on the shallow references.
:param str repository_id: The name or ID of the repository
:param str project: Project ID or project name
:rtype: [[GitItem]]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(request_data, 'GitItemRequestData')
response = self._send(http_method='POST',
location_id='630fd2e4-fb88-4f85-ad21-13f3fd1fbca9',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('[[GitItem]]', self._unwrap_collection(response))
def get_merge_bases(self, repository_name_or_id, commit_id, other_commit_id, project=None, other_collection_id=None, other_repository_id=None):
"""GetMergeBases.
[Preview API] Find the merge bases of two commits, optionally across forks. If otherRepositoryId is not specified, the merge bases will only be calculated within the context of the local repositoryNameOrId.
:param str repository_name_or_id: ID or name of the local repository.
:param str commit_id: First commit, usually the tip of the target branch of the potential merge.
:param str other_commit_id: Other commit, usually the tip of the source branch of the potential merge.
:param str project: Project ID or project name
:param str other_collection_id: The collection ID where otherCommitId lives.
:param str other_repository_id: The repository ID where otherCommitId lives.
:rtype: [GitCommitRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_name_or_id is not None:
route_values['repositoryNameOrId'] = self._serialize.url('repository_name_or_id', repository_name_or_id, 'str')
if commit_id is not None:
route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str')
query_parameters = {}
if other_commit_id is not None:
query_parameters['otherCommitId'] = self._serialize.query('other_commit_id', other_commit_id, 'str')
if other_collection_id is not None:
query_parameters['otherCollectionId'] = self._serialize.query('other_collection_id', other_collection_id, 'str')
if other_repository_id is not None:
query_parameters['otherRepositoryId'] = self._serialize.query('other_repository_id', other_repository_id, 'str')
response = self._send(http_method='GET',
location_id='7cf2abb6-c964-4f7e-9872-f78c66e72e9c',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitCommitRef]', self._unwrap_collection(response))
def create_attachment(self, upload_stream, file_name, repository_id, pull_request_id, project=None, **kwargs):
"""CreateAttachment.
[Preview API] Attach a new file to a pull request.
:param object upload_stream: Stream to upload
:param str file_name: The name of the file.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: :class:`<Attachment> <azure.devops.v5_0.git.models.Attachment>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if file_name is not None:
route_values['fileName'] = self._serialize.url('file_name', file_name, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
content = self._client.stream_upload(upload_stream, callback=callback)
response = self._send(http_method='POST',
location_id='965d9361-878b-413b-a494-45d5b5fd8ab7',
version='5.0-preview.1',
route_values=route_values,
content=content,
media_type='application/octet-stream')
return self._deserialize('Attachment', response)
def delete_attachment(self, file_name, repository_id, pull_request_id, project=None):
"""DeleteAttachment.
[Preview API] Delete a pull request attachment.
:param str file_name: The name of the attachment to delete.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if file_name is not None:
route_values['fileName'] = self._serialize.url('file_name', file_name, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
self._send(http_method='DELETE',
location_id='965d9361-878b-413b-a494-45d5b5fd8ab7',
version='5.0-preview.1',
route_values=route_values)
def get_attachment_content(self, file_name, repository_id, pull_request_id, project=None, **kwargs):
"""GetAttachmentContent.
[Preview API] Get the file content of a pull request attachment.
:param str file_name: The name of the attachment.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if file_name is not None:
route_values['fileName'] = self._serialize.url('file_name', file_name, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='965d9361-878b-413b-a494-45d5b5fd8ab7',
version='5.0-preview.1',
route_values=route_values,
accept_media_type='application/octet-stream')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
def get_attachments(self, repository_id, pull_request_id, project=None):
"""GetAttachments.
[Preview API] Get a list of files attached to a given pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: [Attachment]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='965d9361-878b-413b-a494-45d5b5fd8ab7',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('[Attachment]', self._unwrap_collection(response))
def get_attachment_zip(self, file_name, repository_id, pull_request_id, project=None, **kwargs):
"""GetAttachmentZip.
[Preview API] Get the file content of a pull request attachment.
:param str file_name: The name of the attachment.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if file_name is not None:
route_values['fileName'] = self._serialize.url('file_name', file_name, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='965d9361-878b-413b-a494-45d5b5fd8ab7',
version='5.0-preview.1',
route_values=route_values,
accept_media_type='application/zip')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
def create_like(self, repository_id, pull_request_id, thread_id, comment_id, project=None):
"""CreateLike.
[Preview API] Add a like on a comment.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: The ID of the thread that contains the comment.
:param int comment_id: The ID of the comment.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
if comment_id is not None:
route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int')
self._send(http_method='POST',
location_id='5f2e2851-1389-425b-a00b-fb2adb3ef31b',
version='5.0-preview.1',
route_values=route_values)
def delete_like(self, repository_id, pull_request_id, thread_id, comment_id, project=None):
"""DeleteLike.
[Preview API] Delete a like on a comment.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: The ID of the thread that contains the comment.
:param int comment_id: The ID of the comment.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
if comment_id is not None:
route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int')
self._send(http_method='DELETE',
location_id='5f2e2851-1389-425b-a00b-fb2adb3ef31b',
version='5.0-preview.1',
route_values=route_values)
def get_likes(self, repository_id, pull_request_id, thread_id, comment_id, project=None):
"""GetLikes.
[Preview API] Get likes for a comment.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: The ID of the thread that contains the comment.
:param int comment_id: The ID of the comment.
:param str project: Project ID or project name
:rtype: [IdentityRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
if comment_id is not None:
route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int')
response = self._send(http_method='GET',
location_id='5f2e2851-1389-425b-a00b-fb2adb3ef31b',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('[IdentityRef]', self._unwrap_collection(response))
def get_pull_request_iteration_commits(self, repository_id, pull_request_id, iteration_id, project=None):
"""GetPullRequestIterationCommits.
Get the commits for the specified iteration of a pull request.
:param str repository_id: ID or name of the repository.
:param int pull_request_id: ID of the pull request.
:param int iteration_id: ID of the iteration from which to get the commits.
:param str project: Project ID or project name
:rtype: [GitCommitRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if iteration_id is not None:
route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int')
response = self._send(http_method='GET',
location_id='e7ea0883-095f-4926-b5fb-f24691c26fb9',
version='5.0',
route_values=route_values)
return self._deserialize('[GitCommitRef]', self._unwrap_collection(response))
def get_pull_request_commits(self, repository_id, pull_request_id, project=None):
"""GetPullRequestCommits.
Get the commits for the specified pull request.
:param str repository_id: ID or name of the repository.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: [GitCommitRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='52823034-34a8-4576-922c-8d8b77e9e4c4',
version='5.0',
route_values=route_values)
return self._deserialize('[GitCommitRef]', self._unwrap_collection(response))
def get_pull_request_iteration_changes(self, repository_id, pull_request_id, iteration_id, project=None, top=None, skip=None, compare_to=None):
"""GetPullRequestIterationChanges.
Retrieve the changes made in a pull request between two iterations.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int iteration_id: ID of the pull request iteration. <br /> Iteration IDs are zero-based with zero indicating the common commit between the source and target branches. Iteration one is the head of the source branch at the time the pull request is created and subsequent iterations are created when there are pushes to the source branch.
:param str project: Project ID or project name
:param int top: Optional. The number of changes to retrieve. The default value is 100 and the maximum value is 2000.
:param int skip: Optional. The number of changes to ignore. For example, to retrieve changes 101-150, set top 50 and skip to 100.
:param int compare_to: ID of the pull request iteration to compare against. The default value is zero which indicates the comparison is made against the common commit between the source and target branches
:rtype: :class:`<GitPullRequestIterationChanges> <azure.devops.v5_0.git.models.GitPullRequestIterationChanges>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if iteration_id is not None:
route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int')
query_parameters = {}
if top is not None:
query_parameters['$top'] = self._serialize.query('top', top, 'int')
if skip is not None:
query_parameters['$skip'] = self._serialize.query('skip', skip, 'int')
if compare_to is not None:
query_parameters['$compareTo'] = self._serialize.query('compare_to', compare_to, 'int')
response = self._send(http_method='GET',
location_id='4216bdcf-b6b1-4d59-8b82-c34cc183fc8b',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitPullRequestIterationChanges', response)
def get_pull_request_iteration(self, repository_id, pull_request_id, iteration_id, project=None):
"""GetPullRequestIteration.
Get the specified iteration for a pull request.
:param str repository_id: ID or name of the repository.
:param int pull_request_id: ID of the pull request.
:param int iteration_id: ID of the pull request iteration to return.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequestIteration> <azure.devops.v5_0.git.models.GitPullRequestIteration>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if iteration_id is not None:
route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int')
response = self._send(http_method='GET',
location_id='d43911ee-6958-46b0-a42b-8445b8a0d004',
version='5.0',
route_values=route_values)
return self._deserialize('GitPullRequestIteration', response)
def get_pull_request_iterations(self, repository_id, pull_request_id, project=None, include_commits=None):
"""GetPullRequestIterations.
Get the list of iterations for the specified pull request.
:param str repository_id: ID or name of the repository.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:param bool include_commits: If true, include the commits associated with each iteration in the response.
:rtype: [GitPullRequestIteration]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
query_parameters = {}
if include_commits is not None:
query_parameters['includeCommits'] = self._serialize.query('include_commits', include_commits, 'bool')
response = self._send(http_method='GET',
location_id='d43911ee-6958-46b0-a42b-8445b8a0d004',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitPullRequestIteration]', self._unwrap_collection(response))
def create_pull_request_iteration_status(self, status, repository_id, pull_request_id, iteration_id, project=None):
"""CreatePullRequestIterationStatus.
[Preview API] Create a pull request status on the iteration. This operation will have the same result as Create status on pull request with specified iteration ID in the request body.
:param :class:`<GitPullRequestStatus> <azure.devops.v5_0.git.models.GitPullRequestStatus>` status: Pull request status to create.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param int iteration_id: ID of the pull request iteration.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequestStatus> <azure.devops.v5_0.git.models.GitPullRequestStatus>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if iteration_id is not None:
route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int')
content = self._serialize.body(status, 'GitPullRequestStatus')
response = self._send(http_method='POST',
location_id='75cf11c5-979f-4038-a76e-058a06adf2bf',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitPullRequestStatus', response)
def delete_pull_request_iteration_status(self, repository_id, pull_request_id, iteration_id, status_id, project=None):
"""DeletePullRequestIterationStatus.
[Preview API] Delete pull request iteration status.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param int iteration_id: ID of the pull request iteration.
:param int status_id: ID of the pull request status.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if iteration_id is not None:
route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int')
if status_id is not None:
route_values['statusId'] = self._serialize.url('status_id', status_id, 'int')
self._send(http_method='DELETE',
location_id='75cf11c5-979f-4038-a76e-058a06adf2bf',
version='5.0-preview.1',
route_values=route_values)
def get_pull_request_iteration_status(self, repository_id, pull_request_id, iteration_id, status_id, project=None):
"""GetPullRequestIterationStatus.
[Preview API] Get the specific pull request iteration status by ID. The status ID is unique within the pull request across all iterations.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param int iteration_id: ID of the pull request iteration.
:param int status_id: ID of the pull request status.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequestStatus> <azure.devops.v5_0.git.models.GitPullRequestStatus>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if iteration_id is not None:
route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int')
if status_id is not None:
route_values['statusId'] = self._serialize.url('status_id', status_id, 'int')
response = self._send(http_method='GET',
location_id='75cf11c5-979f-4038-a76e-058a06adf2bf',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('GitPullRequestStatus', response)
def get_pull_request_iteration_statuses(self, repository_id, pull_request_id, iteration_id, project=None):
"""GetPullRequestIterationStatuses.
[Preview API] Get all the statuses associated with a pull request iteration.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param int iteration_id: ID of the pull request iteration.
:param str project: Project ID or project name
:rtype: [GitPullRequestStatus]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if iteration_id is not None:
route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int')
response = self._send(http_method='GET',
location_id='75cf11c5-979f-4038-a76e-058a06adf2bf',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('[GitPullRequestStatus]', self._unwrap_collection(response))
def update_pull_request_iteration_statuses(self, patch_document, repository_id, pull_request_id, iteration_id, project=None):
"""UpdatePullRequestIterationStatuses.
[Preview API] Update pull request iteration statuses collection. The only supported operation type is `remove`.
:param :class:`<[JsonPatchOperation]> <azure.devops.v5_0.git.models.[JsonPatchOperation]>` patch_document: Operations to apply to the pull request statuses in JSON Patch format.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param int iteration_id: ID of the pull request iteration.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if iteration_id is not None:
route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int')
content = self._serialize.body(patch_document, '[JsonPatchOperation]')
self._send(http_method='PATCH',
location_id='75cf11c5-979f-4038-a76e-058a06adf2bf',
version='5.0-preview.1',
route_values=route_values,
content=content,
media_type='application/json-patch+json')
def create_pull_request_label(self, label, repository_id, pull_request_id, project=None, project_id=None):
"""CreatePullRequestLabel.
[Preview API] Create a label for a specified pull request. The only required field is the name of the new label.
:param :class:`<WebApiCreateTagRequestData> <azure.devops.v5_0.git.models.WebApiCreateTagRequestData>` label: Label to assign to the pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:param str project_id: Project ID or project name.
:rtype: :class:`<WebApiTagDefinition> <azure.devops.v5_0.git.models.WebApiTagDefinition>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
query_parameters = {}
if project_id is not None:
query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
content = self._serialize.body(label, 'WebApiCreateTagRequestData')
response = self._send(http_method='POST',
location_id='f22387e3-984e-4c52-9c6d-fbb8f14c812d',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters,
content=content)
return self._deserialize('WebApiTagDefinition', response)
def delete_pull_request_labels(self, repository_id, pull_request_id, label_id_or_name, project=None, project_id=None):
"""DeletePullRequestLabels.
[Preview API] Removes a label from the set of those assigned to the pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str label_id_or_name: The name or ID of the label requested.
:param str project: Project ID or project name
:param str project_id: Project ID or project name.
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if label_id_or_name is not None:
route_values['labelIdOrName'] = self._serialize.url('label_id_or_name', label_id_or_name, 'str')
query_parameters = {}
if project_id is not None:
query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
self._send(http_method='DELETE',
location_id='f22387e3-984e-4c52-9c6d-fbb8f14c812d',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
def get_pull_request_label(self, repository_id, pull_request_id, label_id_or_name, project=None, project_id=None):
"""GetPullRequestLabel.
[Preview API] Retrieves a single label that has been assigned to a pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str label_id_or_name: The name or ID of the label requested.
:param str project: Project ID or project name
:param str project_id: Project ID or project name.
:rtype: :class:`<WebApiTagDefinition> <azure.devops.v5_0.git.models.WebApiTagDefinition>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if label_id_or_name is not None:
route_values['labelIdOrName'] = self._serialize.url('label_id_or_name', label_id_or_name, 'str')
query_parameters = {}
if project_id is not None:
query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
response = self._send(http_method='GET',
location_id='f22387e3-984e-4c52-9c6d-fbb8f14c812d',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('WebApiTagDefinition', response)
def get_pull_request_labels(self, repository_id, pull_request_id, project=None, project_id=None):
"""GetPullRequestLabels.
[Preview API] Get all the labels assigned to a pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:param str project_id: Project ID or project name.
:rtype: [WebApiTagDefinition]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
query_parameters = {}
if project_id is not None:
query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
response = self._send(http_method='GET',
location_id='f22387e3-984e-4c52-9c6d-fbb8f14c812d',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[WebApiTagDefinition]', self._unwrap_collection(response))
def get_pull_request_properties(self, repository_id, pull_request_id, project=None):
"""GetPullRequestProperties.
[Preview API] Get external properties of the pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: :class:`<object> <azure.devops.v5_0.git.models.object>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='48a52185-5b9e-4736-9dc1-bb1e2feac80b',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('object', response)
def update_pull_request_properties(self, patch_document, repository_id, pull_request_id, project=None):
"""UpdatePullRequestProperties.
[Preview API] Create or update pull request external properties. The patch operation can be `add`, `replace` or `remove`. For `add` operation, the path can be empty. If the path is empty, the value must be a list of key value pairs. For `replace` operation, the path cannot be empty. If the path does not exist, the property will be added to the collection. For `remove` operation, the path cannot be empty. If the path does not exist, no action will be performed.
:param :class:`<[JsonPatchOperation]> <azure.devops.v5_0.git.models.[JsonPatchOperation]>` patch_document: Properties to add, replace or remove in JSON Patch format.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: :class:`<object> <azure.devops.v5_0.git.models.object>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
content = self._serialize.body(patch_document, '[JsonPatchOperation]')
response = self._send(http_method='PATCH',
location_id='48a52185-5b9e-4736-9dc1-bb1e2feac80b',
version='5.0-preview.1',
route_values=route_values,
content=content,
media_type='application/json-patch+json')
return self._deserialize('object', response)
def get_pull_request_query(self, queries, repository_id, project=None):
"""GetPullRequestQuery.
This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests.
:param :class:`<GitPullRequestQuery> <azure.devops.v5_0.git.models.GitPullRequestQuery>` queries: The list of queries to perform.
:param str repository_id: ID of the repository.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequestQuery> <azure.devops.v5_0.git.models.GitPullRequestQuery>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(queries, 'GitPullRequestQuery')
response = self._send(http_method='POST',
location_id='b3a6eebe-9cf0-49ea-b6cb-1a4c5f5007b0',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('GitPullRequestQuery', response)
def create_pull_request_reviewer(self, reviewer, repository_id, pull_request_id, reviewer_id, project=None):
"""CreatePullRequestReviewer.
Add a reviewer to a pull request or cast a vote.
:param :class:`<IdentityRefWithVote> <azure.devops.v5_0.git.models.IdentityRefWithVote>` reviewer: Reviewer's vote.<br />If the reviewer's ID is included here, it must match the reviewerID parameter.<br />Reviewers can set their own vote with this method. When adding other reviewers, vote must be set to zero.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str reviewer_id: ID of the reviewer.
:param str project: Project ID or project name
:rtype: :class:`<IdentityRefWithVote> <azure.devops.v5_0.git.models.IdentityRefWithVote>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if reviewer_id is not None:
route_values['reviewerId'] = self._serialize.url('reviewer_id', reviewer_id, 'str')
content = self._serialize.body(reviewer, 'IdentityRefWithVote')
response = self._send(http_method='PUT',
location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('IdentityRefWithVote', response)
def create_pull_request_reviewers(self, reviewers, repository_id, pull_request_id, project=None):
"""CreatePullRequestReviewers.
Add reviewers to a pull request.
:param [IdentityRef] reviewers: Reviewers to add to the pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: [IdentityRefWithVote]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
content = self._serialize.body(reviewers, '[IdentityRef]')
response = self._send(http_method='POST',
location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('[IdentityRefWithVote]', self._unwrap_collection(response))
def delete_pull_request_reviewer(self, repository_id, pull_request_id, reviewer_id, project=None):
"""DeletePullRequestReviewer.
Remove a reviewer from a pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str reviewer_id: ID of the reviewer to remove.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if reviewer_id is not None:
route_values['reviewerId'] = self._serialize.url('reviewer_id', reviewer_id, 'str')
self._send(http_method='DELETE',
location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540',
version='5.0',
route_values=route_values)
def get_pull_request_reviewer(self, repository_id, pull_request_id, reviewer_id, project=None):
"""GetPullRequestReviewer.
Retrieve information about a particular reviewer on a pull request
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str reviewer_id: ID of the reviewer.
:param str project: Project ID or project name
:rtype: :class:`<IdentityRefWithVote> <azure.devops.v5_0.git.models.IdentityRefWithVote>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if reviewer_id is not None:
route_values['reviewerId'] = self._serialize.url('reviewer_id', reviewer_id, 'str')
response = self._send(http_method='GET',
location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540',
version='5.0',
route_values=route_values)
return self._deserialize('IdentityRefWithVote', response)
def get_pull_request_reviewers(self, repository_id, pull_request_id, project=None):
"""GetPullRequestReviewers.
Retrieve the reviewers for a pull request
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: [IdentityRefWithVote]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540',
version='5.0',
route_values=route_values)
return self._deserialize('[IdentityRefWithVote]', self._unwrap_collection(response))
def update_pull_request_reviewers(self, patch_votes, repository_id, pull_request_id, project=None):
"""UpdatePullRequestReviewers.
Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names.
:param [IdentityRefWithVote] patch_votes: IDs of the reviewers whose votes will be reset to zero
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
content = self._serialize.body(patch_votes, '[IdentityRefWithVote]')
self._send(http_method='PATCH',
location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540',
version='5.0',
route_values=route_values,
content=content)
def get_pull_request_by_id(self, pull_request_id, project=None):
"""GetPullRequestById.
Retrieve a pull request.
:param int pull_request_id: The ID of the pull request to retrieve.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequest> <azure.devops.v5_0.git.models.GitPullRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='01a46dea-7d46-4d40-bc84-319e7c260d99',
version='5.0',
route_values=route_values)
return self._deserialize('GitPullRequest', response)
def get_pull_requests_by_project(self, project, search_criteria, max_comment_length=None, skip=None, top=None):
"""GetPullRequestsByProject.
Retrieve all pull requests matching a specified criteria.
:param str project: Project ID or project name
:param :class:`<GitPullRequestSearchCriteria> <azure.devops.v5_0.git.models.GitPullRequestSearchCriteria>` search_criteria: Pull requests will be returned that match this search criteria.
:param int max_comment_length: Not used.
:param int skip: The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
:param int top: The number of pull requests to retrieve.
:rtype: [GitPullRequest]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
query_parameters = {}
if search_criteria is not None:
if search_criteria.repository_id is not None:
query_parameters['searchCriteria.repositoryId'] = search_criteria.repository_id
if search_criteria.creator_id is not None:
query_parameters['searchCriteria.creatorId'] = search_criteria.creator_id
if search_criteria.reviewer_id is not None:
query_parameters['searchCriteria.reviewerId'] = search_criteria.reviewer_id
if search_criteria.status is not None:
query_parameters['searchCriteria.status'] = search_criteria.status
if search_criteria.target_ref_name is not None:
query_parameters['searchCriteria.targetRefName'] = search_criteria.target_ref_name
if search_criteria.source_repository_id is not None:
query_parameters['searchCriteria.sourceRepositoryId'] = search_criteria.source_repository_id
if search_criteria.source_ref_name is not None:
query_parameters['searchCriteria.sourceRefName'] = search_criteria.source_ref_name
if search_criteria.include_links is not None:
query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links
if max_comment_length is not None:
query_parameters['maxCommentLength'] = self._serialize.query('max_comment_length', max_comment_length, 'int')
if skip is not None:
query_parameters['$skip'] = self._serialize.query('skip', skip, 'int')
if top is not None:
query_parameters['$top'] = self._serialize.query('top', top, 'int')
response = self._send(http_method='GET',
location_id='a5d28130-9cd2-40fa-9f08-902e7daa9efb',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitPullRequest]', self._unwrap_collection(response))
def create_pull_request(self, git_pull_request_to_create, repository_id, project=None, supports_iterations=None):
"""CreatePullRequest.
Create a pull request.
:param :class:`<GitPullRequest> <azure.devops.v5_0.git.models.GitPullRequest>` git_pull_request_to_create: The pull request to create.
:param str repository_id: The repository ID of the pull request's target branch.
:param str project: Project ID or project name
:param bool supports_iterations: If true, subsequent pushes to the pull request will be individually reviewable. Set this to false for large pull requests for performance reasons if this functionality is not needed.
:rtype: :class:`<GitPullRequest> <azure.devops.v5_0.git.models.GitPullRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if supports_iterations is not None:
query_parameters['supportsIterations'] = self._serialize.query('supports_iterations', supports_iterations, 'bool')
content = self._serialize.body(git_pull_request_to_create, 'GitPullRequest')
response = self._send(http_method='POST',
location_id='9946fd70-0d40-406e-b686-b4744cbbcc37',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
content=content)
return self._deserialize('GitPullRequest', response)
def get_pull_request(self, repository_id, pull_request_id, project=None, max_comment_length=None, skip=None, top=None, include_commits=None, include_work_item_refs=None):
"""GetPullRequest.
Retrieve a pull request.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: The ID of the pull request to retrieve.
:param str project: Project ID or project name
:param int max_comment_length: Not used.
:param int skip: Not used.
:param int top: Not used.
:param bool include_commits: If true, the pull request will be returned with the associated commits.
:param bool include_work_item_refs: If true, the pull request will be returned with the associated work item references.
:rtype: :class:`<GitPullRequest> <azure.devops.v5_0.git.models.GitPullRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
query_parameters = {}
if max_comment_length is not None:
query_parameters['maxCommentLength'] = self._serialize.query('max_comment_length', max_comment_length, 'int')
if skip is not None:
query_parameters['$skip'] = self._serialize.query('skip', skip, 'int')
if top is not None:
query_parameters['$top'] = self._serialize.query('top', top, 'int')
if include_commits is not None:
query_parameters['includeCommits'] = self._serialize.query('include_commits', include_commits, 'bool')
if include_work_item_refs is not None:
query_parameters['includeWorkItemRefs'] = self._serialize.query('include_work_item_refs', include_work_item_refs, 'bool')
response = self._send(http_method='GET',
location_id='9946fd70-0d40-406e-b686-b4744cbbcc37',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitPullRequest', response)
def get_pull_requests(self, repository_id, search_criteria, project=None, max_comment_length=None, skip=None, top=None):
"""GetPullRequests.
Retrieve all pull requests matching a specified criteria.
:param str repository_id: The repository ID of the pull request's target branch.
:param :class:`<GitPullRequestSearchCriteria> <azure.devops.v5_0.git.models.GitPullRequestSearchCriteria>` search_criteria: Pull requests will be returned that match this search criteria.
:param str project: Project ID or project name
:param int max_comment_length: Not used.
:param int skip: The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
:param int top: The number of pull requests to retrieve.
:rtype: [GitPullRequest]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if search_criteria is not None:
if search_criteria.repository_id is not None:
query_parameters['searchCriteria.repositoryId'] = search_criteria.repository_id
if search_criteria.creator_id is not None:
query_parameters['searchCriteria.creatorId'] = search_criteria.creator_id
if search_criteria.reviewer_id is not None:
query_parameters['searchCriteria.reviewerId'] = search_criteria.reviewer_id
if search_criteria.status is not None:
query_parameters['searchCriteria.status'] = search_criteria.status
if search_criteria.target_ref_name is not None:
query_parameters['searchCriteria.targetRefName'] = search_criteria.target_ref_name
if search_criteria.source_repository_id is not None:
query_parameters['searchCriteria.sourceRepositoryId'] = search_criteria.source_repository_id
if search_criteria.source_ref_name is not None:
query_parameters['searchCriteria.sourceRefName'] = search_criteria.source_ref_name
if search_criteria.include_links is not None:
query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links
if max_comment_length is not None:
query_parameters['maxCommentLength'] = self._serialize.query('max_comment_length', max_comment_length, 'int')
if skip is not None:
query_parameters['$skip'] = self._serialize.query('skip', skip, 'int')
if top is not None:
query_parameters['$top'] = self._serialize.query('top', top, 'int')
response = self._send(http_method='GET',
location_id='9946fd70-0d40-406e-b686-b4744cbbcc37',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitPullRequest]', self._unwrap_collection(response))
def update_pull_request(self, git_pull_request_to_update, repository_id, pull_request_id, project=None):
"""UpdatePullRequest.
Update a pull request.
:param :class:`<GitPullRequest> <azure.devops.v5_0.git.models.GitPullRequest>` git_pull_request_to_update: The pull request content to update.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: The ID of the pull request to retrieve.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequest> <azure.devops.v5_0.git.models.GitPullRequest>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
content = self._serialize.body(git_pull_request_to_update, 'GitPullRequest')
response = self._send(http_method='PATCH',
location_id='9946fd70-0d40-406e-b686-b4744cbbcc37',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('GitPullRequest', response)
def share_pull_request(self, user_message, repository_id, pull_request_id, project=None):
"""SharePullRequest.
[Preview API] Sends an e-mail notification about a specific pull request to a set of recipients
:param :class:`<ShareNotificationContext> <azure.devops.v5_0.git.models.ShareNotificationContext>` user_message:
:param str repository_id: ID of the git repository.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
content = self._serialize.body(user_message, 'ShareNotificationContext')
self._send(http_method='POST',
location_id='696f3a82-47c9-487f-9117-b9d00972ca84',
version='5.0-preview.1',
route_values=route_values,
content=content)
def create_pull_request_status(self, status, repository_id, pull_request_id, project=None):
"""CreatePullRequestStatus.
[Preview API] Create a pull request status.
:param :class:`<GitPullRequestStatus> <azure.devops.v5_0.git.models.GitPullRequestStatus>` status: Pull request status to create.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequestStatus> <azure.devops.v5_0.git.models.GitPullRequestStatus>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
content = self._serialize.body(status, 'GitPullRequestStatus')
response = self._send(http_method='POST',
location_id='b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitPullRequestStatus', response)
def delete_pull_request_status(self, repository_id, pull_request_id, status_id, project=None):
"""DeletePullRequestStatus.
[Preview API] Delete pull request status.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param int status_id: ID of the pull request status.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if status_id is not None:
route_values['statusId'] = self._serialize.url('status_id', status_id, 'int')
self._send(http_method='DELETE',
location_id='b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35',
version='5.0-preview.1',
route_values=route_values)
def get_pull_request_status(self, repository_id, pull_request_id, status_id, project=None):
"""GetPullRequestStatus.
[Preview API] Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param int status_id: ID of the pull request status.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequestStatus> <azure.devops.v5_0.git.models.GitPullRequestStatus>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if status_id is not None:
route_values['statusId'] = self._serialize.url('status_id', status_id, 'int')
response = self._send(http_method='GET',
location_id='b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('GitPullRequestStatus', response)
def get_pull_request_statuses(self, repository_id, pull_request_id, project=None):
"""GetPullRequestStatuses.
[Preview API] Get all the statuses associated with a pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: [GitPullRequestStatus]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('[GitPullRequestStatus]', self._unwrap_collection(response))
def update_pull_request_statuses(self, patch_document, repository_id, pull_request_id, project=None):
"""UpdatePullRequestStatuses.
[Preview API] Update pull request statuses collection. The only supported operation type is `remove`.
:param :class:`<[JsonPatchOperation]> <azure.devops.v5_0.git.models.[JsonPatchOperation]>` patch_document: Operations to apply to the pull request statuses in JSON Patch format.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
content = self._serialize.body(patch_document, '[JsonPatchOperation]')
self._send(http_method='PATCH',
location_id='b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35',
version='5.0-preview.1',
route_values=route_values,
content=content,
media_type='application/json-patch+json')
def create_comment(self, comment, repository_id, pull_request_id, thread_id, project=None):
"""CreateComment.
Create a comment on a specific thread in a pull request.
:param :class:`<Comment> <azure.devops.v5_0.git.models.Comment>` comment: The comment to create.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: ID of the thread that the desired comment is in.
:param str project: Project ID or project name
:rtype: :class:`<Comment> <azure.devops.v5_0.git.models.Comment>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
content = self._serialize.body(comment, 'Comment')
response = self._send(http_method='POST',
location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('Comment', response)
def delete_comment(self, repository_id, pull_request_id, thread_id, comment_id, project=None):
"""DeleteComment.
Delete a comment associated with a specific thread in a pull request.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: ID of the thread that the desired comment is in.
:param int comment_id: ID of the comment.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
if comment_id is not None:
route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int')
self._send(http_method='DELETE',
location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b',
version='5.0',
route_values=route_values)
def get_comment(self, repository_id, pull_request_id, thread_id, comment_id, project=None):
"""GetComment.
Retrieve a comment associated with a specific thread in a pull request.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: ID of the thread that the desired comment is in.
:param int comment_id: ID of the comment.
:param str project: Project ID or project name
:rtype: :class:`<Comment> <azure.devops.v5_0.git.models.Comment>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
if comment_id is not None:
route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int')
response = self._send(http_method='GET',
location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b',
version='5.0',
route_values=route_values)
return self._deserialize('Comment', response)
def get_comments(self, repository_id, pull_request_id, thread_id, project=None):
"""GetComments.
Retrieve all comments associated with a specific thread in a pull request.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: ID of the thread.
:param str project: Project ID or project name
:rtype: [Comment]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
response = self._send(http_method='GET',
location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b',
version='5.0',
route_values=route_values)
return self._deserialize('[Comment]', self._unwrap_collection(response))
def update_comment(self, comment, repository_id, pull_request_id, thread_id, comment_id, project=None):
"""UpdateComment.
Update a comment associated with a specific thread in a pull request.
:param :class:`<Comment> <azure.devops.v5_0.git.models.Comment>` comment: The comment content that should be updated.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: ID of the thread that the desired comment is in.
:param int comment_id: ID of the comment to update.
:param str project: Project ID or project name
:rtype: :class:`<Comment> <azure.devops.v5_0.git.models.Comment>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
if comment_id is not None:
route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int')
content = self._serialize.body(comment, 'Comment')
response = self._send(http_method='PATCH',
location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('Comment', response)
def create_thread(self, comment_thread, repository_id, pull_request_id, project=None):
"""CreateThread.
Create a thread in a pull request.
:param :class:`<GitPullRequestCommentThread> <azure.devops.v5_0.git.models.GitPullRequestCommentThread>` comment_thread: The thread to create. Thread must contain at least one comment.
:param str repository_id: Repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequestCommentThread> <azure.devops.v5_0.git.models.GitPullRequestCommentThread>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
content = self._serialize.body(comment_thread, 'GitPullRequestCommentThread')
response = self._send(http_method='POST',
location_id='ab6e2e5d-a0b7-4153-b64a-a4efe0d49449',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('GitPullRequestCommentThread', response)
def get_pull_request_thread(self, repository_id, pull_request_id, thread_id, project=None, iteration=None, base_iteration=None):
"""GetPullRequestThread.
Retrieve a thread in a pull request.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: ID of the thread.
:param str project: Project ID or project name
:param int iteration: If specified, thread position will be tracked using this iteration as the right side of the diff.
:param int base_iteration: If specified, thread position will be tracked using this iteration as the left side of the diff.
:rtype: :class:`<GitPullRequestCommentThread> <azure.devops.v5_0.git.models.GitPullRequestCommentThread>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
query_parameters = {}
if iteration is not None:
query_parameters['$iteration'] = self._serialize.query('iteration', iteration, 'int')
if base_iteration is not None:
query_parameters['$baseIteration'] = self._serialize.query('base_iteration', base_iteration, 'int')
response = self._send(http_method='GET',
location_id='ab6e2e5d-a0b7-4153-b64a-a4efe0d49449',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitPullRequestCommentThread', response)
def get_threads(self, repository_id, pull_request_id, project=None, iteration=None, base_iteration=None):
"""GetThreads.
Retrieve all threads in a pull request.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:param int iteration: If specified, thread positions will be tracked using this iteration as the right side of the diff.
:param int base_iteration: If specified, thread positions will be tracked using this iteration as the left side of the diff.
:rtype: [GitPullRequestCommentThread]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
query_parameters = {}
if iteration is not None:
query_parameters['$iteration'] = self._serialize.query('iteration', iteration, 'int')
if base_iteration is not None:
query_parameters['$baseIteration'] = self._serialize.query('base_iteration', base_iteration, 'int')
response = self._send(http_method='GET',
location_id='ab6e2e5d-a0b7-4153-b64a-a4efe0d49449',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitPullRequestCommentThread]', self._unwrap_collection(response))
def update_thread(self, comment_thread, repository_id, pull_request_id, thread_id, project=None):
"""UpdateThread.
Update a thread in a pull request.
:param :class:`<GitPullRequestCommentThread> <azure.devops.v5_0.git.models.GitPullRequestCommentThread>` comment_thread: The thread content that should be updated.
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param int thread_id: ID of the thread to update.
:param str project: Project ID or project name
:rtype: :class:`<GitPullRequestCommentThread> <azure.devops.v5_0.git.models.GitPullRequestCommentThread>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
if thread_id is not None:
route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int')
content = self._serialize.body(comment_thread, 'GitPullRequestCommentThread')
response = self._send(http_method='PATCH',
location_id='ab6e2e5d-a0b7-4153-b64a-a4efe0d49449',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('GitPullRequestCommentThread', response)
def get_pull_request_work_item_refs(self, repository_id, pull_request_id, project=None):
"""GetPullRequestWorkItemRefs.
Retrieve a list of work items associated with a pull request.
:param str repository_id: ID or name of the repository.
:param int pull_request_id: ID of the pull request.
:param str project: Project ID or project name
:rtype: [ResourceRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if pull_request_id is not None:
route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int')
response = self._send(http_method='GET',
location_id='0a637fcc-5370-4ce8-b0e8-98091f5f9482',
version='5.0',
route_values=route_values)
return self._deserialize('[ResourceRef]', self._unwrap_collection(response))
def create_push(self, push, repository_id, project=None):
"""CreatePush.
Push changes to the repository.
:param :class:`<GitPush> <azure.devops.v5_0.git.models.GitPush>` push:
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:rtype: :class:`<GitPush> <azure.devops.v5_0.git.models.GitPush>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(push, 'GitPush')
response = self._send(http_method='POST',
location_id='ea98d07b-3c87-4971-8ede-a613694ffb55',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('GitPush', response)
def get_push(self, repository_id, push_id, project=None, include_commits=None, include_ref_updates=None):
"""GetPush.
Retrieves a particular push.
:param str repository_id: The name or ID of the repository.
:param int push_id: ID of the push.
:param str project: Project ID or project name
:param int include_commits: The number of commits to include in the result.
:param bool include_ref_updates: If true, include the list of refs that were updated by the push.
:rtype: :class:`<GitPush> <azure.devops.v5_0.git.models.GitPush>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if push_id is not None:
route_values['pushId'] = self._serialize.url('push_id', push_id, 'int')
query_parameters = {}
if include_commits is not None:
query_parameters['includeCommits'] = self._serialize.query('include_commits', include_commits, 'int')
if include_ref_updates is not None:
query_parameters['includeRefUpdates'] = self._serialize.query('include_ref_updates', include_ref_updates, 'bool')
response = self._send(http_method='GET',
location_id='ea98d07b-3c87-4971-8ede-a613694ffb55',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitPush', response)
def get_pushes(self, repository_id, project=None, skip=None, top=None, search_criteria=None):
"""GetPushes.
Retrieves pushes associated with the specified repository.
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:param int skip: Number of pushes to skip.
:param int top: Number of pushes to return.
:param :class:`<GitPushSearchCriteria> <azure.devops.v5_0.git.models.GitPushSearchCriteria>` search_criteria: Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references.
:rtype: [GitPush]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if skip is not None:
query_parameters['$skip'] = self._serialize.query('skip', skip, 'int')
if top is not None:
query_parameters['$top'] = self._serialize.query('top', top, 'int')
if search_criteria is not None:
if search_criteria.from_date is not None:
query_parameters['searchCriteria.fromDate'] = search_criteria.from_date
if search_criteria.to_date is not None:
query_parameters['searchCriteria.toDate'] = search_criteria.to_date
if search_criteria.pusher_id is not None:
query_parameters['searchCriteria.pusherId'] = search_criteria.pusher_id
if search_criteria.ref_name is not None:
query_parameters['searchCriteria.refName'] = search_criteria.ref_name
if search_criteria.include_ref_updates is not None:
query_parameters['searchCriteria.includeRefUpdates'] = search_criteria.include_ref_updates
if search_criteria.include_links is not None:
query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links
response = self._send(http_method='GET',
location_id='ea98d07b-3c87-4971-8ede-a613694ffb55',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitPush]', self._unwrap_collection(response))
def delete_repository_from_recycle_bin(self, project, repository_id):
"""DeleteRepositoryFromRecycleBin.
[Preview API] Destroy (hard delete) a soft-deleted Git repository.
:param str project: Project ID or project name
:param str repository_id: The ID of the repository.
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
self._send(http_method='DELETE',
location_id='a663da97-81db-4eb3-8b83-287670f63073',
version='5.0-preview.1',
route_values=route_values)
def get_recycle_bin_repositories(self, project):
"""GetRecycleBinRepositories.
[Preview API] Retrieve soft-deleted git repositories from the recycle bin.
:param str project: Project ID or project name
:rtype: [GitDeletedRepository]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
response = self._send(http_method='GET',
location_id='a663da97-81db-4eb3-8b83-287670f63073',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('[GitDeletedRepository]', self._unwrap_collection(response))
def restore_repository_from_recycle_bin(self, repository_details, project, repository_id):
"""RestoreRepositoryFromRecycleBin.
[Preview API] Recover a soft-deleted Git repository. Recently deleted repositories go into a soft-delete state for a period of time before they are hard deleted and become unrecoverable.
:param :class:`<GitRecycleBinRepositoryDetails> <azure.devops.v5_0.git.models.GitRecycleBinRepositoryDetails>` repository_details:
:param str project: Project ID or project name
:param str repository_id: The ID of the repository.
:rtype: :class:`<GitRepository> <azure.devops.v5_0.git.models.GitRepository>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(repository_details, 'GitRecycleBinRepositoryDetails')
response = self._send(http_method='PATCH',
location_id='a663da97-81db-4eb3-8b83-287670f63073',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitRepository', response)
def get_refs(self, repository_id, project=None, filter=None, include_links=None, include_statuses=None, include_my_branches=None, latest_statuses_only=None, peel_tags=None, filter_contains=None):
"""GetRefs.
Queries the provided repository for its refs and returns them.
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:param str filter: [optional] A filter to apply to the refs (starts with).
:param bool include_links: [optional] Specifies if referenceLinks should be included in the result. default is false.
:param bool include_statuses: [optional] Includes up to the first 1000 commit statuses for each ref. The default value is false.
:param bool include_my_branches: [optional] Includes only branches that the user owns, the branches the user favorites, and the default branch. The default value is false. Cannot be combined with the filter parameter.
:param bool latest_statuses_only: [optional] True to include only the tip commit status for each ref. This option requires `includeStatuses` to be true. The default value is false.
:param bool peel_tags: [optional] Annotated tags will populate the PeeledObjectId property. default is false.
:param str filter_contains: [optional] A filter to apply to the refs (contains).
:rtype: [GitRef]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if filter is not None:
query_parameters['filter'] = self._serialize.query('filter', filter, 'str')
if include_links is not None:
query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool')
if include_statuses is not None:
query_parameters['includeStatuses'] = self._serialize.query('include_statuses', include_statuses, 'bool')
if include_my_branches is not None:
query_parameters['includeMyBranches'] = self._serialize.query('include_my_branches', include_my_branches, 'bool')
if latest_statuses_only is not None:
query_parameters['latestStatusesOnly'] = self._serialize.query('latest_statuses_only', latest_statuses_only, 'bool')
if peel_tags is not None:
query_parameters['peelTags'] = self._serialize.query('peel_tags', peel_tags, 'bool')
if filter_contains is not None:
query_parameters['filterContains'] = self._serialize.query('filter_contains', filter_contains, 'str')
response = self._send(http_method='GET',
location_id='2d874a60-a811-4f62-9c9f-963a6ea0a55b',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitRef]', self._unwrap_collection(response))
def update_ref(self, new_ref_info, repository_id, filter, project=None, project_id=None):
"""UpdateRef.
Lock or Unlock a branch.
:param :class:`<GitRefUpdate> <azure.devops.v5_0.git.models.GitRefUpdate>` new_ref_info: The ref update action (lock/unlock) to perform
:param str repository_id: The name or ID of the repository.
:param str filter: The name of the branch to lock/unlock
:param str project: Project ID or project name
:param str project_id: ID or name of the team project. Optional if specifying an ID for repository.
:rtype: :class:`<GitRef> <azure.devops.v5_0.git.models.GitRef>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if filter is not None:
query_parameters['filter'] = self._serialize.query('filter', filter, 'str')
if project_id is not None:
query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
content = self._serialize.body(new_ref_info, 'GitRefUpdate')
response = self._send(http_method='PATCH',
location_id='2d874a60-a811-4f62-9c9f-963a6ea0a55b',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
content=content)
return self._deserialize('GitRef', response)
def update_refs(self, ref_updates, repository_id, project=None, project_id=None):
"""UpdateRefs.
Creating, updating, or deleting refs(branches).
:param [GitRefUpdate] ref_updates: List of ref updates to attempt to perform
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:param str project_id: ID or name of the team project. Optional if specifying an ID for repository.
:rtype: [GitRefUpdateResult]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if project_id is not None:
query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
content = self._serialize.body(ref_updates, '[GitRefUpdate]')
response = self._send(http_method='POST',
location_id='2d874a60-a811-4f62-9c9f-963a6ea0a55b',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
content=content)
return self._deserialize('[GitRefUpdateResult]', self._unwrap_collection(response))
def create_favorite(self, favorite, project):
"""CreateFavorite.
[Preview API] Creates a ref favorite
:param :class:`<GitRefFavorite> <azure.devops.v5_0.git.models.GitRefFavorite>` favorite: The ref favorite to create.
:param str project: Project ID or project name
:rtype: :class:`<GitRefFavorite> <azure.devops.v5_0.git.models.GitRefFavorite>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
content = self._serialize.body(favorite, 'GitRefFavorite')
response = self._send(http_method='POST',
location_id='876f70af-5792-485a-a1c7-d0a7b2f42bbb',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitRefFavorite', response)
def delete_ref_favorite(self, project, favorite_id):
"""DeleteRefFavorite.
[Preview API] Deletes the refs favorite specified
:param str project: Project ID or project name
:param int favorite_id: The Id of the ref favorite to delete.
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if favorite_id is not None:
route_values['favoriteId'] = self._serialize.url('favorite_id', favorite_id, 'int')
self._send(http_method='DELETE',
location_id='876f70af-5792-485a-a1c7-d0a7b2f42bbb',
version='5.0-preview.1',
route_values=route_values)
def get_ref_favorite(self, project, favorite_id):
"""GetRefFavorite.
[Preview API] Gets the refs favorite for a favorite Id.
:param str project: Project ID or project name
:param int favorite_id: The Id of the requested ref favorite.
:rtype: :class:`<GitRefFavorite> <azure.devops.v5_0.git.models.GitRefFavorite>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if favorite_id is not None:
route_values['favoriteId'] = self._serialize.url('favorite_id', favorite_id, 'int')
response = self._send(http_method='GET',
location_id='876f70af-5792-485a-a1c7-d0a7b2f42bbb',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('GitRefFavorite', response)
def get_ref_favorites(self, project, repository_id=None, identity_id=None):
"""GetRefFavorites.
[Preview API] Gets the refs favorites for a repo and an identity.
:param str project: Project ID or project name
:param str repository_id: The id of the repository.
:param str identity_id: The id of the identity whose favorites are to be retrieved. If null, the requesting identity is used.
:rtype: [GitRefFavorite]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
query_parameters = {}
if repository_id is not None:
query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str')
if identity_id is not None:
query_parameters['identityId'] = self._serialize.query('identity_id', identity_id, 'str')
response = self._send(http_method='GET',
location_id='876f70af-5792-485a-a1c7-d0a7b2f42bbb',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitRefFavorite]', self._unwrap_collection(response))
def create_repository(self, git_repository_to_create, project=None, source_ref=None):
"""CreateRepository.
Create a git repository in a team project.
:param :class:`<GitRepositoryCreateOptions> <azure.devops.v5_0.git.models.GitRepositoryCreateOptions>` git_repository_to_create: Specify the repo name, team project and/or parent repository. Team project information can be ommitted from gitRepositoryToCreate if the request is project-scoped (i.e., includes project Id).
:param str project: Project ID or project name
:param str source_ref: [optional] Specify the source refs to use while creating a fork repo
:rtype: :class:`<GitRepository> <azure.devops.v5_0.git.models.GitRepository>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
query_parameters = {}
if source_ref is not None:
query_parameters['sourceRef'] = self._serialize.query('source_ref', source_ref, 'str')
content = self._serialize.body(git_repository_to_create, 'GitRepositoryCreateOptions')
response = self._send(http_method='POST',
location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
content=content)
return self._deserialize('GitRepository', response)
def delete_repository(self, repository_id, project=None):
"""DeleteRepository.
Delete a git repository
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
self._send(http_method='DELETE',
location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f',
version='5.0',
route_values=route_values)
def get_repositories(self, project=None, include_links=None, include_all_urls=None, include_hidden=None):
"""GetRepositories.
Retrieve git repositories.
:param str project: Project ID or project name
:param bool include_links: [optional] True to include reference links. The default value is false.
:param bool include_all_urls: [optional] True to include all remote URLs. The default value is false.
:param bool include_hidden: [optional] True to include hidden repositories. The default value is false.
:rtype: [GitRepository]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
query_parameters = {}
if include_links is not None:
query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool')
if include_all_urls is not None:
query_parameters['includeAllUrls'] = self._serialize.query('include_all_urls', include_all_urls, 'bool')
if include_hidden is not None:
query_parameters['includeHidden'] = self._serialize.query('include_hidden', include_hidden, 'bool')
response = self._send(http_method='GET',
location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitRepository]', self._unwrap_collection(response))
def get_repository(self, repository_id, project=None):
"""GetRepository.
Retrieve a git repository.
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:rtype: :class:`<GitRepository> <azure.devops.v5_0.git.models.GitRepository>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
response = self._send(http_method='GET',
location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f',
version='5.0',
route_values=route_values)
return self._deserialize('GitRepository', response)
def get_repository_with_parent(self, repository_id, include_parent, project=None):
"""GetRepositoryWithParent.
Retrieve a git repository.
:param str repository_id: The name or ID of the repository.
:param bool include_parent: True to include parent repository. Only available in authenticated calls.
:param str project: Project ID or project name
:rtype: :class:`<GitRepository> <azure.devops.v5_0.git.models.GitRepository>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if include_parent is not None:
query_parameters['includeParent'] = self._serialize.query('include_parent', include_parent, 'bool')
response = self._send(http_method='GET',
location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitRepository', response)
def update_repository(self, new_repository_info, repository_id, project=None):
"""UpdateRepository.
Updates the Git repository with either a new repo name or a new default branch.
:param :class:`<GitRepository> <azure.devops.v5_0.git.models.GitRepository>` new_repository_info: Specify a new repo name or a new default branch of the repository
:param str repository_id: The name or ID of the repository.
:param str project: Project ID or project name
:rtype: :class:`<GitRepository> <azure.devops.v5_0.git.models.GitRepository>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(new_repository_info, 'GitRepository')
response = self._send(http_method='PATCH',
location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('GitRepository', response)
def create_revert(self, revert_to_create, project, repository_id):
"""CreateRevert.
[Preview API] Starts the operation to create a new branch which reverts changes introduced by either a specific commit or commits that are associated to a pull request.
:param :class:`<GitAsyncRefOperationParameters> <azure.devops.v5_0.git.models.GitAsyncRefOperationParameters>` revert_to_create:
:param str project: Project ID or project name
:param str repository_id: ID of the repository.
:rtype: :class:`<GitRevert> <azure.devops.v5_0.git.models.GitRevert>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(revert_to_create, 'GitAsyncRefOperationParameters')
response = self._send(http_method='POST',
location_id='bc866058-5449-4715-9cf1-a510b6ff193c',
version='5.0-preview.1',
route_values=route_values,
content=content)
return self._deserialize('GitRevert', response)
def get_revert(self, project, revert_id, repository_id):
"""GetRevert.
[Preview API] Retrieve information about a revert operation by revert Id.
:param str project: Project ID or project name
:param int revert_id: ID of the revert operation.
:param str repository_id: ID of the repository.
:rtype: :class:`<GitRevert> <azure.devops.v5_0.git.models.GitRevert>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if revert_id is not None:
route_values['revertId'] = self._serialize.url('revert_id', revert_id, 'int')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
response = self._send(http_method='GET',
location_id='bc866058-5449-4715-9cf1-a510b6ff193c',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('GitRevert', response)
def get_revert_for_ref_name(self, project, repository_id, ref_name):
"""GetRevertForRefName.
[Preview API] Retrieve information about a revert operation for a specific branch.
:param str project: Project ID or project name
:param str repository_id: ID of the repository.
:param str ref_name: The GitAsyncRefOperationParameters generatedRefName used for the revert operation.
:rtype: :class:`<GitRevert> <azure.devops.v5_0.git.models.GitRevert>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if ref_name is not None:
query_parameters['refName'] = self._serialize.query('ref_name', ref_name, 'str')
response = self._send(http_method='GET',
location_id='bc866058-5449-4715-9cf1-a510b6ff193c',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitRevert', response)
def create_commit_status(self, git_commit_status_to_create, commit_id, repository_id, project=None):
"""CreateCommitStatus.
Create Git commit status.
:param :class:`<GitStatus> <azure.devops.v5_0.git.models.GitStatus>` git_commit_status_to_create: Git commit status object to create.
:param str commit_id: ID of the Git commit.
:param str repository_id: ID of the repository.
:param str project: Project ID or project name
:rtype: :class:`<GitStatus> <azure.devops.v5_0.git.models.GitStatus>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if commit_id is not None:
route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
content = self._serialize.body(git_commit_status_to_create, 'GitStatus')
response = self._send(http_method='POST',
location_id='428dd4fb-fda5-4722-af02-9313b80305da',
version='5.0',
route_values=route_values,
content=content)
return self._deserialize('GitStatus', response)
def get_statuses(self, commit_id, repository_id, project=None, top=None, skip=None, latest_only=None):
"""GetStatuses.
Get statuses associated with the Git commit.
:param str commit_id: ID of the Git commit.
:param str repository_id: ID of the repository.
:param str project: Project ID or project name
:param int top: Optional. The number of statuses to retrieve. Default is 1000.
:param int skip: Optional. The number of statuses to ignore. Default is 0. For example, to retrieve results 101-150, set top to 50 and skip to 100.
:param bool latest_only: The flag indicates whether to get only latest statuses grouped by `Context.Name` and `Context.Genre`.
:rtype: [GitStatus]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if commit_id is not None:
route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
query_parameters = {}
if top is not None:
query_parameters['top'] = self._serialize.query('top', top, 'int')
if skip is not None:
query_parameters['skip'] = self._serialize.query('skip', skip, 'int')
if latest_only is not None:
query_parameters['latestOnly'] = self._serialize.query('latest_only', latest_only, 'bool')
response = self._send(http_method='GET',
location_id='428dd4fb-fda5-4722-af02-9313b80305da',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('[GitStatus]', self._unwrap_collection(response))
def get_suggestions(self, repository_id, project=None):
"""GetSuggestions.
[Preview API] Retrieve a pull request suggestion for a particular repository or team project.
:param str repository_id: ID of the git repository.
:param str project: Project ID or project name
:rtype: [GitSuggestion]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
response = self._send(http_method='GET',
location_id='9393b4fb-4445-4919-972b-9ad16f442d83',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('[GitSuggestion]', self._unwrap_collection(response))
def get_tree(self, repository_id, sha1, project=None, project_id=None, recursive=None, file_name=None):
"""GetTree.
The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.
:param str repository_id: Repository Id.
:param str sha1: SHA1 hash of the tree object.
:param str project: Project ID or project name
:param str project_id: Project Id.
:param bool recursive: Search recursively. Include trees underneath this tree. Default is false.
:param str file_name: Name to use if a .zip file is returned. Default is the object ID.
:rtype: :class:`<GitTreeRef> <azure.devops.v5_0.git.models.GitTreeRef>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if sha1 is not None:
route_values['sha1'] = self._serialize.url('sha1', sha1, 'str')
query_parameters = {}
if project_id is not None:
query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
if recursive is not None:
query_parameters['recursive'] = self._serialize.query('recursive', recursive, 'bool')
if file_name is not None:
query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str')
response = self._send(http_method='GET',
location_id='729f6437-6f92-44ec-8bee-273a7111063c',
version='5.0',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GitTreeRef', response)
def get_tree_zip(self, repository_id, sha1, project=None, project_id=None, recursive=None, file_name=None, **kwargs):
"""GetTreeZip.
The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.
:param str repository_id: Repository Id.
:param str sha1: SHA1 hash of the tree object.
:param str project: Project ID or project name
:param str project_id: Project Id.
:param bool recursive: Search recursively. Include trees underneath this tree. Default is false.
:param str file_name: Name to use if a .zip file is returned. Default is the object ID.
:rtype: object
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if repository_id is not None:
route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str')
if sha1 is not None:
route_values['sha1'] = self._serialize.url('sha1', sha1, 'str')
query_parameters = {}
if project_id is not None:
query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str')
if recursive is not None:
query_parameters['recursive'] = self._serialize.query('recursive', recursive, 'bool')
if file_name is not None:
query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str')
response = self._send(http_method='GET',
location_id='729f6437-6f92-44ec-8bee-273a7111063c',
version='5.0',
route_values=route_values,
query_parameters=query_parameters,
accept_media_type='application/zip')
if "callback" in kwargs:
callback = kwargs["callback"]
else:
callback = None
return self._client.stream_download(response, callback=callback)
|