Skip to content

Commit 87e4ad3

Browse files
authored
chore: refactor codebase to align with latest renames in oas specs stripping Get from operation ids (#246)
1 parent 266981b commit 87e4ad3

34 files changed

+346
-346
lines changed

api/oas-generator/src/oas_generator/builder.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class TypeInfo:
4141
LEDGER_STATE_DELTA_MODEL_NAMES: set[str] = {
4242
"LedgerStateDelta",
4343
"LedgerStateDeltaForTransactionGroup",
44-
"GetTransactionGroupLedgerStateDeltasForRound",
45-
"GetTransactionGroupLedgerStateDeltasForRoundResponseModel",
44+
"TransactionGroupLedgerStateDeltasForRound",
45+
"TransactionGroupLedgerStateDeltasForRoundResponseModel",
4646
}
4747

4848

@@ -684,13 +684,13 @@ def _collect_alias_imports(self, annotation: str, entry: SchemaEntry) -> list[st
684684

685685
class OperationBuilder:
686686
RAW_LEDGER_STATE_DELTA_OPERATIONS: ClassVar[set[str]] = {
687-
"GetLedgerStateDelta",
688-
"GetLedgerStateDeltaForTransactionGroup",
689-
"GetTransactionGroupLedgerStateDeltasForRound",
687+
"LedgerStateDelta",
688+
"LedgerStateDeltaForTransactionGroup",
689+
"TransactionGroupLedgerStateDeltasForRound",
690690
}
691691
ALGOD_PRIVATE_OPERATIONS: ClassVar[set[str]] = {
692692
"RawTransaction",
693-
"GetApplicationBoxByName",
693+
"ApplicationBoxByName",
694694
"TransactionParams",
695695
}
696696
SKIP_TAGS: ClassVar[set[str]] = {"private", "experimental", "skip"}
@@ -922,8 +922,8 @@ def _build_response(self, responses: dict[str, Any], operation_id: str) -> ctx.R
922922
self.uses_msgpack = True
923923
self.uses_ledger_state_delta = True
924924
model_name = (
925-
"GetTransactionGroupLedgerStateDeltasForRound"
926-
if operation_id == "GetTransactionGroupLedgerStateDeltasForRound"
925+
"TransactionGroupLedgerStateDeltasForRound"
926+
if operation_id == "TransactionGroupLedgerStateDeltasForRound"
927927
else "LedgerStateDelta"
928928
)
929929
return ctx.ResponseDescriptor(
@@ -932,7 +932,7 @@ def _build_response(self, responses: dict[str, Any], operation_id: str) -> ctx.R
932932
description=payload.get("description"),
933933
model=model_name,
934934
)
935-
if operation_id == "GetBlock" and schema is not None:
935+
if operation_id == "Block" and schema is not None:
936936
self.uses_block_models = True
937937
media_types = media_types or ["application/json"]
938938
return ctx.ResponseDescriptor(

api/oas-generator/src/oas_generator/renderer/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TemplateRenderer:
6060
"LedgerAccountTotals",
6161
"LedgerStateDelta",
6262
"LedgerStateDeltaForTransactionGroup",
63-
"GetTransactionGroupLedgerStateDeltasForRound",
63+
"TransactionGroupLedgerStateDeltasForRound",
6464
]
6565

6666
def __init__(self, template_dir: Path | None = None) -> None:

api/oas-generator/src/oas_generator/renderer/templates/client.py.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class {{ client.class_name }}:
283283

284284
return self._raw_transaction(payload)
285285

286-
def get_application_box_by_name(
286+
def application_box_by_name(
287287
self,
288288
application_id: int,
289289
box_name: bytes | bytearray | memoryview | str,
@@ -294,7 +294,7 @@ class {{ client.class_name }}:
294294

295295
box_bytes = box_name.encode() if isinstance(box_name, str) else bytes(box_name)
296296
encoded_name = "b64:" + b64encode(box_bytes).decode("ascii")
297-
return self._get_application_box_by_name(application_id, name=encoded_name)
297+
return self._application_box_by_name(application_id, name=encoded_name)
298298

299299
def suggested_params(self) -> models.SuggestedParams:
300300
"""

api/oas-generator/src/oas_generator/renderer/templates/models/ledger_state_delta.py.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ __all__ = [
3939
"LedgerAccountTotals",
4040
"LedgerStateDelta",
4141
"LedgerStateDeltaForTransactionGroup",
42-
"GetTransactionGroupLedgerStateDeltasForRound",
42+
"TransactionGroupLedgerStateDeltasForRound",
4343
]
4444

4545

@@ -375,7 +375,7 @@ class LedgerStateDeltaForTransactionGroup:
375375

376376

377377
@dataclass(slots=True)
378-
class GetTransactionGroupLedgerStateDeltasForRound:
378+
class TransactionGroupLedgerStateDeltasForRound:
379379
"""All ledger deltas for transaction groups in a round."""
380380

381381
deltas: list[LedgerStateDeltaForTransactionGroup] = field(

0 commit comments

Comments
 (0)