Hope the following helps clarify the situation:
The state established by nationalists in 1919 was known as the Irish Republic; when the state achieved according to law independence in 1922, it became known as the Irish Free State.
The Anglo-Irish Treaty, officially called the Articles of Agreement for a Treaty Between Great Britain and Ireland, was a treaty between the Government of the United Kingdom and representatives of the (extra-judicial) Irish Republic which concluded the Irish War of Independence. It established an Irish dominion within the British Empire known as the Irish Free State and provided an option for the previously existing Northern Ireland created by the 1920 Government of Ireland Act, to opt out of the Irish Free State, which it duly exercised.
The Anglo-Irish Treaty explicitly ruled out a republic. What it offered was dominion status, as a state of the British Empire (now called the Commonwealth of Nations, equal to Canada, Australia and New Zealand. Though less than expected by the Sinn Féin leadership of 1919–1922, it was substantially more than the initial form of home rule within the United Kingdom sought by Charles Stewart Parnell from 1880 and a serious advancement on the final Third Home Rule Act 1914 which the Irish nationalist leader]John Redmond had achieved through democratic parliamentary proceedings.
The structures of the new Irish Free State were laid out in the Treaty and in the Constitution of the Irish Free State Act. It provided for a constitutional monarchy, with a three tier parliament, called the Oireachtas, made up of the King and two houses, Dáil Éireann and Seanad Éireann (the Irish Senate). Executive authority was vested in the King, and exercised by a cabinet called the Executive Council, presided over by a prime minister called the President of the Executive Council.
The King in Ireland was represented by a Governor-General of the Irish Free State. The office replaced the previous Lord Lieutenant, who had headed English and British administrations in Ireland since the Middle Ages. Governors-General were appointed by the King initially on the advice of the British Government, but with the consent of the Irish Government. From 1927 the Irish Government alone had the power to advise the King whom to appoint.
As with all dominions, provision was made for an Oath of Allegiance. Within dominions, such oaths were taken by parliamentarians personally towards the monarch. The Irish Oath of Allegiance was fundamentally different. It had two elements; the first, an oath to the Free State, as by law established, the second part a promise of fidelity, to His Majesty, King George V, his heirs and successors. That second fidelity element, however, was qualified in two ways. It was to the King in Ireland, not specifically to the British King. Secondly, it was to the King explicitly in his role as part of the Treaty settlement, not in terms of pre-1922 British rule. The Oath itself came from a combination of three sources, and was largely the work of Michael Collins in the Treaty negotiations. It came in part from a draft oath suggested prior to the negotiations by President de Valera. Other sections were taken by Collins directly from the Oath of the Irish Republican Brotherhood, of which he was the secret head. In its structure, it was also partially based on the form and structure used in the Dominion of Canada.
The compromises contained in the agreement caused the in the 26 counties in June 1922-April 1923, in which Michael Collins's pro-Treaty "Free Staters" defeated the anti-Treaty Republicans led by Eamon de Valera, who had resigned as president of the Republic on the treaty's ratification, to the fury of some of his own supporters, notably. On resigning, he then sought re-election in an attempt to wreck the treaty. However his ploy failed as the electorate voted for pro-treaty candidates.
Michael Collins described the Treaty as 'the freedom to achieve freedom'. In practice, the Treaty offered most of the symbols, powers and functions of independence, including a functioning parliamentary democracy, executive, judiciary, a written constitution which could be changed by the Free State, etc. However, in theory, a number of limits existed:
The British king remained king in Ireland;
The British Government had a continued role in Irish governance. Officially the representative of the King, the Governor-General also received instructions from the British Government on his use of the namely a Bill passed by the Dáil and Seanad could be Granted Assent (signed into law), Withheld (not signed, pending later approval) or Denied (i.e., vetoed). Letters patent to the first Governor-General Tim Healy had named Bills that if passed were to be blocked, namely an attempt to abolish the Oath, etc. In reality no such Bills were ever introduced, so the issue never arose.
The Irish Free State, like all Dominions, had an inferior status to the United Kingdom, which meant, in theory, it could not have its own citizenship (merely a shared Commonwealth citizenship), could not have direct access to the monarch except through a British minister, and had to use the British state's Great Seal of the Realm on all of its state documents, again symbolising its inferior status to the United Kingdom within the Commonwealth.
All this changed in the 1920s. A reform of the King's title, under a Commonwealth Conference decision and given effect by the Royal and Parliamentary Titles Act 1927, changed the King's role in each dominion. No more was he King in Ireland, Australia, New Zealand, etc. Instead he became King of Ireland, Australia, etc. So from that change, embodied in the Royal Titles Act, the British king had no role whatsoever in each dominion. His only role was as each dominion's own king, advised in each dominion's affairs by the dominion, not by the United Kingdom. Furthermore, the British government lost any role in either the selection of a governor-general or in advising him. In this manner, the United Kingdom lost the ability to influence internal dominion legislation.
The Free State went further. It 'accepted' credentials from international ambassadors to Ireland, something no other dominion up to then had done. It registered the treaty with the League of Nations as an international document, to the fury of the United Kingdom, who saw it as a mere internal document between a dominion and the UK. Most dramatically of all, the Statute of Westminster, again embodying a decision of a Commonwealth Conference, enabled each dominion to enact any legislation to change any legislation, without any role for the British parliament which may have enacted the original legislation in the past. Ireland symbolically marked these changes in two mould-breaking moves.
It sought, and got the King's acceptance, to have an Irish minister, with the complete exclusion of British ministers, formally advising the king as King of Ireland in the exercise of his Irish powers and functions (e.g., the signing of a Treaty between the Irish Free State and the Portuguese Republic in 1931);
The unprecedented abandonment of the use of the British Great Seal of the Realm and its replacement by the Great Seal of the Irish Free State, which the King awarded to his Irish Kingdom as King of Ireland, again in 1931. (The Irish Seal consisted of a picture of 'King George V of Ireland' enthroned on one side, with the Irish state Harp and the words Saorstát Éireann (Irish for Irish Free State) on the reverse. It is now on display in the Irish National Museum, Collins Barracks in Dublin.)
When Eamon de Valera became President of the Executive Council (prime minister) in 1932 he described Cosgrave's ministers' achievements simply. Having read the files, he told his son, Vivion, "they were magnificent, son." (All that remained was British control of a number of ports in the Irish Free State, called the Treaty Ports. However that was an issue not of constitutional law but technical requirements in the Treaty which could be and were renegotiated in 1938 to Ireland's satisfaction.).
That freedom allowed de Valera, on becoming President of the Executive Council (February 1932) to go even further. With no British restrictions on his policies, he abolished the Oath of Allegiance (which Cosgrave intended to do had he won the 1932 general election), the Senate, university representation in the Dáil, appeals to the Privy Council. His one major error occurred in 1936 when, in a rush to use the abdication of King Edward VIII, he tried to abolish the crown and governor-general with the Constitution (Amendment No.27 Act), only to be told by senior law officers and others that, as the crown & governor-generalship existed separately from the constitution in a vast number of Acts, Charters, Orders-in-Council, and Letters Patent, they both still existed. He had to rush through a second Bill, The Executive Powers (Consequential Provisions) Act, 1937 to repeal all the elements he had forgotten. He retrospectively dated the second Act's effect back to December 1936.
In 1937, Eamon de Valera replaced the 1922 constitution of Michael Collins with his own, renamed the Irish Free State to Éire, and created a new 'president of Ireland' in place of the Governor-General of the Irish Free State.
Though this state's constitutional structures provided for a President of Ireland instead of a king, it was not technically a republic; the principal key role possessed by a head of state, that of symbolically representing the state internationally remained vested, in statute law, in the King as an organ. On 21 December 1948 the Republic of Ireland Act declared a republic, with the functions previously given to the King given instead to the President of Ireland.