Skip to content

Commit

Permalink
fix: chsarp and swift
Browse files Browse the repository at this point in the history
  • Loading branch information
yse committed Feb 11, 2024
1 parent 5f53e37 commit fd51d26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions snippets/csharp/Metadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public void FilterPaymentMetadata(BlockingBreezServices sdk)
// ANCHOR: filter-payment-metadata
try
{
var metadataFilters = new List<MetadataFilter>(
var metadataFilters = new List<MetadataFilter>() {
new MetadataFilter(
jsonPath: "myCustomValue",
jsonValue: "true"
)
);
};

var payments = sdk.ListPayments(
new ListPaymentsRequest(
Expand All @@ -38,7 +38,7 @@ public void FilterPaymentMetadata(BlockingBreezServices sdk)
public void FilterPaymentMetadataString(BlockingBreezServices sdk)
{
// ANCHOR: filter-payment-metadata-string
var metadataFilters = new List<MetadataFilter>(
var metadataFilters = new List<MetadataFilter>() {
new MetadataFilter(
jsonPath: "customerName",
jsonValue: "\"Satoshi Nakamoto\""
Expand All @@ -47,23 +47,23 @@ public void FilterPaymentMetadataString(BlockingBreezServices sdk)
jsonPath: "customerName",
jsonValue: JsonSerializer.Serialize("Satoshi Nakamoto")
)
);
};
// ANCHOR_END: filter-payment-metadata-string
}

public void FilterPaymentMetadataObject(BlockingBreezServices sdk)
{
// ANCHOR: filter-payment-metadata-object
// This will *NOT* work
var _metadataFilters = new List<MetadataFilter>(
var _metadataFilters = new List<MetadataFilter>() {
new MetadataFilter(
jsonPath: "parent.nestedArray",
jsonValue: "[1, 2, 3]"
)
);
};

// Any of these will work
var metadataFilters = new List<MetadataFilter>(
var metadataFilters = new List<MetadataFilter>() {
new MetadataFilter(
jsonPath: "parent.nestedArray",
jsonValue: "[1,2,3]"
Expand All @@ -72,7 +72,7 @@ public void FilterPaymentMetadataObject(BlockingBreezServices sdk)
jsonPath: "parent.nestedArray",
jsonValue: JsonSerializer.Serialize(new int[] {1, 2, 3})
)
);
};
// ANCHOR_END: filter-payment-metadata-object
}
}
8 changes: 4 additions & 4 deletions snippets/swift/BreezSDKExamples/Sources/Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func FilterPaymentMetadata(sdk: BlockingBreezServices) throws {
MetadataFilter(
jsonPath: "myCustomValue",
jsonValue: "true",
),
)
]

try? sdk.listPayments(
Expand All @@ -36,7 +36,7 @@ func FilterPaymentMetadataString(sdk: BlockingBreezServices) throws {
MetadataFilter(
jsonPath: "myCustomValue",
jsonValue: #""true""#,
),
)
]
// ANCHOR_END: filter-payment-metadata-string
}
Expand All @@ -48,15 +48,15 @@ func FilterPaymentMetadataObject(sdk: BlockingBreezServices) throws {
MetadataFilter(
jsonPath: "myCustomValue",
jsonValue: #"[1, 2, 3]"#,
),
)
]

// Any of these will work
let metadataFilters = [
MetadataFilter(
jsonPath: "myCustomValue",
jsonValue: #"[1,2,3]"#,
),
)
]
// ANCHOR_END: filter-payment-metadata-object
}

0 comments on commit fd51d26

Please sign in to comment.