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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,12 @@ starts the OAuth sign-in of an MCP connection: open `AuthorizeUrl` in a browser
attempt). A signed-in connection shows `SignedIn`, `SignedInBy`, `SignedInAt`
and `TokenExpiresAt`; a listing shows `ConnectSteps` and `OAuthRedirectUrl`.

`Code.SignOutMarketplaceIntegrationAsync`
(`POST /{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out`)
signs an MCP connection out: `WasSignedIn` says whether it was, `Revoke` what
happened to the vendor token (`Revoked`, `NoRevocationEndpoint`, `Failed` or
null).

`TestMarketplaceIntegrationAsync` also returns `AccessChanges`
(`ReadOnlyAdded`, `ReadOnlyRemoved`, `NotGrantable`) and each step's
`ErrorCode`.
Expand Down
85 changes: 85 additions & 0 deletions src/Norbix.Sdk.Types/Generated/Hub.dtos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,11 +1352,14 @@ public partial class IssueServiceUserApiKeyResponse
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Key { get; set; }
public virtual string? Environment { get; set; }
public virtual CodeMashResponseStatus? ResponseStatus { get; set; }
}

public partial class ListServiceUserApiKeysResponse
{
public virtual List<ServiceUserApiKeyDto> Keys { get; set; } = [];
public virtual CodeMashResponseStatus? ResponseStatus { get; set; }
}

public partial class NotificationSettingsChannelDto
Expand Down Expand Up @@ -1786,6 +1789,7 @@ public partial class ServiceUserApiKeyDto
public virtual string Name { get; set; }
public virtual string? VisibleKey { get; set; }
public virtual List<string> Scopes { get; set; } = [];
public virtual string? Environment { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual DateTime? ExpiryDate { get; set; }
public virtual DateTime? CancelledDate { get; set; }
Expand Down Expand Up @@ -2933,6 +2937,16 @@ public partial interface IHasResponsibleUserId
string UserId { get; set; }
}

[DataContract]
public partial class NotificationReadMarkDto
{
[DataMember]
public virtual string UserId { get; set; }

[DataMember]
public virtual DateTime ReadAtUtc { get; set; }
}

public partial class NotificationStatusChangeEntryDto
{
public virtual DateTime Time { get; set; }
Expand Down Expand Up @@ -2978,6 +2992,9 @@ public partial class PushCampaignBatchNotificationDto

[DataMember]
public virtual PushMessageContentDto? Content { get; set; }

[DataMember]
public virtual List<NotificationReadMarkDto>? ReadBy { get; set; }
}

[DataContract]
Expand Down Expand Up @@ -3693,6 +3710,12 @@ public partial class MarketplaceAccessChangesDto

[DataMember]
public virtual IReadOnlyList<string> NotGrantable { get; set; }

[DataMember]
public virtual IReadOnlyList<string> ReadOnlyHintOverridden { get; set; }

[DataMember]
public virtual IReadOnlyList<string> ExcludedFromFullAccess { get; set; }
}

[DataContract]
Expand Down Expand Up @@ -3779,6 +3802,9 @@ public partial class MarketplaceAccessRoleDto

[DataMember]
public virtual string? DefaultNotApplied { get; set; }

[DataMember]
public virtual bool CanChange { get; set; }
}

[DataContract]
Expand All @@ -3792,6 +3818,12 @@ public partial class MarketplaceAccessToolDto

[DataMember]
public virtual bool Grantable { get; set; }

[DataMember]
public virtual bool Curated { get; set; }

[DataMember]
public virtual bool ExcludedFromFullAccess { get; set; }
}

public enum MarketplaceAvailability
Expand Down Expand Up @@ -4039,6 +4071,12 @@ public partial class MarketplaceFunctionRunDto

[DataMember]
public virtual string? Input { get; set; }

[DataMember]
public virtual string? IntegrationId { get; set; }

[DataMember]
public virtual string? ToolName { get; set; }
}

[DataContract]
Expand Down Expand Up @@ -6724,6 +6762,24 @@ public partial class PushDeviceListProjection

[DataMember]
public virtual int? PlatformApiLevel { get; set; }

[DataMember]
public virtual string? Platform { get; set; }

[DataMember]
public virtual string? AppVersion { get; set; }

[DataMember]
public virtual string? InstallationId { get; set; }

[DataMember]
public virtual string? Locale { get; set; }

