Uh oh!
There was an error while loading. Please reload this page.
add secrets forwarding requests teams mle - #77
Conversation
Implements the resources the API docs already show Python examples for: - method.secrets: create, retrieve, list, delete - method.forwarding_requests: create, retrieve - method.teams.mle.public_keys: create, list, retrieve, delete Response types follow octo's public types (ForwardingRequest carries status_history and no updated_at; headers/body are required on create, matching the API's inbound validation). Integration tests follow the existing live dev-API pattern. The ForwardingRequest create tests are skipped pending a whitelisted destination URL and payment instrument (see skip reasons). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…types Closes out the remaining HIGH priority SDK gaps: - method.managed_accounts: list, retrieve, and per-account transactions (field shapes follow octo's public types; the node SDK's stale shapes were not carried over) - method.teams: list (GET /teams returns sub-teams), create, and update_encryption_key (opts match octo's validators: create requires name/legal_name/ein/contacts; encryption key takes an RSA modulus and exponent pair or a certificate) - Account subscription types gain attribute, payment_instrument.card, and payment_instrument.network_token (connect and credit_score are entity-level subscriptions and already exist on Entities) Team create and encryption key tests are skip-marked: both mutate shared dev-environment state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Secret responses include an error field (null when healthy); add it to the Secret TypedDict and test expectations - The MLE public key endpoint only accepts jwk.alg RSA-OAEP-256; the test JWK used RS256, which the API rejects with a 400 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:92289c51b1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Resolves Codex review comment: the new secrets, forwarding_requests, and teams.mle.public_keys resources are documented under Method-Version 2025-12-01, and the versioning docs pin method-python v2.1.0+ to that version. Also adds the split payment_instrument product names introduced by 2025-12-01 to the Account product literals. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds new public API resources to the Method Python SDK (Secrets, ForwardingRequests, Teams/Team MLE public keys, ManagedAccounts) and updates account subscription/product type literals to align with newer API surface (method-version 2025-12-01).
Changes:
- Introduces new resource clients and types:
secrets,forwarding_requests,teams(includingteams.mle.public_keys), andmanaged_accounts. - Adds integration-style pytest modules exercising the new resources.
- Updates account product/subscription literal types and bumps the
method-versionrequest header.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/resources/TeamMLEPublicKey_test.py | Adds live API tests for teams.mle.public_keys create/list/retrieve/delete. |
| test/resources/Team_test.py | Adds team list test plus skipped tests for create and encryption key mutation. |
| test/resources/Secret_test.py | Adds live API tests for secrets create/retrieve/list/delete. |
| test/resources/ManagedAccount_test.py | Adds managed account list/retrieve/transactions tests with optional env-provided ID. |
| test/resources/ForwardingRequest_test.py | Adds forwarding request tests (skipped by default) and setup fixture. |
| method/resources/Teams/Team.py | Implements Teams resource plus nested MLE public keys resources and related TypedDicts. |
| method/resources/Teams/init.py | Exposes Teams resource/types at the package level. |
| method/resources/Secrets/Secret.py | Implements Secrets resource and related TypedDicts. |
| method/resources/Secrets/init.py | Exposes Secrets resource/types at the package level. |
| method/resources/ManagedAccounts/ManagedAccount.py | Implements ManagedAccounts resource, subresource call pattern, and transactions listing. |
| method/resources/ManagedAccounts/init.py | Exposes ManagedAccounts resource/types at the package level. |
| method/resources/ForwardingRequests/ForwardingRequest.py | Implements ForwardingRequests resource and related TypedDicts. |
| method/resources/ForwardingRequests/init.py | Exposes ForwardingRequests resource/types at the package level. |
| method/resources/Accounts/Types.py | Expands account product/subscription literal values. |
| method/resources/Accounts/Subscriptions.py | Expands subscription literal values and response TypedDict keys. |
| method/resources/init.py | Re-exports newly added resources/types from the resources package. |
| method/resource.py | Updates the default method-version request header value. |
| method/method.py | Wires new resources onto the Method client (secrets, forwarding_requests, teams, managed_accounts). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Addresses Copilot review comments: the five new test modules now carry a module-level pytestmark skip so they are skipped instead of failing with auth/network errors when API_KEY is not configured. Also replaces the loose == None assertion in Secret_test.py with to_dict() is None, which is lint-clean and equivalent since MethodResponse.__eq__ compares the wrapped payload. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Suppressed comments (8)
Previously missed (4) — in code that hasn't changed since the last review.
test/resources/Secret_test.py:41
- These tests depend on state created by test_create_secret via a module-level global. If this test is run in isolation (or if collection/order changes), it will error when secrets_create_response is None. Consider using a fixture that creates the secret and yields the id, or at minimum skip when the prerequisite state is missing.
This issue also appears in the following locations of the same file:
- line 55
- line 64
def test_retrieve_secret():
global secrets_retrieve_response
secrets_retrieve_response = method.secrets.retrieve(secrets_create_response['id'])
test/resources/TeamMLEPublicKey_test.py:56
- This test assumes test_create_mle_public_key has already populated public_keys_create_response. If the test is run in isolation it will fail; consider using a fixture dependency or skipping when the prerequisite state is missing.
This issue also appears in the following locations of the same file:
- line 61
- line 80
def test_list_mle_public_keys():
global public_keys_list_response
public_keys_list_response = method.teams.mle.public_keys.list()
public_key_ids = [public_key['id'] for public_key in public_keys_list_response]
test/resources/ForwardingRequest_test.py:95
- This test assumes test_create_forwarding_request has populated forwarding_requests_create_response. If the skips are removed and this test is run alone, it will fail when the create response is None. Consider using a fixture dependency or skipping when the prerequisite state is missing.
def test_retrieve_forwarding_request(setup):
global forwarding_requests_retrieve_response
forwarding_requests_retrieve_response = method.forwarding_requests.retrieve(forwarding_requests_create_response['id'])
method/resources/Teams/Team.py:62
- TeamEncryptionKeyRSAKey uses camelCase field names (keyModulus/keyExponent) while the rest of the SDK's request/response shapes use snake_case. If the API actually expects snake_case, users will get incorrect type hints; if the API expects camelCase, this becomes a one-off inconsistency in the Python SDK. Please verify and align the field naming with the API and existing SDK conventions.
class TeamEncryptionKeyRSAKey(TypedDict):
keyModulus: str
keyExponent: str
test/resources/Secret_test.py:59
- This test assumes test_create_secret has already populated secrets_create_response. When run alone it will fail; either make secret creation a fixture dependency or skip when the prerequisite state is missing.
def test_list_secrets():
global secrets_list_response
secrets_list_response = method.secrets.list()
secret_ids = [secret['id'] for secret in secrets_list_response]
test/resources/Secret_test.py:67
- This test assumes test_create_secret has already populated secrets_create_response. When run alone it will fail; either make secret creation a fixture dependency or skip when the prerequisite state is missing.
def test_delete_secret():
global secrets_delete_response
secrets_delete_response = method.secrets.delete(secrets_create_response['id'])
test/resources/TeamMLEPublicKey_test.py:65
- This test assumes test_create_mle_public_key has already populated public_keys_create_response. If the test is run in isolation it will fail; consider using a fixture dependency or skipping when the prerequisite state is missing.
def test_retrieve_mle_public_key():
global public_keys_retrieve_response
public_keys_retrieve_response = method.teams.mle.public_keys.retrieve(public_keys_create_response['id'])
test/resources/TeamMLEPublicKey_test.py:83
- This test assumes test_create_mle_public_key has already populated public_keys_create_response. If the test is run in isolation it will fail; consider using a fixture dependency or skipping when the prerequisite state is missing.
def test_delete_mle_public_key():
global public_keys_delete_response
public_keys_delete_response = method.teams.mle.public_keys.delete(public_keys_create_response['id'])
Uh oh!
There was an error while loading. Please reload this page.
Addresses Copilot review comment: the module fixture now yields and deletes its secret on teardown so un-skipped runs do not leave active secrets in the shared dev environment. The entity created by the same fixture is left in place because entities cannot be deleted via the public API, matching every other test module in the suite. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
Suppressed comments (4)
Previously missed (3) — in code that hasn't changed since the last review.
test/resources/ForwardingRequest_test.py:57
- These forwarding request tests are currently always skipped, even when FWD_REQUEST_URL / FWD_REQUEST_PMT_INST_ID are provided. Using a conditional skip makes the tests runnable in environments that are configured for them without requiring code edits.
This issue also appears on line 93 of the same file.
@pytest.mark.skip(reason=SKIP_REASON)
def test_create_forwarding_request(setup):
test/resources/Secret_test.py:24
- These tests share state via module-level globals and depend on execution order; if an earlier assertion fails,
test_delete_secretmay not run and the created secret can be left active in the shared dev environment. Consider using a module-scoped fixture that creates the secret, yields its id, and reliably cleans it up in afinally/teardown section.
secrets_create_response = None
secrets_retrieve_response = None
secrets_list_response = None
secrets_delete_response = None
def test_create_secret():
global secrets_create_response
secrets_create_response = method.secrets.create({
'value': 'test_secret_value'
})
test/resources/TeamMLEPublicKey_test.py:36
- These tests share state via module-level globals and depend on execution order; if an earlier assertion fails,
test_delete_mle_public_keymay not run and the created public key can be left active in the shared dev environment. Consider using a module-scoped fixture that creates the key, yields its id, and reliably deletes/disables it in teardown.
public_keys_create_response = None
public_keys_retrieve_response = None
public_keys_list_response = None
public_keys_delete_response = None
def test_create_mle_public_key():
global public_keys_create_response
public_keys_create_response = method.teams.mle.public_keys.create({
'type': 'direct',
'contact': 'engineering@methodfi.com',
'jwk': test_jwk
})
test/resources/ForwardingRequest_test.py:94
- These forwarding request tests are currently always skipped, even when FWD_REQUEST_URL / FWD_REQUEST_PMT_INST_ID are provided. Using a conditional skip makes the tests runnable in environments that are configured for them without requiring code edits.
@pytest.mark.skip(reason=SKIP_REASON)
def test_retrieve_forwarding_request(setup):
Adds delete() to AccountPaymentInstrumentsResource, matching method-node
and DELETE /accounts/{acc_id}/payment_instruments/{pmt_inst_id} in the
2025-12-01 API. Also adds the inbound_achwire_payment type literal and
payload TypedDict (account_number, routing_number, reversal_account) and
the closed status introduced by the same version.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.
Suppressed comments (6)
Previously missed (4) — in code that hasn't changed since the last review.
test/resources/TeamMLEPublicKey_test.py:27
- These tests share state via module-level globals (e.g.,
public_keys_create_response) and implicitly rely on test execution order. Pytest does not guarantee ordering across plugins/parallelization, and a failure intest_create_*can leave subsequent tests crashing or leaking dev resources. Prefer a module-scoped fixture that creates the key and yields the created id/response, with teardown deleting the key in afinally/fixture finalizer so cleanup happens even if assertions fail.
public_keys_create_response = None
public_keys_retrieve_response = None
public_keys_list_response = None
public_keys_delete_response = None
test/resources/Secret_test.py:17
- These tests use module-level globals (
secrets_create_response, etc.) to pass state between test functions, which makes them order-dependent and fragile under plugins like xdist or random-order. Prefer a fixture that creates a secret, yields its id/response, and deletes it in teardown so the resource is cleaned up even if a test fails mid-run.
secrets_create_response = None
secrets_retrieve_response = None
secrets_list_response = None
secrets_delete_response = None
method/resources/Teams/Team.py:146
TeamResource.list()also hard-codesNoneparams, which blocks pagination/filter support at the client level. Accept optional params and forward them to_listto match the rest of the SDK pattern.
def list(self) -> MethodResponse[List[Team]]:
return super(TeamResource, self)._list(None)
method/resources/Teams/Team.py:120
list()currently hard-codesNoneparams, which prevents callers from passing pagination/date filters even though the base_listsupports params. For consistency with other resources, accept an optional params dict and forward it to_list.
def list(self) -> MethodResponse[List[MLEPublicKey]]:
return super(TeamMLEPublicKeysResource, self)._list(None)
test/resources/ForwardingRequest_test.py:58
- These tests are unconditionally skipped, but if someone removes the skip marker without setting the required env vars, the request will be sent with
Nonebindings/url and fail in a confusing way. Prefer a conditional skip based onFWD_REQUEST_URLandFWD_REQUEST_PMT_INST_IDso the tests only run when configured.
@pytest.mark.skip(reason=SKIP_REASON)
def test_create_forwarding_request(setup):
test/resources/ForwardingRequest_test.py:94
- Same as above: make the skip conditional on the required env vars so the test suite is self-configuring and fails less surprisingly when the decorator is adjusted.
@pytest.mark.skip(reason=SKIP_REASON)
def test_retrieve_forwarding_request(setup):
Closing the High Priority Gaps from 2025-07-05 Monthly Diff Report
Added Secrets, ForwardingRequests, and Teams MLE public key resources
Added ManagedAccounts, complete Teams, and update account subscription types
Failing pytests are pre-existing this change.