Skip to content

Commit

Permalink
update client function to the correct client function
Browse files Browse the repository at this point in the history
  • Loading branch information
devgenix committed Dec 14, 2023
1 parent 4023e86 commit b61f72c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion agenta-cli/agenta/cli/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def update_variants_from_backend(
)

try:
variants: List[AppVariant] = client.list_app_variants_apps_app_id_variants_get(
variants: List[AppVariant] = client.list_app_variants(
app_id=app_id
)
except Exception as ex:
Expand Down
4 changes: 2 additions & 2 deletions agenta-cli/agenta/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def init(app_name: str):
if where_question == "On agenta cloud":
try:
key_prefix = api_key.split(".")[0]
client.validate_api_key_keys_key_prefix_validate_get(
client.validate_api_key(
key_prefix=key_prefix
)
except Exception as ex:
Expand All @@ -145,7 +145,7 @@ def init(app_name: str):

# Get app_id after creating new app in the backend server
try:
app_id = client.create_app_apps_post(app_name=app_name).app_id
app_id = client.create_app(app_name=app_name).app_id
except Exception as ex:
click.echo(click.style(f"Error: {ex}", fg="red"))
sys.exit(1)
Expand Down
16 changes: 8 additions & 8 deletions agenta-cli/agenta/cli/variant_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def add_variant(
)
)
with tar_path.open("rb") as tar_file:
image: Image = client.build_image_containers_build_image_post(
image: Image = client.build_image(
app_id=app_id,
base_name=base_name,
tar_file=tar_file,
Expand All @@ -148,8 +148,8 @@ def add_variant(
)
)
variant_id = config["variant_ids"][config["variants"].index(variant_name)]
client.update_variant_image_variants_variant_id_image_put(
variant_id=variant_id, image=image
client.update_variant_image(
variant_id=variant_id, request=image # because Fern code uses "request: Image" instead of "image: Image"
) # this automatically restarts
else:
click.echo(click.style(f"Adding {variant_name} to server...", fg="yellow"))
Expand All @@ -172,7 +172,7 @@ def add_variant(
if overwrite:
# Track a deployment event
if tracking_enabled:
get_user_id = client.user_profile_profile_get()
get_user_id = client.user_profile()
user_id = get_user_id["id"]
event_track.capture_event(
user_id,
Expand All @@ -195,7 +195,7 @@ def add_variant(
else:
# Track a deployment event
if tracking_enabled:
get_user_id = client.user_profile_profile_get()
get_user_id = client.user_profile()
user_id = get_user_id["id"]
event_track.capture_event(
user_id,
Expand Down Expand Up @@ -261,7 +261,7 @@ def start_variant(variant_id: str, app_folder: str, host: str):
api_key=api_key,
)

endpoint = client.start_variant_variants_variant_id_put(
endpoint = client.start_variant(
variant_id=variant_id, action={"action": "START"}
)
click.echo("\n" + click.style("Congratulations! 🎉", bold=True, fg="green"))
Expand Down Expand Up @@ -331,7 +331,7 @@ def remove_variant(variant_name: str, app_folder: str, host: str):
)

try:
client.remove_variant_variants_variant_id_delete(variant_id=variant_id)
client.remove_variant(variant_id=variant_id)
except Exception as ex:
click.echo(
click.style(
Expand Down Expand Up @@ -369,7 +369,7 @@ def list_variants(app_folder: str, host: str):
)

try:
variants: List[AppVariant] = client.list_app_variants_apps_app_id_variants_get(
variants: List[AppVariant] = client.list_app_variants(
app_id=app_id
)
except Exception as ex:
Expand Down
10 changes: 5 additions & 5 deletions agenta-cli/agenta/sdk/agenta_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ def init(
)
else:
try:
get_app_id = client.list_apps_apps_get(app_name=app_name)
get_app_id = client.list_apps(app_name=app_name)
app_id = get_app_id.app_id

if not app_id:
raise APIRequestError(
f"App with name {app_name} does not exist on the server."
)

get_base_id = client.list_bases_bases_get(
get_base_id = client.list_bases(
app_id=app_id, base_name=base_name
)
base_id = get_base_id.base_id
Expand Down Expand Up @@ -132,7 +132,7 @@ def push(self, config_name: str, overwrite=True, **kwargs):
if not self.persist:
return
try:
client.save_config_configs_post(
client.save_config(
base_id=self.base_id,
config_name=config_name,
parameters=kwargs,
Expand All @@ -154,12 +154,12 @@ def pull(self, config_name: str = "default", environment_name: str = None):
if self.persist:
try:
if environment_name:
config = client.get_config_configs_get(
config = client.get_config(
base_id=self.base_id, environment_name=environment_name
)

else:
config = client.get_config_configs_get(
config = client.get_config(
base_id=self.base_id,
config_name=config_name,
)
Expand Down

0 comments on commit b61f72c

Please sign in to comment.