[DataMember]
public virtual string? TimeZone { get; set; }

[DataMember]
public virtual DateTime? UpdatedAtUtc { get; set; }
}

public partial class PushIntegrationDto
Expand Down Expand Up @@ -11615,6 +11671,11 @@ public partial class GetMarketplaceFunctionRuns
///</summary>
public virtual string? TaskId { get; set; }

///<summary>
///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.
///</summary>
public virtual string? IntegrationId { get; set; }

///<summary>
///How many runs, newest first: 1-50. Default 20.
///</summary>
Expand Down Expand Up @@ -11769,6 +11830,9 @@ public partial class GetMarketplaceIntegrationAccessResponse

[DataMember]
public virtual IReadOnlyList<MarketplaceAccessFunctionDto> Functions { get; set; }

[DataMember]
public virtual bool CanManage { get; set; }
}

public partial class GetMarketplaceIntegrationResponse
Expand Down Expand Up @@ -11968,6 +12032,23 @@ public partial class SetMarketplaceIntegrationTokenMappingsResponse
{
}

[NorbixRoute("/{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out", "POST")]
public partial class SignOutMarketplaceIntegration
: CodeMashRequestBase, INorbixRequest<SignOutMarketplaceIntegrationResponse>
{
///<summary>
///Integration view id, from get_marketplace_integrations.
///</summary>
public virtual string IntegrationViewId { get; set; }
}

public partial class SignOutMarketplaceIntegrationResponse
: ResponseBase
{
public virtual bool WasSignedIn { get; set; }
public virtual string? Revoke { get; set; }
}

[NorbixRoute("/{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/start", "POST")]
public partial class StartMarketplaceIntegrationSignIn
: CodeMashRequestBase, INorbixRequest<StartMarketplaceIntegrationSignInResponse>
Expand Down Expand Up @@ -13179,6 +13260,8 @@ public partial class FindOneRecord
///Set true to get every reference value as { id, display } (display = the target's displayField per the schema; null when the target is gone). Needs read permission on every source the schema links to (users, roles, taxonomy, collection, files) — otherwise the read is refused with CM-ERRORS-DATABASE-056 naming the source. Default false returns the stored ids.
///</summary>
public virtual bool ExpandReferences { get; set; }

public virtual bool AllLanguages { get; set; }
}

public partial class FindOneRecordResponse
Expand Down Expand Up @@ -13218,6 +13301,8 @@ public partial class FindRecords
///Set true to get every reference value as { id, display } (display = the target's displayField per the schema; null when the target is gone). Needs read permission on every source the schema links to (users, roles, taxonomy, collection, files) — otherwise the read is refused with CM-ERRORS-DATABASE-056 naming the source. Default false returns the stored ids.
///</summary>
public virtual bool ExpandReferences { get; set; }

public virtual bool AllLanguages { get; set; }
}

public partial class FindRecordsResponse
Expand Down
36 changes: 36 additions & 0 deletions tests/Norbix.Hub.Tests/MarketplaceSignOutTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Norbix.Sdk.Tests.Helpers;
using Norbix.Sdk.Types.Hub;

using NUnit.Framework;

using VerifyNUnit;

namespace Norbix.Hub.Tests;

