Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/hub/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Integration ids look like `int_…`.

## Marketplace

The 28 routes of the gateway contract `Code.Marketplace.md` §14: the catalog
The 29 routes of the gateway contract `Code.Marketplace.md` §14: the catalog
of listings, the installed connections (integration ids look like `int_…`),
their secrets and token mappings, and the functions added on a connection
(`func_…`). Every method, its verb, path, query and body are asserted in
Expand Down Expand Up @@ -60,6 +60,7 @@ their secrets and token mappings, and the functions added on a connection
| `set_marketplace_integration_role_access` | `PUT` | `/{version}/code/marketplace/integrations/{IntegrationViewId}/access/roles` | `project` | path: `integration_view_id`; JSON body: `roleId`, `package` (`None`, `Viewer`, `FunctionsOnly`, `ReadOnly`, `FullAccess`), `manage`; returns the role id |
| `save_marketplace_integration_custom_access` | `POST` | `/{version}/code/marketplace/integrations/{IntegrationViewId}/access/roles/custom` | `project` | path: `integration_view_id`; JSON body: `roleId`, `basePackage`, `tools`, `functions`, `manage`, `newPolicyForThisRoleOnly`; returns `policyId`, `created`, `usedByRoles` |
| `start_marketplace_integration_sign_in` | `POST` | `/{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/start` | `project` | path: `integration_view_id`; returns `authorizeUrl` (open it in a browser), `redirectUrl`, `expiresAt` |
| `sign_out_marketplace_integration` | `POST` | `/{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out` | `project` | path: `integration_view_id`; returns `wasSignedIn`, `revoke` |
| `replace_marketplace_integration_secrets` | `PUT` | `/{version}/code/marketplace/integrations/{IntegrationViewId}/secrets` | `project` | path: `integration_view_id`; JSON body: `secrets` |
| `reveal_marketplace_integration_secrets` | `POST` | `/{version}/code/marketplace/integrations/{IntegrationViewId}/secrets/reveal` | `project` | path: `integration_view_id` |
| `set_marketplace_integration_token_mappings` | `PUT` | `/{version}/code/marketplace/integrations/{IntegrationViewId}/token-mappings` | `project` | path: `integration_view_id`; JSON body: `tokenMappings` |
Expand Down
59 changes: 58 additions & 1 deletion references/hub_dtos.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
""" Options:
Date: 2026-10-13 13:23:39
Date: 2026-10-13 16:21:29
Version: 10.20
Tip: To override a DTO option, remove "#" prefix before updating
BaseUrl: http://localhost:5001
Expand Down Expand Up @@ -5071,6 +5071,7 @@ class ServiceUserApiKeyDto:
name: Optional[str] = None
visible_key: Optional[str] = None
scopes: List[str] = field(default_factory=list)
environment: Optional[str] = None
created_date: datetime.datetime = datetime.datetime(1, 1, 1)
expiry_date: Optional[datetime.datetime] = None
cancelled_date: Optional[datetime.datetime] = None
Expand Down Expand Up @@ -5965,6 +5966,7 @@ class MarketplaceAccessRoleDto:
manage: bool = False
custom: Optional[IReadOnlyList[MarketplaceAccessCustomPolicyDto]] = None
default_not_applied: Optional[str] = None
can_change: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand All @@ -5982,6 +5984,8 @@ class MarketplaceAccessToolDto:
name: Optional[str] = None
read_only: bool = False
grantable: bool = False
curated: bool = False
excluded_from_full_access: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -6028,6 +6032,8 @@ class MarketplaceAccessChangesDto:
read_only_added: Optional[IReadOnlyList[str]] = None
read_only_removed: Optional[IReadOnlyList[str]] = None
not_grantable: Optional[IReadOnlyList[str]] = None
read_only_hint_overridden: Optional[IReadOnlyList[str]] = None
excluded_from_full_access: Optional[IReadOnlyList[str]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -6059,6 +6065,8 @@ class MarketplaceFunctionRunDto:
trigger_id: Optional[str] = None
task_id: Optional[str] = None
input: Optional[str] = None
integration_id: Optional[str] = None
tool_name: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -6142,6 +6150,12 @@ class PushDeviceListProjection:
os_name: Optional[str] = None
os_version: Optional[str] = None
platform_api_level: Optional[int] = None
platform: Optional[str] = None
app_version: Optional[str] = None
installation_id: Optional[str] = None
locale: Optional[str] = None
time_zone: Optional[str] = None
updated_at_utc: Optional[datetime.datetime] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -6185,12 +6199,20 @@ class PushCampaignBatchDto(CampaignBatchDto):
recipients: Optional[PushRecipientsDto] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class NotificationReadMarkDto:
user_id: Optional[str] = None
read_at_utc: datetime.datetime = datetime.datetime(1, 1, 1)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PushCampaignBatchNotificationDto(CampaignBatchNotificationDto):
subject: Optional[str] = None
recipients: Optional[PushRecipientsDto] = None
content: Optional[PushMessageContentDto] = None
read_by: Optional[List[NotificationReadMarkDto]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -7496,12 +7518,15 @@ class IssueServiceUserApiKeyResponse:
id: int = 0
name: Optional[str] = None
key: Optional[str] = None
environment: Optional[str] = None
response_status: Optional[CodeMashResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ListServiceUserApiKeysResponse:
keys: List[ServiceUserApiKeyDto] = field(default_factory=list)
response_status: Optional[CodeMashResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -8131,6 +8156,7 @@ class GetMarketplaceIntegrationAccessResponse(ResponseBase):
packages: Optional[IReadOnlyList[MarketplaceAccessPackageDto]] = None
tools: Optional[IReadOnlyList[MarketplaceAccessToolDto]] = None
functions: Optional[IReadOnlyList[MarketplaceAccessFunctionDto]] = None
can_manage: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -8170,6 +8196,13 @@ class StartMarketplaceIntegrationSignInResponse(ResponseBase):
expires_at: Optional[datetime.datetime] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SignOutMarketplaceIntegrationResponse(ResponseBase):
was_signed_in: bool = False
revoke: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EmptyMarketplaceSecretsResponse(ResponseBase):
Expand Down Expand Up @@ -12858,6 +12891,9 @@ class FindRecords(CodeMashListPaginationRequestBase, IReturn[FindRecordsResponse
"""


