Skip to content

Commit

Permalink
update project-id to project-number
Browse files Browse the repository at this point in the history
  • Loading branch information
fran-tirapu committed Aug 2, 2024
1 parent feca97a commit 9a72b2c
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions docs/firebase-app-distribution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ firebase-app-distribution
### Usage
```bash
firebase-app-distribution [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v]
--project-id PROJECT_ID
--project-number PROJECT_NUMBER
[--credentials FIREBASE_SERVICE_ACCOUNT_CREDENTIALS]
ACTION
```
### Required arguments for command `firebase-app-distribution`

##### `--project-id, -p=PROJECT_ID`
##### `--project-number, -p=PROJECT_NUMBER`


Project ID in Firebase. For example `228333310124`
Project Number in Firebase. For example `228333310124`
### Optional arguments for command `firebase-app-distribution`

##### `--credentials, -c=FIREBASE_SERVICE_ACCOUNT_CREDENTIALS`
Expand Down
6 changes: 3 additions & 3 deletions docs/firebase-app-distribution/get-latest-build-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ get-latest-build-version
### Usage
```bash
firebase-app-distribution get-latest-build-version [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v]
--project-id PROJECT_ID
--project-number PROJECT_NUMBER
[--credentials FIREBASE_SERVICE_ACCOUNT_CREDENTIALS]
--app-id APP_ID
```
Expand All @@ -19,10 +19,10 @@ firebase-app-distribution get-latest-build-version [-h] [--log-stream STREAM] [-
Application ID in Firebase. For example `1:228333310124:ios:5e439e0d0231a788ac8f09`
### Required arguments for command `firebase-app-distribution`

##### `--project-id, -p=PROJECT_ID`
##### `--project-number, -p=PROJECT_NUMBER`


Project ID in Firebase. For example `228333310124`
Project Number in Firebase. For example `228333310124`
### Optional arguments for command `firebase-app-distribution`

##### `--credentials, -c=FIREBASE_SERVICE_ACCOUNT_CREDENTIALS`
Expand Down
6 changes: 3 additions & 3 deletions docs/firebase-app-distribution/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ releases
### Usage
```bash
firebase-app-distribution releases [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v]
--project-id PROJECT_ID
--project-number PROJECT_NUMBER
[--credentials FIREBASE_SERVICE_ACCOUNT_CREDENTIALS]
ACTION
```
### Required arguments for command `firebase-app-distribution`

##### `--project-id, -p=PROJECT_ID`
##### `--project-number, -p=PROJECT_NUMBER`


Project ID in Firebase. For example `228333310124`
Project Number in Firebase. For example `228333310124`
### Optional arguments for command `firebase-app-distribution`

##### `--credentials, -c=FIREBASE_SERVICE_ACCOUNT_CREDENTIALS`
Expand Down
4 changes: 2 additions & 2 deletions docs/firebase-app-distribution/releases/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ list
### Usage
```bash
firebase-app-distribution releases list [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v]
--project-id PROJECT_ID
--project-number PROJECT_NUMBER
[--credentials FIREBASE_SERVICE_ACCOUNT_CREDENTIALS]
[--limit LIMIT]
[--order-by ORDER_BY]
Expand Down Expand Up @@ -36,7 +36,7 @@ Sort resources in the specified order. Default: `createTimeDesc`
Whether to show the request response in JSON format
### Required arguments for command `firebase-app-distribution`

##### `--project-id, -p=PROJECT_ID`
##### `--project-number, -p=PROJECT_NUMBER`


Project ID in Firebase. For example `228333310124`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def list_releases(
List releases for the Firebase application
"""

app_identifier = AppIdentifier(self.project_id, app_id)
app_identifier = AppIdentifier(self.project_number, app_id)
try:
releases = self.client.releases.list(app_identifier, order_by, limit)
except GoogleError as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_latest_build_version(self, app_id: str, should_print: bool = True) -> st
"""
Get latest build version from Firebase
"""
app_identifier = AppIdentifier(self.project_id, app_id)
app_identifier = AppIdentifier(self.project_number, app_id)
try:
releases = self.client.releases.list(app_identifier, limit=1)
except GoogleError as e:
Expand Down
8 changes: 4 additions & 4 deletions src/codemagic/tools/firebase_app_distribution/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@


class FirebaseArgument(cli.Argument):
PROJECT_ID = cli.ArgumentProperties(
key="project_id",
flags=("--project-id", "-p"),
description=f'Project ID in Firebase. For example `{Colors.WHITE("228333310124")}`',
PROJECT_NUMBER = cli.ArgumentProperties(
key="project_number",
flags=("--project-number", "-p"),
description=f'Project Number in Firebase. For example `{Colors.WHITE("228333310124")}`',
argparse_kwargs={"required": True},
)
FIREBASE_SERVICE_ACCOUNT_CREDENTIALS = cli.ArgumentProperties(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .arguments import FirebaseArgument


@cli.common_arguments(FirebaseArgument.PROJECT_ID, FirebaseArgument.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS)
@cli.common_arguments(FirebaseArgument.PROJECT_NUMBER, FirebaseArgument.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS)
class FirebaseAppDistribution(
cli.CliApp,
GetLatestBuildVersionAction,
Expand All @@ -23,28 +23,28 @@ class FirebaseAppDistribution(
Utility to list releases and retrieve the latest release build version number from Firebase
"""

def __init__(self, credentials: Dict, project_id: str, **kwargs):
def __init__(self, credentials: Dict, project_number: str, **kwargs):
super().__init__(**kwargs)
self.client = FirebaseClient(credentials)
self._project_id = project_id
self._project_number = project_number

@property
def project_id(self):
return self._project_id
def project_number(self):
return self._project_number

@classmethod
def from_cli_args(cls, cli_args: argparse.Namespace) -> FirebaseAppDistribution:
credentials_argument = FirebaseArgument.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS.from_args(cli_args)
if credentials_argument is None:
raise FirebaseArgument.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS.raise_argument_error()

project_id_argument = FirebaseArgument.PROJECT_ID.from_args(cli_args)
if project_id_argument is None:
raise FirebaseArgument.PROJECT_ID.raise_argument_error()
project_number_argument = FirebaseArgument.PROJECT_NUMBER.from_args(cli_args)
if project_number_argument is None:
raise FirebaseArgument.PROJECT_NUMBER.raise_argument_error()

return FirebaseAppDistribution(
credentials_argument.value,
project_id_argument,
project_number_argument,
**cls._parent_class_kwargs(cli_args),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FirebaseAppDistributionAction(ABC):

@property
@abstractmethod
def project_id(self):
def project_number(self):
...

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions tests/tools/test_firebase_app_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from oauth2client.service_account import ServiceAccountCredentials

credentials_argument = FirebaseArgument.FIREBASE_SERVICE_ACCOUNT_CREDENTIALS
project_id_argument = FirebaseArgument.PROJECT_ID
project_number_argument = FirebaseArgument.PROJECT_NUMBER


@pytest.fixture
Expand All @@ -41,7 +41,7 @@ def register_args(cli_argument_group):
def namespace_kwargs():
ns_kwargs = {
credentials_argument.key: CredentialsArgument('{"type":"service_account"}'),
project_id_argument.key: "228333310124",
project_number_argument.key: "228333310124",
}
for arg in FirebaseAppDistribution.CLASS_ARGUMENTS:
if not hasattr(arg.type, "environment_variable_key"):
Expand Down

0 comments on commit 9a72b2c

Please sign in to comment.