/// <summary>
/// Route 30 of the marketplace contract (gateway item access-2b): sign an MCP
/// connection out of OAuth. This case pins a real connection id in the path and
/// reads WasSignedIn / Revoke back from the generated response. Nothing leaves
/// the process.
/// </summary>
[TestFixture]
public sealed class MarketplaceSignOutTests
{
[Test]
public async Task Sign_out_puts_the_connection_id_in_the_path_and_returns_the_revoke_outcome()
{
using var fixture = NorbixTestFixture.Create(o =>
{
o.AccountId = "test-account";
o.BearerToken = "test-bearer";
});
fixture.RespondNext(new { wasSignedIn = true, revoke = "Revoked" });

var response = await fixture.Client.Code.SignOutMarketplaceIntegrationAsync(
new SignOutMarketplaceIntegration { IntegrationViewId = "int_6Qp1dW2kRm8NsT4vYc0Hb" });

await Verifier.Verify(
new { Sent = fixture.LastRequest, response!.WasSignedIn, response.Revoke },
VerifyConfig.VerifySettings);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
Target: Hub,
Group: code,
Count: 43,
Count: 44,
Endpoints: [
{
Target: Hub,
Expand Down Expand Up @@ -700,7 +700,7 @@
Sent: {
Method: GET,
Path: /v2/code/marketplace/functions/runs,
Query: ?functionId={guid}&triggerId={guid}&taskId={guid}&limit=1&env=test-env,
Query: ?functionId={guid}&triggerId={guid}&taskId={guid}&integrationId={guid}&limit=1&env=test-env,
Headers: {
Authorization: Bearer test-bearer,
norbix-account-id: test-account,
Expand Down Expand Up @@ -1052,7 +1052,8 @@
IsSystem: false,
Fixed: false,
IsCustom: false,
Manage: false
Manage: false,
CanChange: false
}
],
Packages: [
Expand All @@ -1063,12 +1064,15 @@
Tools: [
{
ReadOnly: false,
Grantable: false
Grantable: false,
Curated: false,
ExcludedFromFullAccess: false
}
],
Functions: [
{}
],
CanManage: true,
ResponseStatus: {
IsSuccess: true
}
Expand Down Expand Up @@ -1385,6 +1389,40 @@
}
}
},
{
Target: Hub,
Group: code,
MethodName: SignOutMarketplaceIntegrationAsync,
RequestType: SignOutMarketplaceIntegration,
HttpMethod: POST,
Path: /{version}/code/marketplace/integrations/{IntegrationViewId}/oauth/sign-out,
PathParams: [
IntegrationViewId
],
IsAccountScoped: false,
IsUnauthenticated: false,
Sent: {
Method: POST,
Path: /v2/code/marketplace/integrations/{guid}/oauth/sign-out,
Headers: {
Authorization: Bearer test-bearer,
Content-Type: application/json; charset=utf-8,
norbix-account-id: test-account,
norbix-project-id: test-project
},
Body: {
env: test-env
}
},
ResponseType: SignOutMarketplaceIntegrationResponse,
Response: {
WasSignedIn: true,
Revoke: test-revoke,
ResponseStatus: {
IsSuccess: true
}
}
},
{
Target: Hub,
Group: code,
Expand Down Expand Up @@ -1466,6 +1504,12 @@
],
NotGrantable: [
test-string
],
ReadOnlyHintOverridden: [
test-string
],
ExcludedFromFullAccess: [
test-string
]
},
ResponseStatus: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@
Sent: {
Method: GET,
Path: /v2/database/collections/test-collectionName/{guid},
Query: ?databaseIntegrationId={guid}&expandReferences=True&env=test-env,
Query: ?databaseIntegrationId={guid}&expandReferences=True&allLanguages=True&env=test-env,
Headers: {
Authorization: Bearer test-bearer,
norbix-account-id: test-account,
Expand Down Expand Up @@ -1099,7 +1099,7 @@
Sent: {
Method: GET,
Path: /v2/database/collections/test-collectionName,
Query: ?databaseIntegrationId={guid}&filter=test-filter&contactId={guid}&schemaVersion=1&pagingArgs=Norbix.Sdk.Types.Hub.PagingArgs&sortBy=test-sortBy&sortOrder=1&expandReferences=True&env=test-env&startingAfter=test-startingAfter&endingBefore=test-endingBefore&pageSize=1,
Query: ?databaseIntegrationId={guid}&filter=test-filter&contactId={guid}&schemaVersion=1&pagingArgs=Norbix.Sdk.Types.Hub.PagingArgs&sortBy=test-sortBy&sortOrder=1&expandReferences=True&allLanguages=True&env=test-env&startingAfter=test-startingAfter&endingBefore=test-endingBefore&pageSize=1,
Headers: {
Authorization: Bearer test-bearer,
norbix-account-id: test-account,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,11 @@
Response: {
Id: 7,
Name: test-name,
Key: test-key
Key: test-key,
Environment: test-environment,
ResponseStatus: {
IsSuccess: true
}
}
},
{
Expand Down Expand Up @@ -1555,7 +1559,10 @@
{
Active: false
}
]
],
ResponseStatus: {
IsSuccess: true
}
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1982,11 +1982,13 @@
HasMore: false
},
Content: {},
ReadBy: [
{}
],
CampaignId: Guid_1,
BatchId: Guid_1,
NotificationId: Guid_1,
RefNotificationId: Guid_1,
Body: test-body
RefNotificationId: Guid_1
},
ResponseStatus: {
IsSuccess: true
Expand Down
Loading
Loading