all_languages: bool = False


# @Route("/{version}/database/collections/{collectionName}/{id}", "GET")
# @Api(Description="Database")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -12889,6 +12925,9 @@ class FindOneRecord(CodeMashRequestBase, IReturn[FindOneRecordResponse]):
"""


all_languages: bool = False


# @Route("/{version}/database/collections/{collectionName}/indexes", "GET")
# @Api(Description="Database")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
Expand Down Expand Up @@ -15550,6 +15589,17 @@ class StartMarketplaceIntegrationSignIn(CodeMashRequestBase, IReturn[StartMarket
"""


# @Route("/{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out", "POST")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SignOutMarketplaceIntegration(CodeMashRequestBase, IReturn[SignOutMarketplaceIntegrationResponse]):
# @ApiMember(Description="Integration view id, from get_marketplace_integrations.", IsRequired=true)
integration_view_id: Optional[str] = None
"""
Integration view id, from get_marketplace_integrations.
"""


# @Route("/{version}/code/marketplace/integrations/{IntegrationViewId}/secrets", "PUT")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
Expand Down Expand Up @@ -15625,6 +15675,13 @@ class GetMarketplaceFunctionRuns(CodeMashRequestBase, IReturn[GetMarketplaceFunc
"""


# @ApiMember(Description="The MCP connection whose tool runs to list — the calls an AI chat made to one of its tools without a saved function (int_…). One of functionId / triggerId / taskId / integrationId.")
integration_id: Optional[str] = None
"""
The MCP connection whose tool runs to list — the calls an AI chat made to one of its tools without a saved function (int_…). One of functionId / triggerId / taskId / integrationId.
"""


# @ApiMember(DataType="integer", Description="How many runs, newest first: 1-50. Default 20.")
limit: Optional[int] = None
"""
Expand Down
26 changes: 26 additions & 0 deletions src/norbix_python/hub/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,19 @@ def start_marketplace_integration_sign_in(self, integration_view_id: str, *, tim
bearer_token=bearer_token,
)

def sign_out_marketplace_integration(self, integration_view_id: str, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""POST /{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out — sign an MCP connection out of OAuth; returns `wasSignedIn` and `revoke` (`Revoked`, `NoRevocationEndpoint`, `Failed` or None)."""
return self._transport.send(
target="hub",
path="/{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out",
method="POST",
path_params={"IntegrationViewId": integration_view_id},
request=request,
scope="project",
timeout=timeout,
bearer_token=bearer_token,
)

def replace_marketplace_integration_secrets(self, integration_view_id: str, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""PUT /{version}/code/marketplace/integrations/{IntegrationViewId}/secrets"""
return self._transport.send(
Expand Down Expand Up @@ -1002,6 +1015,19 @@ async def start_marketplace_integration_sign_in(self, integration_view_id: str,
bearer_token=bearer_token,
)

async def sign_out_marketplace_integration(self, integration_view_id: str, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""POST /{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out — sign an MCP connection out of OAuth; returns `wasSignedIn` and `revoke` (`Revoked`, `NoRevocationEndpoint`, `Failed` or None)."""
return await self._transport.send(
target="hub",
path="/{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out",
method="POST",
path_params={"IntegrationViewId": integration_view_id},
request=request,
scope="project",
timeout=timeout,
bearer_token=bearer_token,
)

async def replace_marketplace_integration_secrets(self, integration_view_id: str, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""PUT /{version}/code/marketplace/integrations/{IntegrationViewId}/secrets"""
return await self._transport.send(
Expand Down
7 changes: 4 additions & 3 deletions tests/hub/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def test_invoke_code_function_sends_the_function_ref_in_the_body() -> None:
("set_marketplace_integration_role_access", "PUT", "/v3/code/marketplace/integrations/int_6Qp1dW2kRm8NsT4vYc0Hb/access/roles", None, {'roleId': 'acc_6Qp1dW2kRm8NsT4vYc0Hb_nr_3kLm9QwErTyU', 'package': 'ReadOnly', 'manage': False}, lambda m: m.set_marketplace_integration_role_access("int_6Qp1dW2kRm8NsT4vYc0Hb", roleId='acc_6Qp1dW2kRm8NsT4vYc0Hb_nr_3kLm9QwErTyU', package='ReadOnly', manage=False)),
("save_marketplace_integration_custom_access", "POST", "/v3/code/marketplace/integrations/int_6Qp1dW2kRm8NsT4vYc0Hb/access/roles/custom", None, {'roleId': 'acc_6Qp1dW2kRm8NsT4vYc0Hb_nr_3kLm9QwErTyU', 'basePackage': 'ReadOnly', 'tools': ['create_issue'], 'functions': ['func_4hT2b9QkLm3XcT1yRfGh7a'], 'manage': False, 'newPolicyForThisRoleOnly': True}, lambda m: m.save_marketplace_integration_custom_access("int_6Qp1dW2kRm8NsT4vYc0Hb", roleId='acc_6Qp1dW2kRm8NsT4vYc0Hb_nr_3kLm9QwErTyU', basePackage='ReadOnly', tools=['create_issue'], functions=['func_4hT2b9QkLm3XcT1yRfGh7a'], manage=False, newPolicyForThisRoleOnly=True)),
("start_marketplace_integration_sign_in", "POST", "/v3/code/marketplace/integrations/int_6Qp1dW2kRm8NsT4vYc0Hb/oauth/start", None, None, lambda m: m.start_marketplace_integration_sign_in("int_6Qp1dW2kRm8NsT4vYc0Hb")),
("sign_out_marketplace_integration", "POST", "/v3/code/marketplace/integrations/int_6Qp1dW2kRm8NsT4vYc0Hb/oauth/sign-out", None, None, lambda m: m.sign_out_marketplace_integration("int_6Qp1dW2kRm8NsT4vYc0Hb")),
("replace_marketplace_integration_secrets", "PUT", "/v3/code/marketplace/integrations/int_6Qp1dW2kRm8NsT4vYc0Hb/secrets", None, {'secrets': {'botToken': 'xoxb-new'}}, lambda m: m.replace_marketplace_integration_secrets("int_6Qp1dW2kRm8NsT4vYc0Hb", secrets={'botToken': 'xoxb-new'})),
("reveal_marketplace_integration_secrets", "POST", "/v3/code/marketplace/integrations/int_6Qp1dW2kRm8NsT4vYc0Hb/secrets/reveal", None, None, lambda m: m.reveal_marketplace_integration_secrets("int_6Qp1dW2kRm8NsT4vYc0Hb")),
("set_marketplace_integration_token_mappings", "PUT", "/v3/code/marketplace/integrations/int_6Qp1dW2kRm8NsT4vYc0Hb/token-mappings", None, {'tokenMappings': [{'key': 'channel', 'value': '#orders', 'resolver': 'Custom'}]}, lambda m: m.set_marketplace_integration_token_mappings("int_6Qp1dW2kRm8NsT4vYc0Hb", tokenMappings=[{'key': 'channel', 'value': '#orders', 'resolver': 'Custom'}])),
Expand Down Expand Up @@ -355,9 +356,9 @@ async def run() -> None:


def test_marketplace_surface_size() -> None:
"""28 marketplace routes in the gateway (Code.Marketplace.md §14; 24 = MCP tool catalog, 25–27 = connection access, 28 = OAuth sign-in start; 29, the callback, is not in the metadata). A new one changes this count."""
assert len(MARKETPLACE_CASES) == 28
assert len({case[0] for case in MARKETPLACE_CASES}) == 28
"""29 marketplace routes in the gateway (Code.Marketplace.md §14; 24 = MCP tool catalog, 25–27 = connection access, 28 = OAuth sign-in start, 30 = OAuth sign-out; 29, the callback, is not in the metadata). A new one changes this count."""
assert len(MARKETPLACE_CASES) == 29
assert len({case[0] for case in MARKETPLACE_CASES}) == 29
client, _ = make_client()
for name, *_ in MARKETPLACE_CASES:
assert callable(getattr(client.hub.code, name)), name
Expand Down
Loading